small cleanup for systems without core dumps, such as Jehanne
This commit is contained in:
parent
82265de5d7
commit
9f3c0efefc
23
jobs.c
23
jobs.c
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
|
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
|
||||||
* 2012, 2013, 2014, 2015, 2016
|
* 2012, 2013, 2014, 2015, 2016, 2018
|
||||||
* mirabilos <m@mirbsd.org>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.124 2017/08/08 14:30:10 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.125 2018/01/05 20:08:34 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
|
@ -1545,7 +1545,9 @@ j_print(Job *j, int how, struct shf *shf)
|
||||||
Proc *p;
|
Proc *p;
|
||||||
int state;
|
int state;
|
||||||
int status;
|
int status;
|
||||||
|
#ifdef WCOREDUMP
|
||||||
bool coredumped;
|
bool coredumped;
|
||||||
|
#endif
|
||||||
char jobchar = ' ';
|
char jobchar = ' ';
|
||||||
char buf[64];
|
char buf[64];
|
||||||
const char *filler;
|
const char *filler;
|
||||||
|
@ -1569,7 +1571,9 @@ j_print(Job *j, int how, struct shf *shf)
|
||||||
jobchar = '-';
|
jobchar = '-';
|
||||||
|
|
||||||
for (p = j->proc_list; p != NULL;) {
|
for (p = j->proc_list; p != NULL;) {
|
||||||
|
#ifdef WCOREDUMP
|
||||||
coredumped = false;
|
coredumped = false;
|
||||||
|
#endif
|
||||||
switch (p->state) {
|
switch (p->state) {
|
||||||
case PRUNNING:
|
case PRUNNING:
|
||||||
memcpy(buf, "Running", 8);
|
memcpy(buf, "Running", 8);
|
||||||
|
@ -1603,7 +1607,10 @@ j_print(Job *j, int how, struct shf *shf)
|
||||||
* kludge for not reporting 'normal termination
|
* kludge for not reporting 'normal termination
|
||||||
* signals' (i.e. SIGINT, SIGPIPE)
|
* signals' (i.e. SIGINT, SIGPIPE)
|
||||||
*/
|
*/
|
||||||
if (how == JP_SHORT && !coredumped &&
|
if (how == JP_SHORT &&
|
||||||
|
#ifdef WCOREDUMP
|
||||||
|
!coredumped &&
|
||||||
|
#endif
|
||||||
(termsig == SIGINT || termsig == SIGPIPE)) {
|
(termsig == SIGINT || termsig == SIGPIPE)) {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
} else
|
} else
|
||||||
|
@ -1629,14 +1636,22 @@ j_print(Job *j, int how, struct shf *shf)
|
||||||
if (how == JP_SHORT) {
|
if (how == JP_SHORT) {
|
||||||
if (buf[0]) {
|
if (buf[0]) {
|
||||||
output = 1;
|
output = 1;
|
||||||
|
#ifdef WCOREDUMP
|
||||||
shf_fprintf(shf, "%s%s ",
|
shf_fprintf(shf, "%s%s ",
|
||||||
buf, coredumped ? " (core dumped)" : null);
|
buf, coredumped ? " (core dumped)" : null);
|
||||||
|
#else
|
||||||
|
shf_puts(buf, shf);
|
||||||
|
shf_putchar(' ', shf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
output = 1;
|
output = 1;
|
||||||
shf_fprintf(shf, "%-20s %s%s%s", buf, p->command,
|
shf_fprintf(shf, "%-20s %s%s%s", buf, p->command,
|
||||||
p->next ? "|" : null,
|
p->next ? "|" : null,
|
||||||
coredumped ? " (core dumped)" : null);
|
#ifdef WCOREDUMP
|
||||||
|
coredumped ? " (core dumped)" :
|
||||||
|
#endif
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
state = p->state;
|
state = p->state;
|
||||||
|
|
Loading…
Reference in New Issue