1
by Scott James Remnant
Import upstream version 0.1.0 |
1 |
/* upstart
|
2 |
*
|
|
3 |
* Copyright © 2006 Canonical Ltd.
|
|
4 |
* Author: Scott James Remnant <scott@ubuntu.com>.
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
#ifdef HAVE_CONFIG_H
|
|
22 |
# include <config.h>
|
|
23 |
#endif /* HAVE_CONFIG_H */ |
|
24 |
||
25 |
||
26 |
#include <stdio.h> |
|
27 |
#include <stdlib.h> |
|
28 |
||
29 |
#include <nih/macros.h> |
|
30 |
#include <nih/signal.h> |
|
31 |
#include <nih/main.h> |
|
32 |
#include <nih/option.h> |
|
33 |
#include <nih/logging.h> |
|
34 |
||
35 |
||
36 |
/**
|
|
37 |
* options:
|
|
38 |
*
|
|
39 |
* Command-line options accepted for all arguments.
|
|
40 |
**/
|
|
41 |
static NihOption options[] = { |
|
42 |
NIH_OPTION_LAST
|
|
43 |
};
|
|
44 |
||
45 |
||
46 |
int
|
|
47 |
main (int argc, |
|
48 |
char *argv[]) |
|
49 |
{
|
|
50 |
char **args; |
|
51 |
int ret; |
|
52 |
||
53 |
nih_main_init (argv[0]); |
|
54 |
||
55 |
args = nih_option_parser (NULL, argc, argv, options, FALSE); |
|
56 |
if (! args) |
|
57 |
exit (1); |
|
58 |
||
59 |
if (args[0] != NULL) { |
|
60 |
fprintf (stderr, _("%s: unexpected argument\n"), program_name); |
|
61 |
nih_main_suggest_help (); |
|
62 |
exit (1); |
|
63 |
}
|
|
64 |
||
65 |
||
66 |
nih_signal_set_handler (SIGTERM, nih_signal_handler); |
|
67 |
nih_signal_add_callback (NULL, SIGTERM, nih_main_term_signal, NULL); |
|
68 |
||
69 |
ret = nih_main_loop (); |
|
70 |
||
71 |
return ret; |
|
72 |
}
|