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

This commit is contained in:
eadler 2018-06-23 22:45:18 +00:00
parent cfe9f44871
commit e08d2013b1

View File

@ -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 *(*get_userid)(int), int flags
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')