Kconfig: fixed function declarations.

This commit is contained in:
Serge Vakulenko
2015-06-01 19:48:56 -07:00
parent 47988903ae
commit ce8371152f
8 changed files with 31 additions and 84 deletions

View File

@@ -15,3 +15,9 @@ clean:
$(PROG): $(OBJS) $(PROG): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(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

View File

@@ -39,6 +39,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#define NODEV ((dev_t)-1) #define NODEV ((dev_t)-1)
@@ -159,22 +160,12 @@ struct opt {
char *ident; char *ident;
char *ldscript; char *ldscript;
char *ns();
char *tc();
char *qu();
char *get_word();
char *get_quoted_word();
char *path();
char *raise();
int do_trace; int do_trace;
int seen_cd; int seen_cd;
struct device *connect();
struct device *dtab; struct device *dtab;
dev_t nametodev();
char *devtoname();
char errbuf[80]; char errbuf[80];
int yyline; int yyline;
@@ -191,9 +182,14 @@ int maxusers;
#define eq(a,b) (!strcmp(a,b)) #define eq(a,b) (!strcmp(a,b))
void init_dev(register struct device *dp); char *get_word(FILE *);
int yyparse(void); char *get_quoted_word(FILE *);
void pic32_ioconf(void); char *raise(char *);
void makefile(void); dev_t nametodev(char *, int, char);
void headers(void); char *devtoname(dev_t);
void swapconf(void); void init_dev(struct device *);
int yyparse(void);
void pic32_ioconf(void);
void makefile(void);
void headers(void);
void swapconf(void);

View File

@@ -165,7 +165,7 @@ WORD [A-Za-z_][-A-Za-z_]*
*/ */
int int
kw_lookup(word) kw_lookup(word)
register char *word; register char *word;
{ {
register struct kt *kp; register struct kt *kp;
@@ -180,7 +180,7 @@ register char *word;
*/ */
int int
octal(str) octal(str)
char *str; char *str;
{ {
int num; int num;
@@ -190,7 +190,7 @@ char *str;
int int
hex(str) hex(str)
char *str; char *str;
{ {
int num; int num;

View File

@@ -33,14 +33,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/file.h> #include <sys/file.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include "y.tab.h" #include "y.tab.h"
#include "config.h" #include "config.h"
static char *PREFIX;
/* /*
* Config builds a set of files for building a UNIX * Config builds a set of files for building a UNIX
* system given a description of the desired system. * system given a description of the desired system.
@@ -71,25 +68,10 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr);
exit(1); exit(1);
} }
PREFIX = *argv; if (! freopen(*argv, "r", stdin)) {
if (! freopen(PREFIX, "r", stdin)) { perror(*argv);
perror(PREFIX);
exit(2); 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; dtab = NULL;
confp = &conf_list; confp = &conf_list;
@@ -199,29 +181,3 @@ get_quoted_word(fp)
return ((char *)EOF); return ((char *)EOF);
return (line); 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
}

View File

@@ -34,8 +34,6 @@
/* /*
* Make all the .h files for the optional entries * Make all the .h files for the optional entries
*/ */
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "config.h" #include "config.h"
#include "y.tab.h" #include "y.tab.h"
@@ -179,7 +177,7 @@ toheader(dev)
{ {
static char hbuf[80]; static char hbuf[80];
(void) strcpy(hbuf, path(dev)); (void) strcpy(hbuf, dev);
(void) strcat(hbuf, ".h"); (void) strcat(hbuf, ".h");
return (hbuf); return (hbuf);
} }

View File

@@ -30,8 +30,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <stdio.h>
#include "y.tab.h" #include "y.tab.h"
#include "config.h" #include "config.h"
@@ -90,10 +88,6 @@ pseudo_ioconf(fp)
*/ */
if (seen_cd) if (seen_cd)
(void)fprintf(fp, "extern void cdattach __P((int));\n"); (void)fprintf(fp, "extern void cdattach __P((int));\n");
/* XXX temporary for HP300, others */
(void)fprintf(fp, "\n#include <sys/systm.h> /* 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"); (void)fprintf(fp, "\nstruct pdevinit pdevinit[] = {\n");
for (dp = dtab; dp != NULL; dp = dp->d_next) for (dp = dtab; dp != NULL; dp = dp->d_next)
if (dp->d_type == PSEUDO_DEVICE) if (dp->d_type == PSEUDO_DEVICE)
@@ -131,9 +125,9 @@ void pic32_ioconf()
register struct device *dp, *mp; register struct device *dp, *mp;
FILE *fp; FILE *fp;
fp = fopen(path("ioconf.c"), "w"); fp = fopen("ioconf.c", "w");
if (fp == 0) { if (fp == 0) {
perror(path("ioconf.c")); perror("ioconf.c");
exit(1); exit(1);
} }
fprintf(fp, "#include \"sys/types.h\"\n"); fprintf(fp, "#include \"sys/types.h\"\n");

View File

@@ -36,8 +36,6 @@
* the information in the files files and the * the information in the files files and the
* additional files for the machine being compiled to. * additional files for the machine being compiled to.
*/ */
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "y.tab.h" #include "y.tab.h"
#include "config.h" #include "config.h"
@@ -472,9 +470,9 @@ void makefile()
perror(line); perror(line);
exit(1); exit(1);
} }
ofp = fopen(path("Makefile"), "w"); ofp = fopen("Makefile", "w");
if (ofp == 0) { if (ofp == 0) {
perror(path("Makefile")); perror("Makefile");
exit(1); exit(1);
} }
fprintf(ofp, "IDENT=-D%s", raise(ident)); fprintf(ofp, "IDENT=-D%s", raise(ident));

View File

@@ -36,7 +36,6 @@
*/ */
#include "config.h" #include "config.h"
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@@ -69,9 +68,9 @@ do_swap(fl)
return (fl->f_next); return (fl->f_next);
} }
(void) sprintf(swapname, "swap%s.c", fl->f_fn); (void) sprintf(swapname, "swap%s.c", fl->f_fn);
fp = fopen(path(swapname), "w"); fp = fopen(swapname, "w");
if (fp == 0) { if (fp == 0) {
perror(path(swapname)); perror(swapname);
exit(1); exit(1);
} }
fprintf(fp, "#include \"sys/param.h\"\n"); fprintf(fp, "#include \"sys/param.h\"\n");
@@ -84,7 +83,7 @@ do_swap(fl)
*/ */
swap = fl->f_next; swap = fl->f_next;
if (swap == 0 || swap->f_type != SWAPSPEC) { if (swap == 0 || swap->f_type != SWAPSPEC) {
(void) unlink(path(swapname)); (void) unlink(swapname);
fclose(fp); fclose(fp);
return (swap); return (swap);
} }