| 128 | // |
| 129 | |
| 130 | int alice(Firebird::UtilSvc* uSvc) |
| 131 | { |
| 132 | AliceGlobals gblInstance(uSvc); |
| 133 | AliceGlobals* tdgbl = &gblInstance; |
| 134 | AliceGlobals::putSpecific(tdgbl); |
| 135 | int exit_code = FINI_ERROR; |
| 136 | |
| 137 | try { |
| 138 | |
| 139 | // Perform some special handling when run as a Firebird service. The |
| 140 | // first switch can be "-svc" (lower case!) or it can be "-svc_re" followed |
| 141 | // by 3 file descriptors to use in re-directing stdin, stdout, and stderr. |
| 142 | |
| 143 | tdgbl->ALICE_data.ua_user = NULL; |
| 144 | tdgbl->ALICE_data.ua_role = NULL; |
| 145 | tdgbl->ALICE_data.ua_password = NULL; |
| 146 | #ifdef TRUSTED_AUTH |
| 147 | tdgbl->ALICE_data.ua_trusted = false; |
| 148 | #endif |
| 149 | tdgbl->ALICE_data.ua_parallel_workers = uSvc->getParallelWorkers(); |
| 150 | |
| 151 | // Start by parsing switches |
| 152 | |
| 153 | bool error = false, help = false, version = false; |
| 154 | SINT64 flags = 0; |
| 155 | tdgbl->ALICE_data.ua_shutdown_delay = 0; |
| 156 | const TEXT* database = NULL; |
| 157 | TEXT string[512] = ""; |
| 158 | |
| 159 | const char** argv = uSvc->argv.begin(); |
| 160 | int argc = uSvc->argv.getCount(); |
| 161 | if (argc == 1) |
| 162 | error = true; |
| 163 | ++argv; |
| 164 | |
| 165 | // tested outside the loop |
| 166 | const Switches::in_sw_tab_t* table = NULL; |
| 167 | const Switches switches(alice_in_sw_table, FB_NELEM(alice_in_sw_table), false, true); |
| 168 | |
| 169 | while (--argc > 0) |
| 170 | { |
| 171 | if ((*argv)[0] != '-') |
| 172 | { |
| 173 | if (database) |
| 174 | { |
| 175 | ALICE_error(1, SafeArg() << database); |
| 176 | // msg 1: "data base file name (%s) already given", |
| 177 | } |
| 178 | database = *argv++; |
| 179 | |
| 180 | continue; |
| 181 | } |
| 182 | |
| 183 | const char* opt = *argv++; |
| 184 | if (!opt[1]) { |
| 185 | continue; |
| 186 | } |
| 187 | if (strcmp(opt, "-?") == 0) |
no test coverage detected