From 628edceba5f1485ef7c4ef30fba93b4c0c0dd955 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Tue, 10 Apr 2001 01:57:46 +0000 Subject: Initial revision --- ax25ipd/Makefile.am | 2 +- ax25ipd/Makefile.in | 5 ++-- ax25ipd/ax25ipd.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++------- ax25ipd/process.c | 3 +++ 4 files changed, 73 insertions(+), 14 deletions(-) (limited to 'ax25ipd') diff --git a/ax25ipd/Makefile.am b/ax25ipd/Makefile.am index 93f90af..2c1acd6 100644 --- a/ax25ipd/Makefile.am +++ b/ax25ipd/Makefile.am @@ -5,7 +5,7 @@ man_MANS = ax25ipd.8 ax25ipd.conf.5 EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA) -docdir = /usr/doc/ax25-apps +docdir = ${datadir}/doc/ax25-apps doc_DATA = README.ax25ipd HISTORY.ax25ipd COPYING.ax25ipd CFLAGS = -DUSE_TERMIO diff --git a/ax25ipd/Makefile.in b/ax25ipd/Makefile.in index 31ea95c..513d44d 100644 --- a/ax25ipd/Makefile.in +++ b/ax25ipd/Makefile.in @@ -81,7 +81,7 @@ man_MANS = ax25ipd.8 ax25ipd.conf.5 EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA) -docdir = /usr/doc/ax25-apps +docdir = ${datadir}/doc/ax25-apps doc_DATA = README.ax25ipd HISTORY.ax25ipd COPYING.ax25ipd CFLAGS = -DUSE_TERMIO @@ -339,14 +339,13 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done - info-am: info: info-am dvi-am: diff --git a/ax25ipd/ax25ipd.c b/ax25ipd/ax25ipd.c index 107ad5f..e73f36b 100644 --- a/ax25ipd/ax25ipd.c +++ b/ax25ipd/ax25ipd.c @@ -17,6 +17,7 @@ #include #include +#include #include "../pathnames.h" #include "ax25ipd.h" @@ -26,6 +27,18 @@ jmp_buf restart_env; /* Prototypes */ void hupper(int); +int opt_version = 0; +int opt_loglevel = 0; +int opt_help = 0; +char opt_configfile[1024]; + +struct option options[] = { + "version", 0, &opt_version, 1, + "loglevel", 1, &opt_loglevel, 1, + "help", 0, &opt_help, 1, + "configfile", 1, NULL, 0, + 0,0,0,0 }; + int main(int argc, char **argv) { @@ -38,14 +51,58 @@ main(int argc, char **argv) signal(SIGINT, int_handler); signal(SIGTERM, term_handler); - /* Say hello to the world */ - greet_world(); - - /* Test arguments */ - if(argc>2){ - fprintf(stderr,"Usage: %s []\n",argv[0]); - exit(1); - } + while(1) { + int option_index = 0; + int c; + + c = getopt_long(argc, argv, "c:hl:v", options, &option_index); + if (c == -1) + break; + + switch (c) { + case 0: + break; + switch(option_index) { + case 0: case 2: + break; + case 1: + opt_loglevel = atoi(optarg); + break; + case 3: + strncpy(opt_configfile, optarg, 1023); + break; + + } + break; + case 'c' : + strncpy(opt_configfile, optarg, 1023); + break; + case 'v': + opt_version = 1; + break; + case 'l': + opt_loglevel = atoi(optarg); + break; + } + } + + if (optind < argc) { printf ("config %s\n", argv[optind++]); } + + if (opt_version == 1) { + greet_world(); + exit(0); + } + if (opt_help == 1) { + greet_world(); + printf ("Usage:\n"); + printf ("%s [flags]\n",argv[0]); + printf ("\nFlags:\n"); + printf (" --version, -v Print version of program\n"); + printf (" --help, -h This help screen\n"); + printf (" --loglevel NUM, -l NUM Set logging level to NUM\n"); + printf (" --configfile FILE, -c FILE Set confgiuration file to FILE\n"); + exit(0); + } /* Initialize all routines */ config_init(); @@ -55,7 +112,7 @@ main(int argc, char **argv) io_init(); /* read config file */ - config_read(argv[1]); + config_read(opt_configfile); /* print the current config and route info */ dump_config(); @@ -67,7 +124,7 @@ main(int argc, char **argv) /* if we get this far without error, let's fork off ! :-) */ if (!daemon_start(TRUE)) { - fprintf(stderr, "ax25ipd: cannot become a daemon\n"); + syslog(stderr, "ax25ipd: cannot become a daemon\n"); return 1; } diff --git a/ax25ipd/process.c b/ax25ipd/process.c index 20bae7f..fdf08ad 100644 --- a/ax25ipd/process.c +++ b/ax25ipd/process.c @@ -122,6 +122,9 @@ int l; /* Warning - assuming buffer has room for 2 bytes */ add_crc(buf, l); l+=2; send_ip(buf, l, ipaddr); + if (is_call_bcast(a)) { + send_broadcast(buf, l); + } } } -- cgit v1.2.3