After w(1), another casualty of my wscons patches: ps(1) gives only the
first two chars of the tty name suffix in the 'TT' field, leading to
e.g. 'C128' appearing as 'C1'. This is obviously misleading.

For just such a case, the patches below fix this by broadening said
field by 2 characters.
 
        --zeurkous.

Index: src/bin/ps/keyword.c
===================================================================
RCS file: /cvs/src/bin/ps/keyword.c,v
retrieving revision 1.45
diff -u -p -r1.45 keyword.c
--- src/bin/ps/keyword.c        24 Jan 2017 22:40:09 -0000      1.45
+++ src/bin/ps/keyword.c        26 Dec 2018 10:47:43 -0000
@@ -175,7 +175,7 @@ VAR var[] = {
        PID("tpgid", "TPGID", pvar, POFF(p_tpgid)),
        {"tsess", "TSESS", NULL, 0, pvar, PTRWIDTH, 0, POFF(p_tsess), UINT64, 
"llx"},
        {"tsiz", "TSIZ", NULL, 0, tsize, 4},
-       {"tt", "TT", NULL, LJUST, tname, 3},
+       {"tt", "TT", NULL, LJUST, tname, 5},
        {"tty", "TTY", NULL, LJUST, longtname, 8},
        {"ucomm", "UCOMM", NULL, LJUST, ucomm, MAXCOMLEN},
        UID("uid", "UID", pvar, POFF(p_uid)),

Index: src/bin/ps/print.c
===================================================================
RCS file: /cvs/src/bin/ps/print.c,v
retrieving revision 1.70
diff -u -p -r1.70 print.c
--- src/bin/ps/print.c  12 Jun 2018 01:58:05 -0000      1.70
+++ src/bin/ps/print.c  26 Dec 2018 10:47:43 -0000
@@ -371,7 +371,7 @@ tname(const struct kinfo_proc *kp, VAREN
        else {
                if (strncmp(ttname, "tty", 3) == 0)
                        ttname += 3;
-               (void)printf("%*.*s%c", v->width-1, v->width-1, ttname,
+               (void)printf("%-*s%c", v->width-1, ttname,
                        kp->p_eflag & EPROC_CTTY ? ' ' : '-');
        }
 }

Reply via email to