summaryrefslogtreecommitdiffstats
path: root/bin/ed/sub.c
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2001-08-06 22:01:31 +0000
committermike <mike@FreeBSD.org>2001-08-06 22:01:31 +0000
commiteced21209cdad6cf4ff64c6008b71b45a226d905 (patch)
tree0469fc49295a48c1140722bbff569214e2135f58 /bin/ed/sub.c
parente7f429490d285f94132046b59db80b6d1fe253c4 (diff)
downloadFreeBSD-src-eced21209cdad6cf4ff64c6008b71b45a226d905.zip
FreeBSD-src-eced21209cdad6cf4ff64c6008b71b45a226d905.tar.gz
o Correctly define rcsid.
o Add consts where appropriate. o Rename some variables that were shadowing global declarations. o Remove register storage-classes. o Make errmsg a const, so we can just set error messages instead of using sprintf/strcpy. o Set WARNS=2 Reviewed by: bde, des
Diffstat (limited to 'bin/ed/sub.c')
-rw-r--r--bin/ed/sub.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/bin/ed/sub.c b/bin/ed/sub.c
index 3221373..1d53848 100644
--- a/bin/ed/sub.c
+++ b/bin/ed/sub.c
@@ -27,12 +27,8 @@
*/
#ifndef lint
-#if 0
-static char * const rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp";
-#else
-static char * const rcsid =
+static const char rcsid[] =
"$FreeBSD$";
-#endif
#endif /* not lint */
#include "ed.h"
@@ -86,7 +82,8 @@ extract_subst_template()
if (*ibufp == '%' && *(ibufp + 1) == delimiter) {
ibufp++;
- if (!rhbuf) sprintf(errmsg, "no previous substitution");
+ if (!rhbuf)
+ errmsg = "no previous substitution";
return rhbuf;
}
while (*ibufp != delimiter) {
@@ -124,8 +121,8 @@ search_and_replace(pat, gflag, kth)
int kth;
{
undo_t *up;
- char *txt;
- char *eot;
+ const char *txt;
+ const char *eot;
long lc;
long xa = current_addr;
int nsubs = 0;
@@ -163,7 +160,7 @@ search_and_replace(pat, gflag, kth)
}
current_addr = xa;
if (nsubs == 0 && !(gflag & GLB)) {
- sprintf(errmsg, "no match");
+ errmsg = "no match";
return ERR;
} else if ((gflag & (GPR | GLS | GNP)) &&
display_lines(current_addr, current_addr, gflag) < 0)
@@ -222,7 +219,7 @@ substitute_matching_text(pat, lp, gflag, kth)
i = eot - txt;
REALLOC(rbuf, rbufsz, off + i + 2, ERR);
if (i > 0 && !rm[0].rm_eo && (gflag & GSG)) {
- sprintf(errmsg, "infinite substitution loop");
+ errmsg = "infinite substitution loop";
return ERR;
}
if (isbinary)
@@ -238,7 +235,7 @@ substitute_matching_text(pat, lp, gflag, kth)
return offset to end of modified text */
int
apply_subst_template(boln, rm, off, re_nsub)
- char *boln;
+ const char *boln;
regmatch_t *rm;
int off;
int re_nsub;
OpenPOWER on IntegriCloud