Debian Codegraph @

src/burp/main/burpMain.cpp

raw
1 /*
2 * PROGRAM: Firebird utilities
3 * MODULE: burpMain.cpp
4 * DESCRIPTION: Proxy for real gbak 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 "../burp/burp_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 static void atexit_fb_shutdown()
39 {
40 fb_shutdown(0, fb_shutrsn_app_stopped);
41 }
42
43 int CLIB_ROUTINE main(int argc, char* argv[])
44 {
45 /**************************************
46 *
47 * m a i n
48 *
49 **************************************
50 *
51 * Functional description
52 * Invoke real gbak main function
53 *
54 **************************************/
55 #ifdef HAVE_LOCALE_H
56 // Pick up the system locale to allow SYSTEM<->UTF8 conversions
57 setlocale(LC_CTYPE, "");
58 #endif
59 atexit(&atexit_fb_shutdown);
60
61 try
62 {
63 Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
64 return gbak(uSvc);
65 }
66 catch (const Firebird::Exception& ex)
67 {
68 Firebird::StaticStatusVector st;
69 ex.stuffException(st);
70 isc_print_status(st.begin());
71 }
72 return 1;
73 }