clean up
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1653 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -31,25 +31,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
#include <sys/types.h>
|
||||
#include <arpa/telnet.h>
|
||||
#include <libtelnet/encrypt.h>
|
||||
#include <libtelnet/misc.h>
|
||||
|
||||
#include "general.h"
|
||||
#include "ring.h"
|
||||
#include "externs.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
|
||||
int
|
||||
net_write(unsigned char *str, int len)
|
||||
{
|
||||
@@ -63,7 +49,7 @@ net_write(unsigned char *str, int len)
|
||||
}
|
||||
|
||||
void
|
||||
net_encrypt()
|
||||
net_encrypt(void)
|
||||
{
|
||||
#if defined(ENCRYPTION)
|
||||
if (encrypt_output)
|
||||
@@ -74,7 +60,7 @@ net_encrypt()
|
||||
}
|
||||
|
||||
int
|
||||
telnet_spin()
|
||||
telnet_spin(void)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
@@ -97,7 +83,7 @@ telnet_gets(char *prompt, char *result, int length, int echo)
|
||||
if (echo) {
|
||||
printf("%s", prompt);
|
||||
res = fgets(result, length, stdin);
|
||||
} else if (res = getpass(prompt)) {
|
||||
} else if ((res = getpass(prompt))) {
|
||||
strncpy(result, res, length);
|
||||
res = result;
|
||||
}
|
||||
|
@@ -31,68 +31,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_SYSTM_H
|
||||
#include <netinet/in_systm.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IP_H
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_TELNET_H
|
||||
#include <arpa/telnet.h>
|
||||
#endif
|
||||
|
||||
#include "general.h"
|
||||
#include "ring.h"
|
||||
|
||||
#include "externs.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "libtelnet/misc-proto.h"
|
||||
|
||||
#include "roken.h"
|
||||
|
||||
#if defined(IPPROTO_IP) && defined(IP_TOS)
|
||||
int tos = -1;
|
||||
#endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
|
||||
@@ -129,7 +71,7 @@ makeargv()
|
||||
margc++;
|
||||
cp++;
|
||||
}
|
||||
while (c = *cp) {
|
||||
while ((c = *cp)) {
|
||||
int inquote = 0;
|
||||
while (isspace(c))
|
||||
c = *++cp;
|
||||
@@ -373,6 +315,9 @@ sendcmd(int argc, char **argv)
|
||||
return (count == success);
|
||||
}
|
||||
|
||||
static int
|
||||
send_tncmd(void (*func)(), char *cmd, char *name);
|
||||
|
||||
static int
|
||||
send_esc()
|
||||
{
|
||||
@@ -404,7 +349,7 @@ send_wontcmd(char *name)
|
||||
return(send_tncmd(send_wont, "wont", name));
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
send_tncmd(void (*func)(), char *cmd, char *name)
|
||||
{
|
||||
char **cpp;
|
||||
@@ -845,55 +790,26 @@ static struct setlist Setlist[] = {
|
||||
{ "tracefile", "file to write trace information to", SetNetTrace, (cc_t *)NetTraceFile},
|
||||
{ " ", "" },
|
||||
{ " ", "The following need 'localchars' to be toggled true", 0, 0 },
|
||||
{ "flushoutput", "character to cause an Abort Output", 0, termFlushCharp },
|
||||
{ "interrupt", "character to cause an Interrupt Process", 0, termIntCharp },
|
||||
{ "quit", "character to cause an Abort process", 0, termQuitCharp },
|
||||
{ "eof", "character to cause an EOF ", 0, termEofCharp },
|
||||
{ "flushoutput", "character to cause an Abort Output", 0, &termFlushChar },
|
||||
{ "interrupt", "character to cause an Interrupt Process", 0, &termIntChar },
|
||||
{ "quit", "character to cause an Abort process", 0, &termQuitChar },
|
||||
{ "eof", "character to cause an EOF ", 0, &termEofChar },
|
||||
{ " ", "" },
|
||||
{ " ", "The following are for local editing in linemode", 0, 0 },
|
||||
{ "erase", "character to use to erase a character", 0, termEraseCharp },
|
||||
{ "kill", "character to use to erase a line", 0, termKillCharp },
|
||||
{ "lnext", "character to use for literal next", 0, termLiteralNextCharp },
|
||||
{ "susp", "character to cause a Suspend Process", 0, termSuspCharp },
|
||||
{ "reprint", "character to use for line reprint", 0, termRprntCharp },
|
||||
{ "worderase", "character to use to erase a word", 0, termWerasCharp },
|
||||
{ "start", "character to use for XON", 0, termStartCharp },
|
||||
{ "stop", "character to use for XOFF", 0, termStopCharp },
|
||||
{ "forw1", "alternate end of line character", 0, termForw1Charp },
|
||||
{ "forw2", "alternate end of line character", 0, termForw2Charp },
|
||||
{ "ayt", "alternate AYT character", 0, termAytCharp },
|
||||
{ "erase", "character to use to erase a character", 0, &termEraseChar },
|
||||
{ "kill", "character to use to erase a line", 0, &termKillChar },
|
||||
{ "lnext", "character to use for literal next", 0, &termLiteralNextChar },
|
||||
{ "susp", "character to cause a Suspend Process", 0, &termSuspChar },
|
||||
{ "reprint", "character to use for line reprint", 0, &termRprntChar },
|
||||
{ "worderase", "character to use to erase a word", 0, &termWerasChar },
|
||||
{ "start", "character to use for XON", 0, &termStartChar },
|
||||
{ "stop", "character to use for XOFF", 0, &termStopChar },
|
||||
{ "forw1", "alternate end of line character", 0, &termForw1Char },
|
||||
{ "forw2", "alternate end of line character", 0, &termForw2Char },
|
||||
{ "ayt", "alternate AYT character", 0, &termAytChar },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if defined(CRAY) && !defined(__STDC__)
|
||||
/* Work around compiler bug in pcc 4.1.5 */
|
||||
void
|
||||
_setlist_init()
|
||||
{
|
||||
#ifndef KLUDGELINEMODE
|
||||
#define N 5
|
||||
#else
|
||||
#define N 6
|
||||
#endif
|
||||
Setlist[N+0].charp = &termFlushChar;
|
||||
Setlist[N+1].charp = &termIntChar;
|
||||
Setlist[N+2].charp = &termQuitChar;
|
||||
Setlist[N+3].charp = &termEofChar;
|
||||
Setlist[N+6].charp = &termEraseChar;
|
||||
Setlist[N+7].charp = &termKillChar;
|
||||
Setlist[N+8].charp = &termLiteralNextChar;
|
||||
Setlist[N+9].charp = &termSuspChar;
|
||||
Setlist[N+10].charp = &termRprntChar;
|
||||
Setlist[N+11].charp = &termWerasChar;
|
||||
Setlist[N+12].charp = &termStartChar;
|
||||
Setlist[N+13].charp = &termStopChar;
|
||||
Setlist[N+14].charp = &termForw1Char;
|
||||
Setlist[N+15].charp = &termForw2Char;
|
||||
Setlist[N+16].charp = &termAytChar;
|
||||
#undef N
|
||||
}
|
||||
#endif /* defined(CRAY) && !defined(__STDC__) */
|
||||
|
||||
static struct setlist *
|
||||
getset(char *name)
|
||||
{
|
||||
@@ -1129,7 +1045,7 @@ struct modelist {
|
||||
int arg1;
|
||||
};
|
||||
|
||||
static int modehelp();
|
||||
static int modehelp(void);
|
||||
|
||||
static struct modelist ModeList[] = {
|
||||
{ "character", "Disable LINEMODE option", docharmode, 1 },
|
||||
@@ -1165,7 +1081,7 @@ static struct modelist ModeList[] = {
|
||||
|
||||
|
||||
static int
|
||||
modehelp()
|
||||
modehelp(void)
|
||||
{
|
||||
struct modelist *mt;
|
||||
|
||||
@@ -1438,7 +1354,7 @@ struct slclist {
|
||||
int arg;
|
||||
};
|
||||
|
||||
static void slc_help();
|
||||
static void slc_help(void);
|
||||
|
||||
struct slclist SlcList[] = {
|
||||
{ "export", "Use local special character definitions",
|
||||
@@ -1453,7 +1369,7 @@ struct slclist SlcList[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
slc_help()
|
||||
slc_help(void)
|
||||
{
|
||||
struct slclist *c;
|
||||
|
||||
@@ -1511,16 +1427,7 @@ struct envlist {
|
||||
int narg;
|
||||
};
|
||||
|
||||
extern struct env_lst *
|
||||
env_define (unsigned char *, unsigned char *);
|
||||
extern void
|
||||
env_undefine (unsigned char *),
|
||||
env_export (unsigned char *),
|
||||
env_unexport (unsigned char *),
|
||||
env_send (unsigned char *),
|
||||
env_list (void);
|
||||
static void
|
||||
env_help (void);
|
||||
static void env_help (void);
|
||||
|
||||
struct envlist EnvList[] = {
|
||||
{ "define", "Define an environment variable",
|
||||
@@ -1621,14 +1528,14 @@ env_find(unsigned char *var)
|
||||
#endif
|
||||
|
||||
void
|
||||
env_init()
|
||||
env_init(void)
|
||||
{
|
||||
extern char **environ;
|
||||
char **epp, *cp;
|
||||
struct env_lst *ep;
|
||||
|
||||
for (epp = environ; *epp; epp++) {
|
||||
if (cp = strchr(*epp, '=')) {
|
||||
if ((cp = strchr(*epp, '='))) {
|
||||
*cp = '\0';
|
||||
ep = env_define((unsigned char *)*epp,
|
||||
(unsigned char *)cp+1);
|
||||
@@ -1642,8 +1549,8 @@ env_init()
|
||||
* hostname.
|
||||
*/
|
||||
if ((ep = env_find("DISPLAY"))
|
||||
&& ((*ep->value == ':')
|
||||
|| (strncmp((char *)ep->value, "unix:", 5) == 0))) {
|
||||
&& (*ep->value == ':'
|
||||
|| strncmp((char *)ep->value, "unix:", 5) == 0)) {
|
||||
char hbuf[256+1];
|
||||
char *cp2 = strchr((char *)ep->value, ':');
|
||||
|
||||
@@ -1681,7 +1588,7 @@ env_define(unsigned char *var, unsigned char *value)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var)) {
|
||||
if ((ep = env_find(var))) {
|
||||
if (ep->var)
|
||||
free(ep->var);
|
||||
if (ep->value)
|
||||
@@ -1706,7 +1613,7 @@ env_undefine(unsigned char *var)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var)) {
|
||||
if ((ep = env_find(var))) {
|
||||
ep->prev->next = ep->next;
|
||||
if (ep->next)
|
||||
ep->next->prev = ep->prev;
|
||||
@@ -1723,7 +1630,7 @@ env_export(unsigned char *var)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
ep->export = 1;
|
||||
}
|
||||
|
||||
@@ -1732,7 +1639,7 @@ env_unexport(unsigned char *var)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
ep->export = 0;
|
||||
}
|
||||
|
||||
@@ -1763,7 +1670,7 @@ env_send(unsigned char *var)
|
||||
}
|
||||
|
||||
void
|
||||
env_list()
|
||||
env_list(void)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
@@ -1783,7 +1690,7 @@ env_default(int init, int welldefined)
|
||||
return NULL;
|
||||
}
|
||||
if (nep) {
|
||||
while (nep = nep->next) {
|
||||
while ((nep = nep->next)) {
|
||||
if (nep->export && (nep->welldefined == welldefined))
|
||||
return(nep->var);
|
||||
}
|
||||
@@ -1796,7 +1703,7 @@ env_getvalue(unsigned char *var)
|
||||
{
|
||||
struct env_lst *ep;
|
||||
|
||||
if (ep = env_find(var))
|
||||
if ((ep = env_find(var)))
|
||||
return(ep->value);
|
||||
return(NULL);
|
||||
}
|
||||
@@ -1814,10 +1721,6 @@ struct authlist {
|
||||
int narg;
|
||||
};
|
||||
|
||||
extern int
|
||||
auth_enable (char *),
|
||||
auth_disable (char *),
|
||||
auth_status (void);
|
||||
static int
|
||||
auth_help (void);
|
||||
|
||||
@@ -1898,17 +1801,6 @@ struct encryptlist {
|
||||
int maxarg;
|
||||
};
|
||||
|
||||
extern int
|
||||
EncryptEnable (char *, char *),
|
||||
EncryptDisable (char *, char *),
|
||||
EncryptType (char *, char *),
|
||||
EncryptStart (char *),
|
||||
EncryptStartInput (void),
|
||||
EncryptStartOutput (void),
|
||||
EncryptStop (char *),
|
||||
EncryptStopInput (void),
|
||||
EncryptStopOutput (void),
|
||||
EncryptStatus (void);
|
||||
static int
|
||||
EncryptHelp (void);
|
||||
|
||||
@@ -2045,14 +1937,13 @@ status(int argc, char **argv)
|
||||
/*
|
||||
* Function that gets called when SIGINFO is received.
|
||||
*/
|
||||
ayt_status()
|
||||
void
|
||||
ayt_status(void)
|
||||
{
|
||||
call(status, "status", "notmuch", 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned long inet_addr();
|
||||
|
||||
static char *rcname = 0;
|
||||
static char rcbuf[128];
|
||||
|
||||
@@ -2148,7 +2039,7 @@ tn(int argc, char **argv)
|
||||
extern char *inet_ntoa();
|
||||
#if defined(IP_OPTIONS) && defined(IPPROTO_IP)
|
||||
char *srp = 0;
|
||||
unsigned long sourceroute(), srlen;
|
||||
int srlen;
|
||||
#endif
|
||||
char *cmd, *hostp = 0, *portp = 0, *user = 0;
|
||||
|
||||
@@ -2360,7 +2251,7 @@ tn(int argc, char **argv)
|
||||
user = getenv("USER");
|
||||
if (user == NULL ||
|
||||
((pw = k_getpwnam(user)) && pw->pw_uid != getuid())) {
|
||||
if (pw = k_getpwuid(getuid()))
|
||||
if ((pw = k_getpwuid(getuid())))
|
||||
user = pw->pw_name;
|
||||
else
|
||||
user = NULL;
|
||||
@@ -2376,6 +2267,7 @@ tn(int argc, char **argv)
|
||||
NetClose(net);
|
||||
ExitString("Connection closed by foreign host.\r\n",1);
|
||||
/*NOTREACHED*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define HELPINDENT (sizeof ("connect"))
|
||||
@@ -2404,7 +2296,7 @@ static char
|
||||
envhelp[] = "change environment variables ('environ ?' for more)",
|
||||
modestring[] = "try to enter line or character mode ('mode ?' for more)";
|
||||
|
||||
static int help();
|
||||
static int help(int argc, char **argv);
|
||||
|
||||
static Command cmdtab[] = {
|
||||
{ "close", closehelp, bye, 1 },
|
||||
@@ -2466,7 +2358,7 @@ static Command
|
||||
{
|
||||
Command *cm;
|
||||
|
||||
if (cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command)))
|
||||
if ((cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command))))
|
||||
return cm;
|
||||
return (Command *) genget(name, (char **) cmdtab2, sizeof(Command));
|
||||
}
|
||||
@@ -2618,9 +2510,6 @@ unsigned long
|
||||
sourceroute(char *arg, char **cpp, int *lenp)
|
||||
{
|
||||
static char lsr[44];
|
||||
#ifdef sysV88
|
||||
static IOPTN ipopt;
|
||||
#endif
|
||||
char *cp, *cp2, *lsrp, *lsrep;
|
||||
int tmp;
|
||||
struct in_addr sin_addr;
|
||||
@@ -2654,27 +2543,17 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
||||
* route or a strict source route, and fill in
|
||||
* the begining of the option.
|
||||
*/
|
||||
#ifndef sysV88
|
||||
if (*cp == '!') {
|
||||
cp++;
|
||||
*lsrp++ = IPOPT_SSRR;
|
||||
} else
|
||||
*lsrp++ = IPOPT_LSRR;
|
||||
#else
|
||||
if (*cp == '!') {
|
||||
cp++;
|
||||
ipopt.io_type = IPOPT_SSRR;
|
||||
} else
|
||||
ipopt.io_type = IPOPT_LSRR;
|
||||
#endif
|
||||
|
||||
if (*cp != '@')
|
||||
return((unsigned long)-1);
|
||||
|
||||
#ifndef sysV88
|
||||
lsrp++; /* skip over length, we'll fill it in later */
|
||||
*lsrp++ = 4;
|
||||
#endif
|
||||
|
||||
cp++;
|
||||
|
||||
@@ -2683,7 +2562,7 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
||||
for (c = 0;;) {
|
||||
if (c == ':')
|
||||
cp2 = 0;
|
||||
else for (cp2 = cp; c = *cp2; cp2++) {
|
||||
else for (cp2 = cp; (c = *cp2); cp2++) {
|
||||
if (c == ',') {
|
||||
*cp2++ = '\0';
|
||||
if (*cp2 == '@')
|
||||
@@ -2701,7 +2580,7 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
||||
|
||||
if ((tmp = inet_addr(cp)) != -1) {
|
||||
sin_addr.s_addr = tmp;
|
||||
} else if (host = gethostbyname(cp)) {
|
||||
} else if ((host = gethostbyname(cp))) {
|
||||
#if defined(h_addr)
|
||||
memmove(&sin_addr,
|
||||
host->h_addr_list[0],
|
||||
@@ -2726,7 +2605,6 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
||||
if (lsrp + 4 > lsrep)
|
||||
return((unsigned long)-1);
|
||||
}
|
||||
#ifndef sysV88
|
||||
if ((*(*cpp+IPOPT_OLEN) = lsrp - *cpp) <= 7) {
|
||||
*cpp = 0;
|
||||
*lenp = 0;
|
||||
@@ -2734,16 +2612,6 @@ sourceroute(char *arg, char **cpp, int *lenp)
|
||||
}
|
||||
*lsrp++ = IPOPT_NOP; /* 32 bit word align it */
|
||||
*lenp = lsrp - *cpp;
|
||||
#else
|
||||
ipopt.io_len = lsrp - *cpp;
|
||||
if (ipopt.io_len <= 5) { /* Is 3 better ? */
|
||||
*cpp = 0;
|
||||
*lenp = 0;
|
||||
return((unsigned long)-1);
|
||||
}
|
||||
*lenp = sizeof(ipopt);
|
||||
*cpp = (char *) &ipopt;
|
||||
#endif
|
||||
return(sin_addr.s_addr);
|
||||
}
|
||||
#endif
|
||||
|
@@ -35,27 +35,10 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#if defined(CRAY) && !defined(NO_BSD_SETJMP)
|
||||
#include <bsdsetjmp.h>
|
||||
#endif
|
||||
/* not with SunOS 4 */
|
||||
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILIO_H
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef BSD
|
||||
# define BSD 43
|
||||
#endif
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#ifndef _POSIX_VDISABLE
|
||||
# ifdef sun
|
||||
# include <sys/param.h> /* pick up VDISABLE definition, mayby */
|
||||
@@ -192,74 +175,182 @@ extern jmp_buf
|
||||
peerdied,
|
||||
toplevel; /* For error conditions. */
|
||||
|
||||
extern void
|
||||
command (int, char *, int),
|
||||
Dump (char, unsigned char *, int),
|
||||
printoption (char *, int, int),
|
||||
printsub (char, unsigned char *, int),
|
||||
sendnaws (void),
|
||||
setconnmode (int),
|
||||
setcommandmode (void),
|
||||
setneturg (void),
|
||||
sys_telnet_init (void),
|
||||
telnet (char *),
|
||||
tel_enter_binary (int),
|
||||
TerminalFlushOutput (void),
|
||||
TerminalNewMode (int),
|
||||
TerminalRestoreState (void),
|
||||
TerminalSaveState (void),
|
||||
tninit (void),
|
||||
willoption (int),
|
||||
wontoption (int);
|
||||
/* authenc.c */
|
||||
|
||||
extern void
|
||||
send_do (int, int),
|
||||
send_dont (int, int),
|
||||
send_will (int, int),
|
||||
send_wont (int, int);
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
int net_write(unsigned char *str, int len);
|
||||
void net_encrypt(void);
|
||||
int telnet_spin(void);
|
||||
char *telnet_getenv(char *val);
|
||||
char *telnet_gets(char *prompt, char *result, int length, int echo);
|
||||
#endif
|
||||
|
||||
extern void
|
||||
lm_will (unsigned char *, int),
|
||||
lm_wont (unsigned char *, int),
|
||||
lm_do (unsigned char *, int),
|
||||
lm_dont (unsigned char *, int),
|
||||
lm_mode (unsigned char *, int, int);
|
||||
/* commands.c */
|
||||
|
||||
extern void
|
||||
slc_init (void),
|
||||
slcstate (void),
|
||||
slc_mode_export (void),
|
||||
slc_mode_import (int),
|
||||
slc_import (int),
|
||||
slc_export (void),
|
||||
slc (unsigned char *, int),
|
||||
slc_check (void),
|
||||
slc_start_reply (void),
|
||||
slc_add_reply (unsigned char, unsigned char, cc_t),
|
||||
slc_end_reply (void);
|
||||
extern int
|
||||
slc_update (void);
|
||||
struct env_lst *env_define (unsigned char *, unsigned char *);
|
||||
struct env_lst *env_find(unsigned char *var);
|
||||
void env_init (void);
|
||||
void env_undefine (unsigned char *);
|
||||
void env_export (unsigned char *);
|
||||
void env_unexport (unsigned char *);
|
||||
void env_send (unsigned char *);
|
||||
void env_list (void);
|
||||
unsigned char * env_default(int init, int welldefined);
|
||||
unsigned char * env_getvalue(unsigned char *var);
|
||||
|
||||
extern void
|
||||
env_opt (unsigned char *, int),
|
||||
env_opt_start (void),
|
||||
env_opt_start_info (void),
|
||||
env_opt_add (unsigned char *),
|
||||
env_opt_end (int);
|
||||
void set_escape_char(char *s);
|
||||
unsigned long sourceroute(char *arg, char **cpp, int *lenp);
|
||||
|
||||
extern unsigned char
|
||||
*env_default (int, int),
|
||||
*env_getvalue (unsigned char *);
|
||||
#if defined(AUTHENTICATION)
|
||||
int auth_enable (char *);
|
||||
int auth_disable (char *);
|
||||
int auth_status (void);
|
||||
#endif
|
||||
|
||||
extern int
|
||||
get_status (void),
|
||||
dosynch (void);
|
||||
#if defined(ENCRYPTION)
|
||||
int EncryptEnable (char *, char *);
|
||||
int EncryptDisable (char *, char *);
|
||||
int EncryptType (char *, char *);
|
||||
int EncryptStart (char *);
|
||||
int EncryptStartInput (void);
|
||||
int EncryptStartOutput (void);
|
||||
int EncryptStop (char *);
|
||||
int EncryptStopInput (void);
|
||||
int EncryptStopOutput (void);
|
||||
int EncryptStatus (void);
|
||||
#endif
|
||||
|
||||
extern cc_t
|
||||
*tcval (int);
|
||||
#ifdef SIGINFO
|
||||
void ayt_status(void);
|
||||
#endif
|
||||
int tn(int argc, char **argv);
|
||||
void command(int top, char *tbuf, int cnt);
|
||||
|
||||
extern int quit (void);
|
||||
/* main.c */
|
||||
|
||||
void tninit(void);
|
||||
void usage(void);
|
||||
|
||||
/* network.c */
|
||||
|
||||
void init_network(void);
|
||||
int stilloob(void);
|
||||
void setneturg(void);
|
||||
int netflush(void);
|
||||
|
||||
/* sys_bsd.c */
|
||||
|
||||
void init_sys(void);
|
||||
int TerminalWrite(char *buf, int n);
|
||||
int TerminalRead(unsigned char *buf, int n);
|
||||
int TerminalAutoFlush(void);
|
||||
int TerminalSpecialChars(int c);
|
||||
void TerminalFlushOutput(void);
|
||||
void TerminalSaveState(void);
|
||||
void TerminalDefaultChars(void);
|
||||
void TerminalNewMode(int f);
|
||||
cc_t *tcval(int func);
|
||||
void TerminalSpeeds(long *ispeed, long *ospeed);
|
||||
int TerminalWindowSize(long *rows, long *cols);
|
||||
int NetClose(int fd);
|
||||
void NetNonblockingIO(int fd, int onoff);
|
||||
int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
|
||||
int poll);
|
||||
|
||||
/* telnet.c */
|
||||
|
||||
void init_telnet(void);
|
||||
|
||||
void tel_leave_binary(int rw);
|
||||
void tel_enter_binary(int rw);
|
||||
int opt_welldefined(char *ep);
|
||||
int telrcv(void);
|
||||
int rlogin_susp(void);
|
||||
void intp(void);
|
||||
void sendbrk(void);
|
||||
void sendabort(void);
|
||||
void sendsusp(void);
|
||||
void sendeof(void);
|
||||
void sendayt(void);
|
||||
|
||||
void xmitAO(void);
|
||||
void xmitEL(void);
|
||||
void xmitEC(void);
|
||||
|
||||
|
||||
void Dump (char, unsigned char *, int);
|
||||
void printoption (char *, int, int);
|
||||
void printsub (char, unsigned char *, int);
|
||||
void sendnaws (void);
|
||||
void setconnmode (int);
|
||||
void setcommandmode (void);
|
||||
void setneturg (void);
|
||||
void sys_telnet_init (void);
|
||||
void telnet (char *);
|
||||
void tel_enter_binary (int);
|
||||
void TerminalFlushOutput (void);
|
||||
void TerminalNewMode (int);
|
||||
void TerminalRestoreState (void);
|
||||
void TerminalSaveState (void);
|
||||
void tninit (void);
|
||||
void willoption (int);
|
||||
void wontoption (int);
|
||||
|
||||
|
||||
void send_do (int, int);
|
||||
void send_dont (int, int);
|
||||
void send_will (int, int);
|
||||
void send_wont (int, int);
|
||||
|
||||
void lm_will (unsigned char *, int);
|
||||
void lm_wont (unsigned char *, int);
|
||||
void lm_do (unsigned char *, int);
|
||||
void lm_dont (unsigned char *, int);
|
||||
void lm_mode (unsigned char *, int, int);
|
||||
|
||||
void slc_init (void);
|
||||
void slcstate (void);
|
||||
void slc_mode_export (void);
|
||||
void slc_mode_import (int);
|
||||
void slc_import (int);
|
||||
void slc_export (void);
|
||||
void slc (unsigned char *, int);
|
||||
void slc_check (void);
|
||||
void slc_start_reply (void);
|
||||
void slc_add_reply (unsigned char, unsigned char, cc_t);
|
||||
void slc_end_reply (void);
|
||||
int slc_update (void);
|
||||
|
||||
void env_opt (unsigned char *, int);
|
||||
void env_opt_start (void);
|
||||
void env_opt_start_info (void);
|
||||
void env_opt_add (unsigned char *);
|
||||
void env_opt_end (int);
|
||||
|
||||
unsigned char *env_default (int, int);
|
||||
unsigned char *env_getvalue (unsigned char *);
|
||||
|
||||
int get_status (void);
|
||||
int dosynch (void);
|
||||
|
||||
cc_t *tcval (int);
|
||||
|
||||
int quit (void);
|
||||
|
||||
/* terminal.c */
|
||||
|
||||
void init_terminal(void);
|
||||
int ttyflush(int drop);
|
||||
int getconnmode(void);
|
||||
|
||||
/* utilities.c */
|
||||
|
||||
int SetSockOpt(int fd, int level, int option, int yesno);
|
||||
void optionstatus(void);
|
||||
void EmptyTerminal(void);
|
||||
void SetForExit(void);
|
||||
void Exit(int returnCode);
|
||||
void ExitString(char *string, int returnCode);
|
||||
|
||||
extern struct termios new_tc;
|
||||
|
||||
@@ -323,23 +414,6 @@ extern cc_t termAytChar;
|
||||
# define termAytChar new_tc.c_cc[VSTATUS]
|
||||
#endif
|
||||
|
||||
# define termEofCharp &termEofChar
|
||||
# define termEraseCharp &termEraseChar
|
||||
# define termIntCharp &termIntChar
|
||||
# define termKillCharp &termKillChar
|
||||
# define termQuitCharp &termQuitChar
|
||||
# define termSuspCharp &termSuspChar
|
||||
# define termFlushCharp &termFlushChar
|
||||
# define termWerasCharp &termWerasChar
|
||||
# define termRprntCharp &termRprntChar
|
||||
# define termLiteralNextCharp &termLiteralNextChar
|
||||
# define termStartCharp &termStartChar
|
||||
# define termStopCharp &termStopChar
|
||||
# define termForw1Charp &termForw1Char
|
||||
# define termForw2Charp &termForw2Char
|
||||
# define termAytCharp &termAytChar
|
||||
|
||||
|
||||
/* Ring buffer structures which are shared */
|
||||
|
||||
extern Ring
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)fdset.h 8.1 (Berkeley) 6/6/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following is defined just in case someone should want to run
|
||||
* this telnet on a 4.2 system.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
|
||||
#define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n)))
|
||||
#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n)))
|
||||
#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n)))
|
||||
#define FD_ZERO(p) ((p)->fds_bits[0] = 0)
|
||||
|
||||
#endif
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)general.h 8.1 (Berkeley) 6/6/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some general definitions.
|
||||
*/
|
||||
|
||||
|
||||
#define numberof(x) (sizeof x/sizeof x[0])
|
||||
#define highestof(x) (numberof(x)-1)
|
||||
|
||||
#define ClearElement(x) memset((char *)&x, 0, sizeof x)
|
||||
#define ClearArray(x) memset((char *)x, 0, sizeof x)
|
@@ -37,21 +37,10 @@ static char copyright[] =
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "roken.h"
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ring.h"
|
||||
#include "externs.h"
|
||||
#include "defines.h"
|
||||
|
||||
/* These values need to be the same as defined in libtelnet/kerberos5.c */
|
||||
/* Either define them in both places, or put in some common header file. */
|
||||
#define OPTS_FORWARD_CREDS 0x00000002
|
||||
@@ -65,7 +54,7 @@ RCSID("$Id$");
|
||||
* Initialize variables.
|
||||
*/
|
||||
void
|
||||
tninit()
|
||||
tninit(void)
|
||||
{
|
||||
init_terminal();
|
||||
|
||||
@@ -76,7 +65,8 @@ tninit()
|
||||
init_sys();
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s %s%s%s%s\n", prompt,
|
||||
#ifdef AUTHENTICATION
|
||||
@@ -101,7 +91,8 @@ void usage(void)
|
||||
*/
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
char *user;
|
||||
@@ -116,7 +107,7 @@ int main(int argc, char **argv)
|
||||
|
||||
TerminalSaveState();
|
||||
|
||||
if (prompt = strrchr(argv[0], '/'))
|
||||
if ((prompt = strrchr(argv[0], '/')))
|
||||
++prompt;
|
||||
else
|
||||
prompt = argv[0];
|
||||
|
@@ -31,37 +31,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#elif defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "externs.h"
|
||||
#include "fdset.h"
|
||||
|
||||
Ring netoring, netiring;
|
||||
unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
|
||||
|
||||
@@ -69,8 +42,8 @@ unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
|
||||
* Initialize internal network data structures.
|
||||
*/
|
||||
|
||||
void
|
||||
init_network()
|
||||
void
|
||||
init_network(void)
|
||||
{
|
||||
if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
|
||||
exit(1);
|
||||
@@ -87,8 +60,8 @@ init_network()
|
||||
* Telnet "synch" processing).
|
||||
*/
|
||||
|
||||
int
|
||||
stilloob()
|
||||
int
|
||||
stilloob(void)
|
||||
{
|
||||
static struct timeval timeout = { 0 };
|
||||
fd_set excepts;
|
||||
@@ -119,8 +92,8 @@ stilloob()
|
||||
* Sets "neturg" to the current location.
|
||||
*/
|
||||
|
||||
void
|
||||
setneturg()
|
||||
void
|
||||
setneturg(void)
|
||||
{
|
||||
ring_mark(&netoring);
|
||||
}
|
||||
@@ -136,8 +109,8 @@ setneturg()
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
netflush()
|
||||
int
|
||||
netflush(void)
|
||||
{
|
||||
int n, n1;
|
||||
|
||||
|
@@ -31,10 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
@@ -49,24 +46,6 @@ RCSID("$Id$");
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include "ring.h"
|
||||
#include "general.h"
|
||||
|
||||
#include <roken.h>
|
||||
|
||||
/* Internal macros */
|
||||
|
||||
#define ring_subtract(d,a,b) (((a)-(b) >= 0)? \
|
||||
|
@@ -92,6 +92,8 @@ extern void
|
||||
ring_clearto (Ring *ring);
|
||||
#endif
|
||||
|
||||
extern int ring_at_mark(Ring *ring);
|
||||
|
||||
extern void
|
||||
ring_clear_mark(),
|
||||
ring_mark();
|
||||
ring_clear_mark(Ring *ring),
|
||||
ring_mark(Ring *ring);
|
||||
|
@@ -31,10 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
@@ -43,56 +40,6 @@ RCSID("$Id$");
|
||||
* (at least between 4.x and dos) which is used in telnet.c.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#elif defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_ARPA_TELNET_H
|
||||
#include <arpa/telnet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#else
|
||||
#ifdef HAVE_TERMIO_H
|
||||
#include <termio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <roken.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "fdset.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "externs.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
#ifdef SIGINFO
|
||||
extern RETSIGTYPE ayt_status();
|
||||
#endif
|
||||
|
||||
int
|
||||
tout, /* Output file descriptor */
|
||||
tin, /* Input file descriptor */
|
||||
@@ -125,15 +72,12 @@ extern struct termios new_tc;
|
||||
# define cfgetispeed(ptr) cfgetospeed(ptr)
|
||||
# endif
|
||||
# endif /* TCSANOW */
|
||||
# ifdef sysV88
|
||||
# define TIOCFLUSH TC_PX_DRAIN
|
||||
# endif
|
||||
|
||||
static fd_set ibits, obits, xbits;
|
||||
|
||||
|
||||
void
|
||||
init_sys()
|
||||
init_sys(void)
|
||||
{
|
||||
tout = fileno(stdout);
|
||||
tin = fileno(stdin);
|
||||
@@ -154,7 +98,7 @@ TerminalWrite(char *buf, int n)
|
||||
int
|
||||
TerminalRead(unsigned char *buf, int n)
|
||||
{
|
||||
return read(tin, (char*)buf, n);
|
||||
return read(tin, buf, n);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -162,7 +106,7 @@ TerminalRead(unsigned char *buf, int n)
|
||||
*/
|
||||
|
||||
int
|
||||
TerminalAutoFlush()
|
||||
TerminalAutoFlush(void)
|
||||
{
|
||||
#if defined(LNOFLSH)
|
||||
int flush;
|
||||
@@ -189,8 +133,6 @@ extern int kludgelinemode;
|
||||
* 1 Do add this character
|
||||
*/
|
||||
|
||||
extern void xmitAO(), xmitEL(), xmitEC(), intp(), sendbrk();
|
||||
|
||||
int
|
||||
TerminalSpecialChars(int c)
|
||||
{
|
||||
@@ -235,7 +177,7 @@ TerminalSpecialChars(int c)
|
||||
*/
|
||||
|
||||
void
|
||||
TerminalFlushOutput()
|
||||
TerminalFlushOutput(void)
|
||||
{
|
||||
#ifdef TIOCFLUSH
|
||||
ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
|
||||
@@ -245,7 +187,7 @@ TerminalFlushOutput()
|
||||
}
|
||||
|
||||
void
|
||||
TerminalSaveState()
|
||||
TerminalSaveState(void)
|
||||
{
|
||||
tcgetattr(0, &old_tc);
|
||||
|
||||
@@ -315,7 +257,7 @@ tcval(int func)
|
||||
}
|
||||
|
||||
void
|
||||
TerminalDefaultChars()
|
||||
TerminalDefaultChars(void)
|
||||
{
|
||||
memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
|
||||
# ifndef VDISCARD
|
||||
@@ -371,6 +313,13 @@ TerminalRestoreState()
|
||||
*/
|
||||
|
||||
|
||||
#ifdef SIGTSTP
|
||||
static RETSIGTYPE susp();
|
||||
#endif /* SIGTSTP */
|
||||
#ifdef SIGINFO
|
||||
static RETSIGTYPE ayt();
|
||||
#endif
|
||||
|
||||
void
|
||||
TerminalNewMode(int f)
|
||||
{
|
||||
@@ -504,12 +453,6 @@ TerminalNewMode(int f)
|
||||
}
|
||||
|
||||
if (f != -1) {
|
||||
#ifdef SIGTSTP
|
||||
RETSIGTYPE susp();
|
||||
#endif /* SIGTSTP */
|
||||
#ifdef SIGINFO
|
||||
RETSIGTYPE ayt();
|
||||
#endif
|
||||
|
||||
#ifdef SIGTSTP
|
||||
signal(SIGTSTP, susp);
|
||||
@@ -634,10 +577,8 @@ struct termspeeds {
|
||||
};
|
||||
#endif /* DECODE_BAUD */
|
||||
|
||||
void
|
||||
TerminalSpeeds(ispeed, ospeed)
|
||||
long *ispeed;
|
||||
long *ospeed;
|
||||
void
|
||||
TerminalSpeeds(long *ispeed, long *ospeed)
|
||||
{
|
||||
#ifdef DECODE_BAUD
|
||||
struct termspeeds *tp;
|
||||
@@ -665,9 +606,8 @@ TerminalSpeeds(ispeed, ospeed)
|
||||
#endif /* DECODE_BAUD */
|
||||
}
|
||||
|
||||
int
|
||||
TerminalWindowSize(rows, cols)
|
||||
long *rows, *cols;
|
||||
int
|
||||
TerminalWindowSize(long *rows, long *cols)
|
||||
{
|
||||
struct winsize ws;
|
||||
|
||||
@@ -679,18 +619,15 @@ TerminalWindowSize(rows, cols)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
NetClose(fd)
|
||||
int fd;
|
||||
int
|
||||
NetClose(int fd)
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NetNonblockingIO(fd, onoff)
|
||||
int fd;
|
||||
int onoff;
|
||||
void
|
||||
NetNonblockingIO(int fd, int onoff)
|
||||
{
|
||||
ioctl(fd, FIONBIO, (char *)&onoff);
|
||||
}
|
||||
@@ -700,19 +637,24 @@ NetNonblockingIO(fd, onoff)
|
||||
* Various signal handling routines.
|
||||
*/
|
||||
|
||||
static RETSIGTYPE deadpeer(int),
|
||||
intr(int), intr2(int), susp(int), sendwin(int);
|
||||
#ifdef SIGINFO
|
||||
static RETSIGTYPE ayt(int);
|
||||
#endif
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
deadpeer(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
deadpeer(int sig)
|
||||
{
|
||||
setcommandmode();
|
||||
longjmp(peerdied, -1);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
intr(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
intr(int sig)
|
||||
{
|
||||
if (localchars) {
|
||||
intp();
|
||||
@@ -723,9 +665,8 @@ intr(sig)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
intr2(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
intr2(int sig)
|
||||
{
|
||||
if (localchars) {
|
||||
#ifdef KLUDGELINEMODE
|
||||
@@ -740,9 +681,8 @@ intr2(sig)
|
||||
|
||||
#ifdef SIGTSTP
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
susp(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
susp(int sig)
|
||||
{
|
||||
if ((rlogin != _POSIX_VDISABLE) && rlogin_susp())
|
||||
return;
|
||||
@@ -753,9 +693,8 @@ susp(sig)
|
||||
|
||||
#ifdef SIGWINCH
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
sendwin(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
sendwin(int sig)
|
||||
{
|
||||
if (connected) {
|
||||
sendnaws();
|
||||
@@ -765,9 +704,8 @@ sendwin(sig)
|
||||
|
||||
#ifdef SIGINFO
|
||||
/* ARGSUSED */
|
||||
RETSIGTYPE
|
||||
ayt(sig)
|
||||
int sig;
|
||||
static RETSIGTYPE
|
||||
ayt(int sig)
|
||||
{
|
||||
if (connected)
|
||||
sendayt();
|
||||
@@ -777,8 +715,8 @@ ayt(sig)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
sys_telnet_init()
|
||||
void
|
||||
sys_telnet_init(void)
|
||||
{
|
||||
signal(SIGINT, intr);
|
||||
signal(SIGQUIT, intr2);
|
||||
@@ -816,9 +754,13 @@ sys_telnet_init()
|
||||
* The return value is 1 if something happened, 0 if not.
|
||||
*/
|
||||
|
||||
int
|
||||
process_rings(netin, netout, netex, ttyin, ttyout, poll)
|
||||
int poll; /* If 0, then block until something to do */
|
||||
int
|
||||
process_rings(int netin,
|
||||
int netout,
|
||||
int netex,
|
||||
int ttyin,
|
||||
int ttyout,
|
||||
int poll) /* If 0, then block until something to do */
|
||||
{
|
||||
int c;
|
||||
/* One wants to be a bit careful about setting returnValue
|
||||
|
@@ -31,34 +31,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <signal.h>
|
||||
/* By the way, we need to include curses.h before telnet.h since,
|
||||
* among other things, telnet.h #defines 'DO', which is a variable
|
||||
* declared in curses.h.
|
||||
*/
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "externs.h"
|
||||
#include "types.h"
|
||||
#include "general.h"
|
||||
#include <roken.h>
|
||||
|
||||
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
|
||||
|
||||
static unsigned char subbuffer[SUBBUFSIZE],
|
||||
@@ -147,17 +123,20 @@ int kludgelinemode = 1;
|
||||
|
||||
Clocks clocks;
|
||||
|
||||
static int is_unique(char *name, char **as, char **ae);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize telnet environment.
|
||||
*/
|
||||
|
||||
void
|
||||
init_telnet()
|
||||
init_telnet(void)
|
||||
{
|
||||
env_init();
|
||||
|
||||
SB_CLEAR();
|
||||
ClearArray(options);
|
||||
memset(options, 0, sizeof options);
|
||||
|
||||
connected = ISend = localflow = donebinarytoggle = 0;
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
@@ -525,7 +504,7 @@ dontoption(int option)
|
||||
static char *name_unknown = "UNKNOWN";
|
||||
static char *unknown[] = { 0, 0 };
|
||||
|
||||
char **
|
||||
static char **
|
||||
mklist(char *buf, char *name)
|
||||
{
|
||||
int n;
|
||||
@@ -636,7 +615,7 @@ mklist(char *buf, char *name)
|
||||
return(unknown);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
is_unique(char *name, char **as, char **ae)
|
||||
{
|
||||
char **ap;
|
||||
@@ -652,7 +631,7 @@ is_unique(char *name, char **as, char **ae)
|
||||
#ifndef HAVE_SETUPTERM
|
||||
char termbuf[1024];
|
||||
|
||||
int
|
||||
static int
|
||||
setupterm(char *tname, int fd, int *errp)
|
||||
{
|
||||
if (tgetent(termbuf, tname) == 1) {
|
||||
@@ -672,7 +651,7 @@ extern char ttytype[];
|
||||
|
||||
int resettermname = 1;
|
||||
|
||||
char *
|
||||
static char *
|
||||
gettermname()
|
||||
{
|
||||
char *tname;
|
||||
@@ -685,7 +664,7 @@ gettermname()
|
||||
if (tnamep && tnamep != unknown)
|
||||
free(tnamep);
|
||||
if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
|
||||
(setupterm(tname, 1, &err) == 0)) {
|
||||
setupterm(tname, 1, &err) == 0) {
|
||||
tnamep = mklist(termbuf, tname);
|
||||
} else {
|
||||
if (tname && ((int)strlen(tname) <= 40)) {
|
||||
@@ -759,8 +738,8 @@ suboption()
|
||||
TerminalSpeeds(&ispeed, &ospeed);
|
||||
|
||||
snprintf((char *)temp, sizeof(temp),
|
||||
"%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED,
|
||||
TELQUAL_IS, ospeed, ispeed, IAC, SE);
|
||||
"%c%c%c%c%u,%u%c%c", IAC, SB, TELOPT_TSPEED,
|
||||
TELQUAL_IS, (unsigned)ospeed, (unsigned)ispeed, IAC, SE);
|
||||
len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */
|
||||
|
||||
if (len < NETROOM()) {
|
||||
@@ -1106,7 +1085,7 @@ slc_init()
|
||||
|
||||
#define initfunc(func, flags) { \
|
||||
spcp = &spc_data[func]; \
|
||||
if (spcp->valp = tcval(func)) { \
|
||||
if ((spcp->valp = tcval(func))) { \
|
||||
spcp->val = *spcp->valp; \
|
||||
spcp->mylevel = SLC_VARIABLE|flags; \
|
||||
} else { \
|
||||
@@ -1470,12 +1449,12 @@ env_opt_add(unsigned char *ep)
|
||||
if (ep == NULL || *ep == '\0') {
|
||||
/* Send user defined variables first. */
|
||||
env_default(1, 0);
|
||||
while (ep = env_default(0, 0))
|
||||
while ((ep = env_default(0, 0)))
|
||||
env_opt_add(ep);
|
||||
|
||||
/* Now add the list of well know variables. */
|
||||
env_default(1, 1);
|
||||
while (ep = env_default(0, 1))
|
||||
while ((ep = env_default(0, 1)))
|
||||
env_opt_add(ep);
|
||||
return;
|
||||
}
|
||||
@@ -1505,7 +1484,7 @@ env_opt_add(unsigned char *ep)
|
||||
else
|
||||
*opt_replyp++ = ENV_USERVAR;
|
||||
for (;;) {
|
||||
while (c = *ep++) {
|
||||
while ((c = *ep++)) {
|
||||
switch(c&0xff) {
|
||||
case IAC:
|
||||
*opt_replyp++ = IAC;
|
||||
@@ -1519,7 +1498,7 @@ env_opt_add(unsigned char *ep)
|
||||
}
|
||||
*opt_replyp++ = c;
|
||||
}
|
||||
if (ep = vp) {
|
||||
if ((ep = vp)) {
|
||||
#ifdef OLD_ENVIRON
|
||||
if (telopt_environ == TELOPT_OLD_ENVIRON)
|
||||
*opt_replyp++ = old_env_value;
|
||||
@@ -1569,7 +1548,7 @@ env_opt_end(int emptyok)
|
||||
|
||||
|
||||
int
|
||||
telrcv()
|
||||
telrcv(void)
|
||||
{
|
||||
int c;
|
||||
int scc;
|
||||
@@ -1801,7 +1780,7 @@ process_iac:
|
||||
static int bol = 1, local = 0;
|
||||
|
||||
int
|
||||
rlogin_susp()
|
||||
rlogin_susp(void)
|
||||
{
|
||||
if (local) {
|
||||
local = 0;
|
||||
@@ -1963,7 +1942,7 @@ telsnd()
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
Scheduler(int block) /* should we block in the select ? */
|
||||
{
|
||||
/* One wants to be a bit careful about setting returnValue
|
||||
@@ -2143,7 +2122,7 @@ doflush()
|
||||
}
|
||||
|
||||
void
|
||||
xmitAO()
|
||||
xmitAO(void)
|
||||
{
|
||||
NET2ADD(IAC, AO);
|
||||
printoption("SENT", IAC, AO);
|
||||
@@ -2154,14 +2133,14 @@ xmitAO()
|
||||
|
||||
|
||||
void
|
||||
xmitEL()
|
||||
xmitEL(void)
|
||||
{
|
||||
NET2ADD(IAC, EL);
|
||||
printoption("SENT", IAC, EL);
|
||||
}
|
||||
|
||||
void
|
||||
xmitEC()
|
||||
xmitEC(void)
|
||||
{
|
||||
NET2ADD(IAC, EC);
|
||||
printoption("SENT", IAC, EC);
|
||||
@@ -2208,7 +2187,7 @@ get_status()
|
||||
}
|
||||
|
||||
void
|
||||
intp()
|
||||
intp(void)
|
||||
{
|
||||
NET2ADD(IAC, IP);
|
||||
printoption("SENT", IAC, IP);
|
||||
@@ -2222,7 +2201,7 @@ intp()
|
||||
}
|
||||
|
||||
void
|
||||
sendbrk()
|
||||
sendbrk(void)
|
||||
{
|
||||
NET2ADD(IAC, BREAK);
|
||||
printoption("SENT", IAC, BREAK);
|
||||
@@ -2236,7 +2215,7 @@ sendbrk()
|
||||
}
|
||||
|
||||
void
|
||||
sendabort()
|
||||
sendabort(void)
|
||||
{
|
||||
NET2ADD(IAC, ABORT);
|
||||
printoption("SENT", IAC, ABORT);
|
||||
@@ -2250,7 +2229,7 @@ sendabort()
|
||||
}
|
||||
|
||||
void
|
||||
sendsusp()
|
||||
sendsusp(void)
|
||||
{
|
||||
NET2ADD(IAC, SUSP);
|
||||
printoption("SENT", IAC, SUSP);
|
||||
@@ -2264,14 +2243,14 @@ sendsusp()
|
||||
}
|
||||
|
||||
void
|
||||
sendeof()
|
||||
sendeof(void)
|
||||
{
|
||||
NET2ADD(IAC, xEOF);
|
||||
printoption("SENT", IAC, xEOF);
|
||||
}
|
||||
|
||||
void
|
||||
sendayt()
|
||||
sendayt(void)
|
||||
{
|
||||
NET2ADD(IAC, AYT);
|
||||
printoption("SENT", IAC, AYT);
|
||||
|
150
appl/telnet/telnet/telnet_locl.h
Normal file
150
appl/telnet/telnet/telnet_locl.h
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* H<>gskolan and its contributors.
|
||||
*
|
||||
* 4. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#elif defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
/* not with SunOS 4 */
|
||||
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif /* HAVE_SYS_RESOURCE_H */
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILIO_H
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_SYSTM_H
|
||||
#include <netinet/in_systm.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IP_H
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_TELNET_H
|
||||
#include <arpa/telnet.h>
|
||||
#endif
|
||||
|
||||
#include <roken.h>
|
||||
#include <krb.h>
|
||||
|
||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||
#include <libtelnet/auth.h>
|
||||
#include <libtelnet/encrypt.h>
|
||||
#endif
|
||||
#include <libtelnet/misc.h>
|
||||
#include <libtelnet/misc-proto.h>
|
||||
|
||||
#include "ring.h"
|
||||
#include "externs.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
|
||||
/* prototypes */
|
||||
|
@@ -31,21 +31,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <arpa/telnet.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "externs.h"
|
||||
#include "types.h"
|
||||
|
||||
Ring ttyoring, ttyiring;
|
||||
unsigned char ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];
|
||||
|
||||
@@ -86,8 +75,8 @@ cc_t termAytChar;
|
||||
* initialize the terminal data structures.
|
||||
*/
|
||||
|
||||
void
|
||||
init_terminal()
|
||||
void
|
||||
init_terminal(void)
|
||||
{
|
||||
if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
|
||||
exit(1);
|
||||
@@ -110,9 +99,8 @@ init_terminal()
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
ttyflush(drop)
|
||||
int drop;
|
||||
int
|
||||
ttyflush(int drop)
|
||||
{
|
||||
int n, n0, n1;
|
||||
|
||||
@@ -160,8 +148,8 @@ ttyflush(drop)
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
getconnmode()
|
||||
int
|
||||
getconnmode(void)
|
||||
{
|
||||
extern int linemode;
|
||||
int mode = 0;
|
||||
|
@@ -31,46 +31,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#ifdef SOCKS
|
||||
#include <socks.h>
|
||||
#endif
|
||||
#define TELOPTS
|
||||
#define TELCMDS
|
||||
#define SLC_NAMES
|
||||
|
||||
#include "telnet_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#define TELOPTS
|
||||
#define TELCMDS
|
||||
#define SLC_NAMES
|
||||
#include <arpa/telnet.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#elif defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <roken.h>
|
||||
|
||||
#include "general.h"
|
||||
|
||||
#include "fdset.h"
|
||||
|
||||
#include "ring.h"
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
|
||||
int prettydump;
|
||||
|
||||
@@ -129,7 +97,6 @@ Dump(char direction, unsigned char *buffer, int length)
|
||||
# define BYTES_PER_LINE 32
|
||||
unsigned char *pThis;
|
||||
int offset;
|
||||
extern int pettydump;
|
||||
|
||||
offset = 0;
|
||||
|
||||
@@ -797,7 +764,6 @@ printsub(char direction, unsigned char *pointer, int length)
|
||||
break;
|
||||
|
||||
default:
|
||||
def_case:
|
||||
if (isprint(pointer[i]) && pointer[i] != '"') {
|
||||
if (noquote) {
|
||||
putc('"', NetTrace);
|
||||
|
Reference in New Issue
Block a user