diff options
Diffstat (limited to 'ax25ipd')
-rw-r--r-- | ax25ipd/Makefile.in | 74 | ||||
-rw-r--r-- | ax25ipd/ax25ipd.c | 19 | ||||
-rw-r--r-- | ax25ipd/ax25ipd.h | 8 | ||||
-rw-r--r-- | ax25ipd/config.c | 1 | ||||
-rw-r--r-- | ax25ipd/io.c | 1 | ||||
-rw-r--r-- | ax25ipd/kiss.c | 1 | ||||
-rw-r--r-- | ax25ipd/process.c | 1 | ||||
-rw-r--r-- | ax25ipd/routing.c | 3 |
8 files changed, 78 insertions, 30 deletions
diff --git a/ax25ipd/Makefile.in b/ax25ipd/Makefile.in index 9170cb9..cb1c4de 100644 --- a/ax25ipd/Makefile.in +++ b/ax25ipd/Makefile.in @@ -133,6 +133,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best +DEP_FILES = .deps/ax25ipd.P .deps/config.P .deps/crc.P .deps/io.P \ +.deps/kiss.P .deps/process.P .deps/routing.P SOURCES = $(ax25ipd_SOURCES) OBJECTS = $(ax25ipd_OBJECTS) @@ -140,9 +142,9 @@ all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .lo .o .obj .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps ax25ipd/Makefile + cd $(top_srcdir) && $(AUTOMAKE) --gnu ax25ipd/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -172,9 +174,6 @@ uninstall-sbinPROGRAMS: rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done -.c.o: - $(COMPILE) -c $< - # FIXME: We should only use cygpath when building on Windows, # and only if it is available. .c.obj: @@ -197,9 +196,6 @@ distclean-compile: maintainer-clean-compile: -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< @@ -345,6 +341,11 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = ax25ipd distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ax25ipd/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ @@ -355,6 +356,38 @@ distdir: $(DISTFILES) || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp info-am: info: info-am dvi-am: @@ -393,27 +426,27 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ - clean-generic mostlyclean-am + clean-depend clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-sbinPROGRAMS distclean-compile \ - distclean-libtool distclean-tags distclean-generic \ - clean-am + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -426,12 +459,13 @@ clean-compile maintainer-clean-compile mostlyclean-libtool \ distclean-libtool clean-libtool maintainer-clean-libtool install-man5 \ uninstall-man5 install-man8 uninstall-man8 install-man uninstall-man \ uninstall-docDATA install-docDATA tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean installconf: $(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR) diff --git a/ax25ipd/ax25ipd.c b/ax25ipd/ax25ipd.c index b75843e..8757e17 100644 --- a/ax25ipd/ax25ipd.c +++ b/ax25ipd/ax25ipd.c @@ -14,6 +14,7 @@ #include <stdio.h> #include <signal.h> #include <setjmp.h> +#include <syslog.h> #include <netax25/daemon.h> #include <config.h> @@ -29,6 +30,7 @@ void hupper(int); int opt_version = 0; int opt_loglevel = 0; +int opt_nofork = 0; int opt_help = 0; char opt_configfile[1024]; @@ -37,6 +39,7 @@ struct option options[] = { "loglevel", 1, &opt_loglevel, 1, "help", 0, &opt_help, 1, "configfile", 1, NULL, 0, + "nofork", 0, &opt_nofork, 1, 0, 0, 0, 0 }; @@ -55,7 +58,7 @@ int main(int argc, char **argv) int option_index = 0; int c; - c = getopt_long(argc, argv, "c:hl:v", options, &option_index); + c = getopt_long(argc, argv, "c:fhl:v", options, &option_index); if (c == -1) break; @@ -78,6 +81,8 @@ int main(int argc, char **argv) case 'c': strncpy(opt_configfile, optarg, 1023); break; + case 'f': + opt_nofork = 1; case 'v': opt_version = 1; break; @@ -107,6 +112,8 @@ int main(int argc, char **argv) (" --loglevel NUM, -l NUM Set logging level to NUM\n"); printf (" --configfile FILE, -c FILE Set configuration file to FILE\n"); + printf + (" --nofork, -f Do not put daemon in background\n"); exit(0); } @@ -129,10 +136,12 @@ int main(int argc, char **argv) io_open(); /* if we get this far without error, let's fork off ! :-) */ - if (!daemon_start(TRUE)) { - syslog(stderr, "ax25ipd: cannot become a daemon\n"); - return 1; - } + if (opt_nofork == 0) { + if (!daemon_start(TRUE)) { + syslog(LOG_DAEMON | LOG_CRIT, "ax25ipd: cannot become a daemon\n"); + return 1; + } + } /* and let the games begin */ io_start(); diff --git a/ax25ipd/ax25ipd.h b/ax25ipd/ax25ipd.h index 76a25b6..de845b8 100644 --- a/ax25ipd/ax25ipd.h +++ b/ax25ipd/ax25ipd.h @@ -109,10 +109,10 @@ struct { #define MAX_FRAME 2048 -#define LOGL1 if(loglevel>0)(void)printf -#define LOGL2 if(loglevel>1)(void)printf -#define LOGL3 if(loglevel>2)(void)printf -#define LOGL4 if(loglevel>3)(void)printf +#define LOGL1(arg...) if(loglevel>0)syslog(LOG_DAEMON | LOG_WARNING, ##arg) +#define LOGL2(arg...) if(loglevel>1)syslog(LOG_DAEMON | LOG_WARNING, ##arg) +#define LOGL3(arg...) if(loglevel>2)syslog(LOG_DAEMON | LOG_WARNING, ##arg) +#define LOGL4(arg...) if(loglevel>3)(void)syslog(LOG_DAEMON | LOG_DEBUG, ##arg) #define AXRT_BCAST 1 #define AXRT_DEFAULT 2 diff --git a/ax25ipd/config.c b/ax25ipd/config.c index 063ca37..d78a333 100644 --- a/ax25ipd/config.c +++ b/ax25ipd/config.c @@ -20,6 +20,7 @@ #include <ctype.h> #include <sys/socket.h> #include <netinet/in.h> +#include <syslog.h> #include "ax25ipd.h" /* Initialize the config table */ diff --git a/ax25ipd/io.c b/ax25ipd/io.c index ae2ab77..ec8de4a 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <syslog.h> #ifdef __bsdi__ #define USE_TERMIOS diff --git a/ax25ipd/kiss.c b/ax25ipd/kiss.c index b43d969..a93b63e 100644 --- a/ax25ipd/kiss.c +++ b/ax25ipd/kiss.c @@ -13,6 +13,7 @@ */ #include <stdio.h> +#include <syslog.h> #include "ax25ipd.h" #define FEND 0xc0 diff --git a/ax25ipd/process.c b/ax25ipd/process.c index 5767129..52dbf72 100644 --- a/ax25ipd/process.c +++ b/ax25ipd/process.c @@ -14,6 +14,7 @@ #include "ax25ipd.h" #include <stdio.h> +#include <syslog.h> /* if dual port the upper nibble will have a value of 1 (not 0) */ #define FROM_PORT2(p) (((*(p+1))&0x10)!=0) #define FOR_PORT2(p) (addrmatch(p,mycallsign2) || addrmatch(p,myalias2)) diff --git a/ax25ipd/routing.c b/ax25ipd/routing.c index b3af836..990c693 100644 --- a/ax25ipd/routing.c +++ b/ax25ipd/routing.c @@ -11,6 +11,7 @@ #include <sys/types.h> #include <netinet/in.h> #include <memory.h> +#include <syslog.h> /* The routing table structure is not visible outside this module. */ @@ -94,7 +95,7 @@ unsigned int flags; route_tbl = rn; /* Log this entry ... */ - LOGL4("added route: %s\t%s\t%s\t%d\t%d\n", + LOGL4("added route: %s %s %s %d %d\n", call_to_a(rn->callsign), (char *) inet_ntoa(*(struct in_addr *) rn->ip_addr), rn->udp_port ? "udp" : "ip", ntohs(rn->udp_port), flags); |