return NULL;
case_default: /* use defaults for ps, ignoring other environment variables */
- return NULL;
-
case_unknown: /* defaults, but also check inferior environment variables */
- if(
- getenv("UNIX95") /* Irix */
- || getenv("POSIXLY_CORRECT") /* most gnu stuff */
- || (getenv("POSIX2") && !strcmp(getenv("POSIX2"), "on")) /* Unixware 7 */
- ) personality = PER_BROKEN_o;
return NULL;
case_aix:
case_irix:
case_sgi:
s = getenv("_XPG");
- if(s && s[0]>'0' && s[0]<='9') personality = PER_BROKEN_o;
- else personality = PER_IRIX_l;
+ if(s && s[0]>'0' && s[0]<='9')
+ return NULL;
+ personality = PER_IRIX_l;
return NULL;
case_os390: /* IBM's OS/390 OpenEdition on the S/390 mainframe */
case_hp:
case_hpux:
- personality = PER_BROKEN_o | PER_HPUX_x;
+ personality = PER_HPUX_x;
return NULL;
case_svr4:
case_sysv:
case_sco:
- personality = PER_BROKEN_o | PER_SVR4_x;
+ personality = PER_SVR4_x;
return NULL;
case_posix:
case_unix95:
case_unix98:
case_unix:
- personality = PER_BROKEN_o;
return NULL;
}
static char **ps_argv; /* global argv */
static int thisarg; /* index into ps_argv */
static char *flagptr; /* current location in ps_argv[thisarg] */
-static int not_pure_unix = 0; /* set by BSD and GNU options */
static int force_bsd = 0; /* set when normal parsing fails */
#define exclusive(x) if((ps_argc != 2) || strcmp(ps_argv[1],x)) \
*/
static const char *get_opt_arg(void){
if(*(flagptr+1)){ /* argument is part of ps_argv[thisarg] */
- not_pure_unix = 1;
return flagptr+1;
}
if(thisarg+2 > ps_argc) return NULL; /* there is nothing left */
flagptr = ps_argv[thisarg];
while(*++flagptr){
- // Find any excuse to ignore stupid Unix98 misfeatures.
- //
- // This list of options is ONLY for those defined by the
- // "IEEE Std 1003.1, 2004 Edition", "ISO/IEC 9945:2003",
- // or "Version 2 of the Single Unix Specification".
- //
- // It may be time to re-think the existence of this list.
- // In the meantime, please do not add to it. The list is
- // intended to ONLY contain flags defined by the POSIX and UNIX
- // standards published by The Open Group, IEEE, and ISO.
- if(!strchr("aAdefgGlnoptuU", *flagptr)) not_pure_unix = 1; // dude, -Z ain't in POSIX
-
switch(*flagptr){
case 'A':
trace("-A selects all processes\n");
trace("-o user-defined format\n");
arg=get_opt_arg();
if(!arg) return _("format specification must follow -o");
- not_pure_unix |= defer_sf_option(arg, SF_U_o);
+ defer_sf_option(arg, SF_U_o);
return NULL; /* can't have any more options */
case 'p': /* end */
trace("-p select by PID\n");
trace("parse_all_options calling arg_type for \"%s\"\n", ps_argv[thisarg]);
at = arg_type(ps_argv[thisarg]);
trace("ps_argv[thisarg] is %s\n", ps_argv[thisarg]);
- if(at != ARG_SYSV) not_pure_unix = 1;
switch(at){
case ARG_GNU:
err = parse_gnu_option();
if(err) goto try_bsd;
err = thread_option_check();
if(err) goto try_bsd;
- err = process_sf_options(!not_pure_unix);
+ err = process_sf_options();
if(err) goto try_bsd;
err = select_bits_setup();
if(err) goto try_bsd;
ps_argv = argv;
thisarg = 0;
/* no need to reset flagptr */
- not_pure_unix=1;
force_bsd=1;
prefer_bsd_defaults=1;
if(!( (PER_OLD_m|PER_BSD_m) & personality )) /* if default m setting... */
if(err2) goto total_failure;
err2 = thread_option_check();
if(err2) goto total_failure;
- err2 = process_sf_options(!not_pure_unix);
+ err2 = process_sf_options();
if(err2) goto total_failure;
err2 = select_bits_setup();
if(err2) goto total_failure;
#include "common.h"
static sf_node *sf_list = NULL; /* deferred sorting and formatting */
-static int broken; /* use gross Unix98 parsing? */
static int have_gnu_sort = 0; /* if true, "O" must be format */
static int already_parsed_sort = 0; /* redundantly set in & out of fn */
static int already_parsed_format = 0;
/***************************************************************
* Used to parse option O lists. Option O is shared between
* sorting and formatting. Users may expect one or the other.
- * The "broken" flag enables a really bad Unix98 misfeature.
* Put each completed format_node onto the list starting at ->f_cooked
*/
static const char *format_parse(sf_node *sfn){
}
need_item=1;
break;
- case '=':
- if(broken) goto out;
- /* fall through */
default:
if(need_item) items++;
need_item=0;
/*
* Used to parse option O lists. Option O is shared between
* sorting and formatting. Users may expect one or the other.
- * The "broken" flag enables a really bad Unix98 misfeature.
* Recursion is to preserve original order.
*/
static const char *parse_O_option(sf_node *sfn){
* sorting and formatting. Users may expect one or the other.
* The "broken" flag enables a really bad Unix98 misfeature.
*/
-const char *process_sf_options(int localbroken){
+const char *process_sf_options(void){
sf_node *sf_walk;
- if(personality & PER_BROKEN_o) localbroken = 1;
- if(personality & PER_GOOD_o) localbroken = 0;
- broken = localbroken;
if(sf_list){
const char *err;
err = parse_O_option(sf_list);