diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2002-09-03 05:44:00 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2002-09-03 05:44:00 +0000 |
commit | daed3ad6613c47b99caf404a809290ba241d9159 (patch) | |
tree | 86a55100917db7efa38ed7ec8158ecc98f7c8ce5 /bin/ps/ps.c | |
parent | b331ec93c042d4656995c2d647b4957548a2b303 (diff) | |
download | src-daed3ad6613c47b99caf404a809290ba241d9159.tar.gz src-daed3ad6613c47b99caf404a809290ba241d9159.zip |
Prevent ps(1) from doing idiotic munging of things in a -ofmt= string.
God I hate the backwards compatability crap here.
Notes
Notes:
svn path=/head/; revision=102886
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r-- | bin/ps/ps.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 1bb1e505348d..98fec49ff710 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -591,9 +591,16 @@ pscomp(const void *a, const void *b) static char * kludge_oldps_options(char *s) { + int have_fmt; size_t len; char *newopts, *ns, *cp; + /* + * If we have an 'o' option, then note it, since we don't want to do + * some types of munging. + */ + have_fmt = index(s, 'o') != NULL; + len = strlen(s); if ((newopts = ns = malloc(len + 2)) == NULL) errx(1, "malloc failed"); @@ -634,7 +641,7 @@ kludge_oldps_options(char *s) */ if (isdigit(*cp) && (cp == s || (cp[-1] != 't' && cp[-1] != 'p')) && - (cp - 1 == s || cp[-2] != 't')) + (cp - 1 == s || cp[-2] != 't') && !have_fmt) *ns++ = 'p'; (void)strcpy(ns, cp); /* and append the number */ |