+2001-06-07 Ezra Peisach <epeisach@mit.edu>
+
+ * authenc.c (telnet_gets): Cleanup assignment in conditional.
+
+ * commands.c: Include sys/wait.h, libtelent/auth.h,
+ libtelnet/encrypt.h for prototypes. Explicity declare functions as
+ returning int. Assignments in conditionals cleanup.
+
+ * externs.h: Add numerous prototypes.
+
+ * ring.c (ring_init): Explicitly declare as returning int.
+
+ * ring.h: Add prototype for ring_at_mark().
+
+ * telnet.c: Include unistd.h, libtelnet/auth.h,
+ libtelnet/encrypt.h for prototypes. Delcare is_unique()
+ static. Fix up format string for sprintf() to expect
+ longs. Assignments in conditionals cleaned up.
+
+ * main.c, terminal.c: Include libtelnet/encrypt.h for prototype.
+
+ * utilities.c: Include sys/socket.h, libtelent/auth.h,
+ libtelnet/encrypt.h for prototypes.
+
2001-05-01 Ken Raeburn <raeburn@mit.edu>
* telnet.c (telnet): Fix grammar in some error messages. Based on
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;
}
#ifdef CRAY
#include <fcntl.h>
#endif /* CRAY */
+#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
#include <libtelnet/auth.h>
#endif
+#ifdef ENCRYPTION
+#include <libtelnet/encrypt.h>
+#endif
+
+#if defined(AUTHENTICATION) || defined(ENCRYPTION)
+#include <libtelnet/misc-proto.h>
+#endif
#if !defined(CRAY) && !defined(sysV88)
#include <netinet/in_systm.h>
extern char **genget();
extern int Ambiguous();
-static call();
+static int call();
+void cmdrc P((char *, char *));
+static int
+send_tncmd P((void (*func)(), char *, char *));
typedef struct {
char *name; /* command name */
margc++;
cp++;
}
- while (c = *cp) {
+ while ((c = *cp)) {
register int inquote = 0;
while (isspace(c))
c = *++cp;
* Todo: 1. Could take random integers (12, 0x12, 012, 0b1).
*/
- static
+ static int
special(s)
register char *s;
{
return(send_tncmd(send_wont, "wont", name));
}
- int
+static int
send_tncmd(func, cmd, name)
void (*func)();
char *cmd, *name;
}
}
}
-/*@*/optionstatus();
+ /*@*/optionstatus();
#ifdef ENCRYPTION
EncryptStatus();
#endif /* ENCRYPTION */
extern int shell();
#endif /* !defined(TN3270) */
- /*VARARGS*/
- static
+/*VARARGS*/
+static int
bye(argc, argv)
int argc; /* Number of arguments */
char *argv[]; /* arguments */
}
/*VARARGS*/
+int
quit()
{
(void) call(bye, "bye", "fromquit", 0);
Exit(0);
/*NOTREACHED*/
+ return 0;
}
/*VARARGS*/
}
}
- static struct slclist *
+static struct slclist *
getslc(name)
char *name;
{
genget(name, (char **) SlcList, sizeof(struct slclist));
}
- static
+static int
slccmd(argc, argv)
int argc;
char *argv[];
genget(name, (char **) EnvList, sizeof(struct envlist));
}
+int
env_cmd(argc, argv)
int argc;
char *argv[];
register 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);
{
register struct env_lst *ep;
- if (ep = env_find(var)) {
+ if ((ep = env_find(var))) {
if (ep->var)
free(ep->var);
if (ep->value)
{
register 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;
{
register struct env_lst *ep;
- if (ep = env_find(var))
+ if ((ep = env_find(var)))
ep->export = 1;
}
{
register struct env_lst *ep;
- if (ep = env_find(var))
+ if ((ep = env_find(var)))
ep->export = 0;
}
return NULL; /* guessing here too -- eichin -- XXX */
}
if (nep) {
- while (nep = nep->next) {
+ while ((nep = nep->next)) {
if (nep->export && (nep->welldefined == welldefined))
return(nep->var);
}
{
register struct env_lst *ep;
- if (ep = env_find(var))
+ if ((ep = env_find(var)))
return(ep->value);
return(NULL);
}
return 0;
}
+int
auth_cmd(argc, argv)
int argc;
char *argv[];
return 0;
}
+int
encrypt_cmd(argc, argv)
int argc;
char *argv[];
return(0);
}
+int
forw_set(f_flags)
int f_flags;
{
return(0);
}
- static int
+static int
forw_help()
{
struct forwlist *c;
return 0;
}
+int
forw_cmd(argc, argv)
int argc;
char *argv[];
* Print status about the connection.
*/
/*ARGSUSED*/
- static
+static int
status(argc, argv)
int argc;
char *argv[];
} else {
#endif
temp = inet_addr(hostp);
- if (temp & 0xffffffff != INADDR_NONE) {
+ if ((temp & 0xffffffff) != INADDR_NONE) {
sin.sin_addr.s_addr = temp;
sin.sin_family = AF_INET;
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
user = getenv("USER");
if (user == NULL ||
- (pw = getpwnam(user)) && pw->pw_uid != getuid()) {
- if (pw = getpwuid(getuid()))
+ ((pw = getpwnam(user)) && pw->pw_uid != getuid())) {
+ pw = getpwuid(getuid());
+ if (pw)
user = pw->pw_name;
else
user = NULL;
(void) NetClose(net);
ExitString("Connection closed by foreign host.\r\n",1);
/*NOTREACHED*/
+ return 0;
}
#define HELPINDENT (sizeof ("connect"))
#endif
{ "environ", envhelp, env_cmd, 0 },
{ "?", helphelp, help, 0 },
- 0
+ { 0, 0, 0, 0 }
};
static char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead";
{ "help", 0, help, 0 },
{ "escape", escapehelp, setescape, 0 },
{ "crmod", crmodhelp, togcrmod, 0 },
- 0
+ { 0, 0, 0, 0 }
};
*/
/*VARARGS1*/
- static
+static int
call(va_alist)
va_dcl
{
{
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));
}
/*
* Help command.
*/
- static
+static int
help(argc, argv)
int argc;
char *argv[];
static char *rcname = 0;
static char rcbuf[128];
+void
cmdrc(m1, m2)
char *m1, *m2;
{
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 == '@')
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)
memcpy((caddr_t)&sin_addr,
host->h_addr_list[0], sizeof(sin_addr));
command P((int, char *, int)),
Dump P((int, unsigned char *, int)),
init_3270 P((void)),
+ init_terminal P((void)),
+ init_telnet P((void)),
+ init_network P((void)),
+ init_sys P((void)),
printoption P((char *, int, int)),
printsub P((int, unsigned char *, int)),
sendnaws P((void)),
+ sendabort P((void)),
+ sendeof P((void)),
+ sendayt P((void)),
+ sendsusp P((void)),
setconnmode P((int)),
setcommandmode P((void)),
setneturg P((void)),
+ set_escape_char P((char *)),
sys_telnet_init P((void)),
telnet P((char *)),
tel_enter_binary P((int)),
+ tel_leave_binary P((int)),
+ TerminalDefaultChars P((void)),
TerminalFlushOutput P((void)),
TerminalNewMode P((int)),
TerminalRestoreState P((void)),
TerminalSaveState P((void)),
+ TerminalSpeeds P((long *, long *)),
tninit P((void)),
upcase P((char *)),
willoption P((int)),
lm_mode P((unsigned char *, int, int));
extern void
+ ExitString P((char *, int)),
+ Exit P((int)),
+ SetForExit P((void)),
+ EmptyTerminal P((void)),
slc_init P((void)),
slcstate P((void)),
slc_mode_export P((void)),
slc_start_reply P((void)),
slc_add_reply P((int, int, int)),
slc_end_reply P((void));
+
extern int
- slc_update P((void));
+ quit P((void)),
+ ttyflush P((int)),
+ rlogin_susp P((void)),
+ tn P((int, char **)),
+ getconnmode P((void)),
+ netflush P((void)),
+ NetClose P((int)),
+ opt_welldefined P((char *)),
+ process_rings P((int, int, int, int, int, int)),
+ slc_update P((void)),
+ Scheduler P((int)),
+ SetSockOpt P((int, int, int, int)),
+ stilloob P((void)),
+ telrcv P((void)),
+ telnet_spin P((void)),
+ TerminalWrite P((char *, int)),
+ TerminalRead P((char *, int)),
+ TerminalAutoFlush P((void)),
+ TerminalSpecialChars P((int)),
+ TerminalWindowSize P((long *, long *));
+
extern void
+ env_init P((void)),
env_opt P((unsigned char *, int)),
env_opt_start P((void)),
env_opt_start_info P((void)),
env_opt_add P((unsigned char *)),
- env_opt_end P((int));
+ env_opt_end P((int)),
+ optionstatus P((void));
extern unsigned char
*env_default P((int, int)),
#include <sys/types.h>
#include <libtelnet/auth.h>
-
+#ifdef ENCRYPTION
+#include <libtelnet/encrypt.h>
+#endif
# include <netinet/in.h>
/* see forward.c -- indicate that we're in telnet, not telnetd. */
char *line = 0;
+int
main(argc, argv)
int argc;
char *argv[];
TerminalSaveState();
- if (prompt = strrchr(argv[0], '/'))
+ if ((prompt = strrchr(argv[0], '/')))
++prompt;
else
prompt = argv[0];
/* Buffer state transition routines */
- ring_init(ring, buffer, count)
+int
+ring_init(ring, buffer, count)
Ring *ring;
unsigned char *buffer;
int count;
extern void
ring_clear_mark(),
ring_mark();
+
+extern int
+ ring_at_mark P((Ring *));
/* based on @(#)telnet.c 8.1 (Berkeley) 6/6/93 */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include <sys/types.h>
+#include <time.h>
#if defined(unix)
#include <signal.h>
#include "types.h"
#include "general.h"
+#ifdef AUTHENTICATION
+#include <libtelnet/auth.h>
+#endif
+
+#ifdef ENCRYPTION
+#include <libtelnet/encrypt.h>
+#endif
+
+#if defined(AUTHENTICATION) || defined(ENCRYPTION)
+#include <libtelnet/misc-proto.h>
+#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
+
+static int is_unique P((char *, char **, char **));
+
\f
#define strip(x) ((x)&0x7f)
return(unknown);
}
- int
+static int
is_unique(name, as, ae)
register char *name, **as, **ae;
{
TerminalSpeeds(&ispeed, &ospeed);
- sprintf((char *)temp, "%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED,
+ sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED,
TELQUAL_IS, ospeed, ispeed, IAC, SE);
len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */
#define initfunc(func, flags) { \
spcp = &spc_data[func]; \
- if (spcp->valp = tcval(func)) { \
+ if ((spcp->valp = tcval(func)) != NULL) { \
spcp->val = *spcp->valp; \
spcp->mylevel = SLC_VARIABLE|flags; \
} else { \
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)) != NULL)
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)) != NULL)
env_opt_add(ep);
return;
}
else
*opt_replyp++ = ENV_USERVAR;
for (;;) {
- while (c = *ep++) {
+ while ((c = *ep++)) {
switch(c&0xff) {
case IAC:
*opt_replyp++ = IAC;
}
*opt_replyp++ = c;
}
- if (ep = vp) {
+ if ((ep = vp) != NULL) {
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
*opt_replyp++ = old_env_value;
#include "externs.h"
#include "types.h"
+#ifdef ENCRYPTION
+#include <libtelnet/encrypt.h>
+#endif
+
Ring ttyoring, ttyiring;
unsigned char ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];
#define SLC_NAMES
#include <arpa/telnet.h>
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/time.h>
#include <ctype.h>
#include "externs.h"
+#ifdef AUTHENTICATION
+#include <libtelnet/auth.h>
+#endif
+
+#ifdef ENCRYPTION
+#include <libtelnet/encrypt.h>
+#endif
+
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
int prettydump;