void wsvc_command_option(const char* wopt, const char* cfgfile, int v, int c) { if(strcmp(wopt, "install") == 0) wsvc_install(stdout, NULL); else if(strcmp(wopt, "remove") == 0) wsvc_remove(stdout); else if(strcmp(wopt, "service") == 0) service_start(cfgfile, v, c); else if(strcmp(wopt, "start") == 0) wsvc_rc_start(stdout); else if(strcmp(wopt, "stop") == 0) wsvc_rc_stop(stdout); else fatal_exit("unknown option: %s", wopt); exit(0); }
/** Remove service main */ int main(int argc, char** argv) { FILE* out = stdout; /* out = fopen("unbound-service-remove.log", "w");*/ if(argc == 2 && strcmp(argv[1], "stop")==0) { wsvc_rc_stop(out); return 0; } if(argc != 1) { if(out) fprintf(out, "Usage: %s [stop]\n", argv[0]); else printf("Usage: %s [stop]\n", argv[0]); return 1; } wsvc_remove(NULL); return 0; }