MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / alice

Function alice

src/alice/alice.cpp:130–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128//
129
130int 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)

Callers 2

ALICE_mainFunction · 0.85
CLIB_ROUTINE mainFunction · 0.85

Calls 15

ALICE_errorFunction · 0.85
ALICE_printFunction · 0.85
ALICE_upper_caseFunction · 0.85
fetchPasswordFunction · 0.85
ALICE_exitFunction · 0.85
EXE_two_phaseFunction · 0.85
EXE_actionFunction · 0.85
ALICE_print_statusFunction · 0.85
copyStatusFunction · 0.85
findSwitchMethod · 0.80
SafeArgClass · 0.50
getParallelWorkersMethod · 0.45

Tested by

no test coverage detected