systat's default was changed to display names numerically,
Can says this was to avoid excessive blocking with the default
displays. However this left behind an ineffective -n flag and
no way to show names from the command-line (though there is
a yet-to-be-documented keyboard command to toggle this, 'n').

This diff adds -N to show names (keeping -n as is, it didn't
seem right to make -n behave oppositely from netstat).

ok?

Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/main.c,v
retrieving revision 1.54
diff -u -p -r1.54 main.c
--- main.c      25 Jun 2009 20:45:43 -0000      1.54
+++ main.c      19 Jul 2009 19:45:00 -0000
@@ -197,7 +197,7 @@ void
 usage(void)
 {
        extern char *__progname;
-       fprintf(stderr, "usage: %s [-abin] [-d count] "
+       fprintf(stderr, "usage: %s [-abinN] [-d count] "
            "[-s delay] [-w width] [view] [delay]\n", __progname);
        exit(1);
 }
@@ -388,7 +388,7 @@ main(int argc, char *argv[])
        if (setresgid(gid, gid, gid) == -1)
                err(1, "setresgid");
 
-       while ((ch = getopt(argc, argv, "abd:ins:w:")) != -1) {
+       while ((ch = getopt(argc, argv, "Nabd:ins:w:")) != -1) {
                switch (ch) {
                case 'a':
                        maxlines = -1;
@@ -405,7 +405,11 @@ main(int argc, char *argv[])
                case 'i':
                        interactive = 1;
                        break;
+               case 'N':
+                       nflag = 0;
+                       break;
                case 'n':
+                       /* this is a noop, -n is the default */
                        nflag = 1;
                        break;
                case 's':
Index: systat.1
===================================================================
RCS file: /cvs/src/usr.bin/systat/systat.1,v
retrieving revision 1.80
diff -u -p -r1.80 systat.1
--- systat.1    23 Jun 2009 18:52:16 -0000      1.80
+++ systat.1    19 Jul 2009 19:45:00 -0000
@@ -96,8 +96,14 @@ Exit after
 screen updates.
 .It Fl i
 Interactive mode.
+.It Fl N
+Resolve network addresses to names.
+This is the opposite of the
+.Fl n
+option.
 .It Fl n
 Do not try to reverse map IP addresses.
+This is the default.
 .It Fl s Ar delay
 Specifies the screen refresh time interval in seconds.
 This option is overridden by the final

Reply via email to