diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-09-03 05:44:00 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-09-03 05:44:00 +0000 |
commit | 26df3d636ef5ceee477279de3f5fd89e956277b9 (patch) | |
tree | 86a55100917db7efa38ed7ec8158ecc98f7c8ce5 /bin/ps | |
parent | 2dc22e49268ddebe68cded7233384ee625be3a6d (diff) | |
download | FreeBSD-src-26df3d636ef5ceee477279de3f5fd89e956277b9.zip FreeBSD-src-26df3d636ef5ceee477279de3f5fd89e956277b9.tar.gz |
Prevent ps(1) from doing idiotic munging of things in a -ofmt= string.
God I hate the backwards compatability crap here.
Diffstat (limited to 'bin/ps')
-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 1bb1e50..98fec49 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 */ |