#include "include/httpd.h"
int readconfig(conf *cf, char *file) {
char data[512];
char *a,*b;
struct stat sb;
cf[1].port = 80;
sprintf(cf[1].servername,"10.0.0.3");
if (stat(file,&sb) == -1) {
printf("Sorry File Does Not Exist\n");
sprintf(file,"ubieserv.cfg");
printf("sdf");
if (stat(file,&sb) == -1) {
printf("Must Specify Config File\n");
exit(0);
}
}
printf("la");
cff = fopen(file,"r");
fgets(data,512,cff);
while (!feof(cff)) {
printf("%s",data);
if (strstr(data," ")) {
a = strtok(data, " ");
b = strtok(NULL,"\n");
if (!strcmp(a,"port")) {
cf[1].port = atoi(b);
}
else if (!strcmp(a,"servername")) {
sprintf(cf[1].servername,b);
}
}
fgets(data,512,cff);
}
return(0);
}