#include #include #include "postfixconf.h" #include "postfixconf.m" /* void setstr (struct s_variable *s, int t){ switch (t){ case 0: s->exist = 0; (s->variable)->setfrom(""); break; case 1: s->exist = 1; } } void setvaluedefnum (struct s_variable *s, int t){ if (t == DEFAULT){ s->exist = 0; (s->variable)->setfrom(""); }else{ s->exist = 1; (s->variable)->setfrom(t); } } */ void setvalue_yesno (SSTRING *s, int t){ switch (t){ case 0: s->setfrom("yes"); break; case 1: s->setfrom("no"); break; } } char getvalue_yesno (SSTRING *s){ char var = 0; if (s->strstr("yes")) var = 0; else if (s->strstr("no")) var = 1; return var; } int execute (const char *command, const char *args, SSTRING ¬ice){ int ret = 0; POPEN pop (command,args); if (pop.isok()){ char buf[100]; sprintf(buf,"%s %s\n",command,args); notice.append (buf); ret = 1; while (pop.wait(1)>=0){ char buf[100]; if (pop.readout (buf,sizeof(buf)-1)==0) notice.append (buf); if (pop.readerr (buf,sizeof(buf)-1)==0) notice.append (buf); } } else return ret; pop.close(); ret = 1; return ret; } int is_caracter (const char *p){ for (int i=0; i<(int)strlen(p); i++){ if (*(p+i)<48||*(p+i)>57){ return 1; } } return 0; }