diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2015-05-02 00:19:09 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-05-02 00:19:09 +0200 |
commit | 56e847dae8f585254c6b336ea557bd75a0574711 (patch) | |
tree | 7e775ea62e06caa505e7ad017e17bbc0800d8ab3 /tcpip | |
parent | 62ceba5818d888041adbd466e8c67a8104bcf4fa (diff) | |
parent | 67d85b3d5cf145a5bf0a1431d6052473b017daa9 (diff) |
Merge branch 'master' of git://git.linux-ax25.org/pub/scm/ralf/ax25-tools
Conflicts:
ax25/axspawn.c
Diffstat (limited to 'tcpip')
-rw-r--r-- | tcpip/Makefile.am | 9 | ||||
-rw-r--r-- | tcpip/rip98d.c | 78 | ||||
-rw-r--r-- | tcpip/rip98r.c | 68 | ||||
-rw-r--r-- | tcpip/rip98t.c | 4 | ||||
-rw-r--r-- | tcpip/ttylinkd.8 | 8 | ||||
-rw-r--r-- | tcpip/ttylinkd.c | 206 | ||||
-rw-r--r-- | tcpip/ttylinkd.conf | 1 | ||||
-rw-r--r-- | tcpip/ttylinkd.conf.5 | 3 |
8 files changed, 187 insertions, 190 deletions
diff --git a/tcpip/Makefile.am b/tcpip/Makefile.am index 7a5a2cb..847c42f 100644 --- a/tcpip/Makefile.am +++ b/tcpip/Makefile.am @@ -10,11 +10,11 @@ installconf: sbin_PROGRAMS = rip98d ttylinkd -man_MANS = rip98d.conf.5 rip98d.8 ttylinkd.conf.5 ttylinkd.8 +dist_man_MANS = rip98d.conf.5 rip98d.8 ttylinkd.conf.5 ttylinkd.8 -doc_DATA= ttylinkd.README ttylinkd.INSTALL +dist_doc_DATA = ttylinkd.README ttylinkd.INSTALL -EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA) +EXTRA_DIST = $(etcfiles) rip98d_SOURCES = \ rip98d.c \ @@ -25,8 +25,7 @@ rip98d_SOURCES = \ rip98d_LDADD = $(AX25_LIB) INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ - diff --git a/tcpip/rip98d.c b/tcpip/rip98d.c index 8688177..ca9a7b5 100644 --- a/tcpip/rip98d.c +++ b/tcpip/rip98d.c @@ -30,13 +30,13 @@ struct dest_struct dest_list[50]; -int dest_count = 0; +int dest_count; int debug = FALSE; int route_restrict = FALSE; int logging = FALSE; -struct route_struct *first_route = NULL; +struct route_struct *first_route; static struct mask_struct { unsigned long int mask; @@ -83,14 +83,14 @@ static void terminate(int sig) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } unsigned int mask2bits(unsigned long int mask) { struct mask_struct *t; - + for (t = mask_table; t->mask != 0; t++) if (mask == t->mask) return t->bits; @@ -101,7 +101,7 @@ unsigned int mask2bits(unsigned long int mask) unsigned long int bits2mask(unsigned int bits) { struct mask_struct *t; - + for (t = mask_table; t->mask != 0; t++) if (bits == t->bits) return htonl(t->mask); @@ -168,7 +168,7 @@ static int read_routes(void) if (first_route != NULL) { route = first_route; - + while (route != NULL) { temp = route->next; free(route); @@ -177,7 +177,7 @@ static int read_routes(void) first_route = NULL; } - + if ((fp = fopen(PROC_IP_ROUTE_FILE, "r")) == NULL) { if (logging) syslog(LOG_ERR, "error cannot open %s\n", PROC_IP_ROUTE_FILE); @@ -196,7 +196,7 @@ static int read_routes(void) netmask = mask2bits(hex2intrev(mask_addr)); network = inet_netof(address); - + if (network == 0 || network == 127) { if (debug && logging) syslog(LOG_DEBUG, "rejecting route to %s/%ld - should not be propogated\n", inet_ntoa(address), netmask); @@ -225,9 +225,9 @@ static int read_routes(void) route->next = first_route; first_route = route; } - + fclose(fp); - + return TRUE; } @@ -236,12 +236,12 @@ static int load_dests(void) struct hostent *host; char buffer[255], *s; FILE *fp; - + if ((fp = fopen(CONF_RIP98D_FILE, "r")) == NULL) { fprintf(stderr, "rip98d: cannot open config file\n"); return FALSE; } - + while (fgets(buffer, 255, fp) != NULL) { if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; @@ -254,12 +254,12 @@ static int load_dests(void) memcpy((char *)&dest_list[dest_count].dest_addr, host->h_addr, host->h_length); dest_count++; } - + fclose(fp); if (dest_count == 0) return FALSE; - + return TRUE; } @@ -279,31 +279,31 @@ int main(int argc, char **argv) while ((i = getopt(argc, argv, "dlrt:v")) != -1) { switch (i) { - case 'd': - debug = TRUE; - break; - case 'l': - logging = TRUE; - break; - case 'r': - route_restrict = TRUE; - break; - case 't': - interval = atoi(optarg) * 60; - if (interval < 60 || interval > 7200) { - fprintf(stderr, "rip98d: invalid time interval\n"); - return 1; - } - break; - case 'v': - printf("rip98d: %s\n", VERSION); - return 0; - case ':': + case 'd': + debug = TRUE; + break; + case 'l': + logging = TRUE; + break; + case 'r': + route_restrict = TRUE; + break; + case 't': + interval = atoi(optarg) * 60; + if (interval < 60 || interval > 7200) { fprintf(stderr, "rip98d: invalid time interval\n"); return 1; - case '?': - fprintf(stderr, "usage: rip98d [-d] [-l] [-r] [-t interval] [-v]\n"); - return 1; + } + break; + case 'v': + printf("rip98d: %s\n", VERSION); + return 0; + case ':': + fprintf(stderr, "rip98d: invalid time interval\n"); + return 1; + case '?': + fprintf(stderr, "usage: rip98d [-d] [-l] [-r] [-t interval] [-v]\n"); + return 1; } } @@ -317,7 +317,7 @@ int main(int argc, char **argv) memset((char *)&loc_addr, 0, sizeof(loc_addr)); loc_addr.sin_family = AF_INET; loc_addr.sin_addr.s_addr = htonl(INADDR_ANY); - loc_addr.sin_port = htons(RIP_PORT); + loc_addr.sin_port = htons(RIP_PORT); if (bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)) < 0) { perror("rip98d: bind"); @@ -342,7 +342,7 @@ int main(int argc, char **argv) timeout.tv_sec = 60; timeout.tv_usec = 0; - + select(s + 1, &fdset, NULL, NULL, &timeout); if (!read_routes()) { diff --git a/tcpip/rip98r.c b/tcpip/rip98r.c index f8d8090..b1f283c 100644 --- a/tcpip/rip98r.c +++ b/tcpip/rip98r.c @@ -42,7 +42,7 @@ static int cmp_route(struct route_struct *route, struct in_addr addr, int bits, if (route->action == DEL_ROUTE || route->action == NEW_ROUTE) return UNMATCH_ROUTE; - + if (old_addr != new_addr) return UNMATCH_ROUTE; @@ -118,7 +118,7 @@ void receive_routes(int s) for (p = message + RIP98_HEADER; p < message + mess_len; p += RIP98_ENTRY) { memcpy((char *)&addr, (char *)p, sizeof(addr)); bits = p[4]; - metric = p[5]; + metric = p[5]; network = inet_netof(addr); @@ -140,7 +140,7 @@ void receive_routes(int s) syslog(LOG_DEBUG, " route to %s/%d metric %d\n", inet_ntoa(addr), bits, metric); metric++; - + if (metric > RIP98_INFINITY) metric = RIP98_INFINITY; @@ -151,37 +151,37 @@ void receive_routes(int s) switch (cmp_route(route, addr, bits, metric)) { - case NO_ROUTE: - matched = TRUE; - break; - - case REPLACE_ROUTE: - route->action = DEL_ROUTE; - - case ADDITIONAL_ROUTE: - if (!found) { - if ((new = malloc(sizeof(struct route_struct))) == NULL) { - if (logging) - syslog(LOG_ERR, "out of memory\n"); - return; - } - - new->addr = addr; - new->bits = bits; - new->metric = metric; - new->action = NEW_ROUTE; - - new->next = first_route; - first_route = new; - - found = TRUE; + case NO_ROUTE: + matched = TRUE; + break; + + case REPLACE_ROUTE: + route->action = DEL_ROUTE; + + case ADDITIONAL_ROUTE: + if (!found) { + if ((new = malloc(sizeof(struct route_struct))) == NULL) { + if (logging) + syslog(LOG_ERR, "out of memory\n"); + return; } - matched = TRUE; - break; + new->addr = addr; + new->bits = bits; + new->metric = metric; + new->action = NEW_ROUTE; + + new->next = first_route; + first_route = new; - default: - break; + found = TRUE; + } + + matched = TRUE; + break; + + default: + break; } } @@ -196,12 +196,12 @@ void receive_routes(int s) new->bits = bits; new->metric = metric; new->action = NEW_ROUTE; - + new->next = first_route; first_route = new; } } - + for (route = first_route; route != NULL; route = route->next) { if (route->action == DEL_ROUTE) { memset((char *)&rt, 0, sizeof(rt)); @@ -233,7 +233,7 @@ void receive_routes(int s) rt.rt_flags |= RTF_HOST; } else { netmask = bits2mask(route->bits); - + trg.sin_family = AF_INET; memcpy((char *)&trg.sin_addr, (char *)&netmask, sizeof(struct in_addr)); trg.sin_port = 0; diff --git a/tcpip/rip98t.c b/tcpip/rip98t.c index 2441c49..9fd78c6 100644 --- a/tcpip/rip98t.c +++ b/tcpip/rip98t.c @@ -45,7 +45,7 @@ void transmit_routes(int s) memset((char *)&rem_addr, 0, sizeof(rem_addr)); rem_addr.sin_family = AF_INET; rem_addr.sin_addr = dest_list[i].dest_addr; - rem_addr.sin_port = htons(RIP_PORT); + rem_addr.sin_port = htons(RIP_PORT); route = first_route; @@ -58,7 +58,7 @@ void transmit_routes(int s) memcpy(message + mess_len + 0, (char *)&route->addr, sizeof(struct in_addr)); message[mess_len + 4] = route->bits; message[mess_len + 5] = route->metric; - + mess_len += RIP98_ENTRY; } diff --git a/tcpip/ttylinkd.8 b/tcpip/ttylinkd.8 index bd427b6..0437626 100644 --- a/tcpip/ttylinkd.8 +++ b/tcpip/ttylinkd.8 @@ -1,6 +1,6 @@ .TH TTYLINKD 8 "5 March 1997" Linux "Linux System Managers Manual" .SH NAME -ttylinkd \- TTYlink daemon for AX.25, NET/ROM, ROSE and IP. +ttylinkd \- TTYlink daemon for AX.25, NET/ROM, ROSE and IP. .SH SYNOPSIS .B ttylinkd [-hv] [-c callsign] [-f file] .SH DESCRIPTION @@ -10,11 +10,11 @@ is a simple daemon that allows incoming ttylink calls to be routed through to Linux's normal talkd(8) system and provides a pipe between the two. .LP -.B ttylinkd +.B ttylinkd is usually setup to be spawned from ax25d(8) or inetd(8) but can, since version 0.03, be used on the command line, although talk(1) is a much better idea for interactive users. -.LP +.LP Use splitscreen(1) for outgoing ttylink sessions. .SH OPTIONS @@ -44,7 +44,7 @@ Use <file> for the configuration file, instead of the default .BR talkd (8). .SH BUGS .LP -There is still some need for some checking of who is still logged on. +There is still some need for some checking of who is still logged on. .LP The daemon may hang if you disconnect from it strangely. .LP diff --git a/tcpip/ttylinkd.c b/tcpip/ttylinkd.c index 792969e..c4399d5 100644 --- a/tcpip/ttylinkd.c +++ b/tcpip/ttylinkd.c @@ -7,13 +7,13 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have recieved a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge. MA 02139, USA. */ /* @@ -80,7 +80,7 @@ void read_config_file(int dummy); "look-up", "delete", "announce" }; -*/ +*/ static char *Responses[] = { "success", "sysop not logged on", @@ -112,18 +112,18 @@ int main(int argc, char *argv[]) struct sockaddr_rose *peer_srose; socklen_t sa_len, length; int i; - + /* Open up the system logger */ openlog(argv[0], LOG_PID, LOG_DAEMON); - + write(STDOUT_FILENO, version, strlen(version)); - + /* Work out who is calling us */ userfamily = AF_UNSPEC; memset(user, 0, NAME_SIZE); strcpy(sysop_addr, SYSOP_USER); strcpy(config_file, CONF_TTYLINKD_FILE); - for(i=1 ; i < argc ; i++) + for (i=1 ; i < argc ; i++) { if (argv[i][0] == '-') { @@ -163,60 +163,60 @@ int main(int argc, char *argv[]) break; } /*switch */ } /* - */ - } /* for */ + } /* for */ if (user[0] == '\0') { sa_len = sizeof(sa); - if (getpeername(STDOUT_FILENO, &sa, &sa_len) < 0) + if (getpeername(STDOUT_FILENO, &sa, &sa_len) < 0) { fprintf(stderr, "%s: getpeername() failed, you must specify a callsign in stdin mode.\n", argv[0]); syslog(LOG_CRIT | LOG_DAEMON, "main(): getpeername() failed."); return 0; } else { userfamily = sa.sa_family; - switch(sa.sa_family) { - case AF_INET: - peer_sin = (struct sockaddr_in*)&sa; - write(STDOUT_FILENO, buf, strlen(buf)); - sprintf(buf, "Please enter your callsign: "); - write(STDOUT_FILENO, buf, strlen(buf)); - fflush(stdout); - if (fgets(user, NAME_SIZE-1, stdin) == NULL) - return 0; - for (i = 0; user[i] != '\0' && user[i] != '\n' && user[i] != '\r'; i++) - ; - user[i] = '\0'; - if (strlen(user) < 1) - return 0; - userfamily = AF_INET; - break; - case AF_AX25: - case AF_NETROM: - peer_sax = (struct sockaddr_ax25*)&sa; - for(i=0 ; i < 6 ; i++) - { - user[i] = tolower(((peer_sax->sax25_call.ax25_call[i]) >>1)&0x7f); - if (user[i] == ' ') - break; - } - user[i] = '\0'; + switch (sa.sa_family) { + case AF_INET: + peer_sin = (struct sockaddr_in*)&sa; + write(STDOUT_FILENO, buf, strlen(buf)); + sprintf(buf, "Please enter your callsign: "); + write(STDOUT_FILENO, buf, strlen(buf)); + fflush(stdout); + if (fgets(user, NAME_SIZE-1, stdin) == NULL) + return 0; + for (i = 0; user[i] != '\0' && user[i] != '\n' && user[i] != '\r'; i++) + ; + user[i] = '\0'; + if (strlen(user) < 1) + return 0; + userfamily = AF_INET; + break; + case AF_AX25: + case AF_NETROM: + peer_sax = (struct sockaddr_ax25*)&sa; + for (i=0 ; i < 6 ; i++) + { + user[i] = tolower(((peer_sax->sax25_call.ax25_call[i]) >>1)&0x7f); + if (user[i] == ' ') break; - case AF_ROSE: - peer_srose = (struct sockaddr_rose*)&sa; - for(i=0 ; i < 6 ; i++) - { - user[i] = tolower(((peer_srose->srose_call.ax25_call[i]) >>1)&0x7f); - if (user[i] == ' ') - break; - } - user[i] = '\0'; + } + user[i] = '\0'; + break; + case AF_ROSE: + peer_srose = (struct sockaddr_rose*)&sa; + for (i=0 ; i < 6 ; i++) + { + user[i] = tolower(((peer_srose->srose_call.ax25_call[i]) >>1)&0x7f); + if (user[i] == ' ') break; - default: - syslog(LOG_DAEMON | LOG_CRIT, "Unsupported address family."); - exit(1); + } + user[i] = '\0'; + break; + default: + syslog(LOG_DAEMON | LOG_CRIT, "Unsupported address family."); + exit(1); } - - } + + } } /* argc */ /* Read the configuration file to find the System Operator. */ @@ -265,22 +265,22 @@ int main(int argc, char *argv[]) memset((char*)&msg_sa, 0, sizeof(msg_sa)); msg_sa.sa_family = AF_INET; - msg_sin = (struct sockaddr_in*)&msg_sa; + msg_sin = (struct sockaddr_in*)&msg_sa; msg_sin->sin_port = htons(0); memcpy((char*)&(msg_sin->sin_addr), phe->h_addr, phe->h_length); - + if ((skt = socket(PF_INET, SOCK_STREAM, 0)) < 0) { syslog(LOG_DAEMON | LOG_CRIT, "main(): socket() failed."); exit(1); } - + if (bind( skt, &msg_sa, sizeof(msg_sa)) != 0) { syslog(LOG_DAEMON | LOG_CRIT, "main(): bind() failed."); exit(1); } - + length = sizeof(msg_sa); if (getsockname(skt, &msg_sa, &length) < 0) { @@ -294,21 +294,21 @@ int main(int argc, char *argv[]) ctl_sin.sin_family = AF_INET; memcpy((char*)&ctl_sin.sin_addr, phe->h_addr, phe->h_length); ctl_sin.sin_port = htons(0); - + if ((ctl_skt = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { syslog(LOG_DAEMON | LOG_CRIT, "main(): socket() while attempting to create control socket."); close(skt); exit(1); } - + if (bind(ctl_skt, (struct sockaddr*)&ctl_sin, sizeof(ctl_sin)) != 0) { syslog(LOG_DAEMON | LOG_CRIT, "main(): Error when trying to bind() control socket."); close(skt); exit(1); } - + length = sizeof(ctl_sin); if (getsockname(ctl_skt, (struct sockaddr*)&ctl_sin, &length) < 0) { @@ -317,21 +317,21 @@ int main(int argc, char *argv[]) close(ctl_skt); exit(1); } - + /* Start talking to the talk daemon */ memset((char*)&msg, 0, sizeof(msg)); msg.vers = TALK_VERSION; msg.id_num = htonl(0); msg.addr.sa_family = ntohs(AF_INET); - memcpy(&(msg.ctl_addr), &msg_sa, sizeof(struct osockaddr)); + memcpy(&(msg.ctl_addr), &msg_sa, sizeof(struct osockaddr)); /*msg.ctl_addr = *(struct sockaddr*)&ctl_sin; msg.ctl_addr = *(struct sockaddr*)&ctl_sin;*/ msg.ctl_addr.sa_family = ntohs(AF_INET); msg.pid = htonl(getpid()); strncpy(msg.l_name, user, NAME_SIZE-1); strncpy(msg.r_name, sysop_user, NAME_SIZE-1); - - + + /* Now look for an invite */ msg.type = LOOK_UP; (void) send_control(ctl_skt, rem_addr, msg, &resp); @@ -348,7 +348,7 @@ int main(int argc, char *argv[]) printf("Cannot talk to sysop errno=%d.\n",i); else printf("Cannot talk to sysop, reason: %s.\n",Responses[i]); - + close(skt); close(ctl_skt); return 0; @@ -362,7 +362,7 @@ int main(int argc, char *argv[]) syslog(LOG_DAEMON | LOG_CRIT, "main(): Error when trying to listen() on socket."); exit(1); } - + /* Now we have to make an invitation for the other user */ msg.type = LEAVE_INVITE; if (send_control(ctl_skt, my_addr, msg, &resp) != SUCCESS) @@ -374,14 +374,14 @@ int main(int argc, char *argv[]) return 0; } local_id = resp.id_num; - + sprintf(buf, "Paging sysop.\n"); write(STDOUT_FILENO, buf, strlen(buf)); - + /* Wait for the sysop to connect to us */ signal(SIGALRM, alarm_handle); alarm(30); - + if ((new_skt = accept(skt, 0, 0)) < 0) { if (errno == EINTR) @@ -401,21 +401,21 @@ int main(int argc, char *argv[]) } alarm(0); signal(SIGALRM, SIG_DFL); - + close(skt); skt = new_skt; - + /* Delete invitations from both daemons */ msg.type = DELETE; msg.id_num = htonl(local_id); send_control(ctl_skt, my_addr, msg, &resp); msg.id_num = htonl(remote_id); send_control(ctl_skt, rem_addr, msg, &resp); - - sprintf(buf, "Sysop has responded.\n"); + + sprintf(buf, "Sysop has responded.\n"); write(STDOUT_FILENO, buf, strlen(buf)); - - /* + + /* * A little thing that they don't mention anywhere is the fact that the * first three characters on a connection are used to work out to erase, * kill and word erase characters. Nice to know eh? @@ -443,7 +443,7 @@ int main(int argc, char *argv[]) erasec = buf[0]; killc = buf[1]; werasec = buf[2]; - + /* Tell the sysop who this person is */ if (sa.sa_family == AF_AX25) { @@ -455,26 +455,26 @@ int main(int argc, char *argv[]) sprintf(buf, "Incoming ttylink from %s@%s.\n", user, inet_ntoa(peer_sin->sin_addr)); write(skt, buf, strlen(buf)); } - - + + do_talk(skt); close(skt); - close(ctl_skt); + close(ctl_skt); return 0; } /* * Used to send control messages to our friendly local talk daemon - */ + */ int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp) { fd_set fdvar; struct timeval timeout; struct sockaddr_in sin; - static int talk_port = 0; + static int talk_port; struct servent *pse; - + /* Look up talk port once only */ if (talk_port == 0) { @@ -492,7 +492,7 @@ int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp) sin.sin_addr = addr; sin.sin_family = AF_INET; sin.sin_port = talk_port; - + if (sendto(skt, (char*)&msg, sizeof(msg), 0, (struct sockaddr*)&sin, sizeof(sin)) != sizeof(msg)) { syslog(LOG_DAEMON | LOG_ERR, "send_control(): sendto failed (%m)."); @@ -504,23 +504,23 @@ int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp) FD_SET(skt, &fdvar); timeout.tv_sec = RING_WAIT; timeout.tv_usec = 0; - + if (select(32, &fdvar, NULL, NULL, &timeout) < 0) syslog(LOG_DAEMON | LOG_ERR, "send_control(): select failed. (%m)"); - + /* * The server is ignoring us, see ya later - */ + */ if (!(FD_ISSET(skt, &fdvar))) { printf("Talk server not responding after %d seconds, aborting.\n", RING_WAIT); return -1; } - + /* Get the message */ - if(recv(skt, resp, sizeof(resp),0) ==0) + if (recv(skt, resp, sizeof(resp),0) ==0) syslog(LOG_DAEMON | LOG_ERR, "send_control(): recv failed. (%m)"); - + return resp->answer; } @@ -530,8 +530,8 @@ int send_sysop_data(char *buf, int len) static char outbuf[82]; static char *bptr = outbuf; int i; - - for(i = 0; i < len; i++) + + for (i = 0; i < len; i++) { /* Check for erase character */ if (buf[i] == erasec) @@ -540,18 +540,18 @@ int send_sysop_data(char *buf, int len) bptr--; continue; } - + /* Check for kill character */ if (buf[i] == killc) { bptr = outbuf; continue; } - + /* Check for word-erase character */ if (buf[i] == werasec) { - while( (bptr > outbuf) && (*bptr != ' ') ) + while ( (bptr > outbuf) && (*bptr != ' ') ) bptr--; continue; } @@ -573,7 +573,7 @@ int send_sysop_data(char *buf, int len) *bptr = buf[i]; bptr++; } - + /* Check for carriage return, which means send it */ /* We also send if we have more than 80 characters */ if (buf[i] == '\n' || (bptr - outbuf) > 80 ) @@ -587,7 +587,7 @@ int send_sysop_data(char *buf, int len) } /* for */ return 0; } - + /* Used to process the data from the user - len must not exceed 256 */ int send_user_data(int skt, char *buf, int len) { @@ -595,7 +595,7 @@ int send_user_data(int skt, char *buf, int len) char *bptr = outbuf; int i; - for(i = 0; i < len; i++) + for (i = 0; i < len; i++) { if (buf[i] == '\r') { @@ -637,14 +637,14 @@ void do_talk(int skt) char inbuf[256], outbuf[256]; struct timeval timeout; int i; - - - while(1) + + + while (1) { FD_ZERO(&fdvar); FD_SET(skt, &fdvar); FD_SET(STDIN_FILENO, &fdvar); - + timeout.tv_sec = 30; timeout.tv_usec = 0; if (select(32, &fdvar, NULL, NULL, &timeout) == 0) @@ -654,7 +654,7 @@ void do_talk(int skt) if (ioctl(skt, FIONREAD, (struct sgttyb*)&i) < 0) return; } - + if (FD_ISSET(skt, &fdvar)) { if ((i = read(skt, inbuf, 256)) <= 0) @@ -686,12 +686,12 @@ void do_talk(int skt) } } } -} +} void alarm_handle(int i) { char buf[256]; - + strcpy(buf, "Sysop not responding.\n"); write(STDOUT_FILENO, buf, strlen(buf)); } @@ -701,13 +701,13 @@ void read_config_file(int dummy) char buf[128]; char param[20], value[108]; FILE *fp; - + if ( (fp = fopen(config_file, "r")) == NULL) { - syslog(LOG_DAEMON | LOG_ERR, "Cannot find configuration file: %s (%m)\n",config_file); + syslog(LOG_DAEMON | LOG_ERR, "Cannot find configuration file: %s (%m)\n",config_file); return; } /* Reset any variables here */ - + while ( fgets(buf, 128, fp) != NULL) { if ( buf[0] == '#') continue; diff --git a/tcpip/ttylinkd.conf b/tcpip/ttylinkd.conf index ae65749..8f581ff 100644 --- a/tcpip/ttylinkd.conf +++ b/tcpip/ttylinkd.conf @@ -7,4 +7,3 @@ # sysop=user # sysop=root - diff --git a/tcpip/ttylinkd.conf.5 b/tcpip/ttylinkd.conf.5 index 7af2dd8..d9a87ef 100644 --- a/tcpip/ttylinkd.conf.5 +++ b/tcpip/ttylinkd.conf.5 @@ -4,7 +4,7 @@ ttylinkd.conf \- ttylinkd configuration file. .SH DESCRIPTION .LP .B ttylinkd.conf -allows the super user to determine certain parameters with ttylinkd(8). +allows the super user to determine certain parameters with ttylinkd(8). Current there is only one field, with the view of not extending this further (ttylinkd is about a resourceful as it is going to get). .SH PARAMETERS @@ -19,4 +19,3 @@ launched. If you do not supply a hostname then the local host will be assumed. .BR ttylinkd (8). .SH AUTHOR Craig Small VK2XLZ <csmall@small.dropbear.id.au> - |