1 /***********************************************************************
7 * Copyright (C) 2002 by Roaring Penguin Software Inc.
9 * This software may be distributed under the terms of the GNU General
10 * Public License, Version 2, or (at your option) any later version.
14 ***********************************************************************/
16 static char const RCSID
[] =
17 "$Id: main.c,v 1.1.48.1 2005/08/08 12:05:25 honor Exp $";
28 usage(int argc
, char *argv
[], int exitcode
)
30 fprintf(stderr
, "\nl2tpd Version %s Copyright 2002 Roaring Penguin Software Inc.\n", VERSION
);
31 fprintf(stderr
, "http://www.roaringpenguin.com/\n\n");
32 fprintf(stderr
, "Usage: %s [options]\n", argv
[0]);
33 fprintf(stderr
, "Options:\n");
34 fprintf(stderr
, "-d level -- Set debugging to 'level'\n");
35 fprintf(stderr
, "-f -- Do not fork\n");
36 fprintf(stderr
, "-h -- Print usage\n");
37 fprintf(stderr
, "\nThis program is licensed under the terms of\nthe GNU General Public License, Version 2.\n");
42 main(int argc
, char *argv
[])
44 EventSelector
*es
= Event_CreateSelector();
50 while((opt
= getopt(argc
, argv
, "d:fh")) != -1) {
53 usage(argc
, argv
, EXIT_SUCCESS
);
59 sscanf(optarg
, "%d", &debugmask
);
62 usage(argc
, argv
, EXIT_FAILURE
);
69 l2tp_debug_set_bitmask(debugmask
);
71 if (l2tp_parse_config_file(es
, "/tmp/l2tp.conf") < 0) { //2005-04-14 by kanki
75 if (!l2tp_network_init(es
)) {
91 signal(SIGHUP
, SIG_IGN
);
102 /* Point stdin/stdout/stderr to /dev/null */
103 for (i
=0; i
<3; i
++) {
106 i
= open("/dev/console", O_RDWR
); //2005-04-14 by kanki for debugging
116 i
= Event_HandleEvent(es
);
118 fprintf(stderr
, "Event_HandleEvent returned %d\n", i
);