From: czarkoff Date: Sun, 25 Oct 2015 15:26:53 +0000 (+0000) Subject: strvis directory names in ps X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4b6b28c6124f02ca45c25d882434f2f054d15baf;p=openbsd strvis directory names in ps OK stsp@ --- 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