diff options
Diffstat (limited to 'contrib/amd/fsinfo/fsi_lex.l')
-rw-r--r-- | contrib/amd/fsinfo/fsi_lex.l | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/contrib/amd/fsinfo/fsi_lex.l b/contrib/amd/fsinfo/fsi_lex.l index 6bca59b..4d09e2c 100644 --- a/contrib/amd/fsinfo/fsi_lex.l +++ b/contrib/amd/fsinfo/fsi_lex.l @@ -1,6 +1,6 @@ %{ /* - * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1997-2014 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -17,11 +17,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -102,7 +98,7 @@ static int ayylineno; */ #ifdef FLEX_SCANNER # ifndef ECHO -# define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +# define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout )) # endif /* not ECHO */ #endif /* FLEX_SCANNER */ @@ -111,9 +107,11 @@ static int ayylineno; * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void); -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ + +int fsi_error(const char *, ...); YYSTYPE yylval; static char *fsi_filename; @@ -153,7 +151,7 @@ struct r { { "passno", tPASSNO }, { "sel", tSEL }, { "volname", tVOLNAME }, - { 0, 0 }, + { NULL, 0 }, }; #define NRES_WORDS (sizeof(rr)/sizeof(rr[0])-1) @@ -162,6 +160,7 @@ struct r { /* This option causes Solaris lex to fail. Use flex. See BUGS file */ /* no need to use yyunput() */ %option nounput +%option noinput /* allocate more output slots so lex scanners don't run out of mem */ %o 1024 @@ -177,7 +176,7 @@ struct r { <F>[={}] { return *yytext; } <F>\" { BEGIN Q; optr = ostr; quoted = 1; } -<Q>\n { ayylineno++; yyerror("\" expected"); BEGIN F; } +<Q>\n { ayylineno++; fsi_error("\" expected"); BEGIN F; } <Q>\\b { *optr++ = '\b'; /* escape */ } <Q>\\t { *optr++ = '\t'; /* escape */ } <Q>\\\" { *optr++ = '\"'; /* escape */ } @@ -187,11 +186,11 @@ struct r { <Q>\\n { *optr++ = '\n'; /* escape */ } <Q>\\f { *optr++ = '\f'; /* escape */ } <Q>"\\ " { *optr++ = ' '; /* force space */ } -<Q>\\. { yyerror("Unknown \\ sequence"); } +<Q>\\. { fsi_error("Unknown \\ sequence"); } <Q>([ \t]|"\\\n"){2,} { char *p = (char *) yytext-1; while ((p = strchr(p+1, '\n'))) ayylineno++; } <Q>\" { BEGIN F; quoted = 0; *optr = '\0'; - yylval.s = strdup(ostr); + yylval.s = xstrdup(ostr); return tSTR; } <Q>. { *optr++ = *yytext; } @@ -224,11 +223,11 @@ find_resword(char *s) switch (tok) { case tLOCALHOST: s = "${host}"; - /* fall through... */ + /*FALLTHROUGH*/ case 0: - yylval.s = strdup(s); + yylval.s = xstrdup(s); tok = tSTR; - /* fall through... */ + /*FALLTHROUGH*/ default: return tok; } @@ -236,7 +235,7 @@ find_resword(char *s) int -yyerror(char *fmt, ...) +fsi_error(const char *fmt, ...) { va_list ap; @@ -266,9 +265,9 @@ current_location(void) * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void) { return 1; } -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ |