Declarations cleanup; make sure externs are in a common header.

Fix declarations, casts and return values.
This commit is contained in:
Mark Murray 2002-04-28 12:34:54 +00:00
parent ffc6a8e325
commit 046f5106a7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95643
3 changed files with 72 additions and 9 deletions

40
usr.bin/mklocale/extern.h Normal file
View File

@ -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);

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#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);

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <arpa/inet.h>
#include <ctype.h>
@ -48,16 +52,25 @@ static char rcsid[] = "$FreeBSD$";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ldef.h"
#include "extern.h"
char *locale_file = "<stdout>";
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 = "<stdout>";
_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;
}