Done (I didn't bother testing this).
diff -urp fileutils-4.1.7.orig/configure.ac fileutils-4.1.7-ls_show_author/configure.ac
--- fileutils-4.1.7.orig/configure.ac Sun Mar 10 19:38:26 2002
+++ fileutils-4.1.7-ls_show_author/configure.ac Thu Mar 28 19:06:30 2002
@@ -45,6 +45,8 @@ if test $fu_cv_sys_truncating_statfs = y
fi
AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
+AC_CHECK_MEMBERS([struct stat.st_author])
+
jm_LIB_CHECK
AM_GNU_GETTEXT
diff -urp fileutils-4.1.7.orig/src/ls.c fileutils-4.1.7-ls_show_author/src/ls.c
--- fileutils-4.1.7.orig/src/ls.c Thu Feb 28 09:34:00 2002
+++ fileutils-4.1.7-ls_show_author/src/ls.c Thu Mar 28 19:15:37 2002
@@ -461,6 +461,11 @@ static int sort_reverse;
static int print_owner = 1;
+#if HAVE_STRUCT_ST_AUTHOR
+/* Nonzero means to display author information.*/
+static int print_author = 0;
+#endif
+
/* Nonzero means to display group information. -G and -o turn this off. */
static int print_group = 1;
@@ -707,6 +712,9 @@ enum
SI_OPTION,
SORT_OPTION,
TIME_OPTION,
+#if HAVE_STRUCT_ST_AUTHOR
+ AUTHOR_OPTION,
+#endif
TIME_STYLE_OPTION
};
@@ -747,6 +755,9 @@ static struct option const long_options[
{"time-style", required_argument, 0, TIME_STYLE_OPTION},
{"color", optional_argument, 0, COLOR_OPTION},
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
+#if HAVE_STRUCT_ST_AUTHOR
+ {"author", no_argument, 0, AUTHOR_OPTION},
+#endif
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
@@ -1494,6 +1505,13 @@ decode_switches (int argc, char **argv)
format = one_per_line;
break;
+#if HAVE_STRUCT_ST_AUTHOR
+ case AUTHOR_OPTION:
+ format = long_format;
+ print_author = 1;
+ break;
+#endif
+
case SORT_OPTION:
sort_type = XARGMATCH ("--sort", optarg, sort_args, sort_types);
sort_type_specified = 1;
@@ -3586,6 +3604,11 @@ Mandatory arguments to long options are
-A, --almost-all do not list implied . and ..\n\
-b, --escape print octal escapes for nongraphic characters\n\
"), stdout);
+#if HAVE_STRUCT_ST_AUTHOR
+ fputs(_("\
+ --author print the author of each file\n\
+"), stdout);
+#endif
fputs (_("\
--block-size=SIZE use SIZE-byte blocks\n\
-B, --ignore-backups do not list implied entries ending with ~\n\
diff -urp fileutils-4.1.7.orig/configure.ac fileutils-4.1.7-ls_gnu_ext/configure.ac
--- fileutils-4.1.7.orig/configure.ac Sun Mar 10 19:38:26 2002
+++ fileutils-4.1.7-ls_gnu_ext/configure.ac Thu Mar 28 19:18:20 2002
@@ -45,6 +45,10 @@ if test $fu_cv_sys_truncating_statfs = y
fi
AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
+AC_CHECK_HEADER(hurd.h,
+ [AC_DEFINE(HAVE_GNU_HURD_EXTENSIONS, 1,
+ [Define to 1 if we have GNU/Hurd extentions.])])
+
jm_LIB_CHECK
AM_GNU_GETTEXT
diff -urp fileutils-4.1.7.orig/src/ls.c fileutils-4.1.7-ls_gnu_ext/src/ls.c
--- fileutils-4.1.7.orig/src/ls.c Thu Feb 28 09:34:00 2002
+++ fileutils-4.1.7-ls_gnu_ext/src/ls.c Thu Mar 28 19:23:12 2002
@@ -465,6 +465,11 @@ static int print_owner = 1;
static int print_group = 1;
+#if HAVE_GNU_HURD_EXTENSIONS
+/* Nonzero means to display unknown user bits and translator information. */
+static int print_gnu_hurd_extensions = 0;
+#endif
+
/* Nonzero means print the user and group id's as numbers rather
than as names. -n */
@@ -747,6 +752,9 @@ static struct option const long_options[
{"time-style", required_argument, 0, TIME_STYLE_OPTION},
{"color", optional_argument, 0, COLOR_OPTION},
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
+#if HAVE_GNU_HURD_EXTENSIONS
+ {"gnu-hurd-extentions", no_argument, 0, 'e'},
+#endif
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
@@ -1294,7 +1302,11 @@ decode_switches (int argc, char **argv)
}
while ((c = getopt_long (argc, argv,
- "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
+ "abcd"
+#if HAVE_GNU_HURD_EXTENSIONS
+ "e"
+#endif
+ "fghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
long_options, NULL)) != -1)
{
switch (c)
@@ -1319,6 +1331,13 @@ decode_switches (int argc, char **argv)
immediate_dirs = 1;
break;
+#if HAVE_GNU_HURD_EXTENSIONS
+ case 'e':
+ format = long_format;
+ print_gnu_hurd_extensions = 1;
+ break;
+#endif
+
case 'f':
/* Same as enabling -a -U and disabling -l -s. */
all_files = 1;
@@ -2287,6 +2306,60 @@ gobble_file (const char *name, enum file
free (linkpath);
}
+#if HAVE_GNU_HURD_EXTENSIONS
+ if ((files[files_index].stat.st_mode & S_IROOT)
+ && print_gnu_hurd_extensions)
+ {
+ file_t trans_port;
+ int trans_fd;
+ struct stat trans_stat;
+
+ /* Get the underlying node */
+ trans_port = file_name_lookup (path, O_NOTRANS, 0);
+ if (trans_port == MACH_PORT_NULL)
+ {
+ error (0, errno, "%s", quotearg_colon (path));
+ exit_status = 1;
+ return 0;
+ }
+
+ trans_fd = open (path, O_NOTRANS);
+ if (trans_fd == -1)
+ {
+ error (0, errno, "%s", quotearg_colon (path));
+ exit_status = 1;
+ return 0;
+ }
+
+ fstat (trans_fd, &trans_stat);
+ if (trans_stat.st_mode & S_IPTRANS)
+ {
+ char buf[1024], *trans = buf;
+ int trans_len = sizeof (buf);
+
+ file_get_translator (trans_port, &trans, &trans_len);
+ argz_stringify (trans, trans_len, ' ');
+
+ files[files_index].trans_name = strdup(trans);
+ files[files_index].trans_mode = 1;
+ }
+
+ /* Get the top node. */
+ trans_fd = open (path, O_NORW);
+ if (trans_fd == -1)
+ {
+ error (0, errno, "%s", quotearg_colon (path));
+ exit_status = 1;
+ return 0;
+ }
+
+ fstat (trans_fd, &trans_stat);
+ files[files_index].trans_fsid = trans_stat.st_fsid;
+
+ mach_port_deallocate (mach_task_self(), trans_port);
+ }
+#endif /* HAVE_GNU_HURD_EXTENSIONS */
+
if (S_ISLNK (files[files_index].stat.st_mode))
files[files_index].filetype = symbolic_link;
else if (S_ISDIR (files[files_index].stat.st_mode))
@@ -2744,15 +2817,18 @@ get_current_time (void)
static void
print_long_format (const struct fileinfo *f)
{
- char modebuf[12];
+ char modebuf[15];
/* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
- 1 10-byte mode string,
+ 1 10-byte mode string (13-bytes on GNU/Hurd),
1 35-byte time string (may be longer in some locales -- see below)
or LONGEST_HUMAN_READABLE integer,
9 spaces, one following each of these fields, and
1 trailing NUL byte. */
char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10
+#if HAVE_GNU_HURD_EXTENSIONS
+ + 3
+#endif
+ MAX (35, LONGEST_HUMAN_READABLE)
+ 9 + 1];
char *buf = init_bigbuf;
@@ -2770,8 +2846,39 @@ print_long_format (const struct fileinfo
mode_string (f->stat.st_mode, modebuf);
#endif
- modebuf[10] = (FILE_HAS_ACL (f) ? '+' : ' ');
- modebuf[11] = '\0';
+#if HAVE_GNU_HURD_EXTENSIONS
+#define S_IRUNK (S_IRUSR << S_IUNKSHIFT)
+#define S_IWUNK (S_IWUSR << S_IUNKSHIFT)
+#define S_IXUNK (S_IXUSR << S_IUNKSHIFT)
+
+ if (print_gnu_hurd_extensions)
+ {
+ /* If S_IUSEUNK is not set then default to showing group member
+ permission bits. */
+ if (f->stat.st_mode & S_IUSEUNK)
+ {
+ modebuf[10] = f->stat.st_mode & S_IRUNK ? 'r' : '-';
+ modebuf[11] = f->stat.st_mode & S_IWUNK ? 'w' : '-';
+ modebuf[12] = f->stat.st_mode & S_IXUNK ? 'x' : '-';
+ }
+ else
+ {
+ modebuf[10] = f->stat.st_mode & S_IROTH ? 'r' : '-';
+ modebuf[11] = f->stat.st_mode & S_IWOTH ? 'w' : '-';
+ modebuf[12] = f->stat.st_mode & S_IXOTH ? 'x' : '-';
+ }
+
+ modebuf[13] = (FILE_HAS_ACL (f) ? '+' : ' ');
+ modebuf[14] = '\0';
+ }
+ else
+ {
+#endif
+ modebuf[10] = (FILE_HAS_ACL (f) ? '+' : ' ');
+ modebuf[11] = '\0';
+#if HAVE_GNU_HURD_EXTENSIONS
+ }
+#endif
switch (time_type)
{
@@ -2940,6 +3047,19 @@ print_long_format (const struct fileinfo
print_type_indicator (f->linkmode);
}
}
+#if HAVE_GNU_HURD_EXTENSIONS
+ else if ((f->stat.st_mode & S_IROOT)
+ && print_gnu_hurd_extensions)
+ {
+ DIRED_FPUTS_LITERAL (" => ", stdout);
+ if (f->trans_name)
+ printf ("%s", f->trans_name);
+ else
+ printf ("unknown");
+
+ printf (" (%d)", f->trans_fsid);
+ }
+#endif /* HAVE_GNU_HURD_EXTENSIONS */
else if (indicator_style != none)
print_type_indicator (f->stat.st_mode);
}
@@ -3601,6 +3721,13 @@ Mandatory arguments to long options are
-d, --directory list directory entries instead of contents\n\
-D, --dired generate output designed for Emacs' dired mode\n\
"), stdout);
+#if HAVE_GNU_HURD_EXTENSIONS
+ fputs (_("\
+ -e, --gnu-hurd-extentions print translator information and unknown\n\
+ user bits\n\
+"), stdout);
+#endif
+
fputs (_("\
-f do not sort, enable -aU, disable -lst\n\
-F, --classify append indicator (one of */=@|) to entries\n\
--
Alfred M. Szmidt