*** ./telnet/telnet.c.ORIG Mon Jun 10 10:04:50 2013 --- ./telnet/telnet.c Mon Jun 10 10:58:40 2013 *************** *** 33,40 **** #include #include #include #include - #include #include #define LINEMODE --- 33,40 ---- #include #include #include + #include #include #include #define LINEMODE *************** *** 43,48 **** --- 43,50 ---- #include "externs.h" #include "defines.h" #include "types.h" + + #include "aixinc.h" #define strip(x) (eight ? (x) : ((x) & 0x7f)) *** ./telnet/commands.c.ORIG Mon Jun 10 10:06:03 2013 --- ./telnet/commands.c Mon Jun 10 10:42:56 2013 *************** *** 28,34 **** --- 28,36 ---- */ #include "telnet_locl.h" + #ifndef _AIX #include + #endif #if defined(IPPROTO_IP) && defined(IP_TOS) int tos = -1; *** ./telnet/network.c.ORIG Mon Jun 10 10:06:34 2013 --- ./telnet/network.c Mon Jun 10 10:06:46 2013 *************** *** 28,34 **** --- 28,36 ---- */ #include "telnet_locl.h" + #ifndef _AIX #include + #endif Ring netoring, netiring; unsigned char netobuf[2*BUFSIZ], netibuf[BUFSIZ]; *** ./telnet/sys_bsd.c.ORIG Mon Jun 10 10:06:56 2013 --- ./telnet/sys_bsd.c Mon Jun 10 10:58:58 2013 *************** *** 28,34 **** --- 28,36 ---- */ + #ifndef _AIX #include + #endif #include #include #include *************** *** 37,44 **** #include #include #include #include - #include #include #include #include --- 39,46 ---- #include #include #include + #include #include #include #include #include *** ./telnet/aixinc.h.ORIG Mon Jun 10 12:28:01 2013 --- ./telnet/aixinc.h Mon Jun 10 11:29:25 2013 *************** *** 0 **** --- 1,103 ---- + + #ifndef _aixinc_wrapper_h + #define _aixinc_wrapper_h 1 + + #undef __P + #ifndef __P + #if __STDC__ + #define __P(protos) protos + #else + #define __P(protos) () + #endif + #endif + + typedef long fd_mask; + + #ifndef NFDBITS + #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ + #endif + + #ifdef _AIX + + #define LFLOW_OFF 0 /* Disable remote flow control */ + #define LFLOW_ON 1 /* Enable remote flow control */ + #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ + #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + + #define LM_MODE 1 + #define LM_FORWARDMASK 2 + #define LM_SLC 3 + + #define MODE_EDIT 0x01 + #define MODE_TRAPSIG 0x02 + #define MODE_ACK 0x04 + #define MODE_SOFT_TAB 0x08 + #define MODE_LIT_ECHO 0x10 + + #define MODE_MASK 0x1f + + /* Not part of protocol, but needed to simplify things... */ + #define MODE_FLOW 0x0100 + #define MODE_ECHO 0x0200 + #define MODE_INBIN 0x0400 + #define MODE_OUTBIN 0x0800 + #define MODE_FORCE 0x1000 + + #define SLC_SYNCH 1 + #define SLC_BRK 2 + #define SLC_IP 3 + #define SLC_AO 4 + #define SLC_AYT 5 + #define SLC_EOR 6 + #define SLC_ABORT 7 + #define SLC_EOF 8 + #define SLC_SUSP 9 + #define SLC_EC 10 + #define SLC_EL 11 + #define SLC_EW 12 + #define SLC_RP 13 + #define SLC_LNEXT 14 + #define SLC_XON 15 + #define SLC_XOFF 16 + #define SLC_FORW1 17 + #define SLC_FORW2 18 + + #define NSLC 18 + + /* + * For backwards compatibility, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ + #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, + #ifdef SLC_NAMES + char *slc_names[] = { + SLC_NAMELIST + }; + #else + extern char *slc_names[]; + #define SLC_NAMES SLC_NAMELIST + #endif + + #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) + #define SLC_NAME(x) slc_names[x] + + #define SLC_NOSUPPORT 0 + #define SLC_CANTCHANGE 1 + #define SLC_VARIABLE 2 + #define SLC_DEFAULT 3 + #define SLC_LEVELBITS 0x03 + + #define SLC_FUNC 0 + #define SLC_FLAGS 1 + #define SLC_VALUE 2 + + #define SLC_ACK 0x80 + #define SLC_FLUSHIN 0x40 + #define SLC_FLUSHOUT 0x20 + + #endif + + #endif /* _aixinc_wrapper_h */ + *** ./telnet/Makefile.am.ORIG Mon Jun 10 12:28:14 2013 --- ./telnet/Makefile.am Mon Jun 10 12:32:05 2013 *************** *** 7,13 **** AM_CFLAGS = @EXTRA_CFLAGS@ -DENV_HACK -DUSE_TERMIO -DKLUDGELINEMODE -D_GNU_SOURCE @PIE_CFLAGS@ DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" ! LDADD = @PIE_LDFLAGS@ -lncurses INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/intl\ -I$(srcdir) --- 7,13 ---- AM_CFLAGS = @EXTRA_CFLAGS@ -DENV_HACK -DUSE_TERMIO -DKLUDGELINEMODE -D_GNU_SOURCE @PIE_CFLAGS@ DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" ! LDADD = @PIE_LDFLAGS@ -lcurses INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/intl\ -I$(srcdir) *************** *** 16,22 **** EXTRA_DIST = ${MANS} noinst_HEADERS = defines.h externs.h ring.h telnet_locl.h types.h\ ! misc-proto.h man_MANS = telnet.1 --- 16,22 ---- EXTRA_DIST = ${MANS} noinst_HEADERS = defines.h externs.h ring.h telnet_locl.h types.h\ ! misc-proto.h aixinc.h man_MANS = telnet.1 *************** *** 23,27 **** bin_PROGRAMS = telnet telnet_SOURCES = main.c ring.c telnet.c tn3270.c commands.c\ ! network.c sys_bsd.c terminal.c utilities.c genget.c --- 23,27 ---- bin_PROGRAMS = telnet telnet_SOURCES = main.c ring.c telnet.c tn3270.c commands.c\ ! network.c sys_bsd.c terminal.c utilities.c genget.c aixhelp.c *** ./telnet/vasprintf.c.ORIG Mon Jun 10 12:27:19 2013 --- ./telnet/vasprintf.c Mon Jun 10 11:49:21 2013 *************** *** 0 **** --- 1,133 ---- + /* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994, 1998-1999, 2000-2003, 2006-2007 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + + /* Specification. */ + #include + + #include + #include + #include + + #ifndef va_copy + # define va_copy(__list1,__list2) ((void)(__list1 = __list2)) + #endif + + static int + int_vasprintf (char **result, const char *format, va_list args) + { + const char *p = format; + /* Add one to make sure that it is never zero, which might cause malloc + to return NULL. */ + size_t total_width = strlen (format) + 1; + va_list ap; + + va_copy (ap, args); + while (*p != '\0') + { + if (*p++ == '%') + { + while (strchr ("-+ #0", *p)) + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + if (*p == '.') + { + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + } + while (strchr ("hlLjtz", *p)) + ++p; + /* Should be big enough for any format specifier except %s + and floats. */ + total_width += 30; + switch (*p) + { + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + case 'c': + (void) va_arg (ap, int); + break; + case 'f': + case 'F': + { + double arg = va_arg (ap, double); + if (arg >= 1.0 || arg <= -1.0) + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; + } + break; + case 'e': + case 'E': + case 'g': + case 'G': + (void) va_arg (ap, double); + break; + case 's': + total_width += strlen (va_arg (ap, char *)); + break; + case 'p': + case 'n': + (void) va_arg (ap, char *); + break; + } + p++; + } + } + va_end (ap); + + *result = malloc (total_width); + if (*result != NULL) + return vsprintf (*result, format, args); + else + return -1; + } + + int + vasprintf (char **result, const char *format, va_list args) + { + return int_vasprintf (result, format, args); + } + + int + asprintf (char **result, const char *format, ...) + { + va_list args; + int done; + + va_start (args, format); + done = vasprintf (result, format, args); + va_end (args); + + return done; + } + *** ./telnet/warn.c.ORIG Mon Jun 10 12:27:24 2013 --- ./telnet/warn.c Mon Jun 10 12:24:28 2013 *************** *** 0 **** --- 1,21 ---- + + #include + #include + #include + #include + + void + warn(const char * fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + fprintf(stderr, "telnet"); + if (fmt != NULL) { + fprintf(stderr, ": "); + vfprintf(stderr, fmt, ap); + } + fprintf(stderr, ": %s\n", strerror(errno)); + va_end(ap); + } + *** ./telnet/warnx.c.ORIG Mon Jun 10 12:27:28 2013 --- ./telnet/warnx.c Mon Jun 10 12:25:02 2013 *************** *** 0 **** --- 1,21 ---- + + #include + #include + #include + #include + + void + warnx(const char * fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + fprintf(stderr, "telnet"); + if (fmt != NULL) { + fprintf(stderr, ": "); + vfprintf(stderr, fmt, ap); + } + fprintf(stderr, "\n"); + va_end(ap); + } + *** ./telnet/misc-proto.h.ORIG Mon Jun 10 13:08:28 2013 --- ./telnet/misc-proto.h Mon Jun 10 10:51:41 2013 *************** *** 65,70 **** --- 65,72 ---- #include + #include "aixinc.h" + void auth_encrypt_init __P((char *, char *, char *, int)); void auth_encrypt_user __P((char *)); void auth_encrypt_connect __P((int)); *** ./telnet/ring.h.ORIG Mon Jun 10 13:10:05 2013 --- ./telnet/ring.h Mon Jun 10 13:11:07 2013 *************** *** 31,36 **** --- 31,38 ---- #include #define P __P + #include "aixinc.h" + /* * This defines a structure for a ring buffer. * *** ./telnet/aixhelp.c.ORIG Mon Jun 10 13:13:54 2013 --- ./telnet/aixhelp.c Mon Jun 10 12:23:46 2013 *************** *** 0 **** --- 1,17 ---- + + #ifndef asprintf + #include "vasprintf.c" + #endif + + #ifndef err + #include "err.c" + #endif + + #ifndef warn + #include "warn.c" + #endif + + #ifndef warnx + #include "warnx.c" + #endif + *** ./telnet/err.c.ORIG Mon Jun 10 13:15:11 2013 --- ./telnet/err.c Mon Jun 10 11:54:00 2013 *************** *** 0 **** --- 1,37 ---- + + #include + #include + #include + #include + + + void verr( int eval, const char *fmt, va_list ap ) + { + int my_errno; + + + my_errno = errno; + (void) fprintf( stderr, "telnet: " ); + + if ( fmt != NULL ) + { + (void) vfprintf( stderr, fmt, ap ); + (void) fprintf( stderr, ": " ); + } + + (void) fprintf( stderr, "%s\n", strerror( my_errno ) ); + + exit( eval ); + } + + + void err( int eval, const char *fmt, ... ) + { + va_list ap; + + + va_start( ap, fmt ); + verr( eval, fmt, ap ); + va_end( ap ); + } + *** ./configure.in.ORIG Mon Jun 10 12:30:54 2013 --- ./configure.in Mon Jun 10 12:31:16 2013 *************** *** 20,26 **** fi fi ! EXTRA_CFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -DXTSTRINGDEFINES -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef" AC_SUBST(EXTRA_CFLAGS) dnl Checks for programs. AC_PROG_CC --- 20,27 ---- fi fi ! dnl EXTRA_CFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -DXTSTRINGDEFINES -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef" ! EXTRA_CFLAGS="" AC_SUBST(EXTRA_CFLAGS) dnl Checks for programs. AC_PROG_CC