From ce8371152f135e914d1fbb1c13e5a7a9977aaa83 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 1 Jun 2015 19:48:56 -0700 Subject: [PATCH] Kconfig: fixed function declarations. --- tools/kconfig/Makefile | 6 +++++ tools/kconfig/config.h | 28 ++++++++++------------ tools/kconfig/lang.l | 6 ++--- tools/kconfig/main.c | 48 ++------------------------------------ tools/kconfig/mkheaders.c | 4 +--- tools/kconfig/mkioconf.c | 10 ++------ tools/kconfig/mkmakefile.c | 6 ++--- tools/kconfig/mkswapconf.c | 7 +++--- 8 files changed, 31 insertions(+), 84 deletions(-) diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 1b5becc..3553bae 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -15,3 +15,9 @@ clean: $(PROG): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + +main.o: main.c y.tab.h config.h +mkheaders.o: mkheaders.c config.h y.tab.h +mkioconf.o: mkioconf.c y.tab.h config.h +mkmakefile.o: mkmakefile.c y.tab.h config.h +mkswapconf.o: mkswapconf.c config.h diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index dca3f9c..7a42a11 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -39,6 +39,7 @@ #include #include #include +#include #define NODEV ((dev_t)-1) @@ -159,22 +160,12 @@ struct opt { char *ident; char *ldscript; -char *ns(); -char *tc(); -char *qu(); -char *get_word(); -char *get_quoted_word(); -char *path(); -char *raise(); int do_trace; int seen_cd; -struct device *connect(); struct device *dtab; -dev_t nametodev(); -char *devtoname(); char errbuf[80]; int yyline; @@ -191,9 +182,14 @@ int maxusers; #define eq(a,b) (!strcmp(a,b)) -void init_dev(register struct device *dp); -int yyparse(void); -void pic32_ioconf(void); -void makefile(void); -void headers(void); -void swapconf(void); +char *get_word(FILE *); +char *get_quoted_word(FILE *); +char *raise(char *); +dev_t nametodev(char *, int, char); +char *devtoname(dev_t); +void init_dev(struct device *); +int yyparse(void); +void pic32_ioconf(void); +void makefile(void); +void headers(void); +void swapconf(void); diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index be4276e..4e38c00 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -165,7 +165,7 @@ WORD [A-Za-z_][-A-Za-z_]* */ int kw_lookup(word) -register char *word; + register char *word; { register struct kt *kp; @@ -180,7 +180,7 @@ register char *word; */ int octal(str) -char *str; + char *str; { int num; @@ -190,7 +190,7 @@ char *str; int hex(str) -char *str; + char *str; { int num; diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 6ad3ae2..ee5d6c5 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -33,14 +33,11 @@ #include #include #include -#include #include #include #include "y.tab.h" #include "config.h" -static char *PREFIX; - /* * Config builds a set of files for building a UNIX * system given a description of the desired system. @@ -71,25 +68,10 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); exit(1); } - PREFIX = *argv; - if (! freopen(PREFIX, "r", stdin)) { - perror(PREFIX); + if (! freopen(*argv, "r", stdin)) { + perror(*argv); exit(2); } -#if 0 - mkdir("../../compile", 0777); - char *p = path((char *)NULL); - struct stat buf; - if (stat(p, &buf) < 0) { - if (mkdir(p, 0777) < 0) { - perror(p); - exit(2); - } - } else if ((buf.st_mode & S_IFMT) != S_IFDIR) { - fprintf(stderr, "config: %s isn't a directory.\n", p); - exit(2); - } -#endif dtab = NULL; confp = &conf_list; @@ -199,29 +181,3 @@ get_quoted_word(fp) return ((char *)EOF); return (line); } - -/* - * prepend the path to a filename - */ -char * -path(file) - char *file; -{ -#if 1 - return file; -#else - register char *cp; - -#define CDIR "../../compile/" - - cp = malloc((unsigned int)(sizeof(CDIR) + strlen(PREFIX) + - (file ? strlen(file) : 0) + 2)); - (void) strcpy(cp, CDIR); - (void) strcat(cp, PREFIX); - if (file) { - (void) strcat(cp, "/"); - (void) strcat(cp, file); - } - return (cp); -#endif -} diff --git a/tools/kconfig/mkheaders.c b/tools/kconfig/mkheaders.c index 4dd31f3..76eec47 100644 --- a/tools/kconfig/mkheaders.c +++ b/tools/kconfig/mkheaders.c @@ -34,8 +34,6 @@ /* * Make all the .h files for the optional entries */ - -#include #include #include "config.h" #include "y.tab.h" @@ -179,7 +177,7 @@ toheader(dev) { static char hbuf[80]; - (void) strcpy(hbuf, path(dev)); + (void) strcpy(hbuf, dev); (void) strcat(hbuf, ".h"); return (hbuf); } diff --git a/tools/kconfig/mkioconf.c b/tools/kconfig/mkioconf.c index 3b763b1..b56e11b 100644 --- a/tools/kconfig/mkioconf.c +++ b/tools/kconfig/mkioconf.c @@ -30,8 +30,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -#include #include "y.tab.h" #include "config.h" @@ -90,10 +88,6 @@ pseudo_ioconf(fp) */ if (seen_cd) (void)fprintf(fp, "extern void cdattach __P((int));\n"); - /* XXX temporary for HP300, others */ - (void)fprintf(fp, "\n#include /* XXX */\n"); - (void)fprintf(fp, "#define etherattach (void (*)__P((int)))nullop\n"); - (void)fprintf(fp, "#define iteattach (void (*) __P((int)))nullop\n"); (void)fprintf(fp, "\nstruct pdevinit pdevinit[] = {\n"); for (dp = dtab; dp != NULL; dp = dp->d_next) if (dp->d_type == PSEUDO_DEVICE) @@ -131,9 +125,9 @@ void pic32_ioconf() register struct device *dp, *mp; FILE *fp; - fp = fopen(path("ioconf.c"), "w"); + fp = fopen("ioconf.c", "w"); if (fp == 0) { - perror(path("ioconf.c")); + perror("ioconf.c"); exit(1); } fprintf(fp, "#include \"sys/types.h\"\n"); diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 752ef29..88538e4 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -36,8 +36,6 @@ * the information in the files files and the * additional files for the machine being compiled to. */ - -#include #include #include "y.tab.h" #include "config.h" @@ -472,9 +470,9 @@ void makefile() perror(line); exit(1); } - ofp = fopen(path("Makefile"), "w"); + ofp = fopen("Makefile", "w"); if (ofp == 0) { - perror(path("Makefile")); + perror("Makefile"); exit(1); } fprintf(ofp, "IDENT=-D%s", raise(ident)); diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index 0aff12d..c7cfefd 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -36,7 +36,6 @@ */ #include "config.h" -#include #include #include @@ -69,9 +68,9 @@ do_swap(fl) return (fl->f_next); } (void) sprintf(swapname, "swap%s.c", fl->f_fn); - fp = fopen(path(swapname), "w"); + fp = fopen(swapname, "w"); if (fp == 0) { - perror(path(swapname)); + perror(swapname); exit(1); } fprintf(fp, "#include \"sys/param.h\"\n"); @@ -84,7 +83,7 @@ do_swap(fl) */ swap = fl->f_next; if (swap == 0 || swap->f_type != SWAPSPEC) { - (void) unlink(path(swapname)); + (void) unlink(swapname); fclose(fp); return (swap); }