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

Function parse_cmd_line

src/utilities/gsec/gsec.cpp:1399–1465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397
1398
1399static SSHORT parse_cmd_line(Firebird::UtilSvc::ArgvType& argv, tsec* tdsec)
1400{
1401/**************************************
1402 *
1403 * p a r s e _ c m d _ l i n e
1404 *
1405 **************************************
1406 *
1407 * Functional description
1408 * Read the command line
1409 * returns 0 on normal completion,
1410 * 1 if user chooses to quit
1411 * -1 on error or if user asks for help
1412 *
1413 **************************************/
1414 bool quitflag = false;
1415 UserData* user_data = tdsec->tsec_user_data;
1416 Firebird::LocalStatus s;
1417 Firebird::CheckStatusWrapper statusWrapper(&s);
1418
1419 user_data->clear(&statusWrapper);
1420 check(&statusWrapper);
1421
1422 // Call a subroutine to process the input line.
1423
1424 const Switches switches(gsec_in_sw_table, FB_NELEM(gsec_in_sw_table), false, true);
1425
1426 SSHORT ret = 0;
1427 if (!get_switches(argv, switches, tdsec, &quitflag))
1428 {
1429 GSEC_diag(GsecMsg16);
1430 // gsec - error in switch specifications
1431 ret = -1;
1432 }
1433 else if (user_data->operation())
1434 {
1435 switch (user_data->operation())
1436 {
1437 case HELP_OPER:
1438 printhelp();
1439 ret = -2;
1440 break;
1441 case OLD_DIS_OPER:
1442 case DIS_OPER:
1443 case QUIT_OPER:
1444 case MAP_SET_OPER:
1445 case MAP_DROP_OPER:
1446 // nothing
1447 break;
1448 default:
1449 if (!user_data->user.entered())
1450 {
1451 GSEC_error(GsecMsg18); // gsec - no user name specified
1452 ret = -1;
1453 }
1454 break;
1455 }
1456 }

Callers 1

gsecFunction · 0.70

Calls 8

GSEC_diagFunction · 0.85
printhelpFunction · 0.85
GSEC_errorFunction · 0.85
get_switchesFunction · 0.70
checkFunction · 0.50
clearMethod · 0.45
operationMethod · 0.45
enteredMethod · 0.45

Tested by

no test coverage detected