diff options
author | jhb <jhb@FreeBSD.org> | 2006-03-24 16:38:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-03-24 16:38:02 +0000 |
commit | 3d92b82bd8ba73b42a6a9ac9a402858ba7562172 (patch) | |
tree | 7e29299b116232736273c0ea1c22bfb2ba2ba8de /bin/ls/ls.c | |
parent | 0f0a98fed88d1f3b6c70ffa9b1ce7142f85e8e78 (diff) | |
download | FreeBSD-src-3d92b82bd8ba73b42a6a9ac9a402858ba7562172.zip FreeBSD-src-3d92b82bd8ba73b42a6a9ac9a402858ba7562172.tar.gz |
Add a new -U flag to instruct ls to use the birthtime for printing or
sorting.
Submitted by: Andrzej Tobola ato at iem dot pw dot edu dot pl
MFC after: 1 week
Diffstat (limited to 'bin/ls/ls.c')
-rw-r--r-- | bin/ls/ls.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c index f354fc2..4a752ce 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -104,6 +104,7 @@ int termwidth = 80; /* default terminal width */ /* flags */ int f_accesstime; /* use time of last access */ + int f_birthtime; /* use time of birth */ int f_flags; /* show flags associated with a file */ int f_humanval; /* show human-readable file sizes */ int f_inode; /* print inode */ @@ -178,7 +179,7 @@ main(int argc, char *argv[]) fts_options = FTS_PHYSICAL; while ((ch = getopt(argc, argv, - "1ABCFGHILPRSTWZabcdfghiklmnopqrstuwx")) != -1) { + "1ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx")) != -1) { switch (ch) { /* * The -1, -C, -x and -l options all override each other so @@ -207,14 +208,21 @@ main(int argc, char *argv[]) f_longform = 0; f_singlecol = 0; break; - /* The -c and -u options override each other. */ + /* The -c, -u, and -U options override each other. */ case 'c': f_statustime = 1; f_accesstime = 0; + f_birthtime = 0; break; case 'u': f_accesstime = 1; f_statustime = 0; + f_birthtime = 0; + break; + case 'U': + f_birthtime = 1; + f_accesstime = 0; + f_statustime = 0; break; case 'F': f_type = 1; @@ -410,6 +418,8 @@ main(int argc, char *argv[]) sortfcn = revnamecmp; else if (f_accesstime) sortfcn = revacccmp; + else if (f_birthtime) + sortfcn = revbirthcmp; else if (f_statustime) sortfcn = revstatcmp; else if (f_sizesort) @@ -421,6 +431,8 @@ main(int argc, char *argv[]) sortfcn = namecmp; else if (f_accesstime) sortfcn = acccmp; + else if (f_birthtime) + sortfcn = birthcmp; else if (f_statustime) sortfcn = statcmp; else if (f_sizesort) |