From 5107125ce24e1efac196a97481d41a9a66673695 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 4 Mar 2002 01:43:48 +0000 Subject: changed fd_set variables around so no clash --- ax25rtd/Makefile.in | 4 ++-- ax25rtd/ax25rtctl.c | 24 ++++++++++++------------ ax25rtd/ax25rtd.c | 29 ++++++++++++++++------------- 3 files changed, 30 insertions(+), 27 deletions(-) (limited to 'ax25rtd') diff --git a/ax25rtd/Makefile.in b/ax25rtd/Makefile.in index 51ef919..d0fdb97 100644 --- a/ax25rtd/Makefile.in +++ b/ax25rtd/Makefile.in @@ -140,7 +140,7 @@ 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 ax25rtd/Makefile + cd $(top_srcdir) && $(AUTOMAKE) --foreign ax25rtd/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ @@ -275,7 +275,7 @@ distdir: $(DISTFILES) 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 ax25rtd/Makefile + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign ax25rtd/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ diff --git a/ax25rtd/ax25rtctl.c b/ax25rtd/ax25rtctl.c index 222ee61..59ed198 100644 --- a/ax25rtd/ax25rtctl.c +++ b/ax25rtd/ax25rtctl.c @@ -1,4 +1,4 @@ -/* $Id: ax25rtctl.c,v 1.2 2001/09/12 13:18:43 terry Exp $ +/* $Id: ax25rtctl.c,v 1.3 2002/03/04 01:43:49 csmall Exp $ * * Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com) * @@ -251,7 +251,7 @@ static void Version(void) int sock; char buf[256]; - printf("ax25rtctl $Revision: 1.2 $\n"); + printf("ax25rtctl $Revision: 1.3 $\n"); sock = open_socket(); wsock(sock, "version\n"); read(sock, buf, sizeof(buf)); @@ -263,31 +263,31 @@ static void debug(void) { int sock, n, k; unsigned char buf[256]; - fd_set fd_set, fd_set2; + fd_set read_fds, write_fds; struct timeval tv; sock = open_socket(); while (1) { - FD_ZERO(&fd_set); - FD_SET(0, &fd_set); - FD_SET(sock, &fd_set); + FD_ZERO(&read_fds); + FD_SET(0, &read_fds); + FD_SET(sock, &read_fds); - FD_ZERO(&fd_set2); - FD_SET(sock, &fd_set2); + FD_ZERO(&write_fds); + FD_SET(sock, &write_fds); tv.tv_sec = 0; tv.tv_usec = 0; - if (select(sock + 1, &fd_set, NULL, &fd_set2, &tv) < 0) { + if (select(sock + 1, &read_fds, NULL, &write_fds, &tv) < 0) { perror("socket gone"); exit(1); } - if (FD_ISSET(sock, &fd_set2)) + if (FD_ISSET(sock, &write_fds)) exit(0); - if (FD_ISSET(0, &fd_set)) { + if (FD_ISSET(0, &read_fds)) { n = read(0, buf, sizeof(buf)); if (n) { k = write(sock, buf, n); @@ -296,7 +296,7 @@ static void debug(void) } } - if (FD_ISSET(sock, &fd_set)) { + if (FD_ISSET(sock, &read_fds)) { n = read(sock, buf, sizeof(buf)); if (n) write(0, buf, n); diff --git a/ax25rtd/ax25rtd.c b/ax25rtd/ax25rtd.c index 7aaa17f..9351fef 100644 --- a/ax25rtd/ax25rtd.c +++ b/ax25rtd/ax25rtd.c @@ -1,4 +1,4 @@ -/* $Id: ax25rtd.c,v 1.2 2001/09/12 13:18:43 terry Exp $ +/* $Id: ax25rtd.c,v 1.3 2002/03/04 01:43:49 csmall Exp $ * * Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com) * @@ -28,6 +28,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -46,7 +50,6 @@ #include #endif -#include #ifdef HAVE_NETAX25_AX25_H #include #else @@ -63,7 +66,7 @@ #include "../pathnames.h" #include "ax25rtd.h" -const char *Version = "ax25rtd $Revision: 1.2 $"; +const char *Version = "ax25rtd $Revision: 1.3 $"; config *Config = NULL; int reload = 0; @@ -128,7 +131,7 @@ void daemon_shutdown(int reason) exit(reason); } -#define FD_MAX(fd) {fd_max = (fd > fd_max? fd : fd_max); FD_SET(fd, &fd_set);} +#define FD_MAX(fd) {fd_max = (fd > fd_max? fd : fd_max); FD_SET(fd, &read_fds);} int main(int argc, char **argv) { @@ -136,7 +139,7 @@ int main(int argc, char **argv) int size, s; int cntrl_s, cntrl_fd, cntrl_len; struct sockaddr_un cntrl_addr; - fd_set fd_set, fd_set2; + fd_set read_fds, write_fds; int fd_max; if (ax25_config_load_ports() == 0) { @@ -184,21 +187,21 @@ int main(int argc, char **argv) for (;;) { fd_max = 0; - FD_ZERO(&fd_set); - FD_ZERO(&fd_set2); + FD_ZERO(&read_fds); + FD_ZERO(&write_fds); FD_MAX(s); if (cntrl_fd > 0) { FD_MAX(cntrl_fd); - FD_SET(cntrl_fd, &fd_set2); + FD_SET(cntrl_fd, &write_fds); } else { FD_MAX(cntrl_s); } - if (select(fd_max + 1, &fd_set, NULL, &fd_set2, NULL) < 0) { + if (select(fd_max + 1, &read_fds, NULL, &write_fds, NULL) < 0) { if (errno == EINTR) /* woops! */ continue; - if (!FD_ISSET(cntrl_fd, &fd_set2)) { + if (!FD_ISSET(cntrl_fd, &write_fds)) { perror("select"); save_cache(); daemon_shutdown(1); @@ -210,7 +213,7 @@ int main(int argc, char **argv) } if (cntrl_fd > 0) { - if (FD_ISSET(cntrl_fd, &fd_set)) { + if (FD_ISSET(cntrl_fd, &read_fds)) { size = read(cntrl_fd, buf, sizeof(buf)); if (size > 0) { buf[size] = '\0'; @@ -220,7 +223,7 @@ int main(int argc, char **argv) cntrl_fd = -1; } } - } else if (FD_ISSET(cntrl_s, &fd_set)) { + } else if (FD_ISSET(cntrl_s, &read_fds)) { if ((cntrl_fd = accept(cntrl_s, (struct sockaddr *) &cntrl_addr, @@ -234,7 +237,7 @@ int main(int argc, char **argv) if (reload) reload_config(); - if (FD_ISSET(s, &fd_set)) + if (FD_ISSET(s, &read_fds)) ax25_receive(s); } -- cgit v1.2.3