MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CLIB_ROUTINE main

Function CLIB_ROUTINE main

src/lock/print.cpp:278–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276//#define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2]
277
278int 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;

Callers

nothing calls this directly

Calls 15

expandDatabaseNameFunction · 0.85
getDefaultMemoryPoolFunction · 0.85
sh_memClass · 0.85
fstatFunction · 0.85
prt_lock_activityFunction · 0.85
prt_html_beginFunction · 0.85
TimeStampClass · 0.85
HtmlLinkClass · 0.85
prt_ownerFunction · 0.85
prt_lockFunction · 0.85
prt_historyFunction · 0.85
prt_html_endFunction · 0.85

Tested by

no test coverage detected