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

Function CLIB_ROUTINE main

src/utilities/install/install_client.cpp:65–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63};
64
65int CLIB_ROUTINE main( int argc, char **argv)
66{
67/**************************************
68 *
69 * m a i n
70 *
71 **************************************
72 *
73 * Functional description
74 * Installs the FBCLIENT.DLL or GDS32.DLL in the Windows system directory.
75 *
76 **************************************/
77
78 USHORT sw_command = COMMAND_NONE;
79 USHORT sw_client = CLIENT_NONE;
80 bool sw_force = false;
81 bool sw_version = false;
82
83 // Let's get the root directory from the instance path of this program.
84 // argv[0] is only _mostly_ guaranteed to give this info,
85 // so we GetModuleFileName()
86 TEXT directory[MAXPATHLEN];
87 USHORT len = GetModuleFileName(NULL, directory, sizeof(directory));
88 if (len == 0)
89 return inst_error(GetLastError(), "GetModuleFileName");
90
91 // Get to the last '\' (this one precedes the filename part). There is
92 // always one after a call to GetModuleFileName().
93 TEXT* p = directory + len;
94 do {--p;} while (*p != '\\');
95
96/* Instclient no longer strips the bin\\ part. This section can be removed after fb2.1.0 beta2
97 // Get to the previous '\' (this one should precede the supposed 'bin\\' part).
98 // There is always an additional '\' OR a ':'.
99 do {--p;} while (*p != '\\' && *p != ':');
100*/
101 *p = '\0';
102
103 const TEXT* const* const end = argv + argc;
104 while (++argv < end)
105 {
106 if (**argv != '-')
107 {
108 if (sw_command == COMMAND_NONE)
109 {
110 const TEXT* cmd;
111 int i;
112 for (i = 0; cmd = commands[i].name; i++)
113 {
114 const TEXT* q;
115 for (p = *argv, q = cmd; *p && UPPER(*p) == *q; p++, q++);
116 if (!*p && commands[i].abbrev <= (USHORT) (q - cmd))
117 break;
118 }
119 if (!cmd)
120 {
121 printf("Unknown command \"%s\"\n", *argv);
122 usage_exit();

Callers

nothing calls this directly

Calls 5

inst_errorFunction · 0.85
CLIENT_installFunction · 0.85
CLIENT_removeFunction · 0.85
CLIENT_queryFunction · 0.85
usage_exitFunction · 0.70

Tested by

no test coverage detected