From db6e9b0f817fc362dc74d8b4273dfb5eb5a65a12 Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 11 Aug 1997 07:21:08 +0000 Subject: [PATCH] Remove local redefinition for err(). Add usage(). --- usr.bin/sed/compile.c | 133 +++++++++++++++++++++++------------------- usr.bin/sed/defs.h | 9 --- usr.bin/sed/extern.h | 1 - usr.bin/sed/main.c | 34 +++++++---- usr.bin/sed/misc.c | 49 +++------------- usr.bin/sed/process.c | 38 ++++++------ usr.bin/sed/sed.1 | 26 ++++----- 7 files changed, 135 insertions(+), 155 deletions(-) diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index 91bf843f5dcb..04bac84d21c4 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -36,14 +36,18 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include #include #include -#include +#include #include #include #include @@ -158,7 +162,8 @@ compile_stream(link) for (;;) { if ((p = cu_fgets(lbuf, sizeof(lbuf))) == NULL) { if (stack != 0) - err(COMPILE, "unexpected EOF (pending }'s)"); + errx(1, "%lu: %s: unexpected EOF (pending }'s)", + linenum, fname); return (link); } @@ -192,16 +197,17 @@ semicolon: EATSPACE(); nonsel: /* Now parse the command */ if (!*p) - err(COMPILE, "command expected"); + errx(1, "%lu: %s: command expected", linenum, fname); cmd->code = *p; for (fp = cmd_fmts; fp->code; fp++) if (fp->code == *p) break; if (!fp->code) - err(COMPILE, "invalid command code %c", *p); + errx(1, "%lu: %s: invalid command code %c", linenum, fname, *p); if (naddr > fp->naddr) - err(COMPILE, -"command %c expects up to %d address(es), found %d", *p, fp->naddr, naddr); + errx(1, + "%lu: %s: command %c expects up to %d address(es), found %d", + linenum, fname, *p, fp->naddr, naddr); switch (fp->args) { case NONSEL: /* ! */ p++; @@ -224,7 +230,7 @@ semicolon: EATSPACE(); */ cmd->nonsel = 1; if (stack == 0) - err(COMPILE, "unexpected }"); + errx(1, "%lu: %s: unexpected }", linenum, fname); cmd2 = stack; stack = cmd2->next; cmd2->next = cmd; @@ -238,20 +244,21 @@ semicolon: EATSPACE(); goto semicolon; } if (*p) - err(COMPILE, -"extra characters at the end of %c command", cmd->code); + errx(1, "%lu: %s: extra characters at the end of %c command", + linenum, fname, cmd->code); break; case TEXT: /* a c i */ p++; EATSPACE(); if (*p != '\\') - err(COMPILE, -"command %c expects \\ followed by text", cmd->code); + errx(1, +"%lu: %s: command %c expects \\ followed by text", linenum, fname, cmd->code); p++; EATSPACE(); if (*p) - err(COMPILE, -"extra characters after \\ at the end of %c command", cmd->code); + errx(1, + "%lu: %s: extra characters after \\ at the end of %c command", + linenum, fname, cmd->code); cmd->t = compile_text(); break; case COMMENT: /* \0 # */ @@ -260,20 +267,20 @@ semicolon: EATSPACE(); p++; EATSPACE(); if (*p == '\0') - err(COMPILE, "filename expected"); + errx(1, "%lu: %s: filename expected", linenum, fname); cmd->t = duptoeol(p, "w command"); if (aflag) cmd->u.fd = -1; else if ((cmd->u.fd = open(p, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(FATAL, "%s: %s\n", p, strerror(errno)); + err(1, "%s", p); break; case RFILE: /* r */ p++; EATSPACE(); if (*p == '\0') - err(COMPILE, "filename expected"); + errx(1, "%lu: %s: filename expected", linenum, fname); else cmd->t = duptoeol(p, "read command"); break; @@ -290,18 +297,20 @@ semicolon: EATSPACE(); EATSPACE(); cmd->t = duptoeol(p, "label"); if (strlen(p) == 0) - err(COMPILE, "empty label"); + errx(1, "%lu: %s: empty label", linenum, fname); enterlabel(cmd); break; case SUBST: /* s */ p++; if (*p == '\0' || *p == '\\') - err(COMPILE, -"substitute pattern can not be delimited by newline or backslash"); + errx(1, +"%lu: %s: substitute pattern can not be delimited by newline or backslash", + linenum, fname); cmd->u.s = xmalloc(sizeof(struct s_subst)); p = compile_re(p, &cmd->u.s->re); if (p == NULL) - err(COMPILE, "unterminated substitute pattern"); + errx(1, + "%lu: %s: unterminated substitute pattern", linenum, fname); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); @@ -322,8 +331,8 @@ semicolon: EATSPACE(); goto semicolon; } if (*p) - err(COMPILE, -"extra text at the end of a transform command"); + errx(1, +"%lu: %s: extra text at the end of a transform command", linenum, fname); break; } } @@ -348,13 +357,15 @@ compile_delimited(p, d) if (c == '\0') return (NULL); else if (c == '\\') - err(COMPILE, "\\ can not be used as a string delimiter"); + errx(1, "%lu: %s: \\ can not be used as a string delimiter", + linenum, fname); else if (c == '\n') - err(COMPILE, "newline can not be used as a string delimiter"); + errx(1, "%lu: %s: newline can not be used as a string delimiter", + linenum, fname); while (*p) { if (*p == '[') { if ((d = compile_ccl(&p, d)) == NULL) - err(COMPILE, "unbalanced brackets ([])"); + errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname); continue; } else if (*p == '\\' && p[1] == '[') { *d++ = *p++; @@ -425,7 +436,8 @@ compile_re(p, repp) } *repp = xmalloc(sizeof(regex_t)); if (p && (eval = regcomp(*repp, re, 0)) != 0) - err(COMPILE, "RE error: %s", strregerror(eval, *repp)); + errx(1, "%lu: %s: RE error: %s", + linenum, fname, strregerror(eval, *repp)); if (maxnsub < (*repp)->re_nsub) maxnsub = (*repp)->re_nsub; return (p); @@ -464,8 +476,8 @@ compile_subst(p, s) ref = *p - '0'; if (s->re != NULL && ref > s->re->re_nsub) - err(COMPILE, -"\\%c not defined in the RE", *p); + errx(1, "%lu: %s: \\%c not defined in the RE", + linenum, fname, *p); if (s->maxbref < ref) s->maxbref = ref; } else if (*p == '&' || *p == '\\') @@ -477,8 +489,8 @@ compile_subst(p, s) s->new = xrealloc(text, size); return (p); } else if (*p == '\n') { - err(COMPILE, -"unescaped newline inside substitute pattern"); + errx(1, +"%lu: %s: unescaped newline inside substitute pattern", linenum, fname); /* NOTREACHED */ } *sp++ = *p; @@ -489,7 +501,8 @@ compile_subst(p, s) text = xmalloc(asize); } } while (cu_fgets(p = lbuf, sizeof(lbuf))); - err(COMPILE, "unterminated substitute in regular expression"); + errx(1, "%lu: %s: unterminated substitute in regular expression", + linenum, fname); /* NOTREACHED */ } @@ -513,8 +526,8 @@ compile_flags(p, s) switch (*p) { case 'g': if (gn) - err(COMPILE, -"more than one number or 'g' in substitute flags"); + errx(1, +"%lu: %s: more than one number or 'g' in substitute flags", linenum, fname); gn = 1; s->n = 0; break; @@ -529,8 +542,8 @@ compile_flags(p, s) case '4': case '5': case '6': case '7': case '8': case '9': if (gn) - err(COMPILE, -"more than one number or 'g' in substitute flags"); + errx(1, +"%lu: %s: more than one number or 'g' in substitute flags", linenum, fname); gn = 1; /* XXX Check for overflow */ s->n = (int)strtol(p, &p, 10); @@ -539,7 +552,7 @@ compile_flags(p, s) p++; #ifdef HISTORIC_PRACTICE if (*p != ' ') { - err(WARNING, "space missing before w wfile"); + warnx("%lu: %s: space missing before w wfile", linenum, fname); return (p); } #endif @@ -552,16 +565,16 @@ compile_flags(p, s) } *q = '\0'; if (q == wfile) - err(COMPILE, "no wfile specified"); + errx(1, "%lu: %s: no wfile specified", linenum, fname); s->wfile = strdup(wfile); if (!aflag && (s->wfd = open(wfile, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(FATAL, "%s: %s\n", wfile, strerror(errno)); + err(1, "%s", wfile); return (p); default: - err(COMPILE, - "bad flag in substitute command: '%c'", *p); + errx(1, "%lu: %s: bad flag in substitute command: '%c'", + linenum, fname, *p); break; } p++; @@ -582,23 +595,21 @@ compile_tr(p, transtab) char new[_POSIX2_LINE_MAX + 1]; if (*p == '\0' || *p == '\\') - err(COMPILE, -"transform pattern can not be delimited by newline or backslash"); + errx(1, + "%lu: %s: transform pattern can not be delimited by newline or backslash", + linenum, fname); p = compile_delimited(p, old); - if (p == NULL) { - err(COMPILE, "unterminated transform source string"); - return (NULL); - } + if (p == NULL) + errx(1, "%lu: %s: unterminated transform source string", + linenum, fname); p = compile_delimited(--p, new); - if (p == NULL) { - err(COMPILE, "unterminated transform target string"); - return (NULL); - } + if (p == NULL) + errx(1, "%lu: %s: unterminated transform target string", + linenum, fname); EATSPACE(); - if (strlen(new) != strlen(old)) { - err(COMPILE, "transform strings are not the same length"); - return (NULL); - } + if (strlen(new) != strlen(old)) + errx(1, "%lu: %s: transform strings are not the same length", + linenum, fname); /* We assume characters are 8 bits */ lt = xmalloc(UCHAR_MAX); for (i = 0; i <= UCHAR_MAX; i++) @@ -662,7 +673,7 @@ compile_addr(p, a) case '/': /* Context address */ p = compile_re(p, &a->u.r); if (p == NULL) - err(COMPILE, "unterminated regular expression"); + errx(1, "%lu: %s: unterminated regular expression", linenum, fname); a->type = AT_RE; return (p); @@ -676,7 +687,7 @@ compile_addr(p, a) a->u.l = strtol(p, &end, 10); return (end); default: - err(COMPILE, "expected context address"); + errx(1, "%lu: %s: expected context address", linenum, fname); return (NULL); } } @@ -699,7 +710,7 @@ duptoeol(s, ctype) ws = isspace((unsigned char)*s); *s = '\0'; if (ws) - err(WARNING, "whitespace after %s", ctype); + warnx("%lu: %s: whitespace after %s", linenum, fname, ctype); len = s - start + 1; return (memmove(xmalloc(len), start, len)); } @@ -730,7 +741,7 @@ fixuplabel(cp, end) break; } if ((cp->u.c = findlabel(cp->t)) == NULL) - err(COMPILE2, "undefined label '%s'", cp->t); + errx(1, "%lu: %s: undefined label '%s'", linenum, fname, cp->t); free(cp->t); break; case '{': @@ -756,7 +767,7 @@ enterlabel(cp) lhp = &labels[h & LHMASK]; for (lh = *lhp; lh != NULL; lh = lh->lh_next) if (lh->lh_hash == h && strcmp(cp->t, lh->lh_cmd->t) == 0) - err(COMPILE2, "duplicate label '%s'", cp->t); + errx(1, "%lu: %s: duplicate label '%s'", linenum, fname, cp->t); lh = xmalloc(sizeof *lh); lh->lh_next = *lhp; lh->lh_hash = h; @@ -802,8 +813,8 @@ uselabel() for (lh = labels[i]; lh != NULL; lh = next) { next = lh->lh_next; if (!lh->lh_ref) - err(WARNING, "unused label '%s'", - lh->lh_cmd->t); + warnx("%lu: %s: unused label '%s'", + linenum, fname, lh->lh_cmd->t); free(lh); } } diff --git a/usr.bin/sed/defs.h b/usr.bin/sed/defs.h index 6e78e910f34c..0e77014fcf8c 100644 --- a/usr.bin/sed/defs.h +++ b/usr.bin/sed/defs.h @@ -134,12 +134,3 @@ typedef struct { char *back; /* Backing memory. */ size_t blen; /* Backing memory length. */ } SPACE; - -/* - * Error severity codes: - */ -#define FATAL 0 /* Exit immediately with 1 */ -#define ERROR 1 /* Continue, but change exit value */ -#define WARNING 2 /* Just print the warning */ -#define COMPILE 3 /* Print error, count and finish script */ -#define COMPILE2 3 /* Print error, count and finish script */ diff --git a/usr.bin/sed/extern.h b/usr.bin/sed/extern.h index 54f2fb5e5527..a80f7c94dbce 100644 --- a/usr.bin/sed/extern.h +++ b/usr.bin/sed/extern.h @@ -51,7 +51,6 @@ void cfclose __P((struct s_command *, struct s_command *)); void compile __P((void)); void cspace __P((SPACE *, char *, size_t, enum e_spflag)); char *cu_fgets __P((char *, int)); -void err __P((int, const char *, ...)); int mf_fgets __P((SPACE *, enum e_spflag)); void process __P((void)); char *strregerror __P((int, regex_t *)); diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 02cbfacdc9e1..6e1ef35c6916 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -36,17 +36,22 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include +#include #include #include #include @@ -101,6 +106,7 @@ int lastline; /* TRUE on the last line of the last file */ static void add_compunit __P((enum e_cut, char *)); static void add_file __P((char *)); +static void usage __P((void)); int main(argc, argv) @@ -130,9 +136,7 @@ main(argc, argv) break; default: case '?': - (void)fprintf(stderr, -"usage:\tsed script [-an] [file ...]\n\tsed [-an] [-e script] ... [-f script_file] ... [file ...]\n"); - exit(1); + usage(); } argc -= optind; argv += optind; @@ -154,10 +158,19 @@ main(argc, argv) process(); cfclose(prog, NULL); if (fclose(stdout)) - err(FATAL, "stdout: %s", strerror(errno)); + err(1, "stdout"); exit (0); } +static void +usage() +{ + (void)fprintf(stderr, "%s\n%s\n", + "usage: sed script [-an] [file ...]", + " sed [-an] [-e script] ... [-f script_file] ... [file ...]"); + exit(1); +} + /* * Like fgets, but go through the chain of compilation units chaining them * together. Empty strings and files are ignored. @@ -182,8 +195,7 @@ cu_fgets(buf, n) switch (script->type) { case CU_FILE: if ((f = fopen(script->s, "r")) == NULL) - err(FATAL, - "%s: %s", script->s, strerror(errno)); + err(1, "%s", script->s); fname = script->s; state = ST_FILE; goto again; @@ -243,6 +255,7 @@ cu_fgets(buf, n) } } /* NOTREACHED */ + return (NULL); } /* @@ -272,8 +285,7 @@ mf_fgets(sp, spflag) } else { fname = files->fname; if ((f = fopen(fname, "r")) == NULL) - err(FATAL, "%s: %s", - fname, strerror(errno)); + err(1, "%s", fname); } if ((c = getc(f)) != EOF) { (void)ungetc(c, f); @@ -295,7 +307,7 @@ mf_fgets(sp, spflag) */ p = fgetln(f, &len); if (ferror(f)) - err(FATAL, "%s: %s", fname, strerror(errno ? errno : EIO)); + errx(1, "%s: %s", fname, strerror(errno ? errno : EIO)); cspace(sp, p, len, spflag); linenum++; @@ -313,7 +325,7 @@ mf_fgets(sp, spflag) } else { fname = files->fname; if ((f = fopen(fname, "r")) == NULL) - err(FATAL, "%s: %s", fname, strerror(errno)); + err(1, "%s", fname); } } (void)ungetc(c, f); diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c index 444b7a8b8131..237f67a3f50c 100644 --- a/usr.bin/sed/misc.c +++ b/usr.bin/sed/misc.c @@ -36,12 +36,16 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include +#include #include #include #include @@ -60,7 +64,7 @@ xmalloc(size) void *p; if ((p = malloc(size)) == NULL) - err(FATAL, "%s", strerror(errno)); + err(1, "malloc"); return (p); } @@ -76,7 +80,7 @@ xrealloc(p, size) return (xmalloc(size)); if ((p = realloc(p, size)) == NULL) - err(FATAL, "%s", strerror(errno)); + err(1, "realloc"); return (p); } @@ -100,42 +104,3 @@ strregerror(errcode, preg) (void)regerror(errcode, preg, oe, s); return (oe); } - -#if __STDC__ -#include -#else -#include -#endif -/* - * Error reporting function - */ -void -#if __STDC__ -err(int severity, const char *fmt, ...) -#else -err(severity, fmt, va_alist) - int severity; - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "sed: "); - switch (severity) { - case WARNING: - case COMPILE: - (void)fprintf(stderr, "%lu: %s: ", linenum, fname); - } - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - if (severity == WARNING) - return; - exit(1); - /* NOTREACHED */ -} diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 3b0828c913ec..dbe7e8b73d43 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -36,7 +36,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -45,6 +49,7 @@ static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; #include #include +#include #include #include #include @@ -220,11 +225,9 @@ process() if (cp->u.fd == -1 && (cp->u.fd = open(cp->t, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(FATAL, "%s: %s\n", - cp->t, strerror(errno)); + err(1, "%s", cp->t); if (write(cp->u.fd, ps, psl) != psl) - err(FATAL, "%s: %s\n", - cp->t, strerror(errno)); + err(1, "%s", cp->t); break; case 'x': if (hs == NULL) @@ -323,8 +326,8 @@ substitute(cp) if (re == NULL) { if (defpreg != NULL && cp->u.s->maxbref > defpreg->re_nsub) { linenum = cp->u.s->linenum; - err(COMPILE, "\\%d not defined in the RE", - cp->u.s->maxbref); + errx(1, "%lu: %s: \\%d not defined in the RE", + linenum, fname, cp->u.s->maxbref); } } if (!regexec_e(re, s, 0, 0, psl)) @@ -407,9 +410,9 @@ substitute(cp) if (cp->u.s->wfile && !pd) { if (cp->u.s->wfd == -1 && (cp->u.s->wfd = open(cp->u.s->wfile, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(FATAL, "%s: %s\n", cp->u.s->wfile, strerror(errno)); + err(1, "%s", cp->u.s->wfile); if (write(cp->u.s->wfd, ps, psl) != psl) - err(FATAL, "%s: %s\n", cp->u.s->wfile, strerror(errno)); + err(1, "%s", cp->u.s->wfile); } return (1); } @@ -442,13 +445,13 @@ flush_appends() */ if ((f = fopen(appends[i].s, "r")) == NULL) break; - while (count = fread(buf, sizeof(char), sizeof(buf), f)) + while ((count = fread(buf, sizeof(char), sizeof(buf), f))) (void)fwrite(buf, sizeof(char), count, stdout); (void)fclose(f); break; } if (ferror(stdout)) - err(FATAL, "stdout: %s", strerror(errno ? errno : EIO)); + errx(1, "stdout: %s", strerror(errno ? errno : EIO)); appendx = sdone = 0; } @@ -462,7 +465,7 @@ lputs(s) static int termwidth = -1; if (termwidth == -1) - if (p = getenv("COLUMNS")) + if ((p = getenv("COLUMNS"))) termwidth = atoi(p); else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 && win.ws_col > 0) @@ -481,7 +484,7 @@ lputs(s) } else { escapes = "\\\a\b\f\n\r\t\v"; (void)putchar('\\'); - if (p = strchr(escapes, *s)) { + if ((p = strchr(escapes, *s))) { (void)putchar("\\abfnrtv"[p - escapes]); count += 2; } else { @@ -493,7 +496,7 @@ lputs(s) (void)putchar('$'); (void)putchar('\n'); if (ferror(stdout)) - err(FATAL, "stdout: %s", strerror(errno ? errno : EIO)); + errx(1, "stdout: %s", strerror(errno ? errno : EIO)); } static inline int @@ -507,7 +510,7 @@ regexec_e(preg, string, eflags, nomatch, slen) if (preg == NULL) { if (defpreg == NULL) - err(FATAL, "first RE may not be empty"); + errx(1, "first RE may not be empty"); } else defpreg = preg; @@ -525,7 +528,7 @@ regexec_e(preg, string, eflags, nomatch, slen) case REG_NOMATCH: return (0); } - err(FATAL, "RE error: %s", strregerror(eval, defpreg)); + errx(1, "RE error: %s", strregerror(eval, defpreg)); /* NOTREACHED */ } @@ -615,13 +618,12 @@ cfclose(cp, end) switch(cp->code) { case 's': if (cp->u.s->wfd != -1 && close(cp->u.s->wfd)) - err(FATAL, - "%s: %s", cp->u.s->wfile, strerror(errno)); + err(1, "%s", cp->u.s->wfile); cp->u.s->wfd = -1; break; case 'w': if (cp->u.fd != -1 && close(cp->u.fd)) - err(FATAL, "%s: %s", cp->t, strerror(errno)); + err(1, "%s", cp->t); cp->u.fd = -1; break; case '{': diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1 index a28efdbed480..ee1ae4e482a0 100644 --- a/usr.bin/sed/sed.1 +++ b/usr.bin/sed/sed.1 @@ -52,7 +52,7 @@ .Op Ar file ... .Sh DESCRIPTION The -.Nm sed +.Nm utility reads the specified files, or the standard input if no files are specified, modifying the input as specified by a list of commands. The input is then written to the standard output. @@ -77,7 +77,7 @@ by default. The .Fl a option causes -.Nm sed +.Nm to delay opening each file until a command containing the related .Dq w function is applied to a line of input. @@ -100,7 +100,7 @@ option suppresses this behavior. .El .Pp The form of a -.Nm sed +.Nm command is as follows: .sp .Dl [address[,address]]function[arguments] @@ -109,7 +109,7 @@ Whitespace may be inserted before the first address and the function portions of the command. .Pp Normally, -.Nm sed +.Nm cyclically copies a line of input, not including its terminating newline character, into a .Em "pattern space" , @@ -145,7 +145,7 @@ pattern space that matches the second. (If the second address is a number less than or equal to the line number first selected, only that line is selected.) Starting at the first line following the selected range, -.Nm sed +.Nm starts looking again for the first address. .Pp Editing commands can be applied to non-selected pattern spaces by use @@ -156,12 +156,12 @@ of the exclamation character function. .Sh "Sed Regular Expressions" The -.Nm sed +.Nm regular expressions are basic regular expressions (BRE's, see .Xr regex 3 for more information). In addition, -.Nm sed +.Nm has the following two additions to BRE's: .sp .Bl -enum -compact @@ -189,7 +189,7 @@ in the substitute command. .El .Pp One special feature of -.Nm sed +.Nm regular expressions is that they can default to the last regular expression used. If a regular expression is empty, i.e. just the delimiter characters @@ -222,7 +222,7 @@ and functions take an optional file parameter, which should be separated from the function letter by white space. Each file given as an argument to -.Nm sed +.Nm is created (or its contents truncated) before any input processing begins. .Pp The @@ -241,7 +241,7 @@ the function letters by white space characters. .Pp Two of the functions take a function-list. This is a list of -.Nm sed +.Nm functions separated by newlines, as follows: .Bd -literal -offset indent { function @@ -493,7 +493,7 @@ option on the command line. .El .Pp The -.Nm sed +.Nm utility exits 0 on success and >0 if an error occurs. .Sh SEE ALSO .Xr awk 1 , @@ -503,12 +503,12 @@ utility exits 0 on success and >0 if an error occurs. .Xr re_format 7 .Sh HISTORY A -.Nm sed +.Nm command appeared in .At v7 . .Sh STANDARDS The -.Nm sed +.Nm function is expected to be a superset of the .St -p1003.2 specification.