[Frugalware-darcs] setup-current: netconfig: added dns variable to
parseconfig()
VMiklos
vmiklos at frugalware.org
Thu Mar 16 18:09:25 CET 2006
[netconfig: added dns variable to parseconfig()
VMiklos <vmiklos at frugalware.org>**20060117224745] {
hunk ./src/config/netconfig.c 44
-char *strtrim(char *str)
+char *trim(char *str)
hunk ./src/config/netconfig.c 59
+char *strtoupper(char *str)
+{
+ char *ptr = str;
+
+ while(*ptr)
+ {
+ (*ptr) = toupper(*ptr);
+ ptr++;
+ }
+ return str;
+}
+
+
hunk ./src/config/netconfig.c 100
- strtrim(line);
+ trim(line);
hunk ./src/config/netconfig.c 127
- /* start a new interface record */
+ // start a new interface record
hunk ./src/config/netconfig.c 137
+ else
+ {
+ // directive
+ ptr = line;
+ var = strsep(&ptr, "=");
+ if(var == NULL)
+ {
+ fprintf(stderr, "profile: line %d: syntax error\n", n);
+ return(NULL);
+ }
+ trim(var);
+ var = strtoupper(var);
+ if(!strlen(interface))
+ {
+ fprintf(stderr, "profile: line %d: all directives must belong to a section\n", n);
+ return(NULL);
+ }
+ if(ptr != NULL)
+ {
+ trim(ptr);
+ if (!strcmp(var, "DNS"))
+ profile->dnses = g_list_append(profile->dnses, strdup(ptr));
+ }
+ }
hunk ./src/config/netconfig.c 164
- /*printf("interfaces found:\n");
- for (i=0; i<g_list_length(profile->interfaces); i++)
+ /*printf("dnses found:\n");
+ for (i=0; i<g_list_length(profile->dnses); i++)
hunk ./src/config/netconfig.c 167
- iface = (interface_t*)g_list_nth_data(profile->interfaces, i);
- printf("%s\n", iface->name);
+ printf("%s\n", (char*)g_list_nth_data(profile->dnses, i));
}
More information about the Frugalware-darcs
mailing list