From 046f5106a74711066172150345c219e8c962f8b5 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Sun, 28 Apr 2002 12:34:54 +0000 Subject: [PATCH] Declarations cleanup; make sure externs are in a common header. Fix declarations, casts and return values. --- usr.bin/mklocale/extern.h | 40 +++++++++++++++++++++++++++++++++++++++ usr.bin/mklocale/lex.l | 8 +++++++- usr.bin/mklocale/yacc.y | 33 ++++++++++++++++++++++++-------- 3 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 usr.bin/mklocale/extern.h diff --git a/usr.bin/mklocale/extern.h b/usr.bin/mklocale/extern.h new file mode 100644 index 000000000000..a52c6b5b9015 --- /dev/null +++ b/usr.bin/mklocale/extern.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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 acknowledgement: + * 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 + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +int yylex(void); +int yyparse(void); diff --git a/usr.bin/mklocale/lex.l b/usr.bin/mklocale/lex.l index 3b81ea5f6202..11ce80aa7545 100644 --- a/usr.bin/mklocale/lex.l +++ b/usr.bin/mklocale/lex.l @@ -36,16 +36,21 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 6/6/93"; -static char rcsid[] = "$FreeBSD$"; +#endif #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include #include "ldef.h" #include "y.tab.h" +#include "extern.h" %} ODIGIT [0-7] @@ -160,6 +165,7 @@ ENCODING { return(ENCODING); } %% #if !defined(yywrap) +int yywrap() { return(1); diff --git a/usr.bin/mklocale/yacc.y b/usr.bin/mklocale/yacc.y index 3001490af995..b1a6979f1e54 100644 --- a/usr.bin/mklocale/yacc.y +++ b/usr.bin/mklocale/yacc.y @@ -36,10 +36,14 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)yacc.y 8.1 (Berkeley) 6/6/93"; -static char rcsid[] = "$FreeBSD$"; +#endif /* 0 */ #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include @@ -48,16 +52,25 @@ static char rcsid[] = "$FreeBSD$"; #include #include #include +#include #include "ldef.h" +#include "extern.h" -char *locale_file = ""; +static void *xmalloc(unsigned int sz); +static unsigned long *xlalloc(unsigned int sz); +static void yyerror(const char *s); +static unsigned long *xrelalloc(unsigned long *old, unsigned int sz); +static void dump_tables(void); -rune_map maplower = { 0, }; -rune_map mapupper = { 0, }; -rune_map types = { 0, }; +const char *locale_file = ""; -_RuneLocale new_locale = { 0, }; +rune_map maplower = { { 0 }, NULL }; +rune_map mapupper = { { 0 }, NULL }; +rune_map types = { { 0 }, NULL }; + +_RuneLocale new_locale = { "", "", NULL, NULL, 0, {}, {}, {}, + {0, NULL}, {0, NULL}, {0, NULL}, NULL, 0 }; void set_map __P((rune_map *, rune_list *, unsigned long)); void set_digitmap __P((rune_map *, rune_list *)); @@ -187,6 +200,7 @@ map : LBRK RUNE RUNE RBRK int debug = 0; FILE *fp; +int main(ac, av) int ac; char *av[]; @@ -236,10 +250,13 @@ main(ac, av) memcpy(new_locale.magic, _RUNE_MAGIC_1, sizeof(new_locale.magic)); yyparse(); + + return(0); } +void yyerror(s) - char *s; + const char *s; { fprintf(stderr, "%s\n", s); } @@ -538,7 +555,7 @@ dump_tables() for(list = types.root; list; list = list->next) { list->map = list->types[0]; for (x = 1; x < list->max - list->min + 1; ++x) { - if (list->types[x] != list->map) { + if ((rune_t)list->types[x] != list->map) { list->map = 0; break; }