summaryrefslogtreecommitdiff
path: root/bin/ed/glbl.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-10-12 19:38:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-10-12 19:38:44 +0000
commit3004d6df5e47bc94053bba1328d73a63c7540609 (patch)
tree90207a20f69ff0c810b4ad246af8c06b00e2bd72 /bin/ed/glbl.c
parent5df03423fe6ca2c39244d226c95864e4fe57f417 (diff)
Back out my sprintf -> snprintf changes where they don't make sense and
use good ole strcpy() instead. Also use perror() instead of fprintf() where it makes sense.
Diffstat (limited to 'bin/ed/glbl.c')
-rw-r--r--bin/ed/glbl.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index 3cbebd97758..b92b2ab1a5b 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glbl.c,v 1.3 1996/09/15 22:25:55 millert Exp $ */
+/* $OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
@@ -33,7 +33,7 @@
#if 0
static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: glbl.c,v 1.3 1996/09/15 22:25:55 millert Exp $";
+static char rcsid[] = "$OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $";
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@ build_active_list(isgcmd)
char delimiter;
if ((delimiter = *ibufp) == ' ' || delimiter == '\n') {
- snprintf(errmsg, sizeof(errmsg), "invalid pattern delimiter");
+ strcpy(errmsg, "invalid pattern delimiter");
return ERR;
} else if ((pat = get_compiled_pattern()) == NULL)
return ERR;
@@ -115,15 +115,13 @@ exec_global(interact, gflag)
if (n < 0)
return ERR;
else if (n == 0) {
- snprintf(errmsg, sizeof(errmsg),
- "unexpected end-of-file");
+ strcpy(errmsg, "unexpected end-of-file");
return ERR;
} else if (n == 1 && !strcmp(ibuf, "\n"))
continue;
else if (n == 2 && !strcmp(ibuf, "&\n")) {
if (cmd == NULL) {
- snprintf(errmsg, sizeof(errmsg),
- "no previous command");
+ strcpy(errmsg, "no previous command");
return ERR;
} else cmd = ocmd;
} else if ((cmd = get_extended_line(&n, 0)) == NULL)
@@ -167,8 +165,8 @@ set_active_node(lp)
#endif
if ((ts = (line_t **) realloc(active_list,
(ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
- fprintf(stderr, "%s\n", strerror(errno));
- snprintf(errmsg, sizeof(errmsg), "out of memory");
+ perror(NULL);
+ strcpy(errmsg, "out of memory");
SPL0();
return ERR;
}
@@ -176,8 +174,8 @@ set_active_node(lp)
} else {
if ((ts = (line_t **) malloc((ti += MINBUFSZ) *
sizeof(line_t **))) == NULL) {
- fprintf(stderr, "%s\n", strerror(errno));
- snprintf(errmsg, sizeof(errmsg), "out of memory");
+ perror(NULL);
+ strcpy(errmsg, "out of memory");
SPL0();
return ERR;
}