Add (unsigned char) cast to ctype functions
Add fpurge(stdin) before prompt - unexpected question. for usr.bin/crontab
This commit is contained in:
parent
3145a29f62
commit
78f35b774e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $ */
|
||||
/* $NetBSD: crontab.c,v 1.23 2004/10/30 17:14:36 dsl Exp $ */
|
||||
|
||||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
|
@ -22,7 +22,7 @@
|
|||
#if 0
|
||||
static char rcsid[] = "Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $");
|
||||
__RCSID("$NetBSD: crontab.c,v 1.23 2004/10/30 17:14:36 dsl Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -494,11 +494,12 @@ edit_cmd() {
|
|||
break;
|
||||
case -1:
|
||||
for (;;) {
|
||||
fpurge(stdin);
|
||||
printf("Do you want to retry the same edit? ");
|
||||
fflush(stdout);
|
||||
q[0] = '\0';
|
||||
(void) fgets(q, sizeof q, stdin);
|
||||
switch (islower(q[0]) ? q[0] : tolower(q[0])) {
|
||||
switch (tolower((unsigned char)q[0])) {
|
||||
case 'y':
|
||||
goto again;
|
||||
case 'n':
|
||||
|
@ -588,7 +589,7 @@ replace_cmd() {
|
|||
fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
|
||||
fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now));
|
||||
fprintf(tmp, "# (Cron version -- %s)\n",
|
||||
"$NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $");
|
||||
"$NetBSD: crontab.c,v 1.23 2004/10/30 17:14:36 dsl Exp $");
|
||||
|
||||
/* copy the crontab to the tmp
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue