From b34f38ae9e101a9c73e0a80153af92b744a6de2d Mon Sep 17 00:00:00 2001 From: Garance A Drosehn Date: Sat, 27 Mar 2004 21:56:49 +0000 Subject: Change the #if-ish logic which is used to add the `-f' option when `ps' is compiled with LAZY_PS, so that there is only one PS_ARGS string to modify when changing the option-list. Also get `-f' to show up in the usage() statement when compiled with LAZY_PS. --- bin/ps/ps.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/ps/ps.c b/bin/ps/ps.c index a5c283dd293a..a446a90d82f8 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -112,10 +112,13 @@ struct listinfo { }; static int needuser, needcomm, needenv; -#if defined(LAZY_PS) -static int forceuread=0; + +#ifdef LAZY_PS +static int forceuread = 0; +#define OPT_LAZY_f "f" #else -static int forceuread=1; +static int forceuread = 1; +#define OPT_LAZY_f /* Ie, the `-f' option is not added. */ #endif static enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT; @@ -150,11 +153,7 @@ static char Zfmt[] = "label"; static kvm_t *kd; -#if defined(LAZY_PS) -#define PS_ARGS "AaCcefG:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ" -#else -#define PS_ARGS "AaCceG:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ" -#endif +#define PS_ARGS "AaCc" OPT_LAZY_f "G:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ" int main(int argc, char *argv[]) @@ -1100,9 +1099,10 @@ kludge_oldps_options(char *s) static void usage(void) { +#define SINGLE_OPTS "[-aC" OPT_LAZY_f "HhjlmrSTuvwXxZ]" (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: ps [-aCHhjlmrSTuvwXxZ] [-G gid[,gid]] [-O|o fmt]", + "usage: ps " SINGLE_OPTS " [-G gid[,gid]] [-O|o fmt]", " [-p pid[,pid]] [-t tty[,tty]] [-U user[,user]]", " [-M core] [-N system]", " ps [-L]"); -- cgit v1.2.3