X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/143a8571be23c8516242ca3919707f012ed255e4..94187a80bd60baab4b9c4b949ad820d730578123:/sbr/read_switch.c diff --git a/sbr/read_switch.c b/sbr/read_switch.c index 4599a41c..8ca0be33 100644 --- a/sbr/read_switch.c +++ b/sbr/read_switch.c @@ -1,6 +1,4 @@ - -/* - * read_switch.c -- prompt the user for an answer from the list +/* read_switch.c -- prompt the user for an answer from the list * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -13,26 +11,26 @@ int read_switch (const char *prompt, const struct swit *ansp) { - register int i; - register char *cp; - register const struct swit *ap; + int i; + char *cp; + const struct swit *ap; char ansbuf[BUFSIZ]; for (;;) { - printf ("%s", prompt); + fputs(prompt, stdout); fflush (stdout); cp = ansbuf; while ((i = getchar ()) != '\n') { if (i == EOF) return 0; if (cp < &ansbuf[sizeof ansbuf - 1]) { - i = (isalpha(i) && isupper(i)) ? tolower(i) : i; + i = tolower(i); *cp++ = i; } } *cp = '\0'; if (ansbuf[0] == '?' || cp == ansbuf) { - printf ("Options are:\n"); + puts("Options are:"); for (ap = ansp; ap->sw; ap++) printf (" %s\n", ap->sw); continue;