OpenSS7 SS7 for the Common Man |
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |
||||||||||||||||||||||||||
Home | Overview | Status | News | Documentation | Resources | About | |||||||||||||||||||||
File /code/strss7/daemons/ss7d/ss7d.cpp#ident "@(#) $Id: ss7d.cpp,v 0.8 2003/02/22 21:53:21 brian Exp $" static char const ident[] = "$Id: ss7d.cpp,v 0.8 2003/02/22 21:53:21 brian Exp $"; extern "C" { # include <ctype.h> # include <stdio.h> # include <sys/types.h> # include <signal.h> # include <getopt.h> # include <string.h> # include <errno.h> # include <sys/time.h> # include <unistd.h> } #include <iostream> #pragma implementation #include "ss7d.hh" extern "C" int ss7d_yydebug; extern "C" int ss7d_yyinit(void); extern "C" int ss7d_yyparse(void); extern "C" FILE * ss7d_yyin; extern void ss7d_usage(void); extern void ss7d_version(void); extern bool ss7d_interactive; int main(int argc, char **argv) { int c; char filename[128]; for (;;) { int option_index = 0; static struct option long_options[] = { {"file", 1, 0, 'f'}, {"help", 0, 0, 'h'}, {"quiet", 0, 0, 'q'}, {NULL, 0, 0, 0}, }; if ((c = getopt_long(argc, argv, "f:hq", long_options, &option_index)) < 0) break; switch (c) { case 0: switch (option_index) { case 0: // file strncpy(filename, optarg, 128); if ((ss7d_yyin == fopen(optarg, "r")) < 0) { strerror(errno); exit(1); } ss7d_interactive = false; break; case 1: // help ss7d_usage(); exit(0); case 2: // quiet ss7d_interactive = false; break; default: ss7d_usage(); exit(1); } break; case 'f': // file strncpy(filename, optarg, 128); if ((ss7d_yyin == fopen(optarg, "r")) < 0) { strerror(errno); exit(1); } ss7d_interactive = false; break; case 'h': // help ss7d_usage(); exit(0); case 'q': // quiet ss7d_usage(); exit(1); default: cerr.form("ERROR: Unrecognized option `%c'\n\n", c); ss7d_usage(); exit(1); } } if (optarg < argc) { cerr.form("ERROR: Option syntax: "); while (optind < argc) cerr.form("%s ", argv[optind++]); cerr.form("\n"); ss7d_usage(); exit(1); } if (ss7d_interactive) { ss7d_version(); } ss7d_yydebug = 0; ss7d_do_newline(); try { ss7d_yyinit(); while (ss7d_yyparse()) ; } catch(Error e) { e.print(); if (ss7d_child_pid) kill(ss7d_child_pid, 9); exit(1); } if (ss7d_child_pid) { kill(ss7d_child_pid, 9); ss7d_child_pid = 0; } if (ss7d_interactive) { cerr.form("\n"); cerr.form("SS7 Configuration Monitor done.\n"); cerr.form("\n"); } exit(0); }
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |