SCCS-vsn: usr.bin/telnet/ring.c 1.9
SCCS-vsn: usr.bin/telnet/terminal.c 1.12
SCCS-vsn: usr.bin/telnet/network.c 1.12
SCCS-vsn: usr.bin/telnet/ring.h 1.7
SCCS-vsn: usr.bin/telnet/externs.h 1.10
SCCS-vsn: usr.bin/telnet/tn3270.c 1.11
SCCS-vsn: usr.bin/telnet/telnet.c 5.32
SCCS-vsn: usr.bin/telnet/sys_bsd.c 1.12
SCCS-vsn: usr.bin/telnet/utilities.c 1.6
SCCS-vsn: usr.bin/telnet/main.c 1.7
SCCS-vsn: usr.bin/telnet/commands.c 1.6
-static char sccsid[] = "@(#)commands.c 1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)commands.c 1.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
arg = argv[1];
else {
printf("new escape character: ");
arg = argv[1];
else {
printf("new escape character: ");
arg = buf;
}
if (arg[0] != '\0')
arg = buf;
}
if (arg[0] != '\0')
if (!In3270) {
printf("Escape character is '%s'.\n", control(escape));
}
if (!In3270) {
printf("Escape character is '%s'.\n", control(escape));
}
crmod = !crmod;
printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
crmod = !crmod;
printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
{
setcommandmode();
#if defined(unix)
{
setcommandmode();
#if defined(unix)
+ (void) kill(0, SIGTSTP);
#endif /* defined(unix) */
/* reget parameters in case they were changed */
TerminalSaveState();
#endif /* defined(unix) */
/* reget parameters in case they were changed */
TerminalSaveState();
char *argv[]; /* arguments */
{
if (connected) {
char *argv[]; /* arguments */
{
if (connected) {
+ (void) shutdown(net, 2);
printf("Connection closed.\n");
printf("Connection closed.\n");
connected = 0;
/* reset options */
tninit();
connected = 0;
/* reset options */
tninit();
{
(void) call(bye, "bye", "fromquit", 0);
Exit(0);
{
(void) call(bye, "bye", "fromquit", 0);
Exit(0);
return 1; /* just to keep lint happy */
}
/*
* Print status about the connection.
*/
return 1; /* just to keep lint happy */
}
/*
* Print status about the connection.
*/
static
status(argc, argv)
int argc;
static
status(argc, argv)
int argc;
}
# if !defined(TN3270)
printf("Escape character is '%s'.\n", control(escape));
}
# if !defined(TN3270)
printf("Escape character is '%s'.\n", control(escape));
# else /* !defined(TN3270) */
if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
printf("Escape character is '%s'.\n", control(escape));
# else /* !defined(TN3270) */
if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
printf("Escape character is '%s'.\n", control(escape));
printf("Transparent mode command is '%s'.\n", transcom);
}
# endif /* defined(unix) */
printf("Transparent mode command is '%s'.\n", transcom);
}
# endif /* defined(unix) */
if (In3270) {
return 0;
}
if (In3270) {
return 0;
}
struct sockaddr_in sin;
struct servent *sp = 0;
static char hnamebuf[32];
struct sockaddr_in sin;
struct servent *sp = 0;
static char hnamebuf[32];
+ unsigned long inet_addr();
if (argc < 2) {
(void) strcpy(line, "Connect ");
printf("(to) ");
if (argc < 2) {
(void) strcpy(line, "Connect ");
printf("(to) ");
- gets(&line[strlen(line)]);
+ (void) gets(&line[strlen(line)]);
makeargv();
argc = margc;
argv = margv;
makeargv();
argc = margc;
argv = margv;
+#if !defined(htons)
+ u_short htons();
+#endif /* !defined(htons) */
+
sin.sin_port = atoi(argv[2]);
sin.sin_port = htons(sin.sin_port);
}
sin.sin_port = atoi(argv[2]);
sin.sin_port = htons(sin.sin_port);
}
if (sp == 0) {
sp = getservbyname("telnet", "tcp");
if (sp == 0) {
if (sp == 0) {
sp = getservbyname("telnet", "tcp");
if (sp == 0) {
- fprintf(stderr, "telnet: tcp/telnet: unknown service\n",1);
+ fprintf(stderr, "telnet: tcp/telnet: unknown service\n");
return 0;
}
sin.sin_port = sp->s_port;
return 0;
}
sin.sin_port = sp->s_port;
#if defined(h_addr) /* In 4.3, this is a #define */
if (host && host->h_addr_list[1]) {
int oerrno = errno;
#if defined(h_addr) /* In 4.3, this is a #define */
if (host && host->h_addr_list[1]) {
int oerrno = errno;
+ extern char *inet_ntoa();
fprintf(stderr, "telnet: connect to address %s: ",
inet_ntoa(sin.sin_addr));
fprintf(stderr, "telnet: connect to address %s: ",
inet_ntoa(sin.sin_addr));
}
connected++;
} while (connected == 0);
}
connected++;
} while (connected == 0);
- call(status, "status", "notmuch", 0);
+ (void) call(status, "status", "notmuch", 0);
if (setjmp(peerdied) == 0)
telnet();
if (setjmp(peerdied) == 0)
telnet();
ExitString("Connection closed by foreign host.\n",1);
/*NOTREACHED*/
}
ExitString("Connection closed by foreign host.\n",1);
/*NOTREACHED*/
}
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
- * @(#)externs.h 1.9 (Berkeley) %G%
+ * @(#)externs.h 1.10 (Berkeley) %G%
toplevel; /* For error conditions. */
extern void
toplevel; /* For error conditions. */
extern void
#if !defined(NOT43)
dosynch(),
#endif /* !defined(NOT43) */
#if !defined(NOT43)
dosynch(),
#endif /* !defined(NOT43) */
+ Dump(),
+ init_3270(),
+ printoption(),
+ printsub(),
+ setcommandmode(),
+ setneturg(),
+ sys_telnet_init(),
+ telnet(),
+ TerminalFlushOutput(),
+ TerminalNewMode(),
+ TerminalRestoreState(),
+ TerminalSaveState(),
+ tninit(),
+ upcase(),
+ willoption(),
+ wontoption();
#if defined(NOT43)
extern int
#if defined(NOT43)
extern int
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 1.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 1.7 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
main(argc, argv)
int argc;
char *argv[];
main(argc, argv)
int argc;
char *argv[];
if (argc != 1) {
if (setjmp(toplevel) != 0)
Exit(0);
if (argc != 1) {
if (setjmp(toplevel) != 0)
Exit(0);
+ if (tn(argc, argv) == 1) {
+ return 0;
+ } else {
+ return 1;
+ }
+ (void) setjmp(toplevel);
for (;;) {
#if !defined(TN3270)
command(1);
for (;;) {
#if !defined(TN3270)
command(1);
-static char sccsid[] = "@(#)network.c 1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)network.c 1.12 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
- ring_init(&netoring, netobuf, sizeof netobuf);
- ring_init(&netiring, netibuf, sizeof netibuf);
+ if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
+ exit(1);
+ }
+ if (ring_init(&netiring, netibuf, sizeof netibuf) != 1) {
+ exit(1);
+ }
if (value < 0) {
perror("select");
if (value < 0) {
perror("select");
}
if (FD_ISSET(net, &excepts)) {
return 1;
}
if (FD_ISSET(net, &excepts)) {
return 1;
-static char sccsid[] = "@(#)ring.c 1.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)ring.c 1.9 (Berkeley) %G%";
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
- * @(#)ring.h 1.6 (Berkeley) %G%
+ * @(#)ring.h 1.7 (Berkeley) %G%
ring_full_count(Ring *ring),
ring_full_consecutive(Ring *ring);
ring_full_count(Ring *ring),
ring_full_consecutive(Ring *ring);
+#else /* LINT_ARGS */
+extern int
+ ring_init();
+
+extern void
+ ring_supply_data(),
+ ring_consume_data();
+
+extern void
+ ring_supplied(),
+ ring_consumed();
+
+extern void
+ ring_clear_mark(),
+ ring_mark();
+
+extern int
+ ring_empty_count(),
+ ring_empty_consecutive(),
+ ring_full_count(),
+ ring_full_consecutive();
#endif /* defined(LINT_ARGS) */
#endif /* defined(LINT_ARGS) */
-static char sccsid[] = "@(#)sys_bsd.c 1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)sys_bsd.c 1.12 (Berkeley) %G%";
if (MODE_LINE(f)) {
void doescape();
if (MODE_LINE(f)) {
void doescape();
- signal(SIGTSTP, doescape);
+ (void) signal(SIGTSTP, (int (*)())doescape);
} else if (MODE_LINE(old)) {
} else if (MODE_LINE(old)) {
- signal(SIGTSTP, SIG_DFL);
+ (void) signal(SIGTSTP, SIG_DFL);
sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
}
}
sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
}
}
ioctl(fd, FIONBIO, (char *)&onoff);
}
ioctl(fd, FIONBIO, (char *)&onoff);
}
void
NetSigIO(fd, onoff)
int
void
NetSigIO(fd, onoff)
int
#endif /* defined(NOT43) */
ioctl(fd, SIOCSPGRP, (char *)&myPid); /* set my pid */
}
#endif /* defined(NOT43) */
ioctl(fd, SIOCSPGRP, (char *)&myPid); /* set my pid */
}
+#endif /*defined(TN3270)*/
\f
/*
* Various signal handling routines.
\f
/*
* Various signal handling routines.
int myPid;
#endif /* defined(TN3270) */
int myPid;
#endif /* defined(TN3270) */
- signal(SIGINT, intr);
- signal(SIGQUIT, intr2);
- signal(SIGPIPE, deadpeer);
+ (void) signal(SIGINT, (int (*)())intr);
+ (void) signal(SIGQUIT, (int (*)())intr2);
+ (void) signal(SIGPIPE, (int (*)())deadpeer);
#endif /* defined(TN3270) */
#if defined(SO_OOBINLINE)
#endif /* defined(TN3270) */
#if defined(SO_OOBINLINE)
- SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1);
+ if (SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1) == -1) {
+ perror("SetSockOpt");
+ }
#endif /* defined(SO_OOBINLINE) */
}
#endif /* defined(SO_OOBINLINE) */
}
-static char sccsid[] = "@(#)telnet.c 5.31 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnet.c 5.32 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
crmod,
netdata, /* Print out network data flow */
crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
crmod,
netdata, /* Print out network data flow */
crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
noasynch = 0, /* User specified "-noasynch" on command line */
askedSGA = 0, /* We have talked about suppress go ahead */
noasynch = 0, /* User specified "-noasynch" on command line */
askedSGA = 0, /* We have talked about suppress go ahead */
+#endif /* defined(TN3270) */
telnetport,
SYNCHing, /* we are in TELNET SYNCH mode */
flushout, /* flush output */
telnetport,
SYNCHing, /* we are in TELNET SYNCH mode */
flushout, /* flush output */
static void
printring(va_alist)
va_dcl
static void
printring(va_alist)
va_dcl
Scheduler(block)
int block; /* should we block in the select ? */
{
Scheduler(block)
int block; /* should we block in the select ? */
{
/* One wants to be a bit careful about setting returnValue
* to one, since a one implies we did some useful work,
* and therefore probably won't be called to block next
/* One wants to be a bit careful about setting returnValue
* to one, since a one implies we did some useful work,
* and therefore probably won't be called to block next
if (ring_full_count(&ttyiring)) {
# if defined(TN3270)
if (In3270) {
if (ring_full_count(&ttyiring)) {
# if defined(TN3270)
if (In3270) {
c = DataFromTerminal(ttyiring.consume,
ring_full_consecutive(&ttyiring));
if (c) {
c = DataFromTerminal(ttyiring.consume,
ring_full_consecutive(&ttyiring));
if (c) {
willoption(TELOPT_SGA, 0);
}
if (!myopts[TELOPT_TTYPE]) {
willoption(TELOPT_SGA, 0);
}
if (!myopts[TELOPT_TTYPE]) {
- dooption(TELOPT_TTYPE, 0);
+ dooption(TELOPT_TTYPE);
}
}
# endif /* !defined(TN3270) */
}
}
# endif /* !defined(TN3270) */
# endif /* !defined(TN3270) */
}
\f
# endif /* !defined(TN3270) */
}
\f
+#if 0 /* XXX - this not being in is a bug */
-static char sccsid[] = "@(#)terminal.c 1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)terminal.c 1.12 (Berkeley) %G%";
#endif /* not lint */
#include <arpa/telnet.h>
#endif /* not lint */
#include <arpa/telnet.h>
termFlushChar,
termIntChar,
termKillChar,
termFlushChar,
termIntChar,
termKillChar,
+#endif /* defined(MSDOS) */
- ring_init(&ttyoring, ttyobuf, sizeof ttyobuf);
- ring_init(&ttyiring, ttyibuf, sizeof ttyibuf);
+ if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
+ exit(1);
+ }
+ if (ring_init(&ttyiring, ttyibuf, sizeof ttyibuf) != 1) {
+ exit(1);
+ }
autoflush = TerminalAutoFlush();
}
autoflush = TerminalAutoFlush();
}
-static char sccsid[] = "@(#)tn3270.c 1.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)tn3270.c 1.11 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
-static char sccsid[] = "@(#)utilities.c 1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c 1.6 (Berkeley) %G%";
#endif /* not lint */
#define TELOPTS
#endif /* not lint */
#define TELOPTS
break;
default:
fprintf(NetTrace,
break;
default:
fprintf(NetTrace,
- "- unknown qualifier %d (0x%x).\n", pointer[1]);
+ "- unknown qualifier %d (0x%x).\n",
+ pointer[1], pointer[1]);