From 9c0bd42e1e1976aa2b56165c1e4e3c5d629e26d2 Mon Sep 17 00:00:00 2001 From: grog Date: Thu, 8 Nov 2012 00:24:26 +0000 Subject: Add y flag and environment variable LS_SAMESORT to specify the same sorting order for time and name with the -t option. IEEE Std 1003.2 (POSIX.2) mandates that the -t option sort in descending order, and that if two files have the same timestamp, they should be sorted in ascending order of their names. The -r flag reverses both of these sort orders, so they're never the same. This creates significant problems for sequentially named files stored on FAT file systems, where it can be impossible to list them in the order in which they were created. Add , (comma) option to print file sizes grouped and separated by thousands using the non-monetary separator returned by localeconv(3), typically a comma or period. MFC after: 14 days --- bin/ls/print.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bin/ls/print.c') diff --git a/bin/ls/print.c b/bin/ls/print.c index 5a0fc86..335d0e9 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -606,7 +606,11 @@ printsize(size_t width, off_t bytes) humanize_number(buf, sizeof(buf), (int64_t)bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); (void)printf("%*s ", (u_int)width, buf); - } else + } else if (f_thousands) { /* with commas */ + /* This format assignment needed to work round gcc bug. */ + const char *format = "%*j'd "; + (void)printf(format, (u_int)width, bytes); + } else (void)printf("%*jd ", (u_int)width, bytes); } -- cgit v1.1