SCCS-vsn: usr.bin/sed/compile.c 5.2
-static char sccsid[] = "@(#)compile.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)compile.c 5.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
cmd->u.s = xmalloc(sizeof(struct s_subst));
p = compile_re(p, &cmd->u.s->re, 0);
if (p == NULL)
cmd->u.s = xmalloc(sizeof(struct s_subst));
p = compile_re(p, &cmd->u.s->re, 0);
if (p == NULL)
- err(COMPILE, "newline in substitution pattern");
+ err(COMPILE, "unterminated substitute pattern");
cmd->u.s->pmatch = xmalloc((cmd->u.s->re.re_nsub + 1) *
sizeof(regmatch_t));
p--;
cmd->u.s->pmatch = xmalloc((cmd->u.s->re.re_nsub + 1) *
sizeof(regmatch_t));
p--;
text = xmalloc(asize);
}
} while (cu_fgets(p = lbuf, sizeof(lbuf)));
text = xmalloc(asize);
}
} while (cu_fgets(p = lbuf, sizeof(lbuf)));
- err(COMPILE, "EOF in substitute pattern");
+ err(COMPILE, "unterminated substitute pattern");
switch (*p) {
case 'g':
if (gn)
switch (*p) {
case 'g':
if (gn)
- err(WARNING,
- "both g and number in substitute flags");
+ err(COMPILE,
+"more than one number or 'g' in substitute flags");
case '4': case '5': case '6':
case '7': case '8': case '9':
if (gn)
case '4': case '5': case '6':
case '7': case '8': case '9':
if (gn)
- err(WARNING,
- "both g and number in substitute flags");
+ err(COMPILE,
+"more than one number or 'g' in substitute flags");
gn = 1;
/* XXX Check for overflow */
s->n = (int)strtol(p, &p, 10);
gn = 1;
/* XXX Check for overflow */
s->n = (int)strtol(p, &p, 10);
}
*q = '\0';
if (q == wfile)
}
*q = '\0';
if (q == wfile)
- err(COMPILE, "empty wfile specified");
+ err(COMPILE, "no wfile specified");
s->wfile = strdup(wfile);
if (!aflag && (s->wfd = open(wfile,
O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
s->wfile = strdup(wfile);
if (!aflag && (s->wfd = open(wfile,
O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
return (p);
default:
err(COMPILE,
return (p);
default:
err(COMPILE,
- "bad flag in substitute command: '%c'", p[-1]);
+ "bad flag in substitute command: '%c'", *p);
break;
}
if ((cp2 = findlabel(cp, root)) == NULL)
break;
}
if ((cp2 = findlabel(cp, root)) == NULL)
- err(COMPILE2, "unspecified label %s", cp->t);
+ err(COMPILE2, "undefined label '%s'", cp->t);
free(cp->t);
cp->u.c = cp2;
break;
free(cp->t);
cp->u.c = cp2;
break;