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.
diff --git a/misc/ChangeLog b/misc/ChangeLog
index b8701d3..b8becd7 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 32b4bf5..5200cda 100644
--- a/misc/chattr.1.in
+++ b/misc/chattr.1.in
@@ -33,9 +33,11 @@
.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 c8c9245..848c1d5 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 @@
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 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 @@
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 03c159d..f5b683a 100644
--- a/misc/lsattr.1.in
+++ b/misc/lsattr.1.in
@@ -5,7 +5,7 @@
.SH SYNOPSIS
.B lsattr
[
-.B \-Radv
+.B \-RVadv
]
[
files...
@@ -18,6 +18,9 @@
.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 73823cc..afc882c 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 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 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 @@
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