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

Function parse_cmd_line

src/utilities/ibmgr/ibmgr.cpp:840–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839
840static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd)
841{
842/**************************************
843 *
844 * p a r s e _ c m d _ l i n e
845 *
846 **************************************
847 *
848 * Functional description
849 * Parses the command line. After it was parsed
850 * executes commands that do require server access
851 * (help, show, etc.) and checks some conditions
852 * for other command.
853 *
854 * returns:
855 *
856 * FB_SUCCESS on normal completion,
857 * ACT_QUIT if user chooses to quit
858 * ACT_PROMT used by main() to switch into
859 * the prompt mode
860 * ACT_NONE on error or
861 * if no further actions necessary
862 * (like help, version, etc.)
863 *
864 **************************************/
865 TEXT msg[MSG_LEN];
866 bool quitflag = false;
867
868 ibmgr_data.operation = OP_NONE;
869 ibmgr_data.suboperation = SOP_NONE;
870 ibmgr_data.par_entered = 0;
871
872 SSHORT ret = get_switches(argc, argv, ibmgr_in_sw_table, &ibmgr_data, &quitflag, zapPasswd);
873 if (ret != FB_SUCCESS)
874 {
875 if (ret == ERR_SYNTAX)
876 {
877 SRVRMGR_msg_get(MSG_SYNTAX, msg);
878 fprintf(OUTFILE, "%s\n", msg);
879 }
880 return ACT_NONE;
881 }
882 switch (ibmgr_data.operation)
883 {
884 case OP_SHUT:
885 if (strcmp(ibmgr_data.user, DBA_USER_NAME))
886 {
887 SRVRMGR_msg_get(MSG_NOPERM, msg);
888 fprintf(OUTFILE, "%s\n", msg);
889 ret = ACT_NONE;
890 break;
891 }
892 // The only allowed suboperation when shutdown
893 // has been started is to IGNORE it.
894 if (ibmgr_data.shutdown && ibmgr_data.suboperation != SOP_SHUT_IGN)
895 {
896 SRVRMGR_msg_get(MSG_SHUTDOWN, msg);
897 fprintf(OUTFILE, "%s\n", msg);

Callers 1

CLIB_ROUTINE mainFunction · 0.70

Calls 4

SRVRMGR_msg_getFunction · 0.85
print_helpFunction · 0.85
print_configFunction · 0.85
get_switchesFunction · 0.70

Tested by

no test coverage detected