X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0a032eea07f6d77ac6ea4d5a39c9491c34358058..94187a80bd60baab4b9c4b949ad820d730578123:/sbr/read_switch_multiword.c diff --git a/sbr/read_switch_multiword.c b/sbr/read_switch_multiword.c index 5c83eec8..a5aedae3 100644 --- a/sbr/read_switch_multiword.c +++ b/sbr/read_switch_multiword.c @@ -1,5 +1,4 @@ -/* - * read_switch_multiword.c -- get an answer from the user and return a string array +/* read_switch_multiword.c -- get an answer from the user and return a string array * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -26,12 +25,11 @@ read_switch_multiword (const char *prompt, const struct swit *ansp) SIGNAL_HANDLER istat = NULL; char *cp, **cpp; - if (!(sigsetjmp(sigenv, 1))) { - istat = SIGNAL (SIGINT, intrser); - } else { + if (sigsetjmp(sigenv, 1)) { SIGNAL (SIGINT, istat); return NULL; } + istat = SIGNAL (SIGINT, intrser); for (;;) { fputs(prompt, stdout); @@ -51,7 +49,7 @@ read_switch_multiword (const char *prompt, const struct swit *ansp) * then just return. */ - else if (ferror(stdin)) { + if (ferror(stdin)) { if (errno == EINTR) { clearerr(stdin); continue; @@ -59,14 +57,11 @@ read_switch_multiword (const char *prompt, const struct swit *ansp) fprintf(stderr, "\nError %s during read\n", strerror(errno)); siglongjmp (sigenv, 1); - } else { - /* - * Just for completeness's sake ... - */ - - fprintf(stderr, "\nUnknown problem in getchar()\n"); - siglongjmp (sigenv, 1); } + + /* Just for completeness's sake... */ + fprintf(stderr, "\nUnknown problem in getchar()\n"); + siglongjmp(sigenv, 1); } if (cp < &ansbuf[sizeof ansbuf - 1]) *cp++ = i; @@ -98,8 +93,5 @@ intrser (int i) { NMH_UNUSED (i); - /* - * should this be siglongjmp? - */ siglongjmp (sigenv, 1); }