=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdist/gram.y,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/rdist/gram.y 2003/05/06 22:10:11 1.6 --- src/usr.bin/rdist/gram.y 2003/05/14 01:34:35 1.7 *************** *** 1,5 **** %{ ! /* $OpenBSD: gram.y,v 1.6 2003/05/06 22:10:11 millert Exp $ */ /* * Copyright (c) 1993 Michael A. Cooper --- 1,5 ---- %{ ! /* $OpenBSD: gram.y,v 1.7 2003/05/14 01:34:35 millert Exp $ */ /* * Copyright (c) 1993 Michael A. Cooper *************** *** 35,66 **** * SUCH DAMAGE. */ #ifndef lint #if 0 ! static char RCSid[] = ! "$From: gram.y,v 6.29 1994/04/11 23:59:15 mcooper Exp mcooper $"; #else ! static char RCSid[] = ! "$OpenBSD: gram.y,v 1.6 2003/05/06 22:10:11 millert Exp $"; #endif ! static char *sccsid = "@(#)gram.y 5.2 (Berkeley) 85/06/21"; ! static char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ - /* - * Tell defs.h not to include y.tab.h - */ - #ifndef yacc - #define yacc - #endif ! #include "defs.h" - static struct namelist *addnl(), *subnl(), *andnl(); struct cmd *cmds = NULL; struct cmd *last_cmd; struct namelist *last_n; --- 35,65 ---- * SUCH DAMAGE. */ + #include "defs.h" + #ifndef lint #if 0 ! static char RCSid[] __attribute__((__unused__)) = ! "$From: gram.y,v 1.3 1999/08/04 15:57:33 christos Exp $"; #else ! static char RCSid[] __attribute__((__unused__)) = ! "$OpenBSD: gram.y,v 1.7 2003/05/14 01:34:35 millert Exp $"; #endif ! static char *sccsid __attribute__((__unused__)) = ! "@(#)gram.y 5.2 (Berkeley) 85/06/21"; ! static char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ ! static struct namelist *addnl __P((struct namelist *, struct namelist *)); ! static struct namelist *subnl __P((struct namelist *, struct namelist *)); ! static struct namelist *andnl __P((struct namelist *, struct namelist *)); ! static int innl __P((struct namelist *nl, char *p)); struct cmd *cmds = NULL; struct cmd *last_cmd; struct namelist *last_n; *************** *** 169,175 **** ; cmd: INSTALL options opt_namelist ';' = { ! register struct namelist *nl; $1->sc_options = $2 | options; if ($3 != NULL) { --- 168,174 ---- ; cmd: INSTALL options opt_namelist ';' = { ! struct namelist *nl; $1->sc_options = $2 | options; if ($3 != NULL) { *************** *** 248,258 **** int yylineno = 1; extern FILE *fin; ! yylex() { static char yytext[INMAX]; ! register int c; ! register char *cp1, *cp2; static char quotechars[] = "[]{}*?$"; again: --- 247,258 ---- int yylineno = 1; extern FILE *fin; ! int ! yylex(void) { static char yytext[INMAX]; ! int c; ! char *cp1, *cp2; static char quotechars[] = "[]{}*?$"; again: *************** *** 318,324 **** if (c != '"') yyerror("missing closing '\"'\n"); *cp1 = '\0'; ! yylval.string = makestr(yytext); return(STRING); case ':': /* : or :: */ --- 318,324 ---- if (c != '"') yyerror("missing closing '\"'\n"); *cp1 = '\0'; ! yylval.string = xstrdup(yytext); return(STRING); case ':': /* : or :: */ *************** *** 360,368 **** switch (yytext[1]) { case 'o': if (parsedistopts(&yytext[2], &opt, TRUE)) { ! (void) snprintf(ebuf, sizeof ebuf, ! "Bad distfile options \"%s\".", ! &yytext[2]); yyerror(ebuf); } break; --- 360,368 ---- switch (yytext[1]) { case 'o': if (parsedistopts(&yytext[2], &opt, TRUE)) { ! (void) snprintf(ebuf, sizeof(ebuf), ! "Bad distfile options \"%s\".", ! &yytext[2]); yyerror(ebuf); } break; *************** *** 385,392 **** case 'r': opt = DO_NODESCEND; break; default: ! (void) snprintf(ebuf, sizeof ebuf, ! "Unknown option \"%s\".", yytext); yyerror(ebuf); } --- 385,392 ---- case 'r': opt = DO_NODESCEND; break; default: ! (void) snprintf(ebuf, sizeof(ebuf), ! "Unknown option \"%s\".", yytext); yyerror(ebuf); } *************** *** 406,412 **** else if (!strcmp(yytext, "cmdspecial")) c = CMDSPECIAL; else { ! yylval.string = makestr(yytext); return(NAME); } yylval.subcmd = makesubcmd(c); --- 406,412 ---- else if (!strcmp(yytext, "cmdspecial")) c = CMDSPECIAL; else { ! yylval.string = xstrdup(yytext); return(NAME); } yylval.subcmd = makesubcmd(c); *************** *** 417,425 **** * XXX We should use strchr(), but most versions can't handle * some of the characters we use. */ ! extern int any(c, str) ! register int c; ! register char *str; { while (*str) if (c == *str++) --- 417,423 ---- * XXX We should use strchr(), but most versions can't handle * some of the characters we use. */ ! int any(int c, char *str) { while (*str) if (c == *str++) *************** *** 431,443 **** * Insert or append ARROW command to list of hosts to be updated. */ void ! insert(label, files, hosts, subcmds) ! char *label; ! struct namelist *files, *hosts; ! struct subcmd *subcmds; { ! register struct cmd *c, *prev, *nc; ! register struct namelist *h, *lasth; debugmsg(DM_CALL, "insert(%s, %x, %x, %x) start, files = %s", label == NULL ? "(null)" : label, --- 429,439 ---- * Insert or append ARROW command to list of hosts to be updated. */ void ! insert(char *label, struct namelist *files, struct namelist *hosts, ! struct subcmd *subcmds) { ! struct cmd *c, *prev, *nc; ! struct namelist *h, *lasth; debugmsg(DM_CALL, "insert(%s, %x, %x, %x) start, files = %s", label == NULL ? "(null)" : label, *************** *** 486,498 **** * executed in the order they appear in the distfile. */ void ! append(label, files, stamp, subcmds) ! char *label; ! struct namelist *files; ! char *stamp; ! struct subcmd *subcmds; { ! register struct cmd *c; c = ALLOC(cmd); c->c_type = DCOLON; --- 482,490 ---- * executed in the order they appear in the distfile. */ void ! append(char *label, struct namelist *files, char *stamp, struct subcmd *subcmds) { ! struct cmd *c; c = ALLOC(cmd); c->c_type = DCOLON; *************** *** 513,548 **** * Error printing routine in parser. */ void ! yyerror(s) ! char *s; { error("Error in distfile: line %d: %s", yylineno, s); } /* - * Return a copy of the string. - */ - char * - makestr(str) - char *str; - { - char *cp; - - cp = strdup(str); - if (cp == NULL) - fatalerr("ran out of memory"); - - return(cp); - } - - /* * Allocate a namelist structure. */ struct namelist * ! makenl(name) ! char *name; { ! register struct namelist *nl; debugmsg(DM_CALL, "makenl(%s)", name == NULL ? "null" : name); --- 505,522 ---- * Error printing routine in parser. */ void ! yyerror(char *s) { error("Error in distfile: line %d: %s", yylineno, s); } /* * Allocate a namelist structure. */ struct namelist * ! makenl(char *name) { ! struct namelist *nl; debugmsg(DM_CALL, "makenl(%s)", name == NULL ? "null" : name); *************** *** 559,567 **** * Is the name p in the namelist nl? */ static int ! innl(nl, p) ! struct namelist *nl; ! char *p; { for ( ; nl; nl = nl->n_next) if (!strcmp(p, nl->n_name)) --- 533,539 ---- * Is the name p in the namelist nl? */ static int ! innl(struct namelist *nl, char *p) { for ( ; nl; nl = nl->n_next) if (!strcmp(p, nl->n_name)) *************** *** 573,580 **** * Join two namelists. */ static struct namelist * ! addnl(n1, n2) ! struct namelist *n1, *n2; { struct namelist *nl, *prev; --- 545,551 ---- * Join two namelists. */ static struct namelist * ! addnl(struct namelist *n1, struct namelist *n2) { struct namelist *nl, *prev; *************** *** 597,604 **** * Copy n1 except for elements that are in n2. */ static struct namelist * ! subnl(n1, n2) ! struct namelist *n1, *n2; { struct namelist *nl, *prev; --- 568,574 ---- * Copy n1 except for elements that are in n2. */ static struct namelist * ! subnl(struct namelist *n1, struct namelist *n2) { struct namelist *nl, *prev; *************** *** 617,624 **** * Copy all items of n1 that are also in n2. */ static struct namelist * ! andnl(n1, n2) ! struct namelist *n1, *n2; { struct namelist *nl, *prev; --- 587,593 ---- * Copy all items of n1 that are also in n2. */ static struct namelist * ! andnl(struct namelist *n1, struct namelist *n2) { struct namelist *nl, *prev; *************** *** 636,646 **** /* * Make a sub command for lists of variables, commands, etc. */ ! extern struct subcmd * ! makesubcmd(type) ! int type; { ! register struct subcmd *sc; sc = ALLOC(subcmd); sc->sc_type = type; --- 605,614 ---- /* * Make a sub command for lists of variables, commands, etc. */ ! struct subcmd * ! makesubcmd(int type) { ! struct subcmd *sc; sc = ALLOC(subcmd); sc->sc_type = type;