diff --git a/gnu/usr.bin/patch/Makefile b/gnu/usr.bin/patch/Makefile index 4d5fad2d6afd..d16f62854b3c 100644 --- a/gnu/usr.bin/patch/Makefile +++ b/gnu/usr.bin/patch/Makefile @@ -1,6 +1,6 @@ PROG= patch SRCS = backupfile.c getopt.c getopt1.c inp.c patch.c pch.c util.c \ version.c -CFLAGS += -DHAVE_CONFIG_H +CFLAGS += -DHAVE_CONFIG_H -Wall MAN= patch.1 .include diff --git a/gnu/usr.bin/patch/inp.c b/gnu/usr.bin/patch/inp.c index e8e1531776df..7b786519044e 100644 --- a/gnu/usr.bin/patch/inp.c +++ b/gnu/usr.bin/patch/inp.c @@ -1,6 +1,9 @@ -/* $Header: /home/ncvs/src/gnu/usr.bin/patch/inp.c,v 1.2 1995/01/12 22:09:39 hsu Exp $ +/* $Header: /usr/cvs/src/gnu/usr.bin/patch/inp.c,v 1.3 1995/05/30 05:02:31 rgrimes Exp $ * * $Log: inp.c,v $ + * Revision 1.3 1995/05/30 05:02:31 rgrimes + * Remove trailing whitespace. + * * Revision 1.2 1995/01/12 22:09:39 hsu * Fix bug that created new files even when running in -C check mode. * Reviewed by: phk @@ -240,7 +243,7 @@ char *filename; "this file doesn't appear to be the %s version--aborting.\n", revision); } else { - ask2( + (void) ask2( "This file doesn't appear to be the %s version--patch anyway? [n] ", revision); if (*buf != 'y') @@ -289,7 +292,7 @@ char *filename; "this file doesn't appear to be the %s version--aborting.\n", revision); } else { - ask2( + (void) ask2( "This file doesn't appear to be the %s version--patch anyway? [n] ", revision); if (*buf != 'y') diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c index b03d065af555..2329ec8fb4a9 100644 --- a/gnu/usr.bin/patch/patch.c +++ b/gnu/usr.bin/patch/patch.c @@ -1,5 +1,5 @@ char rcsid[] = - "$Header: /home/ncvs/src/gnu/usr.bin/patch/patch.c,v 1.5 1995/01/12 22:09:40 hsu Exp $"; + "$Header: /usr/cvs/src/gnu/usr.bin/patch/patch.c,v 1.6 1995/05/30 05:02:34 rgrimes Exp $"; /* patch - a program to apply diffs to original files * @@ -9,6 +9,9 @@ char rcsid[] = * money off of it, or pretend that you wrote it. * * $Log: patch.c,v $ + * Revision 1.6 1995/05/30 05:02:34 rgrimes + * Remove trailing whitespace. + * * Revision 1.5 1995/01/12 22:09:40 hsu * Fix bug that created new files even when running in -C check mode. * Reviewed by: phk @@ -296,12 +299,12 @@ char **argv; reverse ? "Assuming" : "Ignoring"); } else { - ask3( + (void) ask3( "%seversed (or previously applied) patch detected! %s -R? [y] ", reverse ? "R" : "Unr", reverse ? "Assume" : "Ignore"); if (*buf == 'n') { - ask1("Apply anyway? [n] "); + (void) ask1("Apply anyway? [n] "); if (*buf == 'y') rev_okayed = TRUE; else diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c index eb0c54a49097..c976838fe51c 100644 --- a/gnu/usr.bin/patch/pch.c +++ b/gnu/usr.bin/patch/pch.c @@ -1,6 +1,10 @@ -/* $Header: /home/ncvs/src/gnu/usr.bin/patch/pch.c,v 1.7 1996/04/11 10:13:40 markm Exp $ +/* $Header: /usr/cvs/src/gnu/usr.bin/patch/pch.c,v 1.8 1996/04/12 11:37:32 markm Exp $ * * $Log: pch.c,v $ + * Revision 1.8 1996/04/12 11:37:32 markm + * Attempt to break a $Log$ snafu where a *** /--- (minus space) + * was fouling up a comment in the checked-out code. + * * Revision 1.7 1996/04/11 10:13:40 markm * Priorities were broken. If there was an Index: line and *** /--- lines * with valid names, the *** /---names were taken first. @@ -219,7 +223,7 @@ there_is_another_patch() skip_rest_of_patch = TRUE; return TRUE; } - ask1("File to patch: "); + (void) ask1("File to patch: "); if (*buf != '\n') { if (bestguess) free(bestguess); @@ -227,9 +231,10 @@ there_is_another_patch() filearg[0] = fetchname(buf, 0, FALSE); } if (filearg[0] == Nullch) { - ask1("No file found--skip this patch? [n] "); - if (*buf != 'y') { - continue; + if (ask1("No file found--skip this patch? [n] ")) { + if (*buf != 'y') { + continue; + } } if (verbose) say1("Skipping patch...\n"); diff --git a/gnu/usr.bin/patch/util.c b/gnu/usr.bin/patch/util.c index 56ce12e1be90..6c00880c658b 100644 --- a/gnu/usr.bin/patch/util.c +++ b/gnu/usr.bin/patch/util.c @@ -227,7 +227,7 @@ long arg1,arg2,arg3; /* Get a response from the user, somehow or other. */ -void +int ask(pat,arg1,arg2,arg3) char *pat; long arg1,arg2,arg3; @@ -260,7 +260,9 @@ long arg1,arg2,arg3; } else { /* no terminal at all--default it */ buf[0] = '\n'; - r = 1; + buf[1] = 0; + say1(buf); + return 0; /* signal possible error */ } if (r <= 0) buf[0] = 0; @@ -268,6 +270,11 @@ long arg1,arg2,arg3; buf[r] = '\0'; if (!tty2) say1(buf); + + if (r <= 0) + return 0; /* if there was an error, return it */ + else + return 1; } #endif /* lint */ diff --git a/gnu/usr.bin/patch/util.h b/gnu/usr.bin/patch/util.h index c56b4c304004..4260928a1bb2 100644 --- a/gnu/usr.bin/patch/util.h +++ b/gnu/usr.bin/patch/util.h @@ -1,6 +1,9 @@ -/* $Header: /home/ncvs/src/gnu/usr.bin/patch/util.h,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $ +/* $Header: /usr/cvs/src/gnu/usr.bin/patch/util.h,v 1.2 1995/05/30 05:02:38 rgrimes Exp $ * * $Log: util.h,v $ + * Revision 1.2 1995/05/30 05:02:38 rgrimes + * Remove trailing whitespace. + * * Revision 1.1.1.1 1993/06/19 14:21:52 paul * b-maked patch-2.10 * @@ -83,7 +86,7 @@ void copy_file(); void say(); void fatal(); void pfatal(); -void ask(); +int ask(); char *savestr(); void set_signals(); void ignore_signals();