| 81 | }; |
| 82 | |
| 83 | int |
| 84 | main(int argc, char *argv[]) |
| 85 | { |
| 86 | int argerr = 0; |
| 87 | int flag; |
| 88 | int index = 0; |
| 89 | int rc = 0; |
| 90 | servicelog *slog = NULL; |
| 91 | struct sl_event *event = NULL; |
| 92 | uint64_t event_id = 0; |
| 93 | |
| 94 | crm_log_init_quiet("notifyServicelogEvent", LOG_INFO, FALSE, TRUE, argc, argv); |
| 95 | crm_set_options(NULL, "event_id ", long_options, |
| 96 | "Gets called upon events written to servicelog database"); |
| 97 | |
| 98 | if (argc < 2) { |
| 99 | argerr++; |
| 100 | } |
| 101 | |
| 102 | while (1) { |
| 103 | flag = crm_get_option(argc, argv, &index); |
| 104 | if (flag == -1) |
| 105 | break; |
| 106 | |
| 107 | switch (flag) { |
| 108 | case '?': |
| 109 | case '$': |
| 110 | crm_help(flag, 0); |
| 111 | break; |
| 112 | default: |
| 113 | ++argerr; |
| 114 | break; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | if (argc - optind != 1) { |
| 119 | ++argerr; |
| 120 | } |
| 121 | |
| 122 | if (argerr) { |
| 123 | crm_help('?', 1); |
| 124 | } |
| 125 | |
| 126 | openlog("notifyServicelogEvent", LOG_NDELAY, LOG_USER); |
| 127 | |
| 128 | if (sscanf(argv[optind], U64T, &event_id) != 1) { |
| 129 | crm_err("Error: could not read event_id from args!"); |
| 130 | |
| 131 | rc = 1; |
| 132 | goto cleanup; |
| 133 | } |
| 134 | |
| 135 | if (event_id == 0) { |
| 136 | crm_err("Error: event_id is 0!"); |
| 137 | |
| 138 | rc = 1; |
| 139 | goto cleanup; |
| 140 | } |
nothing calls this directly
no test coverage detected