summaryrefslogtreecommitdiff
path: root/usr.bin/mg/search.c
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2005-08-09 00:53:49 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2005-08-09 00:53:49 +0000
commit4eb0925bb60444898b6f1128f225265056cba493 (patch)
tree3ec53231b1f94ee702addb34b93c61049c48d3d8 /usr.bin/mg/search.c
parent00ce1e5a9f30584652a80b25b75ae622e9f4acdb (diff)
Clean up eread handling in mg. (basically, fallout from the 'enter often
means abort' behaviour added during the hackathon). Eliminates redundant ereply function, fixes miscellaneous cores when aborting, and move a number of assumed pathnames into the prompt text, since they are used there anyway. All changes consistent with emacs behavior ok beck@ many, many moons ago.
Diffstat (limited to 'usr.bin/mg/search.c')
-rw-r--r--usr.bin/mg/search.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c
index 709a0a5262a..437874a78da 100644
--- a/usr.bin/mg/search.c
+++ b/usr.bin/mg/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.21 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: search.c,v 1.22 2005/08/09 00:53:48 kjell Exp $ */
/* This file is in the public domain. */
@@ -777,7 +777,7 @@ readpattern(char *prompt)
int retval;
if (pat[0] == '\0')
- rep = ereply("%s: ", tpat, NPAT, prompt);
+ rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, prompt);
else
rep = eread("%s: (default %s) ", tpat, NPAT,
EFNUL | EFNEW | EFCR, prompt, pat);
@@ -785,8 +785,8 @@ readpattern(char *prompt)
/* specified */
if (rep == NULL) {
retval = ABORT;
- } else if (*rep != '\0') {
- (void) strlcpy(pat, tpat, sizeof(pat));
+ } else if (rep[0] != '\0') {
+ (void)strlcpy(pat, tpat, sizeof(pat));
retval = TRUE;
} else if (pat[0] != '\0') {
retval = TRUE;