git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1187 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-01-24 23:13:35 +00:00
parent 7984aaf260
commit 3d7c57acdb
18 changed files with 467 additions and 566 deletions

View File

@@ -53,63 +53,58 @@
* or implied warranty. * or implied warranty.
*/ */
#if !defined(P) /* $Id$ */
#ifdef __STDC__
#define P(x) x
#else
#define P(x) ()
#endif
#endif
#if defined(AUTHENTICATION) #if defined(AUTHENTICATION)
Authenticator *findauthenticator P((int, int)); Authenticator *findauthenticator (int, int);
void auth_init P((char *, int)); void auth_init (char *, int);
int auth_cmd P((int, char **)); int auth_cmd (int, char **);
void auth_request P((void)); void auth_request (void);
void auth_send P((unsigned char *, int)); void auth_send (unsigned char *, int);
void auth_send_retry P((void)); void auth_send_retry (void);
void auth_is P((unsigned char *, int)); void auth_is (unsigned char *, int);
void auth_reply P((unsigned char *, int)); void auth_reply (unsigned char *, int);
void auth_finished P((Authenticator *, int)); void auth_finished (Authenticator *, int);
int auth_wait P((char *)); int auth_wait (char *);
void auth_disable_name P((char *)); void auth_disable_name (char *);
void auth_gen_printsub P((unsigned char *, int, unsigned char *, int)); void auth_gen_printsub (unsigned char *, int, unsigned char *, int);
#ifdef UNSAFE #ifdef UNSAFE
int unsafe_init P((Authenticator *, int)); int unsafe_init (Authenticator *, int);
int unsafe_send P((Authenticator *)); int unsafe_send (Authenticator *);
void unsafe_is P((Authenticator *, unsigned char *, int)); void unsafe_is (Authenticator *, unsigned char *, int);
void unsafe_reply P((Authenticator *, unsigned char *, int)); void unsafe_reply (Authenticator *, unsigned char *, int);
int unsafe_status P((Authenticator *, char *, int)); int unsafe_status (Authenticator *, char *, int);
void unsafe_printsub P((unsigned char *, int, unsigned char *, int)); void unsafe_printsub (unsigned char *, int, unsigned char *, int);
#endif #endif
#ifdef SRA #ifdef SRA
int sra_init P((Authenticator *, int)); int sra_init (Authenticator *, int);
int sra_send P((Authenticator *)); int sra_send (Authenticator *);
void sra_is P((Authenticator *, unsigned char *, int)); void sra_is (Authenticator *, unsigned char *, int);
void sra_reply P((Authenticator *, unsigned char *, int)); void sra_reply (Authenticator *, unsigned char *, int);
int sra_status P((Authenticator *, char *, int)); int sra_status (Authenticator *, char *, int);
void sra_printsub P((unsigned char *, int, unsigned char *, int)); void sra_printsub (unsigned char *, int, unsigned char *, int);
#endif #endif
#ifdef KRB4 #ifdef KRB4
int kerberos4_init P((Authenticator *, int)); int kerberos4_init (Authenticator *, int);
int kerberos4_send_mutual P((Authenticator *)); int kerberos4_send_mutual (Authenticator *);
int kerberos4_send_oneway P((Authenticator *)); int kerberos4_send_oneway (Authenticator *);
void kerberos4_is P((Authenticator *, unsigned char *, int)); void kerberos4_is (Authenticator *, unsigned char *, int);
void kerberos4_reply P((Authenticator *, unsigned char *, int)); void kerberos4_reply (Authenticator *, unsigned char *, int);
int kerberos4_status P((Authenticator *, char *, int)); int kerberos4_status (Authenticator *, char *, int);
void kerberos4_printsub P((unsigned char *, int, unsigned char *, int)); void kerberos4_printsub (unsigned char *, int, unsigned char *, int);
#endif #endif
#ifdef KRB5 #ifdef KRB5
int kerberos5_init P((Authenticator *, int)); int kerberos5_init (Authenticator *, int);
int kerberos5_send P((Authenticator *)); int kerberos5_send_mutual (Authenticator *);
void kerberos5_is P((Authenticator *, unsigned char *, int)); int kerberos5_send_oneway (Authenticator *);
void kerberos5_reply P((Authenticator *, unsigned char *, int)); void kerberos5_is (Authenticator *, unsigned char *, int);
int kerberos5_status P((Authenticator *, char *, int)); void kerberos5_reply (Authenticator *, unsigned char *, int);
void kerberos5_printsub P((unsigned char *, int, unsigned char *, int)); int kerberos5_status (Authenticator *, char *, int);
void kerberos5_printsub (unsigned char *, int, unsigned char *, int);
#endif #endif
#endif #endif

View File

