diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-06-22 13:09:55 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-06-22 13:09:55 +1000 |
commit | 9a526455669748a5ba87bc39ac9572f89dcfb29e (patch) | |
tree | 5ce9228f3547c4b1263ac3689cef25f9628a34ad | |
parent | 15ca6e88426b1b0919151e23268163d93c81e8a0 (diff) |
- djm@cvs.openbsd.org 2004/06/22 01:16:39
[sftp.c]
don't show .files by default in ls, add -a option to turn them back on;
ok markus
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sftp.c | 15 |
2 files changed, 17 insertions, 4 deletions
@@ -33,6 +33,10 @@ | |||
33 | - djm@cvs.openbsd.org 2004/06/21 22:41:31 | 33 | - djm@cvs.openbsd.org 2004/06/21 22:41:31 |
34 | [sftp.1] | 34 | [sftp.1] |
35 | document sort options | 35 | document sort options |
36 | - djm@cvs.openbsd.org 2004/06/22 01:16:39 | ||
37 | [sftp.c] | ||
38 | don't show .files by default in ls, add -a option to turn them back on; | ||
39 | ok markus | ||
36 | 40 | ||
37 | 20040620 | 41 | 20040620 |
38 | - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms. | 42 | - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms. |
@@ -1355,4 +1359,4 @@ | |||
1355 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 1359 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
1356 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 1360 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
1357 | 1361 | ||
1358 | $Id: ChangeLog,v 1.3426 2004/06/22 03:08:21 dtucker Exp $ | 1362 | $Id: ChangeLog,v 1.3427 2004/06/22 03:09:55 dtucker Exp $ |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | 18 | ||
19 | RCSID("$OpenBSD: sftp.c,v 1.53 2004/06/21 22:30:45 djm Exp $"); | 19 | RCSID("$OpenBSD: sftp.c,v 1.54 2004/06/22 01:16:39 djm Exp $"); |
20 | 20 | ||
21 | #include "buffer.h" | 21 | #include "buffer.h" |
22 | #include "xmalloc.h" | 22 | #include "xmalloc.h" |
@@ -72,6 +72,7 @@ char *__progname; | |||
72 | #define LS_TIME_SORT 0x10 /* Sort by mtime */ | 72 | #define LS_TIME_SORT 0x10 /* Sort by mtime */ |
73 | #define LS_SIZE_SORT 0x20 /* Sort by file size */ | 73 | #define LS_SIZE_SORT 0x20 /* Sort by file size */ |
74 | #define LS_REVERSE_SORT 0x40 /* Reverse sort order */ | 74 | #define LS_REVERSE_SORT 0x40 /* Reverse sort order */ |
75 | #define LS_SHOW_ALL 0x80 /* Don't skip filenames starting with '.' */ | ||
75 | 76 | ||
76 | #define VIEW_FLAGS (LS_LONG_VIEW|LS_SHORT_VIEW|LS_NUMERIC_VIEW) | 77 | #define VIEW_FLAGS (LS_LONG_VIEW|LS_SHORT_VIEW|LS_NUMERIC_VIEW) |
77 | #define SORT_FLAGS (LS_NAME_SORT|LS_TIME_SORT|LS_SIZE_SORT) | 78 | #define SORT_FLAGS (LS_NAME_SORT|LS_TIME_SORT|LS_SIZE_SORT) |
@@ -378,6 +379,9 @@ parse_ls_flags(const char **cpp, int *lflag) | |||
378 | case 'f': | 379 | case 'f': |
379 | *lflag &= ~SORT_FLAGS; | 380 | *lflag &= ~SORT_FLAGS; |
380 | break; | 381 | break; |
382 | case 'a': | ||
383 | *lflag |= LS_SHOW_ALL; | ||
384 | break; | ||
381 | default: | 385 | default: |
382 | error("Invalid flag -%c", *cp); | 386 | error("Invalid flag -%c", *cp); |
383 | return(-1); | 387 | return(-1); |
@@ -666,8 +670,10 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) | |||
666 | char *tmp; | 670 | char *tmp; |
667 | 671 | ||
668 | /* Count entries for sort and find longest filename */ | 672 | /* Count entries for sort and find longest filename */ |
669 | for (n = 0; d[n] != NULL; n++) | 673 | for (n = 0; d[n] != NULL; n++) { |
670 | m = MAX(m, strlen(d[n]->filename)); | 674 | if (d[n]->filename[0] != '.' || (lflag & LS_SHOW_ALL)) |
675 | m = MAX(m, strlen(d[n]->filename)); | ||
676 | } | ||
671 | 677 | ||
672 | /* Add any subpath that also needs to be counted */ | 678 | /* Add any subpath that also needs to be counted */ |
673 | tmp = path_strip(path, strip_path); | 679 | tmp = path_strip(path, strip_path); |
@@ -691,6 +697,9 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) | |||
691 | for (n = 0; d[n] != NULL && !interrupted; n++) { | 697 | for (n = 0; d[n] != NULL && !interrupted; n++) { |
692 | char *tmp, *fname; | 698 | char *tmp, *fname; |
693 | 699 | ||
700 | if (d[n]->filename[0] == '.' && !(lflag & LS_SHOW_ALL)) | ||
701 | continue; | ||
702 | |||
694 | tmp = path_append(path, d[n]->filename); | 703 | tmp = path_append(path, d[n]->filename); |
695 | fname = path_strip(tmp, strip_path); | 704 | fname = path_strip(tmp, strip_path); |
696 | xfree(tmp); | 705 | xfree(tmp); |