+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
.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.
* 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>
com_err (program_name, errno, "while stating %s", name);
return;
}
+ if (S_ISLNK(st.st_mode) && recursive)
+ return;
if (set)
{
if (verbose)
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;
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);
.SH SYNOPSIS
.B lsattr
[
-.B \-Radv
+.B \-RVadv
]
[
files...
.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
* 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>
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);
}
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;
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