| 35 | } |
| 36 | |
| 37 | int main(int argc, char* argv[]) |
| 38 | { |
| 39 | int ch; |
| 40 | acl::string name, type, app("master"); |
| 41 | |
| 42 | while ((ch = getopt(argc, argv, "hn:t:a:")) > 0) { |
| 43 | switch (ch) { |
| 44 | case 'h': |
| 45 | usage(argv[0]); |
| 46 | return 0; |
| 47 | case 'n': |
| 48 | name = optarg; |
| 49 | break; |
| 50 | case 't': |
| 51 | type = optarg; |
| 52 | break; |
| 53 | case 'a': |
| 54 | app = optarg; |
| 55 | break; |
| 56 | default: |
| 57 | break; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | acl::acl_cpp_init(); |
| 62 | |
| 63 | if (!name.empty() && !type.empty()) { |
| 64 | if (app == "master") { |
| 65 | return create_master_service(name, type); |
| 66 | } else if (app == "http") { |
| 67 | return create_http_service(name, type); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | while (true) { |
| 72 | char buf[256]; |
| 73 | |
| 74 | printf("select one below:\r\n"); |
| 75 | printf("m: master_service; d: db; h: http; q: exit\r\n"); |
| 76 | printf(">"); fflush(stdout); |
| 77 | |
| 78 | int n = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf)); |
| 79 | if (n == ACL_VSTREAM_EOF) { |
| 80 | break; |
| 81 | } |
| 82 | |
| 83 | if (strcasecmp(buf, "m") == 0) { |
| 84 | master_creator(NULL, NULL); |
| 85 | } else if (strcasecmp(buf, "d") == 0) { |
| 86 | create_db(); |
| 87 | } else if (strcasecmp(buf, "h") == 0) { |
| 88 | http_creator(NULL, NULL); |
| 89 | } else if (strcasecmp(buf, "q") == 0) { |
| 90 | break; |
| 91 | } else { |
| 92 | printf("unknown %s\r\n", buf); |
| 93 | } |
| 94 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…