This commit is contained in:
Dag-Erling Smørgrav 2003-11-04 12:15:20 +00:00
parent 9df25dda8c
commit e6478125c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122044
4 changed files with 33 additions and 78 deletions

View File

@ -132,7 +132,7 @@ struct s_command *prog;
* Initialise appends.
*/
void
compile()
compile(void)
{
*compile_stream(&prog) = NULL;
fixuplabel(prog, NULL);
@ -153,8 +153,7 @@ compile()
} while (0)
static struct s_command **
compile_stream(link)
struct s_command **link;
compile_stream(struct s_command **link)
{
char *p;
static char lbuf[_POSIX2_LINE_MAX + 1]; /* To save stack */
@ -363,8 +362,7 @@ semicolon: EATSPACE();
* with the processed string.
*/
static char *
compile_delimited(p, d)
char *p, *d;
compile_delimited(char *p, char *d)
{
char c;
@ -404,9 +402,7 @@ compile_delimited(p, d)
/* compile_ccl: expand a POSIX character class */
static char *
compile_ccl(sp, t)
char **sp;
char *t;
compile_ccl(char **sp, char *t)
{
int c, d;
char *s = *sp;
@ -437,9 +433,7 @@ compile_ccl(sp, t)
* Cflags are passed to regcomp.
*/
static char *
compile_re(p, repp)
char *p;
regex_t **repp;
compile_re(char *p, regex_t **repp)
{
int eval;
char re[_POSIX2_LINE_MAX + 1];
@ -465,9 +459,7 @@ compile_re(p, repp)
* expressions.
*/
static char *
compile_subst(p, s)
char *p;
struct s_subst *s;
compile_subst(char *p, struct s_subst *s)
{
static char lbuf[_POSIX2_LINE_MAX + 1];
int asize, size;
@ -554,9 +546,7 @@ compile_subst(p, s)
* Compile the flags of the s command
*/
static char *
compile_flags(p, s)
char *p;
struct s_subst *s;
compile_flags(char *p, struct s_subst *s)
{
int gn; /* True if we have seen g or n */
char wfile[_POSIX2_LINE_MAX + 1], *q;
@ -629,9 +619,7 @@ compile_flags(p, s)
* Compile a translation set of strings into a lookup table.
*/
static char *
compile_tr(p, transtab)
char *p;
char **transtab;
compile_tr(char *p, char **transtab)
{
int i;
char *lt, *op, *np;
@ -669,7 +657,7 @@ compile_tr(p, transtab)
* Compile the text following an a or i command.
*/
static char *
compile_text()
compile_text(void)
{
int asize, esc_nl, size;
char *text, *p, *op, *s;
@ -710,9 +698,7 @@ compile_text()
* it. Fill the structure pointed to according to the address.
*/
static char *
compile_addr(p, a)
char *p;
struct s_addr *a;
compile_addr(char *p, struct s_addr *a)
{
char *end;
@ -747,9 +733,7 @@ compile_addr(p, a)
* Return a copy of all the characters up to \n or \0.
*/
static char *
duptoeol(s, ctype)
char *s;
const char *ctype;
duptoeol(char *s, const char *ctype)
{
size_t len;
int ws;
@ -775,8 +759,7 @@ duptoeol(s, ctype)
* TODO: Remove } nodes
*/
static void
fixuplabel(cp, end)
struct s_command *cp, *end;
fixuplabel(struct s_command *cp, struct s_command *end)
{
for (; cp != end; cp = cp->next)
@ -807,8 +790,7 @@ fixuplabel(cp, end)
* Associate the given command label for later lookup.
*/
static void
enterlabel(cp)
struct s_command *cp;
enterlabel(struct s_command *cp)
{
struct labhash **lhp, *lh;
u_char *p;
@ -834,8 +816,7 @@ enterlabel(cp)
* list cp. L is excluded from the search. Return NULL if not found.
*/
static struct s_command *
findlabel(name)
char *name;
findlabel(char *name)
{
struct labhash *lh;
u_char *p;
@ -857,7 +838,7 @@ findlabel(name)
* table space.
*/
static void
uselabel()
uselabel(void)
{
struct labhash *lh, *next;
int i;

View File

@ -116,9 +116,7 @@ static int inplace_edit(char **);
static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int c, fflag;
char *temp_arg;
@ -183,7 +181,7 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: sed script [-Ean] [-i extension] [file ...]",
@ -196,10 +194,7 @@ usage()
* together. Empty strings and files are ignored.
*/
char *
cu_fgets(buf, n, more)
char *buf;
int n;
int *more;
cu_fgets(char *buf, int n, int *more)
{
static enum {ST_EOF, ST_FILE, ST_STRING} state = ST_EOF;
static FILE *f; /* Current open file */
@ -295,9 +290,7 @@ cu_fgets(buf, n, more)
* Set len to the length of the line.
*/
int
mf_fgets(sp, spflag)
SPACE *sp;
enum e_spflag spflag;
mf_fgets(SPACE *sp, enum e_spflag spflag)
{
size_t len;
char *p;
@ -373,9 +366,7 @@ mf_fgets(sp, spflag)
* Add a compilation unit to the linked list
*/
static void
add_compunit(type, s)
enum e_cut type;
char *s;
add_compunit(enum e_cut type, char *s)
{
struct s_compunit *cu;
@ -392,8 +383,7 @@ add_compunit(type, s)
* Add a file to the linked list
*/
static void
add_file(s)
char *s;
add_file(char *s)
{
struct s_flist *fp;
@ -409,8 +399,7 @@ add_file(s)
* Modify a pointer to a filename for inplace editing and reopen stdout
*/
static int
inplace_edit(filename)
char **filename;
inplace_edit(char **filename)
{
struct stat orig;
char backup[MAXPATHLEN];

View File

@ -59,9 +59,7 @@ static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
* the buffer).
*/
char *
strregerror(errcode, preg)
int errcode;
regex_t *preg;
strregerror(int errcode, regex_t *preg)
{
static char *oe;
size_t s;

View File

@ -89,7 +89,7 @@ regmatch_t *match;
#define OUT(s) { fwrite(s, sizeof(u_char), psl, stdout); putchar('\n'); }
void
process()
process(void)
{
struct s_command *cp;
SPACE tspace;
@ -276,8 +276,7 @@ new: if (!nflag && !pd)
* flag to process ranges. Interprets the non-select (``!'') flag.
*/
static __inline int
applies(cp)
struct s_command *cp;
applies(struct s_command *cp)
{
int r;
@ -318,8 +317,7 @@ applies(cp)
* and then swap them.
*/
static int
substitute(cp)
struct s_command *cp;
substitute(struct s_command *cp)
{
SPACE tspace;
regex_t *re;
@ -430,7 +428,7 @@ substitute(cp)
* therefore it also resets the substitution done (sdone) flag.
*/
static void
flush_appends()
flush_appends(void)
{
FILE *f;
int count, i;
@ -464,8 +462,7 @@ flush_appends()
}
static void
lputs(s)
char *s;
lputs(char *s)
{
int count;
const char *escapes;
@ -514,11 +511,8 @@ lputs(s)
}
static __inline int
regexec_e(preg, string, eflags, nomatch, slen)
regex_t *preg;
const char *string;
int eflags, nomatch;
size_t slen;
regexec_e(regex_t *preg, const char *string, int eflags, int nomatch,
size_t slen)
{
int eval;
@ -549,9 +543,7 @@ regexec_e(preg, string, eflags, nomatch, slen)
* Based on a routine by Henry Spencer
*/
static void
regsub(sp, string, src)
SPACE *sp;
char *string, *src;
regsub(SPACE *sp, char *string, char *src)
{
int len, no;
char c, *dst;
@ -598,11 +590,7 @@ regsub(sp, string, src)
* space as necessary.
*/
void
cspace(sp, p, len, spflag)
SPACE *sp;
const char *p;
size_t len;
enum e_spflag spflag;
cspace(SPACE *sp, const char *p, size_t len, enum e_spflag spflag)
{
size_t tlen;
@ -627,8 +615,7 @@ cspace(sp, p, len, spflag)
* Close all cached opened files and report any errors
*/
void
cfclose(cp, end)
struct s_command *cp, *end;
cfclose(struct s_command *cp, struct s_command *end)
{
for (; cp != end; cp = cp->next)