summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-09-03 05:44:00 +0000
committerjmallett <jmallett@FreeBSD.org>2002-09-03 05:44:00 +0000
commit26df3d636ef5ceee477279de3f5fd89e956277b9 (patch)
tree86a55100917db7efa38ed7ec8158ecc98f7c8ce5 /bin
parent2dc22e49268ddebe68cded7233384ee625be3a6d (diff)
downloadFreeBSD-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')
-rw-r--r--bin/ps/ps.c9
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 */
OpenPOWER on IntegriCloud