Author: Description: Fix up some option processing Index: b/sysctl.c =================================================================== --- a/sysctl.c 2009-11-24 20:53:05.000000000 +1100 +++ b/sysctl.c 2009-11-24 21:00:33.000000000 +1100 @@ -421,6 +421,7 @@ const char *me = (const char *)basename(argv[0]); bool SwitchesAllowed = true; bool WriteMode = false; + bool DisplayAllOpt = false; int ReturnCode = 0; const char *preloadfile = DEFAULT_PRELOAD; @@ -486,8 +487,8 @@ case 'a': // string and integer values (for Linux, all of them) case 'A': // same as -a -o case 'X': // same as -a -x - SwitchesAllowed = false; - return DisplayAll(PROC_PATH); + DisplayAllOpt = true; + break; case 'V': fprintf(stdout, "sysctl (%s)\n",procps_version); exit(0); @@ -502,6 +503,8 @@ } else { if (NameOnly && Quiet) // nonsense return Usage(me); + if (DisplayAllOpt) // We cannot have values with -a + return Usage(me); SwitchesAllowed = false; if (WriteMode || index(*argv, '=')) ReturnCode = WriteSetting(*argv); @@ -509,6 +512,11 @@ ReturnCode = ReadSetting(*argv); } } + if (DisplayAllOpt) { + if (Quiet) + return Usage(me); + return DisplayAll(PROC_PATH); + } return ReturnCode; }