summaryrefslogtreecommitdiffstats
path: root/usr.bin/telnet/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/telnet/main.c')
-rw-r--r--usr.bin/telnet/main.c76
1 files changed, 19 insertions, 57 deletions
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 91da94d..0cf715d 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -34,19 +34,20 @@
*/
#ifndef lint
-static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1988, 1990, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93";
+static const char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
#endif /* not lint */
-#include <unistd.h>
-#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "ring.h"
#include "externs.h"
@@ -54,13 +55,19 @@ static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93";
/* 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
-#define OPTS_FORWARDABLE_CREDS 0x00000001
+#define OPTS_FORWARD_CREDS 0x00000002
+#define OPTS_FORWARDABLE_CREDS 0x00000001
#if 0
#define FORWARD
#endif
+void init_terminal(void);
+void init_network(void);
+void init_telnet(void);
+void init_sys(void);
+void init_3270(void);
+
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
char *ipsec_policy_in = NULL;
char *ipsec_policy_out = NULL;
@@ -92,28 +99,18 @@ usage()
{
fprintf(stderr, "Usage: %s %s%s%s%s\n",
prompt,
-#ifdef AUTHENTICATION
- "[-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]",
- "\n\t[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] ",
-#else
- "[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d]",
+ "[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-c] [-d]",
"\n\t[-e char] [-l user] [-n tracefile] ",
-#endif
#if defined(TN3270) && defined(unix)
-# ifdef AUTHENTICATION
- "[-noasynch] [-noasynctty]\n\t"
- "[-noasyncnet] [-r] [-s src_addr] [-t transcom] ",
-# else
"[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t"
"[-s src_addr] [-t transcom] ",
-# endif
#else
"[-r] [-s src_addr] [-u] ",
#endif
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
"[-P policy] "
#endif
- "\n\t[host-name [port]]"
+ "[host-name [port]]"
);
exit(1);
}
@@ -122,7 +119,7 @@ usage()
* main. Parse arguments, invoke the protocol or command parser.
*/
-
+ int
main(argc, argv)
int argc;
char *argv[];
@@ -141,7 +138,7 @@ main(argc, argv)
TerminalSaveState();
- if (prompt = strrchr(argv[0], '/'))
+ if ((prompt = strrchr(argv[0], '/')))
++prompt;
else
prompt = argv[0];
@@ -157,10 +154,9 @@ main(argc, argv)
#define IPSECOPT
#endif
while ((ch = getopt(argc, argv,
- "468EKLNS:X:acde:fFk:l:n:rs:t:ux" IPSECOPT)) != -1)
+ "468EKLNS:X:acde:fFk:l:n:rs:t:uxy" IPSECOPT)) != -1)
#undef IPSECOPT
{
-
switch(ch) {
case '4':
family = AF_INET;
@@ -177,9 +173,6 @@ main(argc, argv)
rlogin = escape = _POSIX_VDISABLE;
break;
case 'K':
-#ifdef AUTHENTICATION
- autologin = 0;
-#endif
break;
case 'L':
eight |= 2; /* binary output only */
@@ -205,9 +198,6 @@ main(argc, argv)
}
break;
case 'X':
-#ifdef AUTHENTICATION
- auth_disable_name(optarg);
-#endif
break;
case 'a':
autologin = 1;
@@ -222,48 +212,19 @@ main(argc, argv)
set_escape_char(optarg);
break;
case 'f':
-#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD)
- if (forward_flags & OPTS_FORWARD_CREDS) {
- fprintf(stderr,
- "%s: Only one of -f and -F allowed.\n",
- prompt);
- usage();
- }
- forward_flags |= OPTS_FORWARD_CREDS;
-#else
fprintf(stderr,
"%s: Warning: -f ignored, no Kerberos V5 support.\n",
prompt);
-#endif
break;
case 'F':
-#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD)
- if (forward_flags & OPTS_FORWARD_CREDS) {
- fprintf(stderr,
- "%s: Only one of -f and -F allowed.\n",
- prompt);
- usage();
- }
- forward_flags |= OPTS_FORWARD_CREDS;
- forward_flags |= OPTS_FORWARDABLE_CREDS;
-#else
fprintf(stderr,
"%s: Warning: -F ignored, no Kerberos V5 support.\n",
prompt);
-#endif
break;
case 'k':
-#if defined(AUTHENTICATION) && defined(KRB4)
- {
- extern char *dest_realm, dst_realm_buf[], dst_realm_sz;
- dest_realm = dst_realm_buf;
- (void)strncpy(dest_realm, optarg, dst_realm_sz);
- }
-#else
fprintf(stderr,
"%s: Warning: -k ignored, no Kerberos V4 support.\n",
prompt);
-#endif
break;
case 'l':
autologin = 1;
@@ -366,4 +327,5 @@ main(argc, argv)
#endif
command(1, 0, 0);
}
+ return 0;
}
OpenPOWER on IntegriCloud