diff options
author | Dmitrij Czarkoff <czarkoff@cvs.openbsd.org> | 2015-10-25 15:26:54 +0000 |
---|---|---|
committer | Dmitrij Czarkoff <czarkoff@cvs.openbsd.org> | 2015-10-25 15:26:54 +0000 |
commit | aedd53b8b94bf81c77032c55fb4763b33151f86b (patch) | |
tree | 7ab572a1df199cb7586d5db766891a7281f75bb2 | |
parent | 054a2e192246eb601ef0869f3da1c0ef5ebc88c7 (diff) |
strvis directory names in ps
OK stsp@
-rw-r--r-- | bin/ps/print.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index d42614e9fae..d8cb7806c58 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.63 2015/10/09 01:37:06 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.64 2015/10/25 15:26:53 czarkoff Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -179,16 +179,19 @@ ucomm(const struct kinfo_proc *kp, VARENT *ve) void curwd(const struct kinfo_proc *kp, VARENT *ve) { - VAR *v; int name[] = { CTL_KERN, KERN_PROC_CWD, kp->p_pid }; char path[PATH_MAX]; size_t pathlen = sizeof path; + int left; + + left = ve->var->width; if (!kvm_sysctl_only || sysctl(name, 3, path, &pathlen, NULL, 0) != 0) *path = '\0'; - v = ve->var; - (void)printf("%-*s", v->width, path); + fmt_puts(path, &left); + if (ve->next != NULL && left) + (void)printf("%-*s", left, ""); } void |