Debian Codegraph @

src/alice/main/aliceMain.cpp

raw
1 /*
2 * PROGRAM: Firebird utilities
3 * MODULE: aliceMain.cpp
4 * DESCRIPTION: Proxy for real alice main function
5 *
6 * The contents of this file are subject to the Initial
7 * Developer's Public License Version 1.0 (the "License");
8 * you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
11 *
12 * Software distributed under the License is distributed AS IS,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights
15 * and limitations under the License.
16 *
17 * The Original Code was created by Alex Peshkov
18 * for the Firebird Open Source RDBMS project.
19 *
20 * Copyright (c) 2007 Alex Peshkov <peshkoff at mail dot ru>
21 * and all contributors signed below.
22 *
23 * All Rights Reserved.
24 * Contributor(s): ______________________________________.
25 *
26 *
27 */
28
29 #include "firebird.h"
30 #include "../alice/alice_proto.h"
31 #include "../common/classes/auto.h"
32 #include "../common/SimpleStatusVector.h"
33
34 #ifdef HAVE_LOCALE_H
35 #include <locale.h>
36 #endif
37
38
39 static void atexit_fb_shutdown()
40 {
41 fb_shutdown(0, fb_shutrsn_app_stopped);
42 }
43
44 int CLIB_ROUTINE main(int argc, char* argv[])
45 {
46 /**************************************
47 *
48 * m a i n
49 *
50 **************************************
51 *
52 * Functional description
53 * Invoke real gfix main function
54 *
55 **************************************/
56 #ifdef HAVE_LOCALE_H
57 // Pick up the system locale to allow SYSTEM<->UTF8 conversions
58 setlocale(LC_CTYPE, "");
59 #endif
60 atexit(&atexit_fb_shutdown);
61
62 try
63 {
64 Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
65 return alice(uSvc);
66 }
67 catch (const Firebird::Exception& ex)
68 {
69 Firebird::StaticStatusVector st;
70 ex.stuffException(st);
71 isc_print_status(st.begin());
72 }
73 return 1;
74 }