top(1): Use basename instead of a homegrown alternative
This commit is contained in:
parent
9324388b0a
commit
ac8f40ea78
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335589
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <kvm.h>
|
#include <kvm.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
@ -992,11 +993,7 @@ format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags
|
|||||||
dst = argbuf;
|
dst = argbuf;
|
||||||
|
|
||||||
/* Extract cmd name from argv */
|
/* Extract cmd name from argv */
|
||||||
cmd = strrchr(*args, '/');
|
cmd = basename(*args);
|
||||||
if (cmd == NULL)
|
|
||||||
cmd = *args;
|
|
||||||
else
|
|
||||||
cmd++;
|
|
||||||
|
|
||||||
for (; (src = *args++) != NULL; ) {
|
for (; (src = *args++) != NULL; ) {
|
||||||
if (*src == '\0')
|
if (*src == '\0')
|
||||||
|
Loading…
Reference in New Issue
Block a user