#include #include #include #include "whoson.h" int main(int argc,char *argv[]) { char buf[128]; int rc; openlog("whoson",LOG_CONS|LOG_PID,LOG_LOCAL1); buf[0]='\0'; if (argc < 2) { printf("bad usage\n"); rc=-1; } else if (strcasecmp(argv[1],"login") == 0) { rc=wso_login(argv[2],argv[3],buf,sizeof(buf)); } else if (strcasecmp(argv[1],"logout") == 0) { rc=wso_logout(argv[2],buf,sizeof(buf)); } else if (strcasecmp(argv[1],"query") == 0) { rc=wso_query(argv[2],buf,sizeof(buf)); } else { printf("bad usage\n"); rc=-1; } printf("rc=%d, info=\"%s\"%s\n", rc,buf,(rc<0)?" (may be irrelevant)":""); return 0; }