From e65d9edc11e3c362ee041c21b0789f323a8458e2 Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 1 Aug 2006 12:57:07 +0000 Subject: [PATCH] * use strsignal(3) not strerror(3), oops * on GNU, that needs -D_GNU_SOURCE * a little style(9) KNF while here --- Build.sh | 4 ++-- histrap.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Build.sh b/Build.sh index 8c5a67e..1d64ccc 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $MirOS: src/bin/mksh/Build.sh,v 1.33 2006/07/23 18:44:22 tg Exp $ +# $MirOS: src/bin/mksh/Build.sh,v 1.34 2006/08/01 12:57:07 tg Exp $ #- # This script recognises CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS and NROFF. @@ -63,7 +63,7 @@ Interix) Linux) # Hello Mr Drepper, we all like you too... SRCS="$SRCS compat.c strlfun.c" - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE" + CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DNEED_COMPAT" LDSTATIC= # glibc dlopens the PAM library with getpwnam at runtime ;; diff --git a/histrap.c b/histrap.c index 23b0caa..33a78a2 100644 --- a/histrap.c +++ b/histrap.c @@ -3,7 +3,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.15 2006/05/10 18:54:10 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.16 2006/08/01 12:57:07 tg Exp $"); static int histfd; static int hsize; @@ -37,7 +37,7 @@ static Source *hist_source; #define mksh_siglist(x) _sys_siglist[(x)] #elif defined(__gnu_linux__) || defined(__sun__) || defined(__CYGWIN__) #define NEED_MKSH_SIGNAME -#define mksh_siglist(x) strerror(x) +#define mksh_siglist(x) strsignal(x) #else # error "Define sys_sig{name,list} for this platform!" #endif @@ -648,7 +648,7 @@ hist_init(Source *s) return; hname = str_save(hname, APERM); - retry: + retry: /* we have a file and are interactive */ if ((fd = open(hname, O_RDWR|O_CREAT|O_APPEND, 0600)) < 0) return; @@ -943,7 +943,7 @@ writehistfile(int lno, char *cmd) hsize = lseek(histfd, 0L, SEEK_END); (void) flock(histfd, LOCK_UN); return; -bad: + bad: hist_finish(); } #endif @@ -986,10 +986,10 @@ mksh_signame(int s) while (mksh_sigpair[i].name != NULL) { if (mksh_sigpair[i].nr == s) - return mksh_sigpair[i].name; + return (mksh_sigpair[i].name); ++i; } - return NULL; + return (NULL); } #endif