From 17d484bfacf46fe1a36a8e4eafa590ad0a13615d Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 24 May 2016 15:11:30 +0000 Subject: [PATCH 1/2] preserve previous value of haderr. --- sh.proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sh.proc.c b/sh.proc.c index e48a3b4..8472ef5 100644 --- a/sh.proc.c +++ b/sh.proc.c @@ -993,6 +993,7 @@ pprint(struct process *pp, int flag) struct process *tp; int jobflags, pstatus, pcond; const char *format; + int ohaderr; #ifdef BACKPIPE struct process *pipehead = NULL, *pipetail = NULL, *pmarker = NULL; @@ -1008,6 +1009,7 @@ pprint(struct process *pp, int flag) tp = pp; status = reason = -1; jobflags = 0; + ohaderr = haderr; haderr = 1; /* Print status to stderr */ do { #ifdef BACKPIPE @@ -1217,7 +1219,7 @@ prcomd: xprintf(" "); ptprint(tp); } - haderr = 0; + haderr = ohaderr; return (jobflags); } -- 2.5.5 From 50029cb5d4fe43059eacda5a6e5a25db2e94975e Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 24 May 2016 17:41:12 +0000 Subject: [PATCH 2/2] don't print jobs to stderr (paulo.cesar.pereira.de.andrade) --- sh.proc.c | 5 +++-- sh.proc.h | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sh.proc.c b/sh.proc.c index 8472ef5..49b199f 100644 --- a/sh.proc.c +++ b/sh.proc.c @@ -1010,7 +1010,8 @@ pprint(struct process *pp, int flag) status = reason = -1; jobflags = 0; ohaderr = haderr; - haderr = 1; /* Print status to stderr */ + /* Print status to stderr, except for jobs built-in */ + haderr = !(flag & JOBLIST); do { #ifdef BACKPIPE /* @@ -1318,7 +1319,7 @@ void dojobs(Char **v, struct command *c) { struct process *pp; - int flag = NUMBER | NAME | REASON; + int flag = NUMBER | NAME | REASON | JOBLIST; int i; USE(c); diff --git a/sh.proc.h b/sh.proc.h index 859e55a..919c7c3 100644 --- a/sh.proc.h +++ b/sh.proc.h @@ -106,14 +106,15 @@ struct process { #define PBRACE (1<<18) /* Process is {} evaluation */ /* defines for arguments to pprint */ -#define NUMBER 01 -#define NAME 02 -#define REASON 04 -#define AMPERSAND 010 -#define FANCY 020 -#define SHELLDIR 040 /* print shell's dir if not the same */ -#define JOBDIR 0100 /* print job's dir if not the same */ -#define AREASON 0200 +#define NUMBER 0x001 +#define NAME 0x002 +#define REASON 0x004 +#define AMPERSAND 0x008 +#define FANCY 0x010 +#define SHELLDIR 0x020 /* print shell's dir if not the same */ +#define JOBDIR 0x040 /* print job's dir if not the same */ +#define AREASON 0x080 +#define JOBLIST 0x100 EXTERN struct process proclist IZERO_STRUCT;/* list head of all processes */ -- 2.5.5