From 7f909bd163630a2ce710653e0fafb7bae7171745 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 19 Nov 2012 01:49:53 -0600 Subject: Teach option parsing about [groups] of related options. --- toys/lsb/seq.c | 9 +++------ toys/posix/ls.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'toys') diff --git a/toys/lsb/seq.c b/toys/lsb/seq.c index 22e45dde..7faea185 100644 --- a/toys/lsb/seq.c +++ b/toys/lsb/seq.c @@ -28,12 +28,9 @@ void seq_main(void) // Note that any non-numeric arguments are treated as zero. first = increment = 1; switch (toys.optc) { - case 3: - increment = atof(toys.optargs[1]); - case 2: - first = atof(*toys.optargs); - default: - last = atof(toys.optargs[toys.optc-1]); + case 3: increment = atof(toys.optargs[1]); + case 2: first = atof(*toys.optargs); + default: last = atof(toys.optargs[toys.optc-1]); } // Yes, we're looping on a double. Yes rounding errors can accumulate if diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 70200e7c..55de239f 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -5,8 +5,7 @@ * * See http://opengroup.org/onlinepubs/9699919799/utilities/ls.html -// "[-Cl]" -USE_LS(NEWTOY(ls, "goACFHLRSacdfiklmnpqrstux1", TOYFLAG_BIN)) +USE_LS(NEWTOY(ls, "goACFHLRSacdfiklmnpqrstux1[-1Cglmnox][-cu][-ftS][-HL]", TOYFLAG_BIN)) config LS bool "ls" -- cgit v1.2.3