Author: eadler
Date: Sat Jun 23 22:45:18 2018
New Revision: 335589
URL: https://svnweb.freebsd.org/changeset/base/335589

Log:
  top(1): Use basename instead of a homegrown alternative

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c  Sat Jun 23 20:12:30 2018        (r335588)
+++ head/usr.bin/top/machine.c  Sat Jun 23 22:45:18 2018        (r335589)
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 #include <err.h>
+#include <libgen.h>
 #include <kvm.h>
 #include <math.h>
 #include <paths.h>
@@ -992,11 +993,7 @@ format_next_process(struct handle * xhandle, char *(*g
                        dst = argbuf;
 
                        /* Extract cmd name from argv */
-                       cmd = strrchr(*args, '/');
-                       if (cmd == NULL)
-                               cmd = *args;
-                       else
-                               cmd++;
+                       cmd = basename(*args);
 
                        for (; (src = *args++) != NULL; ) {
                                if (*src == '\0')
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to