diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2006-11-09 21:47:53 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2006-11-09 21:47:53 +0000 |
commit | 00607485a32dc10751be769dd226f96c51d1c587 (patch) | |
tree | 9f120b18761aefd026c9be1ee0d6f40c6a8d57e9 /usr.bin/rcs/rcsutil.c | |
parent | 944dbc8ce0241ebc542b6a5cea01de250904fbf1 (diff) |
Simplify stripping of write bits from file mode.
Add support for reusing the checkin message for multiple files, ala GNU
Fix the message when you abort a checkout and the file was not writable.
OK joris@ niallo@
Diffstat (limited to 'usr.bin/rcs/rcsutil.c')
-rw-r--r-- | usr.bin/rcs/rcsutil.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c index 403b5abad55..98b7c8741f2 100644 --- a/usr.bin/rcs/rcsutil.c +++ b/usr.bin/rcs/rcsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.22 2006/10/12 17:20:12 niallo Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.23 2006/11/09 21:47:52 millert Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -562,24 +562,27 @@ rcs_patchfile(BUF *data, BUF *patch, /* * rcs_yesno() * - * Read from standart input for `y' or `Y' character. - * Returns 0 on success, or -1 on failure. + * Read a char from standard input, returns defc if the + * user enters an equivalent to defc, else whatever char + * was entered. Converts input to lower case. */ int -rcs_yesno(void) +rcs_yesno(int defc) { int c, ret; - ret = 0; - fflush(stderr); fflush(stdout); - if ((c = getchar()) != 'y' && c != 'Y') - ret = -1; + if (isalpha(c = getchar())) + c = tolower(c); + if (c == defc || c == '\n' || (c == EOF && feof(stdin))) + ret = defc; else - while (c != EOF && c != '\n') - c = getchar(); + ret = c; + + while (c != EOF && c != '\n') + c = getchar(); return (ret); } |