| 276 | //#define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2] |
| 277 | |
| 278 | int CLIB_ROUTINE main( int argc, char *argv[]) |
| 279 | { |
| 280 | /************************************** |
| 281 | * |
| 282 | * m a i n |
| 283 | * |
| 284 | ************************************** |
| 285 | * |
| 286 | * Functional description |
| 287 | * Check switches passed in and prepare to dump the lock table |
| 288 | * to stdout. |
| 289 | * |
| 290 | **************************************/ |
| 291 | #ifdef HAVE_LOCALE_H |
| 292 | // Pick up the system locale to allow SYSTEM<->UTF8 conversions |
| 293 | setlocale(LC_CTYPE, ""); |
| 294 | #endif |
| 295 | |
| 296 | OUTFILE outfile = stdout; |
| 297 | |
| 298 | // Perform some special handling when run as a Firebird service. The |
| 299 | // first switch can be "-svc" (lower case!) or it can be "-svc_re" followed |
| 300 | // by 3 file descriptors to use in re-directing stdin, stdout, and stderr. |
| 301 | |
| 302 | if (argc > 1 && !strcmp(argv[1], "-svc")) |
| 303 | { |
| 304 | argv++; |
| 305 | argc--; |
| 306 | } |
| 307 | else if (argc > 4 && !strcmp(argv[1], "-svc_re")) |
| 308 | { |
| 309 | long redir_in = atol(argv[2]); |
| 310 | long redir_out = atol(argv[3]); |
| 311 | long redir_err = atol(argv[4]); |
| 312 | #ifdef WIN_NT |
| 313 | redir_in = _open_osfhandle(redir_in, 0); |
| 314 | redir_out = _open_osfhandle(redir_out, 0); |
| 315 | redir_err = _open_osfhandle(redir_err, 0); |
| 316 | #endif |
| 317 | if (redir_in != 0) |
| 318 | { |
| 319 | if (dup2((int) redir_in, 0)) |
| 320 | close((int) redir_in); |
| 321 | } |
| 322 | if (redir_out != 1) |
| 323 | { |
| 324 | if (dup2((int) redir_out, 1)) |
| 325 | close((int) redir_out); |
| 326 | } |
| 327 | if (redir_err != 2) |
| 328 | { |
| 329 | if (dup2((int) redir_err, 2)) |
| 330 | close((int) redir_err); |
| 331 | } |
| 332 | argv += 4; |
| 333 | argc -= 4; |
| 334 | } |
| 335 | //const int orig_argc = argc; |
nothing calls this directly
no test coverage detected