diff options
author | Theodore Ts'o <tytso@mit.edu> | 1999-01-05 07:02:39 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1999-01-05 07:02:39 +0000 |
commit | a88fa0c0135307288562d4922438ae52fdbad855 (patch) | |
tree | 5494e70f186772dd5328d1e79704c3d516e336ac | |
parent | 7a46952e3fbe7f03868061725f968a2af18a23e9 (diff) | |
download | e2fsprogs-a88fa0c0135307288562d4922438ae52fdbad855.tar.gz |
ChangeLog, chattr.1.in, chattr.c, lsattr.1.in, lsattr.c:
chattr.c, lsattr.c: Only print the version information for the program
if the -V option is given.
chattr.c: Ignore symbolic links when doing a recursive descent through
a directory.
-rw-r--r-- | misc/ChangeLog | 8 | ||||
-rw-r--r-- | misc/chattr.1.in | 4 | ||||
-rw-r--r-- | misc/chattr.c | 11 | ||||
-rw-r--r-- | misc/lsattr.1.in | 5 | ||||
-rw-r--r-- | misc/lsattr.c | 16 |
5 files changed, 34 insertions, 10 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index b8701d35..b8becd77 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,11 @@ +1999-01-05 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * chattr.c, lsattr.c: Only print the version information for the + program if the -V option is given. + + * chattr.c: Ignore symbolic links when doing a recursive descent + through a directory. + 1999-01-01 Theodore Ts'o <tytso@rsts-11.mit.edu> * fsck.c (load_fs_info, parse_fstab_line): Ignore fstab lines diff --git a/misc/chattr.1.in b/misc/chattr.1.in index 32b4bf5a..5200cda7 100644 --- a/misc/chattr.1.in +++ b/misc/chattr.1.in @@ -33,9 +33,11 @@ secure deletion (s), and undeletable (u). .TP .I -R Recursively change attributes of directories and their contents. +Symbolic links encountered during recursive directory traversals are +ignored. .TP .I -V -Verbosely describe changed attributes. +Be verbose with chattr's output and print the program version. .TP .I -v version Set the files version. diff --git a/misc/chattr.c b/misc/chattr.c index c8c92453..848c1d55 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -14,6 +14,8 @@ * 93/10/30 - Creation * 93/11/13 - Replace stat() calls by lstat() to avoid loops * 94/02/27 - Integrated in Ted's distribution + * 98/12/29 - Ignore symlinks when working recursively (G M Sipe) + * 98/12/29 - Display version info only when -V specified (G M Sipe) */ #include <sys/types.h> @@ -237,6 +239,8 @@ static void change_attributes (const char * name) com_err (program_name, errno, "while stating %s", name); return; } + if (S_ISLNK(st.st_mode) && recursive) + return; if (set) { if (verbose) @@ -304,9 +308,6 @@ int main (int argc, char ** argv) int i, j; int end_arg = 0; - fprintf (stderr, "chattr %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); if (argc && *argv) program_name = *argv; i = 1; @@ -329,6 +330,10 @@ int main (int argc, char ** argv) fprintf (stderr, "Must use '-v', =, - or +\n"); exit (1); } + if (verbose) + fprintf (stderr, "chattr %s, %s for EXT2 FS %s, %s\n", + E2FSPROGS_VERSION, E2FSPROGS_DATE, + EXT2FS_VERSION, EXT2FS_DATE); for (j = i; j < argc; j++) change_attributes (argv[j]); exit(0); diff --git a/misc/lsattr.1.in b/misc/lsattr.1.in index 03c159d1..f5b683a8 100644 --- a/misc/lsattr.1.in +++ b/misc/lsattr.1.in @@ -5,7 +5,7 @@ lsattr \- list file attributes on a Linux second extended file system .SH SYNOPSIS .B lsattr [ -.B \-Radv +.B \-RVadv ] [ files... @@ -18,6 +18,9 @@ lists the file attributes on a second extended file system. .I -R Recursively list attributes of directories and their contents. .TP +.I -V +Display the program version. +.TP .I -a List all files in directories, including files that start with `.'. .TP diff --git a/misc/lsattr.c b/misc/lsattr.c index 73823cce..afc882c8 100644 --- a/misc/lsattr.c +++ b/misc/lsattr.c @@ -14,6 +14,7 @@ * 93/10/30 - Creation * 93/11/13 - Replace stat() calls by lstat() to avoid loops * 94/02/27 - Integrated in Ted's distribution + * 98/12/29 - Display version info only when -V specified (G M Sipe) */ #include <sys/types.h> @@ -47,11 +48,12 @@ int all = 0; int d_opt = 0; int l_opt = 0; int recursive = 0; +int verbose = 0; int v_opt = 0; static void usage(void) { - fprintf(stderr, "Usage: %s [-Radlv] [files...]\n", program_name); + fprintf(stderr, "Usage: %s [-RVadlv] [files...]\n", program_name); exit(1); } @@ -124,17 +126,17 @@ int main (int argc, char ** argv) int c; int i; - fprintf (stderr, "lsattr %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); if (argc && *argv) program_name = *argv; - while ((c = getopt (argc, argv, "Radlv")) != EOF) + while ((c = getopt (argc, argv, "RVadlv")) != EOF) switch (c) { case 'R': recursive = 1; break; + case 'V': + verbose = 1; + break; case 'a': all = 1; break; @@ -151,6 +153,10 @@ int main (int argc, char ** argv) usage(); } + if (verbose) + fprintf (stderr, "lsattr %s, %s for EXT2 FS %s, %s\n", + E2FSPROGS_VERSION, E2FSPROGS_DATE, + EXT2FS_VERSION, EXT2FS_DATE); if (optind > argc - 1) lsattr_args ("."); else |