| 17 #ifndef WIN32 |
17 #ifndef WIN32 |
| 18 #include <pwd.h> |
18 #include <pwd.h> |
| 19 #endif |
19 #endif |
| 20 |
20 |
| 21 static char *get_localvarfile(void); |
21 static char *get_localvarfile(void); |
| 22 static char *get_varval(char *fn, char *val); |
22 static const gchar *get_varval(const gchar *fn, const gchar *val); |
| 23 static int varline(char *bfr, char *var); |
23 static int varline(const gchar *bfr, const gchar *var); |
| 24 |
24 |
| 25 char *ZGetVariable(var) |
25 const gchar * |
| 26 char *var; |
26 ZGetVariable(const gchar *var) |
| 27 { |
27 { |
| 28 char *varfile, *ret; |
28 gchar *varfile; |
| |
29 const gchar *ret; |
| 29 |
30 |
| 30 if ((varfile = get_localvarfile()) == NULL) |
31 if ((varfile = get_localvarfile()) == NULL) |
| 31 return ((char *)0); |
32 return ((char *)0); |
| 32 |
33 |
| 33 ret = get_varval(varfile, var); |
34 ret = get_varval(varfile, var); |
| 186 return ((char *)0); |
186 return ((char *)0); |
| 187 } |
187 } |
| 188 |
188 |
| 189 /* If the variable in the line bfr[] is the same as var, return index to |
189 /* If the variable in the line bfr[] is the same as var, return index to |
| 190 the variable value, else return 0. */ |
190 the variable value, else return 0. */ |
| 191 static int varline(bfr, var) |
191 static int |
| 192 char *bfr; |
192 varline(const gchar *bfr, const gchar *var) |
| 193 char *var; |
193 { |
| 194 { |
194 register const gchar *cp; |
| 195 register char *cp; |
|
| 196 |
|
| 197 |
195 |
| 198 if (!bfr[0] || bfr[0] == '#') /* comment or null line */ |
196 if (!bfr[0] || bfr[0] == '#') /* comment or null line */ |
| 199 return (0); |
197 return (0); |
| 200 |
198 |
| 201 cp = bfr; |
199 cp = bfr; |