summaryrefslogtreecommitdiffstats
path: root/usr.bin/telnet/utilities.c
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-11-30 22:09:10 +0000
committermarkm <markm@FreeBSD.org>2001-11-30 22:09:10 +0000
commit57acab063b3ef9760ddafee33cca79b6f179421a (patch)
tree872c39a50cab6fcadd1ac8e8806bfb0b5f2c9bd9 /usr.bin/telnet/utilities.c
parentb72e252a0180e401fa4d5bd71ab4374f6f6e2735 (diff)
downloadFreeBSD-src-57acab063b3ef9760ddafee33cca79b6f179421a.zip
FreeBSD-src-57acab063b3ef9760ddafee33cca79b6f179421a.tar.gz
After running "make unifdef", commit the result. This code is now
a complete subset of the crypto (master) code.
Diffstat (limited to 'usr.bin/telnet/utilities.c')
-rw-r--r--usr.bin/telnet/utilities.c111
1 files changed, 35 insertions, 76 deletions
diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c
index ff6e1eb..8ea888e 100644
--- a/usr.bin/telnet/utilities.c
+++ b/usr.bin/telnet/utilities.c
@@ -31,14 +31,13 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
#ifndef lint
-#if 0
static const char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
-#else
-static const char rcsid[] =
- "$FreeBSD$";
#endif
-#endif /* not lint */
#define TELOPTS
#define TELCMDS
@@ -60,6 +59,7 @@ static const char rcsid[] =
#include "externs.h"
+
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
int prettydump;
@@ -69,11 +69,10 @@ int prettydump;
* Upcase (in place) the argument.
*/
- void
-upcase(argument)
- register char *argument;
+void
+upcase(char *argument)
{
- register int c;
+ int c;
while ((c = *argument) != 0) {
if (islower(c)) {
@@ -89,21 +88,11 @@ upcase(argument)
* Compensate for differences in 4.2 and 4.3 systems.
*/
- int
-SetSockOpt(fd, level, option, yesno)
- int fd, level, option, yesno;
+int
+SetSockOpt(int fd, int level, int option, int yesno)
{
-#ifndef NOT43
return setsockopt(fd, level, option,
(char *)&yesno, sizeof yesno);
-#else /* NOT43 */
- if (yesno == 0) { /* Can't do that in 4.2! */
- fprintf(stderr, "Error: attempt to turn off an option 0x%x.\n",
- option);
- return -1;
- }
- return setsockopt(fd, level, option, 0, 0);
-#endif /* NOT43 */
}
/*
@@ -112,9 +101,8 @@ SetSockOpt(fd, level, option, yesno)
unsigned char NetTraceFile[256] = "(standard output)";
- void
-SetNetTrace(file)
- register char *file;
+void
+SetNetTrace(char *file)
{
if (NetTrace && NetTrace != stdout)
fclose(NetTrace);
@@ -130,11 +118,8 @@ SetNetTrace(file)
strcpy((char *)NetTraceFile, "(standard output)");
}
- void
-Dump(direction, buffer, length)
- char direction;
- unsigned char *buffer;
- int length;
+void
+Dump(char direction, unsigned char *buffer, int length)
{
# define BYTES_PER_LINE 32
# define min(x,y) ((x<y)? x:y)
@@ -181,10 +166,8 @@ Dump(direction, buffer, length)
}
- void
-printoption(direction, cmd, option)
- char *direction;
- int cmd, option;
+void
+printoption(const char *direction, int cmd, int option)
{
if (!showoptions)
return;
@@ -194,7 +177,7 @@ printoption(direction, cmd, option)
else
fprintf(NetTrace, "%s IAC %d", direction, option);
} else {
- register char *fmt;
+ const char *fmt;
fmt = (cmd == WILL) ? "WILL" : (cmd == WONT) ? "WONT" :
(cmd == DO) ? "DO" : (cmd == DONT) ? "DONT" : 0;
if (fmt) {
@@ -217,10 +200,10 @@ printoption(direction, cmd, option)
return;
}
- void
-optionstatus()
+void
+optionstatus(void)
{
- register int i;
+ int i;
extern char will_wont_resp[], do_dont_resp[];
for (i = 0; i < 256; i++) {
@@ -294,14 +277,10 @@ optionstatus()
}
- void
-printsub(direction, pointer, length)
- char direction; /* '<' or '>' */
- unsigned char *pointer; /* where suboption data sits */
- int length; /* length of suboption data */
+void
+printsub(char direction, unsigned char *pointer, int length)
{
- register int i;
- char buf[512];
+ int i;
extern int want_status_response;
if (showoptions || direction == 0 ||
@@ -310,7 +289,7 @@ printsub(direction, pointer, length)
fprintf(NetTrace, "%s IAC SB ",
(direction == '<')? "RCVD":"SENT");
if (length >= 3) {
- register int j;
+ int j;
i = pointer[length-2];
j = pointer[length-1];
@@ -525,8 +504,8 @@ printsub(direction, pointer, length)
break;
case TELOPT_STATUS: {
- register char *cp;
- register int j, k;
+ const char *cp;
+ int j, k;
fprintf(NetTrace, "STATUS");
@@ -639,7 +618,7 @@ printsub(direction, pointer, length)
fprintf(NetTrace, "INFO ");
env_common:
{
- register int noquote = 2;
+ int noquote = 2;
#if defined(ENV_HACK) && defined(OLD_ENVIRON)
extern int old_env_var, old_env_value;
#endif
@@ -734,72 +713,52 @@ printsub(direction, pointer, length)
* way to the kernel (thus the select).
*/
- void
-EmptyTerminal()
+static void
+EmptyTerminal(void)
{
-#if defined(unix)
fd_set o;
FD_ZERO(&o);
-#endif /* defined(unix) */
if (TTYBYTES() == 0) {
-#if defined(unix)
FD_SET(tout, &o);
(void) select(tout+1, (fd_set *) 0, &o, (fd_set *) 0,
(struct timeval *) 0); /* wait for TTLOWAT */
-#endif /* defined(unix) */
} else {
while (TTYBYTES()) {
(void) ttyflush(0);
-#if defined(unix)
FD_SET(tout, &o);
(void) select(tout+1, (fd_set *) 0, &o, (fd_set *) 0,
(struct timeval *) 0); /* wait for TTLOWAT */
-#endif /* defined(unix) */
}
}
}
- void
-SetForExit()
+static void
+SetForExit(void)
{
setconnmode(0);
-#if defined(TN3270)
- if (In3270) {
- Finish3270();
- }
-#else /* defined(TN3270) */
do {
(void)telrcv(); /* Process any incoming data */
EmptyTerminal();
} while (ring_full_count(&netiring)); /* While there is any */
-#endif /* defined(TN3270) */
setcommandmode();
fflush(stdout);
fflush(stderr);
-#if defined(TN3270)
- if (In3270) {
- StopScreen(1);
- }
-#endif /* defined(TN3270) */
setconnmode(0);
EmptyTerminal(); /* Flush the path to the tty */
setcommandmode();
}
- void
-Exit(returnCode)
- int returnCode;
+void
+Exit(int returnCode)
{
SetForExit();
exit(returnCode);
}
- void
-ExitString(string, returnCode)
- char *string;
- int returnCode;
+void
+ExitString(const char *string, int returnCode)
{
SetForExit();
fwrite(string, 1, strlen(string), stderr);
OpenPOWER on IntegriCloud