summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/patch/util.c
diff options
context:
space:
mode:
authorJohn-Mark Gurney <jmg@FreeBSD.org>1997-03-17 22:32:29 +0000
committerJohn-Mark Gurney <jmg@FreeBSD.org>1997-03-17 22:32:29 +0000
commit4937b79d098318d18bd4fc881b87c3ecf5b29f11 (patch)
tree68f938d6e73e6d54bcb3a5c1d979aaecb07c13b7 /gnu/usr.bin/patch/util.c
parentc0eea35fcb69f9aa3ef813824c730cdb9d9deda9 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin/patch/util.c')
-rw-r--r--gnu/usr.bin/patch/util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gnu/usr.bin/patch/util.c b/gnu/usr.bin/patch/util.c
index 56ce12e1be90..6ab6ecf21fec 100644
--- a/gnu/usr.bin/patch/util.c
+++ b/gnu/usr.bin/patch/util.c
@@ -169,7 +169,7 @@ Reg1 char *s;
}
else {
t = rv;
- while (*t++ = *s++);
+ while ((*t++ = *s++));
}
return rv;
}
@@ -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 */
@@ -410,7 +417,7 @@ int assume_exists;
#define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0)
if ( try("RCS/%s%s", filebase, RCSSUFFIX)
- || try("RCS/%s" , filebase, 0)
+ || try("RCS/%s%s", filebase, "")
|| try( "%s%s", filebase, RCSSUFFIX)
|| try("SCCS/%s%s", SCCSPREFIX, filebase)
|| try( "%s%s", SCCSPREFIX, filebase))