aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-26 00:48:56 +0000
committerrsc <devnull@localhost>2003-11-26 00:48:56 +0000
commit1555bd7aaad44bb26e0442a6798671be636df5b3 (patch)
tree3e8fea4e894d372840035706568f5a735f3fe058 /src
parent268fa933851bab18609b69064e1cc4299f7de32d (diff)
downloadplan9port-1555bd7aaad44bb26e0442a6798671be636df5b3.tar.gz
plan9port-1555bd7aaad44bb26e0442a6798671be636df5b3.tar.bz2
plan9port-1555bd7aaad44bb26e0442a6798671be636df5b3.zip
call exit rather than _exits inside exits,
so that the c library atexit handlers get a chance to run.
Diffstat (limited to 'src')
-rw-r--r--src/cmd/dict/dict.c18
-rw-r--r--src/lib9/atexit.c2
-rw-r--r--src/lib9/exits.c22
3 files changed, 10 insertions, 32 deletions
diff --git a/src/cmd/dict/dict.c b/src/cmd/dict/dict.c
index bafe90d5..00534ea0 100644
--- a/src/cmd/dict/dict.c
+++ b/src/cmd/dict/dict.c
@@ -59,18 +59,18 @@ void
main(int argc, char **argv)
{
int i, cmd, kflag;
- char *line, *p;
+ char *line, *p, *root;
Binit(&binbuf, 0, OREAD);
Binit(&boutbuf, 1, OWRITE);
kflag = 0;
line = 0;
dict = 0;
- p = getenv("PLAN9");
- if(p == nil)
- p = "/usr/local/plan9";
- if(chdir(p) < 0)
- sysfatal("chdir %s: %r", p);
+ root = getenv("PLAN9");
+ if(root == nil)
+ root = "/usr/local/plan9";
+ if(chdir(root) < 0)
+ sysfatal("chdir %s: %r", root);
for(i=0; dicts[i].name; i++){
if(access(dicts[i].path, 0)>=0 && access(dicts[i].indexpath, 0)>=0){
@@ -126,12 +126,12 @@ main(int argc, char **argv)
}
bdict = Bopen(dict->path, OREAD);
if(!bdict) {
- err("can't open dictionary %s/%s", p, dict->path);
+ err("can't open dictionary %s/%s", root, dict->path);
exits("nodict");
}
bindex = Bopen(dict->indexpath, OREAD);
if(!bindex) {
- err("can't open index %s/%s", p, dict->indexpath);
+ err("can't open index %s/%s", root, dict->indexpath);
exits("noindex");
}
indextop = Bseek(bindex, 0L, 2);
@@ -227,10 +227,10 @@ execcmd(int cmd)
doall = 0;
cur = dot->cur;
}
-
if(debug && doall && cmd == 'a')
Bprint(bout, "%d entries, cur=%d\n", dot->n, cur+1);
for(;;){
+print("execcmd dot->n %d\n", dot->n);
if(cur >= dot->n)
break;
if(doall) {
diff --git a/src/lib9/atexit.c b/src/lib9/atexit.c
index b1d8b977..c5cdde1d 100644
--- a/src/lib9/atexit.c
+++ b/src/lib9/atexit.c
@@ -50,5 +50,5 @@ exits(char *s)
onex[i].f = 0;
(*f)();
}
- _exits(s);
+ exit(s && *s ? 1 : 0);
}
diff --git a/src/lib9/exits.c b/src/lib9/exits.c
deleted file mode 100644
index f4206e9a..00000000
--- a/src/lib9/exits.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <u.h>
-#include <libc.h>
-
-extern void _privdie(void);
-
-void
-exits(char *s)
-{
- _privdie();
- if(s && *s)
- exit(1);
- exit(0);
-}
-
-void
-_exits(char *s)
-{
- _privdie();
- if(s && *s)
- _exit(1);
- _exit(0);
-}