@@ -148,9 +148,16 @@ Authenticator authenticators[] = {
spx_printsub }, spx_printsub },
#endif #endif
#ifdef KRB5 #ifdef KRB5
{ AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
kerberos5_init,
kerberos5_send_mutual,
kerberos5_is,
kerberos5_reply,
kerberos5_status,
kerberos5_printsub },
{ AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY, { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
kerberos5_init, kerberos5_init,
kerberos5_send, kerberos5_send_oneway,
kerberos5_is, kerberos5_is,
kerberos5_reply, kerberos5_reply,
kerberos5_status, kerberos5_status,

View File

@@ -53,6 +53,8 @@
* or implied warranty. * or implied warranty.
*/ */
/* $Id$ */
#ifndef __AUTH__ #ifndef __AUTH__
#define __AUTH__ #define __AUTH__
@@ -62,23 +64,15 @@
#define AUTH_USER 3 /* We know he name */ #define AUTH_USER 3 /* We know he name */
#define AUTH_VALID 4 /* We know him, and he needs no password */ #define AUTH_VALID 4 /* We know him, and he needs no password */
#if !defined(P)
#ifdef __STDC__
#define P(x) x
#else
#define P(x) ()
#endif
#endif
typedef struct XauthP { typedef struct XauthP {
int type; int type;
int way; int way;
int (*init) P((struct XauthP *, int)); int (*init) (struct XauthP *, int);
int (*send) P((struct XauthP *)); int (*send) (struct XauthP *);
void (*is) P((struct XauthP *, unsigned char *, int)); void (*is) (struct XauthP *, unsigned char *, int);
void (*reply) P((struct XauthP *, unsigned char *, int)); void (*reply) (struct XauthP *, unsigned char *, int);
int (*status) P((struct XauthP *, char *, int)); int (*status) (struct XauthP *, char *, int);
void (*printsub) P((unsigned char *, int, unsigned char *, int)); void (*printsub) (unsigned char *, int, unsigned char *, int);
} Authenticator; } Authenticator;
#include "auth-proto.h" #include "auth-proto.h"

View File

@@ -54,63 +54,57 @@
* this software for any purpose. It is provided "as is" without express * this software for any purpose. It is provided "as is" without express
* or implied warranty. * or implied warranty.
*/ */
#if !defined(P)
#ifdef __STDC__
#define P(x) x
#else
#define P(x) ()
#endif
#endif
/* $Id$ */
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
void encrypt_init P((char *, int)); void encrypt_init (char *, int);
Encryptions *findencryption P((int)); Encryptions *findencryption (int);
void encrypt_send_supprt P((void)); void encrypt_send_supprt (void);
void encrypt_auto P((int)); void encrypt_auto (int);
void decrypt_auto P((int)); void decrypt_auto (int);
void encrypt_not P((void)); void encrypt_not (void);
void encrypt_verbose_quiet P((int)); void encrypt_verbose_quiet (int);
void encrypt_is P((unsigned char *, int)); void encrypt_is (unsigned char *, int);
void encrypt_reply P((unsigned char *, int)); void encrypt_reply (unsigned char *, int);
void encrypt_start_input P((int)); void encrypt_start_input (int);
void encrypt_session_key P((Session_Key *, int)); void encrypt_session_key (Session_Key *, int);
void encrypt_end_input P((void)); void encrypt_end_input (void);
void encrypt_start_output P((int)); void encrypt_start_output (int);
void encrypt_end_output P((void)); void encrypt_end_output (void);
void encrypt_send_request_start P((void)); void encrypt_send_request_start (void);
void encrypt_send_request_end P((void)); void encrypt_send_request_end (void);
void encrypt_send_end P((void)); void encrypt_send_end (void);
void encrypt_wait P((void)); void encrypt_wait (void);
void encrypt_send_support P((void)); void encrypt_send_support (void);
void encrypt_send_keyid P((int, unsigned char *, int, int)); void encrypt_send_keyid (int, unsigned char *, int, int);
int net_write P((unsigned char *, int)); int net_write (unsigned char *, int);
#ifdef TELENTD #ifdef TELENTD
void encrypt_wait P((void)); void encrypt_wait (void);
#else #else
int encrypt_cmd P((int, char **)); int encrypt_cmd (int, char **);
void encrypt_display P((void)); void encrypt_display (void);
#endif #endif
void cfb64_encrypt P((unsigned char *, int)); void cfb64_encrypt (unsigned char *, int);
int cfb64_decrypt P((int)); int cfb64_decrypt (int);
void cfb64_init P((int)); void cfb64_init (int);
int cfb64_start P((int, int)); int cfb64_start (int, int);
int cfb64_is P((unsigned char *, int)); int cfb64_is (unsigned char *, int);
int cfb64_reply P((unsigned char *, int)); int cfb64_reply (unsigned char *, int);
void cfb64_session P((Session_Key *, int)); void cfb64_session (Session_Key *, int);
int cfb64_keyid P((int, unsigned char *, int *)); int cfb64_keyid (int, unsigned char *, int *);
void cfb64_printsub P((unsigned char *, int, unsigned char *, int)); void cfb64_printsub (unsigned char *, int, unsigned char *, int);
void ofb64_encrypt P((unsigned char *, int)); void ofb64_encrypt (unsigned char *, int);
int ofb64_decrypt P((int)); int ofb64_decrypt (int);
void ofb64_init P((int)); void ofb64_init (int);
int ofb64_start P((int, int)); int ofb64_start (int, int);
int ofb64_is P((unsigned char *, int)); int ofb64_is (unsigned char *, int);
int ofb64_reply P((unsigned char *, int)); int ofb64_reply (unsigned char *, int);
void ofb64_session P((Session_Key *, int)); void ofb64_session (Session_Key *, int);
int ofb64_keyid P((int, unsigned char *, int *)); int ofb64_keyid (int, unsigned char *, int *);
void ofb64_printsub P((unsigned char *, int, unsigned char *, int)); void ofb64_printsub (unsigned char *, int, unsigned char *, int);
#endif #endif

View File

@@ -115,14 +115,14 @@ struct keyidlist {
#define FB64_IV_BAD 3 #define FB64_IV_BAD 3
void fb64_stream_iv P((des_cblock, struct stinfo *)); void fb64_stream_iv (des_cblock, struct stinfo *);
void fb64_init P((struct fb *)); void fb64_init (struct fb *);
static int fb64_start P((struct fb *, int, int)); static int fb64_start (struct fb *, int, int);
int fb64_is P((unsigned char *, int, struct fb *)); int fb64_is (unsigned char *, int, struct fb *);
int fb64_reply P((unsigned char *, int, struct fb *)); int fb64_reply (unsigned char *, int, struct fb *);
static void fb64_session P((Session_Key *, int, struct fb *)); static void fb64_session (Session_Key *, int, struct fb *);
void fb64_stream_key P((des_cblock, struct stinfo *)); void fb64_stream_key (des_cblock, struct stinfo *);
int fb64_keyid P((int, unsigned char *, int *, struct fb *)); int fb64_keyid (int, unsigned char *, int *, struct fb *);
void cfb64_init(int server) void cfb64_init(int server)
{ {

View File

@@ -67,21 +67,15 @@ RCSID("$Id$");
#include "encrypt.h" #include "encrypt.h"
#include "misc.h" #include "misc.h"
#ifdef __STDC__
#include <stdlib.h> #include <stdlib.h>
#endif
#ifdef NO_STRING_H
#include <strings.h>
#else
#include <string.h> #include <string.h>
#endif
/* /*
* These functions pointers point to the current routines * These functions pointers point to the current routines
* for encrypting and decrypting data. * for encrypting and decrypting data.
*/ */
void (*encrypt_output) P((unsigned char *, int)); void (*encrypt_output) (unsigned char *, int);
int (*decrypt_input) P((int)); int (*decrypt_input) (int);
char *nclearto; char *nclearto;
int encrypt_debug_mode = 0; int encrypt_debug_mode = 0;

View File

@@ -55,6 +55,7 @@
* or implied warranty. * or implied warranty.
*/ */
/* $Id$ */
#ifndef __ENCRYPT__ #ifndef __ENCRYPT__
#define __ENCRYPT__ #define __ENCRYPT__
@@ -73,26 +74,18 @@ typedef struct {
unsigned char *data; unsigned char *data;
} Session_Key; } Session_Key;
#if !defined(P)
#ifdef __STDC__
#define P(x) x
#else
#define P(x) ()
#endif
#endif
typedef struct { typedef struct {
char *name; char *name;
int type; int type;
void (*output) P((unsigned char *, int)); void (*output) (unsigned char *, int);
int (*input) P((int)); int (*input) (int);
void (*init) P((int)); void (*init) (int);
int (*start) P((int, int)); int (*start) (int, int);
int (*is) P((unsigned char *, int)); int (*is) (unsigned char *, int);
int (*reply) P((unsigned char *, int)); int (*reply) (unsigned char *, int);
void (*session) P((Session_Key *, int)); void (*session) (Session_Key *, int);
int (*keyid) P((int, unsigned char *, int *)); int (*keyid) (int, unsigned char *, int *);
void (*printsub) P((unsigned char *, int, unsigned char *, int)); void (*printsub) (unsigned char *, int, unsigned char *, int);
} Encryptions; } Encryptions;
#define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ #define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */
@@ -100,6 +93,6 @@ typedef struct {
#include "enc-proto.h" #include "enc-proto.h"
extern int encrypt_debug_mode; extern int encrypt_debug_mode;
extern int (*decrypt_input) P((int)); extern int (*decrypt_input) (int);
extern void (*encrypt_output) P((unsigned char *, int)); extern void (*encrypt_output) (unsigned char *, int);
#endif #endif

View File

@@ -31,10 +31,9 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#ifndef lint #include <config.h>
static char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
RCSID("$Id$");
#include <ctype.h> #include <ctype.h>
@@ -97,7 +96,7 @@ genget(char *name, char **table, int stlen)
* Function call version of Ambiguous() * Function call version of Ambiguous()
*/ */
int int
Ambiguous(char *s) Ambiguous(void *s)
{ {
return((char **)s == &ambiguous); return((char **)s == &ambiguous);
} }

View File

@@ -80,7 +80,7 @@ RCSID("$Id$");
#include "auth.h" #include "auth.h"
#include "misc.h" #include "misc.h"
int kerberos4_cksum P((unsigned char *, int)); int kerberos4_cksum (unsigned char *, int);
extern int auth_debug_mode; extern int auth_debug_mode;
static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0, static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
@@ -306,9 +306,12 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
Data(ap, KRB_REJECT, NULL, 0); Data(ap, KRB_REJECT, NULL, 0);
sprintf (msg, "user `%s' is not authorized to " sprintf (msg, "user `%s' is not authorized to "
"login as `%s'", "login as `%s'",
#if 0
krb_unparse_name_long(adat.pname, krb_unparse_name_long(adat.pname,
adat.pinst, adat.pinst,
adat.prealm), adat.prealm),
#endif
NULL,
UserNameRequested); UserNameRequested);
Data(ap, KRB_REJECT, (void *)msg, -1); Data(ap, KRB_REJECT, (void *)msg, -1);

View File

@@ -79,21 +79,15 @@ RCSID("$Id$");
#include <des.h> #include <des.h>
#include <krb.h> #include <krb.h>
#ifdef __STDC__
#include <stdlib.h> #include <stdlib.h>
#endif
#ifdef NO_STRING_H
#include <strings.h>
#else
#include <string.h> #include <string.h>
#endif
#include "encrypt.h" #include "encrypt.h"
#include "auth.h" #include "auth.h"
#include "misc.h" #include "misc.h"
int krb_mk_encpwd_req P((KTEXT, char *, char *, char *, char *, char *, char *)); int krb_mk_encpwd_req (KTEXT, char *, char *, char *, char *, char *, char *);
int krb_rd_encpwd_req P((KTEXT, char *, char *, u_long, AUTH_DAT *, char *, char *, char *, char *)); int krb_rd_encpwd_req (KTEXT, char *, char *, u_long, AUTH_DAT *, char *, char *, char *, char *);
extern auth_debug_mode; extern auth_debug_mode;

View File

@@ -53,30 +53,25 @@
* or implied warranty. * or implied warranty.
*/ */
/* $Id$ */
#ifndef __MISC_PROTO__ #ifndef __MISC_PROTO__
#define __MISC_PROTO__ #define __MISC_PROTO__
#if !defined(P) void auth_encrypt_init (char *, char *, char *, int);
#ifdef __STDC__ void auth_encrypt_connect (int);
#define P(x) x void printd (unsigned char *, int);
#else
#define P(x) ()
#endif
#endif
void auth_encrypt_init P((char *, char *, char *, int));
void auth_encrypt_connect P((int));
void printd P((unsigned char *, int));
char** genget P((char *name, char **table, int stlen));
char** genget (char *name, char **table, int stlen);
int isprefix(char *s1, char *s2);
int Ambiguous(void *s);
/* /*
* These functions are imported from the application * These functions are imported from the application
*/ */
int net_write P((unsigned char *, int)); int net_write (unsigned char *, int);
void net_encrypt P((void)); void net_encrypt (void);
int telnet_spin P((void)); int telnet_spin (void);
char *telnet_getenv P((char *)); char *telnet_getenv (char *);
char *telnet_gets P((char *, char *, int, int)); char *telnet_gets (char *, char *, int, int);
#endif #endif

View File

@@ -50,10 +50,8 @@ RCSID("$Id$");
#include "defines.h" #include "defines.h"
#include "types.h" #include "types.h"
int int
net_write(str, len) net_write(unsigned char *str, int len)
unsigned char *str;
int len;
{ {
if (NETROOM() > len) { if (NETROOM() > len) {
ring_supply_data(&netoring, str, len); ring_supply_data(&netoring, str, len);
@@ -64,7 +62,7 @@ net_write(str, len)
return(0); return(0);
} }
void void
net_encrypt() net_encrypt()
{ {
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
@@ -75,25 +73,20 @@ net_encrypt()
#endif #endif
} }
int int
telnet_spin() telnet_spin()
{ {
return(-1); return(-1);
} }
char * char *
telnet_getenv(val) telnet_getenv(char *val)
char *val;
{ {
return((char *)env_getvalue((unsigned char *)val)); return((char *)env_getvalue((unsigned char *)val));
} }
char * char *
telnet_gets(prompt, result, length, echo) telnet_gets(char *prompt, char *result, int length, int echo)
char *prompt;
char *result;
int length;
int echo;
{ {
extern char *getpass(); extern char *getpass();
extern int globalmode; extern int globalmode;

View File

@@ -38,47 +38,61 @@
RCSID("$Id$"); RCSID("$Id$");
#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <signal.h>
#include <netdb.h>
#include <ctype.h>
#include <pwd.h>
#include <stdarg.h>
#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h>
#include <string.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> #include <arpa/telnet.h>
#endif
#include "general.h" #include "general.h"
#include "ring.h" #include "ring.h"
#include "externs.h" #include "externs.h"
#include "defines.h" #include "defines.h"
#include "types.h" #include "types.h"
#include "libtelnet/misc-proto.h"
#include "roken.h" #include "roken.h"
#if !defined(CRAY) && !defined(sysV88)
#include <netinet/in_systm.h>
# if (defined(vax) || defined(tahoe) || defined(hp300)) && !defined(ultrix)
# include <machine/endian.h>
# endif /* vax */
#endif /* !defined(CRAY) && !defined(sysV88) */
#include <netinet/ip.h>
#ifndef MaxHostNameLen
#define MaxHostNameLen 64
#endif
#if defined(IPPROTO_IP) && defined(IP_TOS) #if defined(IPPROTO_IP) && defined(IP_TOS)
int tos = -1; int tos = -1;
#endif /* defined(IPPROTO_IP) && defined(IP_TOS) */ #endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
@@ -86,12 +100,6 @@ int tos = -1;
char *hostname; char *hostname;
static char _hostname[MaxHostNameLen]; static char _hostname[MaxHostNameLen];
extern char *getenv();
extern int isprefix();
extern char **genget();
extern int Ambiguous();
typedef int (*intrtn_t)(int, char**); typedef int (*intrtn_t)(int, char**);
static int call(intrtn_t, ...); static int call(intrtn_t, ...);
@@ -107,7 +115,7 @@ static char saveline[256];
static int margc; static int margc;
static char *margv[20]; static char *margv[20];
static void static void
makeargv() makeargv()
{ {
char *cp, *cp2, c; char *cp, *cp2, c;
@@ -164,7 +172,8 @@ makeargv()
* Todo: 1. Could take random integers (12, 0x12, 012, 0b1). * Todo: 1. Could take random integers (12, 0x12, 012, 0b1).
*/ */
static char special(char *s) static char
special(char *s)
{ {
char c; char c;
char b; char b;
@@ -189,9 +198,8 @@ static char special(char *s)
* Construct a control character sequence * Construct a control character sequence
* for a special character. * for a special character.
*/ */
static char * static char *
control(c) control(cc_t c)
cc_t c;
{ {
static char buf[5]; static char buf[5];
/* /*
@@ -245,12 +253,12 @@ struct sendlist {
static int static int
send_esc P((void)), send_esc (void),
send_help P((void)), send_help (void),
send_docmd P((char *)), send_docmd (char *),
send_dontcmd P((char *)), send_dontcmd (char *),
send_willcmd P((char *)), send_willcmd (char *),
send_wontcmd P((char *)); send_wontcmd (char *);
static struct sendlist Sendlist[] = { static struct sendlist Sendlist[] = {
{ "ao", "Send Telnet Abort output", 1, 0, 0, 2, AO }, { "ao", "Send Telnet Abort output", 1, 0, 0, 2, AO },
@@ -284,7 +292,8 @@ static struct sendlist Sendlist[] = {
#define GETSEND(name) ((struct sendlist *) genget(name, (char **) Sendlist, \ #define GETSEND(name) ((struct sendlist *) genget(name, (char **) Sendlist, \
sizeof(struct sendlist))) sizeof(struct sendlist)))
static int sendcmd(int argc, char **argv) static int
sendcmd(int argc, char **argv)
{ {
int count; /* how many bytes we are going to need to send */ int count; /* how many bytes we are going to need to send */
int i; int i;
@@ -364,43 +373,39 @@ static int sendcmd(int argc, char **argv)
return (count == success); return (count == success);
} }
static int static int
send_esc() send_esc()
{ {
NETADD(escape); NETADD(escape);
return 1; return 1;
} }
static int static int
send_docmd(name) send_docmd(char *name)
char *name;
{ {
return(send_tncmd(send_do, "do", name)); return(send_tncmd(send_do, "do", name));
} }
static int static int
send_dontcmd(name) send_dontcmd(char *name)
char *name;
{ {
return(send_tncmd(send_dont, "dont", name)); return(send_tncmd(send_dont, "dont", name));
} }
static int
send_willcmd(name) static int
char *name; send_willcmd(char *name)
{ {
return(send_tncmd(send_will, "will", name)); return(send_tncmd(send_will, "will", name));
} }
static int
send_wontcmd(name) static int
char *name; send_wontcmd(char *name)
{ {
return(send_tncmd(send_wont, "wont", name)); return(send_tncmd(send_wont, "wont", name));
} }
int int
send_tncmd(func, cmd, name) send_tncmd(void (*func)(), char *cmd, char *name)
void (*func)();
char *cmd, *name;
{ {
char **cpp; char **cpp;
extern char *telopts[]; extern char *telopts[];
@@ -426,7 +431,7 @@ send_tncmd(func, cmd, name)
printf("\n"); printf("\n");
return 0; return 0;
} }
cpp = (char **)genget(name, telopts, sizeof(char *)); cpp = genget(name, telopts, sizeof(char *));
if (Ambiguous(cpp)) { if (Ambiguous(cpp)) {
fprintf(stderr,"'%s': ambiguous argument ('send %s ?' for help).\n", fprintf(stderr,"'%s': ambiguous argument ('send %s ?' for help).\n",
name, cmd); name, cmd);
@@ -460,7 +465,7 @@ send_tncmd(func, cmd, name)
return 1; return 1;
} }
static int static int
send_help() send_help()
{ {
struct sendlist *s; /* pointer to current command */ struct sendlist *s; /* pointer to current command */
@@ -476,14 +481,14 @@ send_help()
* to by the arguments to the "toggle" command. * to by the arguments to the "toggle" command.
*/ */
static int static int
lclchars() lclchars()
{ {
donelclchars = 1; donelclchars = 1;
return 1; return 1;
} }
static int static int
togdebug() togdebug()
{ {
#ifndef NOT43 #ifndef NOT43
@@ -502,7 +507,7 @@ togdebug()
} }
static int static int
togcrlf() togcrlf()
{ {
if (crlf) { if (crlf) {
@@ -515,9 +520,8 @@ togcrlf()
int binmode; int binmode;
static int static int
togbinary(val) togbinary(int val)
int val;
{ {
donebinarytoggle = 1; donebinarytoggle = 1;
@@ -554,9 +558,8 @@ togbinary(val)
return 1; return 1;
} }
static int static int
togrbinary(val) togrbinary(int val)
int val;
{ {
donebinarytoggle = 1; donebinarytoggle = 1;
@@ -581,9 +584,8 @@ togrbinary(val)
return 1; return 1;
} }
static int static int
togxbinary(val) togxbinary(int val)
int val;
{ {
donebinarytoggle = 1; donebinarytoggle = 1;
@@ -609,15 +611,15 @@ togxbinary(val)
} }
static int togglehelp P((void)); static int togglehelp (void);
#if defined(AUTHENTICATION) #if defined(AUTHENTICATION)
extern int auth_togdebug P((int)); extern int auth_togdebug (int);
#endif #endif
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
extern int EncryptAutoEnc P((int)); extern int EncryptAutoEnc (int);
extern int EncryptAutoDec P((int)); extern int EncryptAutoDec (int);
extern int EncryptDebug P((int)); extern int EncryptDebug (int);
extern int EncryptVerbose P((int)); extern int EncryptVerbose (int);
#endif #endif
struct togglelist { struct togglelist {
@@ -743,7 +745,7 @@ static struct togglelist Togglelist[] = {
{ 0 } { 0 }
}; };
static int static int
togglehelp() togglehelp()
{ {
struct togglelist *c; struct togglelist *c;
@@ -761,9 +763,8 @@ togglehelp()
return 0; return 0;
} }
static void static void
settogglehelp(set) settogglehelp(int set)
int set;
{ {
struct togglelist *c; struct togglelist *c;
@@ -781,10 +782,8 @@ settogglehelp(set)
#define GETTOGGLE(name) (struct togglelist *) \ #define GETTOGGLE(name) (struct togglelist *) \
genget(name, (char **) Togglelist, sizeof(struct togglelist)) genget(name, (char **) Togglelist, sizeof(struct togglelist))
static int static int
toggle(argc, argv) toggle(int argc, char *argv[])
int argc;
char *argv[];
{ {
int retval = 1; int retval = 1;
char *name; char *name;
@@ -895,17 +894,15 @@ _setlist_init()
} }
#endif /* defined(CRAY) && !defined(__STDC__) */ #endif /* defined(CRAY) && !defined(__STDC__) */
static struct setlist * static struct setlist *
getset(name) getset(char *name)
char *name;
{ {
return (struct setlist *) return (struct setlist *)
genget(name, (char **) Setlist, sizeof(struct setlist)); genget(name, (char **) Setlist, sizeof(struct setlist));
} }
void void
set_escape_char(s) set_escape_char(char *s)
char *s;
{ {
if (rlogin != _POSIX_VDISABLE) { if (rlogin != _POSIX_VDISABLE) {
rlogin = (s && *s) ? special(s) : _POSIX_VDISABLE; rlogin = (s && *s) ? special(s) : _POSIX_VDISABLE;
@@ -917,10 +914,8 @@ set_escape_char(s)
} }
} }
static int static int
setcmd(argc, argv) setcmd(int argc, char *argv[])
int argc;
char *argv[];
{ {
int value; int value;
struct setlist *ct; struct setlist *ct;
@@ -990,10 +985,8 @@ setcmd(argc, argv)
return 1; return 1;
} }
static int static int
unsetcmd(argc, argv) unsetcmd(int argc, char *argv[])
int argc;
char *argv[];
{ {
struct setlist *ct; struct setlist *ct;
struct togglelist *c; struct togglelist *c;
@@ -1060,7 +1053,8 @@ unsetcmd(argc, argv)
#ifdef KLUDGELINEMODE #ifdef KLUDGELINEMODE
extern int kludgelinemode; extern int kludgelinemode;
static int dokludgemode(void) static int
dokludgemode(void)
{ {
kludgelinemode = 1; kludgelinemode = 1;
send_wont(TELOPT_LINEMODE, 1); send_wont(TELOPT_LINEMODE, 1);
@@ -1070,7 +1064,7 @@ static int dokludgemode(void)
} }
#endif #endif
static int static int
dolinemode() dolinemode()
{ {
#ifdef KLUDGELINEMODE #ifdef KLUDGELINEMODE
@@ -1082,7 +1076,7 @@ dolinemode()
return 1; return 1;
} }
static int static int
docharmode() docharmode()
{ {
#ifdef KLUDGELINEMODE #ifdef KLUDGELINEMODE
@@ -1095,9 +1089,8 @@ docharmode()
return 1; return 1;
} }
static int static int
dolmmode(bit, on) dolmmode(int bit, int on)
int bit, on;
{ {
unsigned char c; unsigned char c;
extern int linemode; extern int linemode;
@@ -1116,14 +1109,14 @@ dolmmode(bit, on)
return 1; return 1;
} }
int static int
setmode(bit) tn_setmode(int bit)
{ {
return dolmmode(bit, 1); return dolmmode(bit, 1);
} }
int static int
clearmode(bit) tn_clearmode(int bit)
{ {
return dolmmode(bit, 0); return dolmmode(bit, 0);
} }
@@ -1136,7 +1129,7 @@ struct modelist {
int arg1; int arg1;
}; };
extern int modehelp(); static int modehelp();
static struct modelist ModeList[] = { static struct modelist ModeList[] = {
{ "character", "Disable LINEMODE option", docharmode, 1 }, { "character", "Disable LINEMODE option", docharmode, 1 },
@@ -1149,18 +1142,18 @@ static struct modelist ModeList[] = {
#endif #endif
{ "", "", 0 }, { "", "", 0 },
{ "", "These require the LINEMODE option to be enabled", 0 }, { "", "These require the LINEMODE option to be enabled", 0 },
{ "isig", "Enable signal trapping", setmode, 1, MODE_TRAPSIG }, { "isig", "Enable signal trapping", tn_setmode, 1, MODE_TRAPSIG },
{ "+isig", 0, setmode, 1, MODE_TRAPSIG }, { "+isig", 0, tn_setmode, 1, MODE_TRAPSIG },
{ "-isig", "Disable signal trapping", clearmode, 1, MODE_TRAPSIG }, { "-isig", "Disable signal trapping", tn_clearmode, 1, MODE_TRAPSIG },
{ "edit", "Enable character editing", setmode, 1, MODE_EDIT }, { "edit", "Enable character editing", tn_setmode, 1, MODE_EDIT },
{ "+edit", 0, setmode, 1, MODE_EDIT }, { "+edit", 0, tn_setmode, 1, MODE_EDIT },
{ "-edit", "Disable character editing", clearmode, 1, MODE_EDIT }, { "-edit", "Disable character editing", tn_clearmode, 1, MODE_EDIT },
{ "softtabs", "Enable tab expansion", setmode, 1, MODE_SOFT_TAB }, { "softtabs", "Enable tab expansion", tn_setmode, 1, MODE_SOFT_TAB },
{ "+softtabs", 0, setmode, 1, MODE_SOFT_TAB }, { "+softtabs", 0, tn_setmode, 1, MODE_SOFT_TAB },
{ "-softtabs", "Disable character editing", clearmode, 1, MODE_SOFT_TAB }, { "-softtabs", "Disable character editing", tn_clearmode, 1, MODE_SOFT_TAB },
{ "litecho", "Enable literal character echo", setmode, 1, MODE_LIT_ECHO }, { "litecho", "Enable literal character echo", tn_setmode, 1, MODE_LIT_ECHO },
{ "+litecho", 0, setmode, 1, MODE_LIT_ECHO }, { "+litecho", 0, tn_setmode, 1, MODE_LIT_ECHO },
{ "-litecho", "Disable literal character echo", clearmode, 1, MODE_LIT_ECHO }, { "-litecho", "Disable literal character echo", tn_clearmode, 1, MODE_LIT_ECHO },
{ "help", 0, modehelp, 0 }, { "help", 0, modehelp, 0 },
#ifdef KLUDGELINEMODE #ifdef KLUDGELINEMODE
{ "kludgeline", 0, dokludgemode, 1 }, { "kludgeline", 0, dokludgemode, 1 },
@@ -1171,7 +1164,7 @@ static struct modelist ModeList[] = {
}; };
int static int
modehelp() modehelp()
{ {
struct modelist *mt; struct modelist *mt;
@@ -1191,10 +1184,8 @@ modehelp()
#define GETMODECMD(name) (struct modelist *) \ #define GETMODECMD(name) (struct modelist *) \
genget(name, (char **) ModeList, sizeof(struct modelist)) genget(name, (char **) ModeList, sizeof(struct modelist))
static int static int
modecmd(argc, argv) modecmd(int argc, char **argv)
int argc;
char *argv[];
{ {
struct modelist *mt; struct modelist *mt;
@@ -1219,10 +1210,8 @@ modecmd(argc, argv)
* "display" command. * "display" command.
*/ */
static int static int
display(argc, argv) display(int argc, char *argv[])
int argc;
char *argv[];
{ {
struct togglelist *tl; struct togglelist *tl;
struct setlist *sl; struct setlist *sl;
@@ -1290,10 +1279,8 @@ display(argc, argv)
/* /*
* Set the escape character. * Set the escape character.
*/ */
static int static int
setescape(argc, argv) setescape(int argc, char *argv[])
int argc;
char *argv[];
{ {
char *arg; char *arg;
char buf[50]; char buf[50];
@@ -1316,8 +1303,7 @@ setescape(argc, argv)
return 1; return 1;
} }
/*VARARGS*/ static int
static int
togcrmod() togcrmod()
{ {
crmod = !crmod; crmod = !crmod;
@@ -1327,8 +1313,7 @@ togcrmod()
return 1; return 1;
} }
/*VARARGS*/ static int
int
suspend() suspend()
{ {
#ifdef SIGTSTP #ifdef SIGTSTP
@@ -1357,8 +1342,7 @@ suspend()
return 1; return 1;
} }
/*ARGSUSED*/ static int
int
shell(int argc, char **argv) shell(int argc, char **argv)
{ {
long oldrows, oldcols, newrows, newcols, err; long oldrows, oldcols, newrows, newcols, err;
@@ -1404,7 +1388,8 @@ shell(int argc, char **argv)
return 1; return 1;
} }
static int bye(int argc, char **argv) static int
bye(int argc, char **argv)
{ {
extern int resettermname; extern int resettermname;
@@ -1425,16 +1410,15 @@ static int bye(int argc, char **argv)
return 0; /* NOTREACHED */ return 0; /* NOTREACHED */
} }
/*VARARGS*/ int
int quit(void) quit(void)
{ {
call(bye, "bye", "fromquit", 0); call(bye, "bye", "fromquit", 0);
Exit(0); Exit(0);
return 0; /*NOTREACHED*/ return 0; /*NOTREACHED*/
} }
/*VARARGS*/ static int
int
logout() logout()
{ {
send_do(TELOPT_LOGOUT, 1); send_do(TELOPT_LOGOUT, 1);
@@ -1468,7 +1452,7 @@ struct slclist SlcList[] = {
{ 0 }, { 0 },
}; };
static void static void
slc_help() slc_help()
{ {
struct slclist *c; struct slclist *c;
@@ -1483,15 +1467,15 @@ slc_help()
} }
} }
static struct slclist * static struct slclist *
getslc(name) getslc(char *name)
char *name;
{ {
return (struct slclist *) return (struct slclist *)
genget(name, (char **) SlcList, sizeof(struct slclist)); genget(name, (char **) SlcList, sizeof(struct slclist));
} }
static int slccmd(int argc, char **argv) static int
slccmd(int argc, char **argv)
{ {
struct slclist *c; struct slclist *c;
@@ -1528,15 +1512,15 @@ struct envlist {
}; };
extern struct env_lst * extern struct env_lst *
env_define P((unsigned char *, unsigned char *)); env_define (unsigned char *, unsigned char *);
extern void extern void
env_undefine P((unsigned char *)), env_undefine (unsigned char *),
env_export P((unsigned char *)), env_export (unsigned char *),
env_unexport P((unsigned char *)), env_unexport (unsigned char *),
env_send P((unsigned char *)), env_send (unsigned char *),
env_list P((void)); env_list (void);
static void static void
env_help P((void)); env_help (void);
struct envlist EnvList[] = { struct envlist EnvList[] = {
{ "define", "Define an environment variable", { "define", "Define an environment variable",
@@ -1555,7 +1539,7 @@ struct envlist EnvList[] = {
{ 0 }, { 0 },
}; };
static void static void
env_help() env_help()
{ {
struct envlist *c; struct envlist *c;
@@ -1570,15 +1554,15 @@ env_help()
} }
} }
static struct envlist * static struct envlist *
getenvcmd(name) getenvcmd(char *name)
char *name;
{ {
return (struct envlist *) return (struct envlist *)
genget(name, (char **) EnvList, sizeof(struct envlist)); genget(name, (char **) EnvList, sizeof(struct envlist));
} }
int env_cmd(int argc, char **argv) static int
env_cmd(int argc, char **argv)
{ {
struct envlist *c; struct envlist *c;
@@ -1620,9 +1604,8 @@ struct env_lst {
struct env_lst envlisthead; struct env_lst envlisthead;
struct env_lst * struct env_lst *
env_find(var) env_find(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1637,7 +1620,7 @@ env_find(var)
#define environ _environ #define environ _environ
#endif #endif
void void
env_init() env_init()
{ {
extern char **environ; extern char **environ;
@@ -1694,9 +1677,8 @@ env_init()
env_export((unsigned char *)"XAUTHORITY"); env_export((unsigned char *)"XAUTHORITY");
} }
struct env_lst * struct env_lst *
env_define(var, value) env_define(unsigned char *var, unsigned char *value)
unsigned char *var, *value;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1720,9 +1702,8 @@ env_define(var, value)
return(ep); return(ep);
} }
void void
env_undefine(var) env_undefine(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1738,9 +1719,8 @@ env_undefine(var)
} }
} }
void void
env_export(var) env_export(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1748,9 +1728,8 @@ env_export(var)
ep->export = 1; ep->export = 1;
} }
void void
env_unexport(var) env_unexport(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1758,9 +1737,8 @@ env_unexport(var)
ep->export = 0; ep->export = 0;
} }
void void
env_send(var) env_send(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1785,7 +1763,7 @@ env_send(var)
env_opt_end(0); env_opt_end(0);
} }
void void
env_list() env_list()
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1796,9 +1774,8 @@ env_list()
} }
} }
unsigned char * unsigned char *
env_default(init, welldefined) env_default(int init, int welldefined)
int init;
{ {
static struct env_lst *nep = NULL; static struct env_lst *nep = NULL;
@@ -1815,9 +1792,8 @@ env_default(init, welldefined)
return(NULL); return(NULL);
} }
unsigned char * unsigned char *
env_getvalue(var) env_getvalue(unsigned char *var)
unsigned char *var;
{ {
struct env_lst *ep; struct env_lst *ep;
@@ -1840,11 +1816,11 @@ struct authlist {
}; };
extern int extern int
auth_enable P((char *)), auth_enable (char *),
auth_disable P((char *)), auth_disable (char *),
auth_status P((void)); auth_status (void);
static int static int
auth_help P((void)); auth_help (void);
struct authlist AuthList[] = { struct authlist AuthList[] = {
{ "status", "Display current status of authentication information", { "status", "Display current status of authentication information",
@@ -1858,7 +1834,7 @@ struct authlist AuthList[] = {
{ 0 }, { 0 },
}; };
static int static int
auth_help() auth_help()
{ {
struct authlist *c; struct authlist *c;
@@ -1874,7 +1850,8 @@ auth_help()
return 0; return 0;
} }
int auth_cmd(int argc, char **argv) static int
auth_cmd(int argc, char **argv)
{ {
struct authlist *c; struct authlist *c;
@@ -1923,18 +1900,18 @@ struct encryptlist {
}; };
extern int extern int
EncryptEnable P((char *, char *)), EncryptEnable (char *, char *),
EncryptDisable P((char *, char *)), EncryptDisable (char *, char *),
EncryptType P((char *, char *)), EncryptType (char *, char *),
EncryptStart P((char *)), EncryptStart (char *),
EncryptStartInput P((void)), EncryptStartInput (void),
EncryptStartOutput P((void)), EncryptStartOutput (void),
EncryptStop P((char *)), EncryptStop (char *),
EncryptStopInput P((void)), EncryptStopInput (void),
EncryptStopOutput P((void)), EncryptStopOutput (void),
EncryptStatus P((void)); EncryptStatus (void);
static int static int
EncryptHelp P((void)); EncryptHelp (void);
struct encryptlist EncryptList[] = { struct encryptlist EncryptList[] = {
{ "enable", "Enable encryption. ('encrypt enable ?' for more)", { "enable", "Enable encryption. ('encrypt enable ?' for more)",
@@ -1963,7 +1940,7 @@ struct encryptlist EncryptList[] = {
{ 0 }, { 0 },
}; };
static int static int
EncryptHelp() EncryptHelp()
{ {
struct encryptlist *c; struct encryptlist *c;
@@ -1979,7 +1956,8 @@ EncryptHelp()
return 0; return 0;
} }
int encrypt_cmd(int argc, char **argv) static int
encrypt_cmd(int argc, char **argv)
{ {
struct encryptlist *c; struct encryptlist *c;
@@ -2026,7 +2004,8 @@ int encrypt_cmd(int argc, char **argv)
* Print status about the connection. * Print status about the connection.
*/ */
static int status(int argc, char **argv) static int
status(int argc, char **argv)
{ {
if (connected) { if (connected) {
printf("Connected to %s.\n", hostname); printf("Connected to %s.\n", hostname);
@@ -2080,7 +2059,8 @@ static char rcbuf[128];
static Command *getcmd(char *name); static Command *getcmd(char *name);
static void cmdrc(char *m1, char *m2) static void
cmdrc(char *m1, char *m2)
{ {
Command *c; Command *c;
FILE *rcfile; FILE *rcfile;
@@ -2159,7 +2139,8 @@ static void cmdrc(char *m1, char *m2)
fclose(rcfile); fclose(rcfile);
} }
int tn(int argc, char **argv) int
tn(int argc, char **argv)
{ {
struct hostent *host = 0; struct hostent *host = 0;
struct sockaddr_in sin; struct sockaddr_in sin;
@@ -2292,9 +2273,6 @@ int tn(int argc, char **argv)
return 0; return 0;
} }
} else { } else {
#if !defined(htons) && 0
u_short htons P((unsigned short));
#endif /* !defined(htons) */
sin.sin_port = htons(sin.sin_port); sin.sin_port = htons(sin.sin_port);
} }
} else { } else {
@@ -2462,7 +2440,8 @@ static Command cmdtab2[] = {
* Call routine with argc, argv set from args (terminated by 0). * Call routine with argc, argv set from args (terminated by 0).
*/ */
static int call(intrtn_t routine, ...) static int
call(intrtn_t routine, ...)
{ {
va_list ap; va_list ap;
char *args[100]; char *args[100];
@@ -2475,7 +2454,8 @@ static int call(intrtn_t routine, ...)
} }
static Command *getcmd(char *name) static Command
*getcmd(char *name)
{ {
Command *cm; Command *cm;
@@ -2484,11 +2464,8 @@ static Command *getcmd(char *name)
return (Command *) genget(name, (char **) cmdtab2, sizeof(Command)); return (Command *) genget(name, (char **) cmdtab2, sizeof(Command));
} }
void void
command(top, tbuf, cnt) command(int top, char *tbuf, int cnt)
int top;
char *tbuf;
int cnt;
{ {
Command *c; Command *c;
@@ -2560,7 +2537,8 @@ command(top, tbuf, cnt)
/* /*
* Help command. * Help command.
*/ */
static int help(int argc, char **argv) static int
help(int argc, char **argv)
{ {
Command *c; Command *c;
@@ -2629,11 +2607,8 @@ static int help(int argc, char **argv)
* pointed to by *cpp is. * pointed to by *cpp is.
* *
*/ */
unsigned long unsigned long
sourceroute(arg, cpp, lenp) sourceroute(char *arg, char **cpp, int *lenp)
char *arg;
char **cpp;
int *lenp;
{ {
static char lsr[44]; static char lsr[44];
#ifdef sysV88 #ifdef sysV88

View File

@@ -33,6 +33,8 @@
* @(#)externs.h 8.3 (Berkeley) 5/30/95 * @(#)externs.h 8.3 (Berkeley) 5/30/95
*/ */
/* $Id$ */
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
#if defined(CRAY) && !defined(NO_BSD_SETJMP) #if defined(CRAY) && !defined(NO_BSD_SETJMP)
@@ -67,14 +69,6 @@
#define SUBBUFSIZE 256 #define SUBBUFSIZE 256
#if !defined(P)
# ifdef __STDC__
# define P(x) x
# else
# define P(x) ()
# endif
#endif
extern int extern int
autologin, /* Autologin enabled */ autologin, /* Autologin enabled */
skiprc, /* Don't process the ~/.telnetrc file */ skiprc, /* Don't process the ~/.telnetrc file */
@@ -120,8 +114,8 @@ extern char
options[], /* All the little options */ options[], /* All the little options */
*hostname; /* Who are we connected to? */ *hostname; /* Who are we connected to? */
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
extern void (*encrypt_output) P((unsigned char *, int)); extern void (*encrypt_output) (unsigned char *, int);
extern int (*decrypt_input) P((int)); extern int (*decrypt_input) (int);
#endif #endif
/* /*
@@ -192,80 +186,80 @@ extern FILE
extern unsigned char extern unsigned char
NetTraceFile[]; /* Name of file where debugging output goes */ NetTraceFile[]; /* Name of file where debugging output goes */
extern void extern void
SetNetTrace P((char *)); /* Function to change where debugging goes */ SetNetTrace (char *); /* Function to change where debugging goes */
extern jmp_buf extern jmp_buf
peerdied, peerdied,
toplevel; /* For error conditions. */ toplevel; /* For error conditions. */
extern void extern void
command P((int, char *, int)), command (int, char *, int),
Dump P((char, unsigned char *, int)), Dump (char, unsigned char *, int),
printoption P((char *, int, int)), printoption (char *, int, int),
printsub P((char, unsigned char *, int)), printsub (char, unsigned char *, int),
sendnaws P((void)), sendnaws (void),
setconnmode P((int)), setconnmode (int),
setcommandmode P((void)), setcommandmode (void),
setneturg P((void)), setneturg (void),
sys_telnet_init P((void)), sys_telnet_init (void),
telnet P((char *)), telnet (char *),
tel_enter_binary P((int)), tel_enter_binary (int),
TerminalFlushOutput P((void)), TerminalFlushOutput (void),
TerminalNewMode P((int)), TerminalNewMode (int),
TerminalRestoreState P((void)), TerminalRestoreState (void),
TerminalSaveState P((void)), TerminalSaveState (void),
tninit P((void)), tninit (void),
upcase P((char *)), upcase (char *),
willoption P((int)), willoption (int),
wontoption P((int)); wontoption (int);
extern void extern void
send_do P((int, int)), send_do (int, int),
send_dont P((int, int)), send_dont (int, int),
send_will P((int, int)), send_will (int, int),
send_wont P((int, int)); send_wont (int, int);
extern void extern void
lm_will P((unsigned char *, int)), lm_will (unsigned char *, int),
lm_wont P((unsigned char *, int)), lm_wont (unsigned char *, int),
lm_do P((unsigned char *, int)), lm_do (unsigned char *, int),
lm_dont P((unsigned char *, int)), lm_dont (unsigned char *, int),
lm_mode P((unsigned char *, int, int)); lm_mode (unsigned char *, int, int);
extern void extern void
slc_init P((void)), slc_init (void),
slcstate P((void)), slcstate (void),
slc_mode_export P((void)), slc_mode_export (void),
slc_mode_import P((int)), slc_mode_import (int),
slc_import P((int)), slc_import (int),
slc_export P((void)), slc_export (void),
slc P((unsigned char *, int)), slc (unsigned char *, int),
slc_check P((void)), slc_check (void),
slc_start_reply P((void)), slc_start_reply (void),
slc_add_reply P((unsigned char, unsigned char, cc_t)), slc_add_reply (unsigned char, unsigned char, cc_t),
slc_end_reply P((void)); slc_end_reply (void);
extern int extern int
slc_update P((void)); slc_update (void);
extern void extern void
env_opt P((unsigned char *, int)), env_opt (unsigned char *, int),
env_opt_start P((void)), env_opt_start (void),
env_opt_start_info P((void)), env_opt_start_info (void),
env_opt_add P((unsigned char *)), env_opt_add (unsigned char *),
env_opt_end P((int)); env_opt_end (int);
extern unsigned char extern unsigned char
*env_default P((int, int)), *env_default (int, int),
*env_getvalue P((unsigned char *)); *env_getvalue (unsigned char *);
extern int extern int
get_status P((void)), get_status (void),
dosynch P((void)); dosynch (void);
extern cc_t extern cc_t
*tcval P((int)); *tcval (int);
extern int quit P((void)); extern int quit (void);
extern struct termios new_tc; extern struct termios new_tc;

View File

@@ -52,24 +52,22 @@ RCSID("$Id$");
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#ifdef size_t #ifdef HAVE_SYS_TYPES_H
#undef size_t
#endif
#include <sys/types.h> #include <sys/types.h>
#endif
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif
#include "ring.h" #include "ring.h"
#include "general.h" #include "general.h"
/* Internal macros */ #include <roken.h>
#if !defined(MIN) /* Internal macros */
#define MIN(a,b) (((a)<(b))? (a):(b))
#endif /* !defined(MIN) */
#define ring_subtract(d,a,b) (((a)-(b) >= 0)? \ #define ring_subtract(d,a,b) (((a)-(b) >= 0)? \
(a)-(b): (((a)-(b))+(d)->size)) (a)-(b): (((a)-(b))+(d)->size))
@@ -102,7 +100,8 @@ static u_long ring_clock = 0;
/* Buffer state transition routines */ /* Buffer state transition routines */
int ring_init(Ring *ring, unsigned char *buffer, int count) int
ring_init(Ring *ring, unsigned char *buffer, int count)
{ {
memset(ring, 0, sizeof *ring); memset(ring, 0, sizeof *ring);
@@ -125,9 +124,8 @@ int ring_init(Ring *ring, unsigned char *buffer, int count)
* Mark the most recently supplied byte. * Mark the most recently supplied byte.
*/ */
void void
ring_mark(ring) ring_mark(Ring *ring)
Ring *ring;
{ {
ring->mark = ring_decrement(ring, ring->supply, 1); ring->mark = ring_decrement(ring, ring->supply, 1);
} }
@@ -136,9 +134,8 @@ ring_mark(ring)
* Is the ring pointing to the mark? * Is the ring pointing to the mark?
*/ */
int int
ring_at_mark(ring) ring_at_mark(Ring *ring)
Ring *ring;
{ {
if (ring->mark == ring->consume) { if (ring->mark == ring->consume) {
return 1; return 1;
@@ -151,9 +148,8 @@ ring_at_mark(ring)
* Clear any mark set on the ring. * Clear any mark set on the ring.
*/ */
void void
ring_clear_mark(ring) ring_clear_mark(Ring *ring)
Ring *ring;
{ {
ring->mark = 0; ring->mark = 0;
} }
@@ -161,10 +157,8 @@ ring_clear_mark(ring)
/* /*
* Add characters from current segment to ring buffer. * Add characters from current segment to ring buffer.
*/ */
void void
ring_supplied(ring, count) ring_supplied(Ring *ring, int count)
Ring *ring;
int count;
{ {
ring->supply = ring_increment(ring, ring->supply, count); ring->supply = ring_increment(ring, ring->supply, count);
ring->supplytime = ++ring_clock; ring->supplytime = ++ring_clock;
@@ -173,10 +167,8 @@ ring_supplied(ring, count)
/* /*
* We have just consumed "c" bytes. * We have just consumed "c" bytes.
*/ */
void void
ring_consumed(ring, count) ring_consumed(Ring *ring, int count)
Ring *ring;
int count;
{ {
if (count == 0) /* don't update anything */ if (count == 0) /* don't update anything */
return; return;
@@ -210,9 +202,8 @@ ring_consumed(ring, count)
/* Number of bytes that may be supplied */ /* Number of bytes that may be supplied */
int int
ring_empty_count(ring) ring_empty_count(Ring *ring)
Ring *ring;
{ {
if (ring_empty(ring)) { /* if empty */ if (ring_empty(ring)) { /* if empty */
return ring->size; return ring->size;
@@ -222,9 +213,8 @@ ring_empty_count(ring)
} }
/* number of CONSECUTIVE bytes that may be supplied */ /* number of CONSECUTIVE bytes that may be supplied */
int int
ring_empty_consecutive(ring) ring_empty_consecutive(Ring *ring)
Ring *ring;
{ {
if ((ring->consume < ring->supply) || ring_empty(ring)) { if ((ring->consume < ring->supply) || ring_empty(ring)) {
/* /*
@@ -244,9 +234,8 @@ ring_empty_consecutive(ring)
* (but don't give more than enough to get to cross over set mark) * (but don't give more than enough to get to cross over set mark)
*/ */
int int
ring_full_count(ring) ring_full_count(Ring *ring)
Ring *ring;
{ {
if ((ring->mark == 0) || (ring->mark == ring->consume)) { if ((ring->mark == 0) || (ring->mark == ring->consume)) {
if (ring_full(ring)) { if (ring_full(ring)) {
@@ -263,9 +252,8 @@ ring_full_count(ring)
* Return the number of CONSECUTIVE bytes available for consuming. * Return the number of CONSECUTIVE bytes available for consuming.
* However, don't return more than enough to cross over set mark. * However, don't return more than enough to cross over set mark.
*/ */
int int
ring_full_consecutive(ring) ring_full_consecutive(Ring *ring)
Ring *ring;
{ {
if ((ring->mark == 0) || (ring->mark == ring->consume)) { if ((ring->mark == 0) || (ring->mark == ring->consume)) {
if ((ring->supply < ring->consume) || ring_full(ring)) { if ((ring->supply < ring->consume) || ring_full(ring)) {
@@ -285,16 +273,13 @@ ring_full_consecutive(ring)
/* /*
* Move data into the "supply" portion of of the ring buffer. * Move data into the "supply" portion of of the ring buffer.
*/ */
void void
ring_supply_data(ring, buffer, count) ring_supply_data(Ring *ring, unsigned char *buffer, int count)
Ring *ring;
unsigned char *buffer;
int count;
{ {
int i; int i;
while (count) { while (count) {
i = MIN(count, ring_empty_consecutive(ring)); i = min(count, ring_empty_consecutive(ring));
memmove(ring->supply, buffer, i); memmove(ring->supply, buffer, i);
ring_supplied(ring, i); ring_supplied(ring, i);
count -= i; count -= i;
@@ -307,16 +292,13 @@ ring_supply_data(ring, buffer, count)
/* /*
* Move data from the "consume" portion of the ring buffer * Move data from the "consume" portion of the ring buffer
*/ */
void void
ring_consume_data(ring, buffer, count) ring_consume_data(Ring *ring, unsigned char *buffer, int count)
Ring *ring;
unsigned char *buffer;
int count;
{ {
int i; int i;
while (count) { while (count) {
i = MIN(count, ring_full_consecutive(ring)); i = min(count, ring_full_consecutive(ring));
memmove(buffer, ring->consume, i); memmove(buffer, ring->consume, i);
ring_consumed(ring, i); ring_consumed(ring, i);
count -= i; count -= i;
@@ -326,10 +308,8 @@ ring_consume_data(ring, buffer, count)
#endif #endif
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
void void
ring_encrypt(ring, encryptor) ring_encrypt(Ring *ring, void (*encryptor)())
Ring *ring;
void (*encryptor)();
{ {
unsigned char *s, *c; unsigned char *s, *c;
@@ -350,9 +330,8 @@ ring_encrypt(ring, encryptor)
ring->clearto = ring->supply; ring->clearto = ring->supply;
} }
void void
ring_clearto(ring) ring_clearto(Ring *ring)
Ring *ring;
{ {
if (!ring_empty(ring)) if (!ring_empty(ring))
ring->clearto = ring->supply; ring->clearto = ring->supply;

View File

@@ -33,15 +33,7 @@
* @(#)ring.h 8.1 (Berkeley) 6/6/93 * @(#)ring.h 8.1 (Berkeley) 6/6/93
*/ */
#if defined(P) /* $Id$ */
# undef P
#endif
#if defined(__STDC__) || defined(LINT_ARGS)
# define P(x) x
#else
# define P(x) ()
#endif
/* /*
* This defines a structure for a ring buffer. * This defines a structure for a ring buffer.
@@ -72,32 +64,32 @@ typedef struct {
/* Initialization routine */ /* Initialization routine */
extern int extern int
ring_init P((Ring *ring, unsigned char *buffer, int count)); ring_init (Ring *ring, unsigned char *buffer, int count);
/* Data movement routines */ /* Data movement routines */
extern void extern void
ring_supply_data P((Ring *ring, unsigned char *buffer, int count)); ring_supply_data (Ring *ring, unsigned char *buffer, int count);
#ifdef notdef #ifdef notdef
extern void extern void
ring_consume_data P((Ring *ring, unsigned char *buffer, int count)); ring_consume_data (Ring *ring, unsigned char *buffer, int count);
#endif #endif
/* Buffer state transition routines */ /* Buffer state transition routines */
extern void extern void
ring_supplied P((Ring *ring, int count)), ring_supplied (Ring *ring, int count),
ring_consumed P((Ring *ring, int count)); ring_consumed (Ring *ring, int count);
/* Buffer state query routines */ /* Buffer state query routines */
extern int extern int
ring_empty_count P((Ring *ring)), ring_empty_count (Ring *ring),
ring_empty_consecutive P((Ring *ring)), ring_empty_consecutive (Ring *ring),
ring_full_count P((Ring *ring)), ring_full_count (Ring *ring),
ring_full_consecutive P((Ring *ring)); ring_full_consecutive (Ring *ring);
#if defined(ENCRYPTION) #if defined(ENCRYPTION)
extern void extern void
ring_encrypt P((Ring *ring, void (*func)())), ring_encrypt (Ring *ring, void (*func)()),
ring_clearto P((Ring *ring)); ring_clearto (Ring *ring);
#endif #endif
extern void extern void

View File

@@ -859,10 +859,10 @@ tty_rspeed(int val)
extern struct utmp wtmp; extern struct utmp wtmp;
extern char wtmpf[]; extern char wtmpf[];
extern void utmp_sig_init P((void)); extern void utmp_sig_init (void);
extern void utmp_sig_reset P((void)); extern void utmp_sig_reset (void);
extern void utmp_sig_wait P((void)); extern void utmp_sig_wait (void);
extern void utmp_sig_notify P((int)); extern void utmp_sig_notify (int);
# endif /* PARENT_DOES_UTMP */ # endif /* PARENT_DOES_UTMP */
#ifdef STREAMSPTY #ifdef STREAMSPTY

View File

@@ -141,7 +141,7 @@ int debug = 0;
int keepalive = 1; int keepalive = 1;
char *progname; char *progname;
extern void usage P((void)); extern void usage (void);
/* /*
* The string to pass to getopt(). We do it this way so * The string to pass to getopt(). We do it this way so
@@ -721,7 +721,7 @@ char *hostname;
char host_name[MaxHostNameLen]; char host_name[MaxHostNameLen];
char remote_host_name[MaxHostNameLen]; char remote_host_name[MaxHostNameLen];
extern void telnet P((int, int)); extern void telnet (int, int);
/* /*
* Get a pty, scan input lines. * Get a pty, scan input lines.