svn commit: r335589 - head/usr.bin/top
Eitan Adler
eadler at FreeBSD.org
Sat Jun 23 22:45:19 UTC 2018
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')
More information about the svn-src-head
mailing list