static int parse_conf(const char *conf,char *name,char *value) { int res; char buf[1024]; char *ptr; conf=skip_blanks(conf); if(*conf=='#'||*conf=='\0'||*conf=='=') { res=-1; } else { strcpy(buf,conf); if((ptr=strchr(buf,'='))==NULL) return -1; *ptr='\0'; strcpy(name,trim_blanks(buf)); ptr++; ptr=skip_blanks(ptr); if(*ptr=='\0'|| *ptr=='#') return -1; char *tmp=NULL; if((tmp=strchr(ptr,'#'))!=NULL) *tmp='\0'; strcpy(value,trim_blanks(ptr)); res=0; } return res; }
static char *strip(char *str) { if ((str = skip_blanks(str))) trim_blanks(str); return str; }