FreeBSD Bugzilla – Attachment 161986 Details for
Bug 203744
pgrep: -d outputs delimiter as terminator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch ported from OpenBSD
freebsd-10.2-pkill-delim.patch (text/plain), 2.06 KB, created by
chneukirchen
on 2015-10-13 16:42:35 UTC
(
hide
)
Description:
Patch ported from OpenBSD
Filename:
MIME Type:
Creator:
chneukirchen
Created:
2015-10-13 16:42:35 UTC
Size:
2.06 KB
patch
obsolete
>Index: pkill.c >=================================================================== >--- pkill.c (revision 289220) >+++ pkill.c (working copy) >@@ -122,8 +122,8 @@ > static struct listhead classlist = SLIST_HEAD_INITIALIZER(classlist); > > static void usage(void) __attribute__((__noreturn__)); >-static int killact(const struct kinfo_proc *); >-static int grepact(const struct kinfo_proc *); >+static int killact(const struct kinfo_proc *, int); >+static int grepact(const struct kinfo_proc *, int); > static void makelist(struct listhead *, enum listtype, char *); > static int takepid(const char *, int); > >@@ -133,9 +133,9 @@ > char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile; > const char *execf, *coref; > int ancestors, debug_opt, did_action; >- int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock; >+ int i, j, ch, bestidx, rv, criteria, pidfromfile, pidfilelock; > size_t jsz; >- int (*action)(const struct kinfo_proc *); >+ int (*action)(const struct kinfo_proc *, int); > struct kinfo_proc *kp; > struct list *li; > struct timeval best_tval; >@@ -553,7 +553,7 @@ > * Take the appropriate action for each matched process, if any. > */ > did_action = 0; >- for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) { >+ for (i = 0, j = 0, rv = 0, kp = plist; i < nproc; i++, kp++) { > if (PSKIP(kp)) > continue; > if (selected[i]) { >@@ -565,11 +565,13 @@ > continue; > } else if (!inverse) > continue; >- rv |= (*action)(kp); >+ rv |= (*action)(kp, j++); > } > if (!did_action && !pgrep && longfmt) > fprintf(stderr, > "No matching processes belonging to you were found\n"); >+ if (pgrep && j && !quiet) >+ putchar('\n'); > > exit(rv ? STATUS_MATCH : STATUS_NOMATCH); > } >@@ -617,7 +619,7 @@ > } > > static int >-killact(const struct kinfo_proc *kp) >+killact(const struct kinfo_proc *kp, int dummy) > { > int ch, first; > >@@ -654,12 +656,11 @@ > } > > static int >-grepact(const struct kinfo_proc *kp) >+grepact(const struct kinfo_proc *kp, int printdelim) > { >- >+ if (!quiet && printdelim) >+ fputs(delim, stdout); > show_process(kp); >- if (!quiet) >- printf("%s", delim); > return (1); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203744
: 161986