Introduction
Introduction Statistics Contact Development Disclaimer Help
Use atexit to ensure proper shutdown. - sam - An updated version of the sam tex…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 1d7381514a5589c78eca12a92b341fbd0de9ff2f
parent 3a8f45f007849613466d20ed16760917bdb2bf9d
Author: Rob King <[email protected]>
Date: Thu, 20 Oct 2016 16:04:18 -0500
Use atexit to ensure proper shutdown.
Diffstat:
sam/file.c | 4 +---
sam/mesg.c | 1 -
sam/sam.c | 3 ++-
sam/sam.h | 1 +
4 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/sam/file.c b/sam/file.c
@@ -20,7 +20,7 @@ enum{
MAXCACHE=STRSIZE /* max length of cache. must be < 32K-BLOCKSIZE */
};
-static void
+void
freebufs(void)
{
Bterm(undobuf);
@@ -34,8 +34,6 @@ Fstart(void)
undobuf = Bopen();
snarfbuf = Bopen();
plan9buf = Bopen();
-
- atexit(freebufs);
}
void
diff --git a/sam/mesg.c b/sam/mesg.c
@@ -491,7 +491,6 @@ inmesg(Tmesg type)
break;
case Texit:
- shutdown();
exit(EXIT_SUCCESS);
}
return true;
diff --git a/sam/sam.c b/sam/sam.c
@@ -135,12 +135,12 @@ main(int argc, char *argv[])
if(file.nused)
current(file.filepptr[0]);
+ atexit(shutdown);
setjmp(mainloop);
cmdloop();
trytoquit(); /* if we already q'ed, quitok will be true */
- shutdown();
exit(EXIT_SUCCESS);
}
@@ -172,6 +172,7 @@ shutdown(void)
free(tempfile.listptr);
freecmdlists();
+ freebufs();
}
void
diff --git a/sam/sam.h b/sam/sam.h
@@ -207,6 +207,7 @@ void error_s(Err, char*);
int execute(File*, Posn, Posn);
int filematch(File*, String*);
void filename(File*);
+void freebufs(void);
void freecmd(void);
void freecmdlists(void);
File *getfile(String*);
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.