tadd exitcode - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit eadb18a3357b9b735b2f7da478854a39fb0c73c6
(DIR) parent 5cc53af92d6bfae8b930d3c9154c8ed44e1feb09
(HTM) Author: rsc <devnull@localhost>
Date: Sun, 12 Feb 2006 19:40:55 +0000
add exitcode
Diffstat:
M include/libc.h | 1 +
M src/lib9/_exits.c | 6 +++---
M src/lib9/atexit.c | 4 +++-
3 files changed, 7 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/include/libc.h b/include/libc.h
t@@ -376,6 +376,7 @@ extern int dec16(uchar*, int, char*, int);
extern int enc16(char*, int, uchar*, int);
extern int encodefmt(Fmt*);
extern int dirmodefmt(Fmt*);
+extern int exitcode(char*);
extern void exits(char*);
extern double frexp(double, int*);
extern ulong getcallerpc(void*);
(DIR) diff --git a/src/lib9/_exits.c b/src/lib9/_exits.c
t@@ -4,7 +4,7 @@
void
_exits(char *s)
{
- if(s && *s)
- _exit(1);
- _exit(0);
+ if(s == 0 || *s == 0)
+ _exit(0);
+ _exit(exitcode(s));
}
(DIR) diff --git a/src/lib9/atexit.c b/src/lib9/atexit.c
t@@ -50,5 +50,7 @@ exits(char *s)
onex[i].f = 0;
(*f)();
}
- exit(s && *s ? 1 : 0);
+ if(s == 0 || *s == 0)
+ exit(0);
+ exit(exitcode(s));
}