summaryrefslogtreecommitdiff
path: root/devel/frink/files/patch-config.c
blob: 981f126316de21aa5128f98b37983119845aa8ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
--- config.c.orig	2002-12-13 09:56:37 UTC
+++ config.c
@@ -29,14 +29,10 @@
 #include <malloc.h>
 #endif
 
-extern Token *tokenPop(Token **);
-extern void freeToken(Token *);
-extern void streamMore(Input *);
-
 List *config = noList;
 
 static struct {
-	char		*name;
+	const char	*name;
 	ParamType	code;
 } pvals[] ={
 	{"var",		PVAR},
@@ -71,10 +67,10 @@ static struct {
 	{(char *) 0,	0}
 };
 
-void dumpPdata(ParamData *pt, FILE *op)
+static void dumpPdata(ParamData *pt, FILE *op)
 {
     int i;
-    char *pad;
+    const char *pad;
     List *lp;
 
     for (i=0; pvals[i].name != (char *) 0; i += 1)
@@ -91,7 +87,7 @@ void dumpPdata(ParamData *pt, FILE *op)
 	    {
 	        while (lp != noList)
 		{
-		    fprintf(op, "%x ", (int) lp->item);
+		  fprintf(op, "%x ", (int)(size_t) lp->item);
 		    lp = lp->next;
 		}
 	        fprintf(op, "}");
@@ -104,7 +100,7 @@ void dumpPdata(ParamData *pt, FILE *op)
 
 }
 
-void dumpConf(ConfigData *cp, FILE *op)
+void dumpConf(const ConfigData *cp, FILE *op)
 {
     List *plp;
 
@@ -118,7 +114,7 @@ void dumpConf(ConfigData *cp, FILE *op)
     fprintf(op, "}\n");
 }
 
-static void pcode(ParamData *ppt, char *str)
+static void pcode(ParamData *ppt, const char *str)
 {
     int i;
 
@@ -171,8 +167,7 @@ static void param(Token *tp, List **plist)
     ParamData *ppt;
     SeqnData *sd;
     void *dp;
-    extern void dumpToken(Token *, FILE *);
-    
+ 
     ppt = newpdata();
     switch (tp->type)
     {
@@ -252,7 +247,7 @@ static void parlist(Token *tp, List **plist)
     freeToken(lp2);
 }
 
-static int handle(Token *line)
+static int confighandle(Token *line)
 {
     ConfigData *cpt;
     Token *hd, *tp;
@@ -306,11 +301,11 @@ static int handle(Token *line)
     return 1;
 }
 
-void readconfig(char *str)
+void readconfig(const char *str)
 {
     FILE *fd;
     Input file;
-    
+
     if ((fd = fopen(str, "r")) == NULL)
     {
 	fprintf(stderr, "Warning: cannot open config file\n");
@@ -319,21 +314,21 @@ void readconfig(char *str)
 /*
  * use the tokenising mechanism we already have to parse the config file
  */
-    file.text = (char *) malloc(64*1024);
+    file.atext = malloc(64*1024);
     file.stream = fd;
     file.tcall = file.texpr = 0;
     file.lineNumber = 1;
     file.lineStart = 1;
     streamMore(&file);
-    while(handle(collect(&file)))
+    while(confighandle(collect(&file)))
     {
         /* skip */
     }
-    free(file.text);  
+    free(file.atext);
     fclose(fd);
 }
 
-void stringconfig(char *str)
+void stringconfig(const char *str)
 {
     Input file;
 /*
@@ -346,7 +341,7 @@ void stringconfig(char *str)
     file.tcall = file.texpr = 0;
     file.lineNumber = 1;
     file.lineStart = 1;
-    while(handle(collect(&file)))
+    while(confighandle(collect(&file)))
     {
         /* skip */
     }