Last change
on this file was
9899,
checked in by epruesse, 11 years ago
|
pass down argc/argv to AW_root::AW_root (for GTK)
GTK will pick its parameters (e.g. —g-fatal-warnings) from argv and
remove them, hence argv must not be const and AW_root() should
be called before command line parsing (if possible).
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.8 KB
|
Line | |
---|
1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : arb_notify.cxx // |
---|
4 | // Purpose : report termination of external jobs to ARB // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in May 2007 // |
---|
7 | // Institute of Microbiology (Technical University Munich) // |
---|
8 | // http://www.arb-home.de/ // |
---|
9 | // // |
---|
10 | // =============================================================== // |
---|
11 | |
---|
12 | #include <arbdbt.h> |
---|
13 | |
---|
14 | int ARB_main(int argc, char *argv[]) { |
---|
15 | if (argc == 1) { |
---|
16 | fprintf(stderr, "Usage: arb_notify ID \"message\"\n"); |
---|
17 | fprintf(stderr, "Used by ARB itself to report termination of external jobs - see GB_notify()\n"); |
---|
18 | return -1; |
---|
19 | } |
---|
20 | |
---|
21 | const char *progname = argv[0]; |
---|
22 | if (!progname || progname[0] == 0) progname = "arb_notify"; |
---|
23 | |
---|
24 | GB_shell shell; |
---|
25 | GBDATA *gb_main = GB_open(":", "r"); |
---|
26 | if (!gb_main) { |
---|
27 | fprintf(stderr, "%s: Can't notify (connect to ARB failed)\n", progname); |
---|
28 | } |
---|
29 | else { |
---|
30 | char *the_message = strdup(argv[2]); |
---|
31 | const char *idstr = argv[1]; |
---|
32 | int id = atoi(idstr); |
---|
33 | GB_ERROR error = 0; |
---|
34 | |
---|
35 | if (!id) { |
---|
36 | error = GBS_global_string("Illegal ID '%s'", idstr); |
---|
37 | } |
---|
38 | |
---|
39 | if (!error) { |
---|
40 | GB_transaction ta(gb_main); |
---|
41 | error = GB_notify(gb_main, id, the_message); |
---|
42 | } |
---|
43 | |
---|
44 | free(the_message); |
---|
45 | |
---|
46 | if (error) { |
---|
47 | GBT_message(gb_main, GBS_global_string("Error in %s: %s", progname, error)); |
---|
48 | } |
---|
49 | GB_close(gb_main); |
---|
50 | } |
---|
51 | |
---|
52 | return 0; |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.