#include #include #include #include #include using namespace std; int main (int argc, char *argv[]) { glocal int ret = -1; glocal const char *unixpath = "/var/run/findproc.sock"; glocal int rep = 1; glocal.ret = (argc,argv); setproginfo ("findproc-control",VERSION ,"Send commands and configuration to the findproc service\n" "\n" "Commands are:\n" "\tident ip_from port_from ip_to port_to\n" "\tvserver XID rootdir\n" "\tvuser XID uid name\n" "\tvgroup XID gid name\n" "\tclear\n" "\tcommit\n" "\tquit\n" "\tprintconf\n" "\tstatus\n" ); setarg ('s',"unixsock","Unix socket",glocal.unixpath,false); setarg ('r',"repeat","Repeat an operation N type (test)",glocal.rep,false); glocal int ret = -1; glocal string args; for (int i=0; i 0) glocal.args += " "; glocal.args += argv[i]; } for (int i=0; i("unix:",glocal.unixpath,1); sendf ("%s\n",glocal.args.c_str()); if (strcmp(line,"OK")==0){ glocal.ret = 0; end = true; }else if (strncmp(line,"ERR ",4)==0){ fprintf (stderr,"%s\n",line+4); end = true; }else{ printf ("%s\n",line); } } return glocal.ret; return glocal.ret; }