diff options
Diffstat (limited to 'contrib/bmake/util.c')
-rw-r--r-- | contrib/bmake/util.c | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/contrib/bmake/util.c b/contrib/bmake/util.c index a5d867d9df91..6143e4c462d2 100644 --- a/contrib/bmake/util.c +++ b/contrib/bmake/util.c @@ -1,9 +1,9 @@ -/* $NetBSD: util.c,v 1.68 2020/11/16 18:29:49 rillig Exp $ */ +/* $NetBSD: util.c,v 1.73 2020/12/30 10:03:16 rillig Exp $ */ /* * Missing stuff from OS's * - * $Id: util.c,v 1.41 2020/11/18 03:58:32 sjg Exp $ + * $Id: util.c,v 1.45 2021/01/01 22:55:09 sjg Exp $ */ #include <sys/param.h> @@ -13,7 +13,7 @@ #include "make.h" -MAKE_RCSID("$NetBSD: util.c,v 1.68 2020/11/16 18:29:49 rillig Exp $"); +MAKE_RCSID("$NetBSD: util.c,v 1.73 2020/12/30 10:03:16 rillig Exp $"); #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR) extern int errno, sys_nerr; @@ -153,7 +153,8 @@ main(int argc, char *argv[]) #if defined(__hpux__) || defined(__hpux) -/* strrcpy(): +/* + * strrcpy(): * Like strcpy, going backwards and returning the new pointer */ static char * @@ -161,7 +162,7 @@ strrcpy(char *ptr, char *str) { int len = strlen(str); - while (len) + while (len != 0) *--ptr = str[--len]; return ptr; @@ -170,38 +171,38 @@ strrcpy(char *ptr, char *str) char *sys_siglist[] = { "Signal 0", - "Hangup", /* SIGHUP */ - "Interrupt", /* SIGINT */ - "Quit", /* SIGQUIT */ - "Illegal instruction", /* SIGILL */ - "Trace/BPT trap", /* SIGTRAP */ - "IOT trap", /* SIGIOT */ - "EMT trap", /* SIGEMT */ - "Floating point exception", /* SIGFPE */ - "Killed", /* SIGKILL */ - "Bus error", /* SIGBUS */ - "Segmentation fault", /* SIGSEGV */ - "Bad system call", /* SIGSYS */ - "Broken pipe", /* SIGPIPE */ - "Alarm clock", /* SIGALRM */ - "Terminated", /* SIGTERM */ - "User defined signal 1", /* SIGUSR1 */ - "User defined signal 2", /* SIGUSR2 */ - "Child exited", /* SIGCLD */ - "Power-fail restart", /* SIGPWR */ - "Virtual timer expired", /* SIGVTALRM */ - "Profiling timer expired", /* SIGPROF */ - "I/O possible", /* SIGIO */ - "Window size changes", /* SIGWINDOW */ - "Stopped (signal)", /* SIGSTOP */ - "Stopped", /* SIGTSTP */ - "Continued", /* SIGCONT */ - "Stopped (tty input)", /* SIGTTIN */ - "Stopped (tty output)", /* SIGTTOU */ - "Urgent I/O condition", /* SIGURG */ - "Remote lock lost (NFS)", /* SIGLOST */ - "Signal 31", /* reserved */ - "DIL signal" /* SIGDIL */ + "Hangup", /* SIGHUP */ + "Interrupt", /* SIGINT */ + "Quit", /* SIGQUIT */ + "Illegal instruction", /* SIGILL */ + "Trace/BPT trap", /* SIGTRAP */ + "IOT trap", /* SIGIOT */ + "EMT trap", /* SIGEMT */ + "Floating point exception", /* SIGFPE */ + "Killed", /* SIGKILL */ + "Bus error", /* SIGBUS */ + "Segmentation fault", /* SIGSEGV */ + "Bad system call", /* SIGSYS */ + "Broken pipe", /* SIGPIPE */ + "Alarm clock", /* SIGALRM */ + "Terminated", /* SIGTERM */ + "User defined signal 1", /* SIGUSR1 */ + "User defined signal 2", /* SIGUSR2 */ + "Child exited", /* SIGCLD */ + "Power-fail restart", /* SIGPWR */ + "Virtual timer expired", /* SIGVTALRM */ + "Profiling timer expired", /* SIGPROF */ + "I/O possible", /* SIGIO */ + "Window size changes", /* SIGWINDOW */ + "Stopped (signal)", /* SIGSTOP */ + "Stopped", /* SIGTSTP */ + "Continued", /* SIGCONT */ + "Stopped (tty input)", /* SIGTTIN */ + "Stopped (tty output)", /* SIGTTOU */ + "Urgent I/O condition", /* SIGURG */ + "Remote lock lost (NFS)", /* SIGLOST */ + "Signal 31", /* reserved */ + "DIL signal" /* SIGDIL */ }; #endif /* __hpux__ || __hpux */ @@ -343,16 +344,16 @@ getcwd(path, sz) SignalProc bmake_signal(int s, SignalProc a) { - struct sigaction sa, osa; + struct sigaction sa, osa; - sa.sa_handler = a; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; + sa.sa_handler = a; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; - if (sigaction(s, &sa, &osa) == -1) - return SIG_ERR; - else - return osa.sa_handler; + if (sigaction(s, &sa, &osa) == -1) + return SIG_ERR; + else + return osa.sa_handler; } #if !defined(HAVE_VSNPRINTF) || !defined(HAVE_VASPRINTF) |