Refactored code. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4fc20405021028c8d1354b9a7502edb981f5611d | |
parent 3faf10fec3196e42b6ca31cd216091d73475944a | |
Author: Rob King <[email protected]> | |
Date: Tue, 4 Oct 2016 11:19:09 -0500 | |
Refactored code. | |
Diffstat: | |
include/u.h | 1 - | |
sam/sam.c | 14 +++++++++++++- | |
sam/unix.c | 15 --------------- | |
3 files changed, 13 insertions(+), 17 deletions(-) | |
--- | |
diff --git a/include/u.h b/include/u.h | |
@@ -19,4 +19,3 @@ | |
#define runelen(r) (wctomb(NULL, (r))) | |
int chartorune(wchar_t *, char *); | |
-void notify(void); | |
diff --git a/sam/sam.c b/sam/sam.c | |
@@ -2,6 +2,7 @@ | |
#include "sam.h" | |
#include <libgen.h> | |
+#include <signal.h> | |
#include <stdbool.h> | |
#include <unistd.h> | |
@@ -39,6 +40,13 @@ wchar_t baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '… | |
void usage(void); | |
+static void | |
+hup(int sig) | |
+{ | |
+ rescue(); | |
+ exit(EXIT_FAILURE); | |
+} | |
+ | |
int | |
main(int argc, char *argv[]) | |
{ | |
@@ -106,7 +114,11 @@ main(int argc, char *argv[]) | |
if(!dflag) | |
startup(machine, Rflag, arg, ap); | |
Fstart(); | |
- notify(); | |
+ | |
+ signal(SIGINT, SIG_IGN); | |
+ signal(SIGHUP, hup); | |
+ signal(SIGPIPE, SIG_IGN); | |
+ | |
if(argc > 0){ | |
for(i=0; i<argc; i++) | |
if(!setjmp(mainloop)){ | |
diff --git a/sam/unix.c b/sam/unix.c | |
@@ -96,21 +96,6 @@ statfd(int fd, uint64_t *dev, uint64_t *id, int64_t *time, i… | |
return 1; | |
} | |
-static void | |
-hup(int sig) | |
-{ | |
- rescue(); | |
- exit(1); | |
-} | |
- | |
-void | |
-notify(void) | |
-{ | |
- signal(SIGINT, SIG_IGN); | |
- signal(SIGHUP, hup); | |
- signal(SIGPIPE, SIG_IGN); | |
-} | |
- | |
int | |
newtmp(void) | |
{ |