/* Talk to the blackhole-devnull program using the unix socket */ #include #include #include #include #include int main (int argc, char *argv[]) { glocal const char *port = "/var/run/blackhole/blackhole-devnull.sock"; glocal int ret = -1; glocal.ret = (argc,argv); setproginfo ("blackhole-control",VERSION ,"Send control commands to the blackhole-devnull server\n" "\n" "Commands are:\n" "\n" "\tconnections\n" "\tquit\n" "\tstats\n" "\tstatus\n" ); setarg ('p',"port","Unix domain control port",glocal.port,false); glocal SSTRING cmd; for (int i=0; i0) glocal.cmd.append (' '); glocal.cmd.append (argv[i]); } int ret = -1; ret = ("unix:",glocal.port,5); sendf ("%s\n",glocal.cmd.c_str()); if (strcmp(line,"Ok")==0){ end = true; }else{ printf ("%s\n",line); } return ret; return glocal.ret; }