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

Function CLIB_ROUTINE main

src/utilities/run_service.cpp:34–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33
34int CLIB_ROUTINE main( int argc, char *argv[])
35{
36/**************************************
37 *
38 * m a i n
39 *
40 **************************************
41 *
42 * Functional description
43 * Initialize lock manager for process.
44 *
45 **************************************/
46 if (argc < 2)
47 {
48 printf("usage: run_service service_path [args]\n");
49 exit(FINI_ERROR);
50 }
51
52 const char* service_path = argv[1];
53
54 char spb_buffer[2048];
55 char* spb = spb_buffer;
56 const char* const spb_end = spb_buffer + sizeof(spb_buffer) - 1;
57 if (argc > 2)
58 {
59 *spb++ = isc_spb_version1;
60 *spb++ = isc_spb_command_line;
61 spb++;
62 for (argv += 2, argc -= 2; argc && spb < spb_end; --argc)
63 {
64 for (const char* p = *argv++; spb < spb_end && (*spb = *p++); spb++)
65 ;
66 *spb++ = ' ';
67 }
68 *--spb = 0;
69 fb_assert(spb < spb_end);
70 spb_buffer[2] = strlen(spb_buffer + 3);
71 }
72
73 SLONG* handle = NULL;
74 isc_service_attach(NULL, 0, service_path, &handle, (SSHORT) (spb - spb_buffer), spb_buffer);
75
76 SCHAR send_buffer[2048];
77
78 const char* send_items;
79 SSHORT send_item_length;
80 if (strstr(service_path, "start_cache"))
81 {
82 send_items = send_timeout;
83 send_item_length = sizeof(send_timeout);
84 }
85 else
86 {
87 send_items = send_buffer;
88 send_item_length = 0;
89 }
90
91 if (send_item_length)

Callers

nothing calls this directly

Calls 2

putcharFunction · 0.85
fgetsFunction · 0.85

Tested by

no test coverage detected