Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2012 23:37:24 +0000 (UTC)
From:      Greg Lehey <grog@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242722 - head/bin/ls
Message-ID:  <201211072337.qA7NbOLX030229@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grog
Date: Wed Nov  7 23:37:24 2012
New Revision: 242722
URL: http://svnweb.freebsd.org/changeset/base/242722

Log:
  Sort option parsing as far as practical.

Modified:
  head/bin/ls/ls.c

Modified: head/bin/ls/ls.c
==============================================================================
--- head/bin/ls/ls.c	Wed Nov  7 23:15:36 2012	(r242721)
+++ head/bin/ls/ls.c	Wed Nov  7 23:37:24 2012	(r242722)
@@ -192,17 +192,9 @@ main(int argc, char *argv[])
 			f_longform = 0;
 			f_stream = 0;
 			break;
-		case 'B':
-			f_nonprint = 0;
-			f_octal = 1;
-			f_octal_escape = 0;
-			break;
 		case 'C':
 			f_sortacross = f_longform = f_singlecol = 0;
 			break;
-                case 'D':
-                        f_timeformat = optarg;
-                        break;
 		case 'l':
 			f_longform = 1;
 			f_singlecol = 0;
@@ -229,16 +221,43 @@ main(int argc, char *argv[])
 			f_accesstime = 0;
 			f_statustime = 0;
 			break;
-		case 'F':
+		case 'a':
+			fts_options |= FTS_SEEDOT;
+			/* FALLTHROUGH */
+		case 'A':
+			f_listdot = 1;
+			break;
+		/* The -t and -S options override each other. */
+		case 'S':
+			f_sizesort = 1;
+			f_timesort = 0;
+			break;
+		case 't':
+			f_timesort = 1;
+			f_sizesort = 0;
+			break;
+                /* Other flags.  Please keep alphabetic. */
+		case 'B':
+			f_nonprint = 0;
+			f_octal = 1;
+			f_octal_escape = 0;
+			break;
+                case 'D':
+                        f_timeformat = optarg;
+                        break;
+                case 'F':
 			f_type = 1;
 			f_slash = 0;
 			break;
+		case 'G':
+			setenv("CLICOLOR", "", 1);
+			break;
 		case 'H':
 			fts_options |= FTS_COMFOLLOW;
 			f_nofollow = 0;
 			break;
-		case 'G':
-			setenv("CLICOLOR", "", 1);
+		case 'I':
+			f_noautodot = 1;
 			break;
 		case 'L':
 			fts_options &= ~FTS_PHYSICAL;
@@ -254,14 +273,19 @@ main(int argc, char *argv[])
 		case 'R':
 			f_recursive = 1;
 			break;
-		case 'a':
-			fts_options |= FTS_SEEDOT;
-			/* FALLTHROUGH */
-		case 'A':
-			f_listdot = 1;
+		case 'T':
+			f_sectime = 1;
 			break;
-		case 'I':
-			f_noautodot = 1;
+		case 'W':
+			f_whiteout = 1;
+			break;
+		case 'Z':
+			f_label = 1;
+			break;
+		case 'b':
+			f_nonprint = 0;
+			f_octal = 0;
+			f_octal_escape = 1;
 			break;
 		/* The -d option turns off the -R option. */
 		case 'd':
@@ -309,34 +333,11 @@ main(int argc, char *argv[])
 		case 's':
 			f_size = 1;
 			break;
-		case 'T':
-			f_sectime = 1;
-			break;
-		/* The -t and -S options override each other. */
-		case 't':
-			f_timesort = 1;
-			f_sizesort = 0;
-			break;
-		case 'S':
-			f_sizesort = 1;
-			f_timesort = 0;
-			break;
-		case 'W':
-			f_whiteout = 1;
-			break;
-		case 'b':
-			f_nonprint = 0;
-			f_octal = 0;
-			f_octal_escape = 1;
-			break;
 		case 'w':
 			f_nonprint = 0;
 			f_octal = 0;
 			f_octal_escape = 0;
 			break;
-		case 'Z':
-			f_label = 1;
-			break;
 		default:
 		case '?':
 			usage();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211072337.qA7NbOLX030229>