Skip to content

Commit 9f3c0ef

Browse files
committed
small cleanup for systems without core dumps, such as Jehanne
1 parent 82265de commit 9f3c0ef

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

jobs.c

+19-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*-
44
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
5-
* 2012, 2013, 2014, 2015, 2016
5+
* 2012, 2013, 2014, 2015, 2016, 2018
66
* mirabilos <m@mirbsd.org>
77
*
88
* Provided that these terms and disclaimer and all copyright notices
@@ -23,7 +23,7 @@
2323

2424
#include "sh.h"
2525

26-
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.124 2017/08/08 14:30:10 tg Exp $");
26+
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.125 2018/01/05 20:08:34 tg Exp $");
2727

2828
#if HAVE_KILLPG
2929
#define mksh_killpg killpg
@@ -1545,7 +1545,9 @@ j_print(Job *j, int how, struct shf *shf)
15451545
Proc *p;
15461546
int state;
15471547
int status;
1548+
#ifdef WCOREDUMP
15481549
bool coredumped;
1550+
#endif
15491551
char jobchar = ' ';
15501552
char buf[64];
15511553
const char *filler;
@@ -1569,7 +1571,9 @@ j_print(Job *j, int how, struct shf *shf)
15691571
jobchar = '-';
15701572

15711573
for (p = j->proc_list; p != NULL;) {
1574+
#ifdef WCOREDUMP
15721575
coredumped = false;
1576+
#endif
15731577
switch (p->state) {
15741578
case PRUNNING:
15751579
memcpy(buf, "Running", 8);
@@ -1603,7 +1607,10 @@ j_print(Job *j, int how, struct shf *shf)
16031607
* kludge for not reporting 'normal termination
16041608
* signals' (i.e. SIGINT, SIGPIPE)
16051609
*/
1606-
if (how == JP_SHORT && !coredumped &&
1610+
if (how == JP_SHORT &&
1611+
#ifdef WCOREDUMP
1612+
!coredumped &&
1613+
#endif
16071614
(termsig == SIGINT || termsig == SIGPIPE)) {
16081615
buf[0] = '\0';
16091616
} else
@@ -1629,14 +1636,22 @@ j_print(Job *j, int how, struct shf *shf)
16291636
if (how == JP_SHORT) {
16301637
if (buf[0]) {
16311638
output = 1;
1639+
#ifdef WCOREDUMP
16321640
shf_fprintf(shf, "%s%s ",
16331641
buf, coredumped ? " (core dumped)" : null);
1642+
#else
1643+
shf_puts(buf, shf);
1644+
shf_putchar(' ', shf);
1645+
#endif
16341646
}
16351647
} else {
16361648
output = 1;
16371649
shf_fprintf(shf, "%-20s %s%s%s", buf, p->command,
16381650
p->next ? "|" : null,
1639-
coredumped ? " (core dumped)" : null);
1651+
#ifdef WCOREDUMP
1652+
coredumped ? " (core dumped)" :
1653+
#endif
1654+
null);
16401655
}
16411656

16421657
state = p->state;

0 commit comments

Comments
 (0)