diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78146753..61e44bc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ env: # So we're now fetching zlib from ftp.zx.net.nz instead. ZLIB_VERSION: 1.2.13 # Expected filename: https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz - OPENSSL_VERSION: 3.0.13 + OPENSSL_VERSION: 3.0.14 # Exoected filename: ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz LIBSSH_SOURCE: https://www.libssh.org/files/0.10/ LIBSSH_VERSION: 0.10.6 @@ -129,7 +129,6 @@ jobs: uses: ilammy/msvc-dev-cmd@v1.12.0 with: arch: x86 - toolset: 14.3 - name: Build ckwart run: | call ..\..\setenv.bat @@ -167,7 +166,7 @@ jobs: toolset: - 14.0 - 14.2 - - 14.3 + - 14.4 exclude: # No point building ARM or ARM64 targets with anything less than the latest as the latest # still supports the first ARM Windows. diff --git a/README.md b/README.md index e67d4f54..68ae86aa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Major features include: To get the latest most stable release as well as other news and information, visit the [C-Kermit for Windows Beta website](https://www.kermitproject.org/ckw10beta.html). This software is currently based on C-Kermit version 10.0 Pre-Beta.11 of -6-FEB-2024 and is available under the 3-clause BSD license. +29-JUN-2024 and is available under the 3-clause BSD license. ![Screenshot](doc/screenshot-w11.png) diff --git a/doc/changes.md b/doc/changes.md index 9f667451..8c4a77d6 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -42,7 +42,7 @@ Windows NT for MIPS computers, though without TAPI support. ### Minor Enhancements and other changes -* Upgraded to OpenSSL 3.0.13, the current long term support release +* Upgraded to OpenSSL 3.0.14, the current long term support release (supported until 7 September 2026) * Help text for "set gui window position" updated: this command *is* supported and it does work. @@ -57,6 +57,13 @@ Windows NT for MIPS computers, though without TAPI support. * Upgraded to C-Kermit 10.0 Pre-Beta.11 * About window (Help -> About) now includes the beta number +### New features + +* Implemented the DECRQCRA VT420 escape sequence which is required by esctest2. + This is disabled by default due to its security risks, but can be enabled + with `set terminal send-data on`. As C-Kermit doesn't currently have a VT420 + terminal option yet, select VT320 to make use of VT420 features. + ### Source Changes * Some minor changes to support a future replacement for the dialer. diff --git a/kermit/k95/ck_crp.c b/kermit/k95/ck_crp.c index c0e58aa3..62430d20 100644 --- a/kermit/k95/ck_crp.c +++ b/kermit/k95/ck_crp.c @@ -95,6 +95,22 @@ static char * tmpstring = NULL; #ifdef CRYPT_DLL int cmd_quoting = 0; +#ifdef OS2 +/* Copied from ckctel.c */ +char * +#ifdef CK_ANSIC +tel_unk(int opt) /* "UNKNOWN-%u" string. */ +#else +tel_unk(opt) int opt; +#endif /* CK_ANSIC */ +{ + /* 2024-03-27 SMS. Added (decimal) value to "UNKNOWN" messages. */ + static char val_str[ 20]; + sprintf(val_str, "UNKNOWN-%u", opt); + return(val_str); +} +#endif /* OS2 */ + #ifndef TELOPT_MACRO int telopt_index(opt) int opt; { diff --git a/kermit/k95/ck_ssl.c b/kermit/k95/ck_ssl.c index 7c11e045..0428133c 100644 --- a/kermit/k95/ck_ssl.c +++ b/kermit/k95/ck_ssl.c @@ -2684,7 +2684,11 @@ ssl_http_init(hostname) char * hostname; #endif /* NOHTTP */ char * +#ifdef CK_ANSIC +ssl_get_dNSName(SSL *ssl) +#else ssl_get_dNSName(ssl) SSL * ssl; +#endif /* CK_ANSIC */ { static char *dns = NULL; X509 *server_cert = NULL; @@ -2732,7 +2736,12 @@ ssl_get_dNSName(ssl) SSL * ssl; } char * -ssl_get_commonName(ssl) SSL * ssl; { +#ifdef CK_ANSIC +ssl_get_commonName(SSL *ssl) +#else +ssl_get_commonName(ssl) SSL * ssl; +#endif /* CK_ANSIC */ +{ static char name[256]; int name_text_len; int err; @@ -2761,7 +2770,11 @@ ssl_get_commonName(ssl) SSL * ssl; { } char * +#ifdef CK_ANSIC +ssl_get_issuer_name(SSL *ssl) +#else ssl_get_issuer_name(ssl) SSL * ssl; +#endif /* CK_ANSIC */ { static char name[256]; X509 *server_cert; @@ -2781,7 +2794,11 @@ ssl_get_issuer_name(ssl) SSL * ssl; } char * +#ifdef CK_ANSIC +ssl_get_subject_name(SSL *ssl) +#else ssl_get_subject_name(ssl) SSL * ssl; +#endif /* CK_ANSIC */ { static char name[256]; X509 *server_cert; @@ -3030,7 +3047,11 @@ ssl_verify_crl(int ok, X509_STORE_CTX *ctx) } char * +#ifdef CK_ANSIC +tls_userid_from_client_cert(SSL *ssl) +#else tls_userid_from_client_cert(ssl) SSL * ssl; +#endif /* CK_ANSIC */ { /* DavidG 2022-09-05: On Windows and OS/2, X509_to_user is expected to be * provided by a user-supplied DLL as described here: @@ -4023,7 +4044,11 @@ ck_tn_tls_negotiate(VOID) } int +#ifdef CK_ANSIC +ck_ssl_incoming(int fd) +#else ck_ssl_incoming(fd) int fd; +#endif /* CK_ANSIC */ { /* if we are not running in debug then any error * stuff from SSL debug *must* not go down @@ -4194,7 +4219,11 @@ ck_ssl_incoming(fd) int fd; } int +#ifdef CK_ANSIC +ck_ssl_outgoing(int fd) +#else ck_ssl_outgoing(fd) int fd; +#endif /* CK_ANSIC */ { int timo = 2000; @@ -4371,7 +4400,11 @@ ck_ssl_outgoing(fd) int fd; #ifndef NOHTTP int +#ifdef CK_ANSIC +ck_ssl_http_client(int fd, char *hostname) +#else ck_ssl_http_client(fd, hostname) int fd; char * hostname; +#endif /* CK_ANSIC */ { int timo = 2000; diff --git a/kermit/k95/ckcdeb.h b/kermit/k95/ckcdeb.h index ee69a73e..52c46608 100644 --- a/kermit/k95/ckcdeb.h +++ b/kermit/k95/ckcdeb.h @@ -1405,9 +1405,6 @@ extern int errno; /* fdc 1 November 2022 */ #else /* def __ALPHA */ #ifdef __ia64 #define VMS64 -#ifndef VMSI64 -#define VMSI64 /* See ckvtio.c. Pointless now? */ -#endif /* ndef VMSI64 */ #else /* def __ia64 */ #ifdef __x86_64 #define VMS64 @@ -2705,15 +2702,24 @@ _PROTOTYP( void bleep, (short) ); #ifndef NOFLOAT +#ifdef __alpha /* Why only __alpha? Other 64-bit systems? */ +#define FLT_NOT_DBL /* (See also ckclib.c:ckround()). */ +#else /* def __alpha */ +#ifdef VMS64 +#define FLT_NOT_DBL /* Was testing only __alpha below. */ +#endif /* def VMS64 */ +#endif /* def __alpha [else] */ + #ifndef CKFLOAT -#ifdef __alpha +#ifdef FLT_NOT_DBL /* 2024-05-16 SMS. Use instead of __alpha. */ /* Don't use double on 64-bit platforms -- bad things happen */ +/* "double" on 64-bit platforms typically means 128-bit? Do we care?*/ #define CKFLOAT float #define CKFLOAT_S "float" -#else +#else /* def FLT_NOT_DBL */ #define CKFLOAT double #define CKFLOAT_S "double" -#endif /* __alpha */ +#endif /* def FLT_NOT_DBL [else] */ #endif /* CKFLOAT */ #ifndef NOGFTIMER /* Floating-point timers */ @@ -6438,6 +6444,72 @@ extern int _flsbuf(char c,FILE *stream); * obsolete value, which is why NAMX_C_MAXRSS is used instead. */ +/* Maximum length for a simple filename, not counting \0 at end. */ +/* + Define maximum length for a file name if not already defined. + NOTE: This applies to a path segment (directory or file name), + not the entire path string, which can be CKMAXPATH bytes long. +*/ + +/* On VMS, this is ill-defined, and depends on the file system: + * ODS2: 39.39 + version (;32767), so 84. + * ODS5: 238 + version (;32767), so 233. + */ +#ifndef CKMAXNAM +#ifdef VMS +#ifdef NAML$C_BID +#define CKMAXNAM 233 /* ODS5 possible. */ +#else +#define CKMAXNAM 84 /* ODS5 unknown. */ +#endif /* def NAML$C_BID */ +#else /* def VMS */ +/* Non-VMS definitions moved here from ckufio.c. with MAXNAMLEN -> CKMAXNAM. */ + +#ifndef CKMAXNAM /* If MAXNAMLEN is defined, then use that. */ +#ifdef MAXNAMLEN +#define CKMAXNAM MAXNAMLEN +#endif /* def MAXNAMLEN */ +#endif /* ndef CKMAXNAM */ + +#ifdef QNX +#ifdef _MAX_FNAME +#define CKMAXNAM _MAX_FNAME +#else +#define CKMAXNAM 48 +#endif /* _MAX_FNAME */ +#else +#ifndef CKMAXNAM +#ifdef sun +#define CKMAXNAM 255 +#else +#ifdef FILENAME_MAX +#define CKMAXNAM FILENAME_MAX +#else +#ifdef NAME_MAX +#define CKMAXNAM NAME_MAX +#else +#ifdef _POSIX_NAME_MAX +#define CKMAXNAM _POSIX_NAME_MAX +#else +#ifdef _D_NAME_MAX +#define CKMAXNAM _D_NAME_MAX +#else +#ifdef DIRSIZ +#define CKMAXNAM DIRSIZ +#else +#define CKMAXNAM 14 +#endif /* DIRSIZ */ +#endif /* _D_NAME_MAX */ +#endif /* _POSIX_NAME_MAX */ +#endif /* _POSIX_NAME_MAX */ +#endif /* NAME_MAX */ +#endif /* FILENAME_MAX */ +#endif /* sun */ +#endif /* CKMAXNAM */ +#endif /* QNX */ + +#endif /* def VMS [else] */ + /* Maximum length for the name of a tty device */ #ifndef DEVNAMLEN #define DEVNAMLEN CKMAXPATH diff --git a/kermit/k95/ckcfns.c b/kermit/k95/ckcfns.c index 6ca1b637..81829b99 100644 --- a/kermit/k95/ckcfns.c +++ b/kermit/k95/ckcfns.c @@ -6399,16 +6399,24 @@ nxtstatus( } break; case 7: { - extern int maxnam; debug(F101,"nxtstatus case","",7); - sprintf((char *)funcbuf," Filename length limit: %d\n", maxnam); +#ifdef CKMAXNAM + sprintf((char *)funcbuf, + " Filename length limit: %d\n", CKMAXNAM); +#else + *funcbuf = '\0'; +#endif /* def CKMAXNAM [else] */ break; } case 8: { - extern int maxpath; debug(F101,"nxtstatus case","",8); +#ifdef CKMAXPATH sprintf((char *)funcbuf, - " Pathname length limit: %d\n\n", maxpath); + " Pathname length limit: %d\n\n", CKMAXPATH); +#else + *funcbuf = '\0'; +#endif /* def CKMAXPATH [else] */ + break; } default: diff --git a/kermit/k95/ckclib.c b/kermit/k95/ckclib.c index 02dcfc4b..1a858af8 100644 --- a/kermit/k95/ckclib.c +++ b/kermit/k95/ckclib.c @@ -2301,7 +2301,7 @@ ckround(fpnum,places,obuf,obuflen) } } if (minus) number--; /* Back up to minus sign, if any. */ -#ifdef __alpha +#ifdef FLT_NOT_DBL sscanf(number,"%f",&value); /* Convert back to floating point */ #else sscanf(number,"%lf",&value); /* Convert back to floating point */ diff --git a/kermit/k95/ckcmai.c b/kermit/k95/ckcmai.c index 6269e6bc..160bdbcf 100644 --- a/kermit/k95/ckcmai.c +++ b/kermit/k95/ckcmai.c @@ -1,8 +1,8 @@ /* ckcmai.c - Main program for C-Kermit plus some miscellaneous functions */ -#define EDITDATE "06 Feb 2024" /* Last edit date dd mmm yyyy */ -#define EDITNDATE "20240206" /* Keep them in sync */ -/* Tue Feb 6 11:41:35 2024 */ +#define EDITDATE "5 Jun 2024" /* Last edit date dd mmm yyyy */ +#define EDITNDATE "20240605" /* Keep them in sync */ +/* Wed Jun 5 13:44:42 2024 */ /* As of 27 September 2022 BETATEST is defined in ckcdeb.h, not here, because it's also used in other modules. @@ -104,9 +104,9 @@ int offtsize = 0; /* Size of OFF_T */ Macintosh), just C-Kermit for each platform (except the original Mac). */ char *ck_s_ver = "10.0"; /* C-Kermit version string */ -char *ck_s_edit = "408"; /* Edit number (for Debian package) */ -char *ck_s_xver = "10.0.408"; /* eXtended version string */ -long ck_l_ver = 1000408L; /* C-Kermit version number */ +char *ck_s_edit = "413"; /* Edit number (for Debian package) */ +char *ck_s_xver = "10.0.413"; /* eXtended version string */ +long ck_l_ver = 1000413L; /* C-Kermit version number */ char *ck_s_name = "C-Kermit"; /* Name of this program */ char *ck_s_who = ""; /* Where customized, "" = not. */ char *ck_patch = ""; /* Patch info, if any. */ @@ -1357,6 +1357,9 @@ int deblog = 0, /* Debug log is open */ dest = DEST_D, /* Destination for packet data */ zchkod = 0, /* zchko() should work for dirs too? */ zchkid = 0, /* zchki() should work for dirs too? */ +#ifdef VMS + vms_text = VMSTFS, /* VMS text file dflt fmt: Stream_LF */ +#endif /* VMS */ /* If you change this, also see struct ptab above... */ diff --git a/kermit/k95/ckcnet.c b/kermit/k95/ckcnet.c index 6a9f3737..bfaa93d9 100644 --- a/kermit/k95/ckcnet.c +++ b/kermit/k95/ckcnet.c @@ -13966,7 +13966,12 @@ static int rlog_oob( CHAR *, int ); #include "ckcfnp.h" /* Prototypes (must be last) */ int -fwdx_create_listen_socket(screen) int screen; { +#ifdef CK_ANSIC +fwdx_create_listen_socket(int screen) +#else +fwdx_create_listen_socket(screen) int screen; +#endif /* CK_ANSIC */ +{ #ifdef NOPUTENV return(-1); #else /* NOPUTENV */ @@ -14046,7 +14051,12 @@ fwdx_create_listen_socket(screen) int screen; { int -fwdx_open_client_channel(channel) int channel; { +#ifdef CK_ANSIC +fwdx_open_client_channel(int channel) +#else +fwdx_open_client_channel(channel) int channel; +#endif /* CK_ANSIC */ +{ char * env; struct sockaddr_in saddr; #ifdef FWDX_UNIX_SOCK @@ -14465,7 +14475,12 @@ fwdx_open_server_channel() { } int -fwdx_close_channel(channel) int channel; { +#ifdef CK_ANSIC +fwdx_close_channel(int channel) +#else +fwdx_close_channel(channel) int channel; +#endif /* CK_ANSIC */ +{ int i,fd; for ( i=0; i= 0 && opt <= TELOPT_STDERR) return(opt); else if (opt >= TELOPT_PRAGMA_LOGON && opt <= TELOPT_PRAGMA_HEARTBEAT) @@ -257,32 +278,53 @@ telopt_index(opt) int opt; { } int -telopt_ok(opt) int opt; { +#ifdef CK_ANSIC +telopt_ok(int opt) +#else +telopt_ok(opt) int opt; +#endif /* CK_ANSIC */ +{ return((opt >= TELOPT_BINARY && opt <= TELOPT_STDERR) || (opt >= TELOPT_PRAGMA_LOGON && opt <= TELOPT_PRAGMA_HEARTBEAT) || (opt == TELOPT_IBM_SAK)); } -CHAR * -telopt(opt) int opt; { +char * +#ifdef CK_ANSIC +telopt(int opt) +#else +telopt(opt) int opt; +#endif /* CK_ANSIC */ +{ if (telopt_ok(opt)) - return((CHAR *)telopts[telopt_index(opt)]); + return(telopts[telopt_index(opt)]); else - return((CHAR *)"UNKNOWN"); + return(tel_unk(opt)); } int -telopt_mode_ok(opt) int opt; { - return((unsigned int)(opt) <= TN_NG_MU); +#ifdef CK_ANSIC +telopt_mode_ok(int mode) +#else +telopt_mode_ok(mode) int mode; +#endif /* CK_ANSIC */ +{ + return (((unsigned int)mode) <= TN_NG_MU); } -CHAR * -telopt_mode(opt) int opt; { - if (telopt_mode_ok(opt)) - return((CHAR *)telopt_modes[opt-TN_NG_RF]); +char * /* Type matches ckctel.h:telopt_modes[]. */ +#ifdef CK_ANSIC +telopt_mode(int mode) +#else +telopt_mode(mode) int mode; +#endif /* CK_ANSIC */ +{ + if (telopt_mode_ok(mode)) + return(telopt_modes[mode-TN_NG_RF]); else - return((CHAR *)"UNKNOWN"); + return(tel_unk(mode)); } + #endif /* TELOPT_MACRO */ static int @@ -891,7 +933,7 @@ tn_ssbopt(opt,sub,data,len) int opt, sub; CHAR * data; int len; TELOPT(TELOPT_NEWENVIRON)," ", sub == TELQUAL_SEND ? "SEND" : sub == TELQUAL_IS ? "IS" : - sub == TELQUAL_INFO ?"INFO" : "UNKNOWN" ); + sub == TELQUAL_INFO ?"INFO" : tel_unk(sub) ); for (i = 0, quote = 0; i < len; i++) { if (quote) { sprintf(hexbuf,"%02x",data[i]); /* safe but ugly */ diff --git a/kermit/k95/ckctel.h b/kermit/k95/ckctel.h index b784c080..b7a0d142 100644 --- a/kermit/k95/ckctel.h +++ b/kermit/k95/ckctel.h @@ -167,6 +167,8 @@ #endif /* COMMENT */ +_PROTOTYP(char * tel_unk, (int)); /* "UNKNOWN-%u" string. */ + #ifdef TELCMDS char *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", @@ -183,7 +185,7 @@ extern char *telcmds[]; (unsigned int)(x) >= TELCMD_FIRST || \ (unsigned int)(x) == TN_SAK) #define TELCMD(x) (TELCMD_OK(x)? ((x) == TN_SAK?"SAK": \ - telcmds[(x)-TELCMD_FIRST]):"UNKNOWN") + telcmds[(x)-TELCMD_FIRST]):tel_unk(x)) /* Then the options */ /* NB: the following platforms have TELOPT_AUTHENTICATION defined as */ @@ -429,11 +431,11 @@ extern char *telcmds[]; #define TELOPT_OK(x) (((x) >= TELOPT_BINARY && (x) <= TELOPT_STDERR) ||\ ((x) >= TELOPT_PRAGMA_LOGON && (x) <= TELOPT_PRAGMA_HEARTBEAT) ||\ ((x) == TELOPT_IBM_SAK)) -#define TELOPT(x) (TELOPT_OK(x)?telopts[TELOPT_INDEX(x)]:"UNKNOWN") +#define TELOPT(x) (TELOPT_OK(x)?telopts[TELOPT_INDEX(x)]:tel_unk(x)) #else /* TELOPT_MACRO */ _PROTOTYP(int telopt_index,(int)); _PROTOTYP(int telopt_ok,(int)); -_PROTOTYP(CHAR * telopt, (int)); +_PROTOTYP(char * telopt, (int)); /* Type match telopts[], below. */ #define TELOPT_INDEX(x) telopt_index(x) #define TELOPT_OK(x) telopt_ok(x) @@ -635,10 +637,10 @@ extern char * telopt_modes[]; #ifdef TELOPT_MACRO #define TELOPT_MODE_OK(x) ((unsigned int)(x) <= TN_NG_MU) -#define TELOPT_MODE(x) (TELOPT_MODE_OK(x)?telopt_modes[(x)-TN_NG_RF]:"UNKNOWN") +#define TELOPT_MODE(x) (TELOPT_MODE_OK(x)?telopt_modes[(x)-TN_NG_RF]:tel_unk(x)) #else /* TELOPT_MACRO */ _PROTOTYP(int telopt_mode_ok,(int)); -_PROTOTYP(CHAR * telopt_mode,(int)); +_PROTOTYP(char * telopt_mode,(int)); /* Type match telopt_modes[], above. */ #define TELOPT_MODE_OK(x) telopt_mode_ok(x) #define TELOPT_MODE(x) telopt_mode(x) @@ -736,7 +738,7 @@ extern char *slc_names[]; #endif #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) -#define SLC_NAME(x) (SLC_NAME_OK(x)?slc_names[x]:"UNKNOWN") +#define SLC_NAME(x) (SLC_NAME_OK(x)?slc_names[x]:tel_unk(x)) #define SLC_NOSUPPORT 0 #define SLC_CANTCHANGE 1 @@ -898,10 +900,10 @@ extern char *authmode_names[]; #define AUTHMODE_CNT 32 #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) (AUTHTYPE_NAME_OK(x)?authtype_names[x]:"UNKNOWN") +#define AUTHTYPE_NAME(x) (AUTHTYPE_NAME_OK(x)?authtype_names[x]:tel_unk(x)) #define AUTHMODE_NAME_OK(x) ((unsigned int)(x) < AUTHMODE_CNT) -#define AUTHMODE_NAME(x) (AUTHMODE_NAME_OK(x)?authmode_names[x]:"UNKNOWN") +#define AUTHMODE_NAME(x) (AUTHMODE_NAME_OK(x)?authmode_names[x]:tel_unk(x)) /* Kerberos Authentication Message Identifiers */ #define KRB_AUTH 0 /* Authentication data follows */ @@ -1008,10 +1010,10 @@ extern char *enctype_names[]; #endif #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) (ENCRYPT_NAME_OK(x)?encrypt_names[x]:"UNKNOWN") +#define ENCRYPT_NAME(x) (ENCRYPT_NAME_OK(x)?encrypt_names[x]:tel_unk(x)) #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) (ENCTYPE_NAME_OK(x)?enctype_names[x]:"UNKNOWN") +#define ENCTYPE_NAME(x) (ENCTYPE_NAME_OK(x)?enctype_names[x]:tel_unk(x)) /* For setting the state of validUser */ @@ -1280,7 +1282,7 @@ extern char *tnc_names[]; #define TNC_NAME_OK(x) ((x) >= 0 && (x) <= 12 || (x) >= 100 && (x) <= 112) #define TNC_NAME(x) \ - (TNC_NAME_OK(x)?tnc_names[(x)>=100?(x)-100:(x)]:"UNKNOWN") + (TNC_NAME_OK(x)?tnc_names[(x)>=100?(x)-100:(x)]:tel_unk(x)) _PROTOTYP(int tnc_init,(void)); _PROTOTYP(int tnc_wait,(CHAR *, int)); diff --git a/kermit/k95/ckoco3.c b/kermit/k95/ckoco3.c index a6c832ab..d0f62816 100644 --- a/kermit/k95/ckoco3.c +++ b/kermit/k95/ckoco3.c @@ -629,16 +629,36 @@ static int f_pushed = 0, c_pushed = 0, f_popped = 0; int sgrcolors = TRUE; /* Process SGR Color Commands */ +/* + * The numbers below are 3-bit colour codes for the OS/2 console + * +---+---+---+ + * | R | G | B | + * +---+---+---+ + * 1 0 0 = 4, Red + * See the comment in ckocon.h near swapcolors for a full description. + */ static unsigned char sgrcols[8] = { -/* Black */ 0, -/* Red */ 4, -/* Green */ 2, -/* Brown */ 6, -/* Blue */ 1, -/* Magenta */ 5, -/* Cyan */ 3, -/* White */ 7 +/* Black */ 0, /* 0 (index) */ +/* Red */ 4, /* 1 */ +/* Green */ 2, /* 2 */ +/* Brown */ 6, /* 3 */ +/* Blue */ 1, /* 4 */ +/* Magenta */ 5, /* 5 */ +/* Cyan */ 3, /* 6 */ +/* White */ 7 /* 7 */ +}; + +/* Map colour code (table above) back to SGR Index */ +static unsigned char sgrindex[8] = { + 0, + 4, + 2, + 6, + 1, + 5, + 3, + 7 }; #ifdef COMMENT @@ -13706,6 +13726,122 @@ vtcsi(void) decsace = TRUE; } break; + case 'y': { /* DECRQCRA - Request Checksum of Rectangular Area */ + if ( (ISVT420( tt_type_mode) || ISXTERM(tt_type_mode)) && tt_senddata) { + /* pn[1] - Request Id + * pn[2] - Page number + * pn[3] - top. Default=1 + * pn[4] - left. + * pn[5] - bottom. Default=height of screen + * pn[6] - right. Width of screen + * + * If pn[2] is omitted (or 0), following parameters are ignored + * we're supposed to calculate the checksum for all pages in + * memory + * + * If pn[3-6] are omitted we calculate the checksum for the entire + * page. + * + * Constraints: + * pn[4] < pn[6] + * pn[3] < pn[5] + * + * Note: coordinates of the rectangular area are affected by + * setting of origin mode + */ + int checksum=0, pid=1; + int top, left, bot, right; + int row, col; + int x, y; + char buf[20]; + + if (k < 3) pn[3] = 1; + if (k < 4) pn[4] = 1; + if (k < 5) pn[5] = VscrnGetHeight(VTERM) - (tt_status[VTERM] ? 1 : 0); + if (k < 6) pn[6] = VscrnGetWidth(VTERM); + k = 6; + + /*checksum &= 0xffff;*/ + pid = pn[1]; + /* Ignore pn[2] - we don't support multiple pages */ + top = pn[3] + (margintop > 1 ? margintop : 0); + left = pn[4] + (marginleft > 1 ? marginleft : 0); + bot = pn[5]; + right = pn[6]; + + debug(F111, "DECRQCRA", "pid", pid); + debug(F111, "DECRQCRA", "init-top", pn[3]); + debug(F111, "DECRQCRA", "init-left", pn[4]); + debug(F111, "DECRQCRA", "init-bot", pn[5]); + debug(F111, "DECRQCRA", "init-right", pn[6]); + + + debug(F111, "DECRQCRA", "margintop", margintop); + debug(F111, "DECRQCRA", "marginleft", marginleft); + debug(F111, "DECRQCRA", "marginbot", marginbot); + debug(F111, "DECRQCRA", "marginright", marginright); + + if (top < margintop) top = margintop; + if (top > marginbot + 1) top = marginbot + 1; + if (left < marginleft) left = marginleft; + if (left > marginright + 1) left = marginright + 1; + if (bot < margintop) bot = margintop; + if (bot > marginbot) bot = marginbot; + if (right < marginleft) right = marginleft; + if (right > marginright) right = marginright; + + + debug(F111, "DECRQCRA", "top", top); + debug(F111, "DECRQCRA", "left", left); + debug(F111, "DECRQCRA", "bot", bot); + debug(F111, "DECRQCRA", "right", right); + + for ( y=top-1; ycells[x].c; + cellattr = line->cells[x].a; + a = line->vt_char_attrs[x]; + /* Get colour including bright flag - not sure if we actually + * need that for this calculation + * bgcolor = (cellattr&0xF0)>>4; + * fgcolor = (cellattr&0x0F);*/ + bgcoloridx = sgrindex[((cellattr&0x70)>>4)%8]; + fgcoloridx = sgrindex[(cellattr&0x07)%8]; + + debug(F111, "DECRQCRA iteration", "x", x); + debug(F111, "DECRQCRA iteration", "y", y); + debug(F111, "DECRQCRA iteration", "c", c); + debug(F111, "DECRQCRA iteration", "checksum", checksum); + + checksum += c; + + debug(F111, "DECRQCRA iteration", "checksum+c", checksum); + + if (a & VT_CHAR_ATTR_PROTECTED) checksum += 0x04; + if (a & VT_CHAR_ATTR_INVISIBLE) checksum += 0x08; + if (a & VT_CHAR_ATTR_UNDERLINE) checksum += 0x10; + if (a & VT_CHAR_ATTR_REVERSE) checksum += 0x20; + if (a & VT_CHAR_ATTR_BLINK) checksum += 0x40; + if (a & VT_CHAR_ATTR_BOLD) checksum += 0x80; + /*checksum += bgcoloridx; + checksum += fgcoloridx * 0x10;*/ + debug(F111, "DECRQCRA iteration", "checksum+attrs", checksum); + } + } + debug(F111, "DECRQCRA", "checksum", checksum); + sprintf(buf, "\033P%d!~%04X\033\\", pid, checksum); + + // TODO: Call sendesqseq instead (and check for any other places + // where we should be doing this but aren't) + sendchars(buf, strlen(buf)); + } + + break; + } } break; case '`': diff --git a/kermit/k95/ckuath.c b/kermit/k95/ckuath.c index 11db6394..3a9fc05d 100644 --- a/kermit/k95/ckuath.c +++ b/kermit/k95/ckuath.c @@ -12827,8 +12827,12 @@ in this Software without prior written authorization from the X Consortium. #include "ckcfnp.h" /* Prototypes (must be last) */ void +#ifdef CK_ANSIC +XauDisposeAuth (Xauth *auth) +#else XauDisposeAuth (auth) Xauth *auth; +#endif /* CK_ANSIC */ { if (auth) { if (auth->address) (void) free (auth->address); @@ -12884,9 +12888,13 @@ XauFileName () } static int +#ifdef CK_ANSIC +binaryEqual (const char *a, const char *b, int len) +#else binaryEqual (a, b, len) const char *a, *b; int len; +#endif /* CK_ANSIC */ { while (len--) if (*a++ != *b++) @@ -12899,6 +12907,15 @@ int len; #endif /* R_OK */ Xauth * +#ifdef CK_ANSIC +XauGetAuthByAddr (unsigned int family, + unsigned int address_length, + const char *address, + unsigned int number_length, + const char *number, + unsigned int name_length, + const char *name) +#else XauGetAuthByAddr (family, address_length, address, number_length, number, name_length, name) @@ -12909,6 +12926,7 @@ unsigned int number_length; const char *number; unsigned int name_length; const char *name; +#endif /* CK_ANSIC */ { FILE *auth_file; char *auth_name; @@ -12974,9 +12992,13 @@ const char *name; } static int +#ifdef CK_ANSIC +read_short (unsigned short *shortp, FILE *file) +#else read_short (shortp, file) unsigned short *shortp; FILE *file; +#endif /* CK_ANSIC */ { unsigned char file_short[2]; @@ -12987,10 +13009,14 @@ FILE *file; } static int +#ifdef CK_ANSIC +read_counted_string (unsigned short *countp, char **stringp, FILE *file) +#else read_counted_string (countp, stringp, file) unsigned short *countp; char **stringp; FILE *file; +#endif /* CK_ANSIC */ { unsigned short len; char *data; @@ -13015,8 +13041,12 @@ FILE *file; } Xauth * +#ifdef CK_ANSIC +XauReadAuth (FILE *auth_file) +#else XauReadAuth (auth_file) FILE *auth_file; +#endif /* CK_ANSIC */ { Xauth local; Xauth *ret; @@ -13060,9 +13090,13 @@ FILE *auth_file; } static int +#ifdef CK_ANSIC +write_short (unsigned short s, FILE *file) +#else write_short (s, file) unsigned short s; FILE *file; +#endif /* CK_ANSIC */ { unsigned char file_short[2]; @@ -13074,10 +13108,14 @@ FILE *file; } static int +#ifdef CK_ANSIC +write_counted_string (unsigned short count, char *string, FILE *file) +#else write_counted_string (count, string, file) unsigned short count; char *string; FILE *file; +#endif /* CK_ANSIC */ { if (write_short (count, file) == 0) return 0; @@ -13087,9 +13125,13 @@ FILE *file; } int +#ifdef CK_ANSIC +XauWriteAuth (FILE *auth_file, Xauth *auth) +#else XauWriteAuth (auth_file, auth) FILE *auth_file; Xauth *auth; +#endif /* CK_ANSIC */ { if (write_short (auth->family, auth_file) == 0) return 0; @@ -13406,7 +13448,12 @@ ck_auth_init( hostname, ipaddr, username, socket ) } void -auth_finished(result) int result; { +#ifdef CK_ANSIC +auth_finished(int result) +#else +auth_finished(result) int result; +#endif /* CK_ANSIC */ +{ extern char uidbuf[]; extern int sstelnet; diff --git a/kermit/k95/ckuus2.c b/kermit/k95/ckuus2.c index 0617ad0f..9cc56fd2 100644 --- a/kermit/k95/ckuus2.c +++ b/kermit/k95/ckuus2.c @@ -10782,6 +10782,14 @@ case XYUNCS: character sets. KEEP means to accept them anyway.")); #endif /* NOCSETS */ +#ifdef VMS +case XYVMSTF: + return(hmsg("Syntax: SET VMS_TEXT { STREAM_LF, VARIABLE }\n\ + Selects the record format for text output files on VMS\n\ + (Stream_LF (default) or Variable-length)." +)); +#endif /* VMS */ + #ifdef UNIX case XYWILD: return(hmsga(hxywild)); diff --git a/kermit/k95/ckuus3.c b/kermit/k95/ckuus3.c index b618d594..768c7f86 100644 --- a/kermit/k95/ckuus3.c +++ b/kermit/k95/ckuus3.c @@ -1007,6 +1007,16 @@ extern int tapibong; extern int tapiusecfg; #endif /* CK_TAPI */ +#ifdef VMS +extern int vms_text; +static struct keytab vmstftab[] = { /* SET VMS_TEXT */ + { "stream_lf", VMSTFS, 0 }, + { "variable", VMSTFV, 0 } +}; +int nvmstftab = (sizeof(vmstftab) / sizeof(struct keytab)); + +#endif /* VMS */ + #ifndef NOPUSH extern int nopush; extern int wildena; @@ -12012,6 +12022,14 @@ case XYDEBU: /* SET DEBUG { on, off, session } */ #endif /* NOCSETS */ #endif /* NOXFER */ +#ifdef VMS + case XYVMSTF: /* VMS_TEXT */ + if ((y = cmkey(vmstftab,nvmstftab,"VMS text-file format", + "",xxstring)) < 0) return(y); + vms_text = y; /* Set new text-file format value. */ + return(y); +#endif /* VMS */ + #ifndef NOPUSH #ifdef UNIX case XYWILD: /* WILDCARD-EXPANSION */ diff --git a/kermit/k95/ckuus4.c b/kermit/k95/ckuus4.c index 1a9b614f..02bfc626 100644 --- a/kermit/k95/ckuus4.c +++ b/kermit/k95/ckuus4.c @@ -544,10 +544,6 @@ extern char lock2[]; #endif /* USETTYLOCK */ #endif /* UNIX */ -#ifdef OS2ORUNIX -extern int maxnam, maxpath; /* Longest name, path length */ -#endif /* OS2ORUNIX */ - extern int mdmtyp, mdmsav; #ifndef NODIAL @@ -6026,12 +6022,14 @@ shofil() { if (++n > cmd_rows - 3) { if (!askmore()) { return;} else {n = 0;}} #endif /* DYNAMIC */ #endif /* UNIX */ -#ifdef OS2ORUNIX - printf(" Longest filename: %d\n", maxnam); +#ifdef CKMAXNAM + printf(" Longest filename: %d\n", CKMAXNAM); if (++n > cmd_rows - 3) { if (!askmore()) { return;} else {n = 0;}} - printf(" Longest pathname: %d\n", maxpath); +#endif /* def CKMAXNAM */ +#ifdef CKMAXPATH + printf(" Longest pathname: %d\n", CKMAXPATH); if (++n > cmd_rows - 3) { if (!askmore()) { return;} else {n = 0;}} -#endif /* OS2ORUNIX */ +#endif /* def CKMAXPATH */ printf(" Last file sent: %s\n", sfspec ? sfspec : "(none)"); if (++n > cmd_rows - 3) { if (!askmore()) { return;} else {n = 0;}} diff --git a/kermit/k95/ckuus5.c b/kermit/k95/ckuus5.c index e43c3762..d5b785cf 100644 --- a/kermit/k95/ckuus5.c +++ b/kermit/k95/ckuus5.c @@ -150,6 +150,11 @@ extern int carrier, cdtimo, local, quiet, backgrd, bgset, sosi, xsuspend, extern int locus, autolocus; #endif /* LOCUS */ +#ifdef VMS +extern int vms_text; /* SET VMS_TEXT */ +#endif /* VMS */ + + #ifndef NOMSEND extern int addlist; #endif /* NOMSEND */ @@ -7968,6 +7973,21 @@ doshow(x) int x; break; #endif /* NOSPL */ +#ifdef VMS + char *rec_fmt; + case SHOVMSTXT: + + if (vms_text == VMSTFS) { + rec_fmt = "Stream_LF"; + } else if (vms_text == VMSTFV) { + rec_fmt = "Variable"; + } else { + rec_fmt = "(Unknown?)"; + } + printf("VMS text-file record format: %s\n", rec_fmt); + break; +#endif /* VMS */ + #ifndef NOMSEND case SHSFL: { extern struct filelist * filehead; @@ -11632,9 +11652,6 @@ initoptlist() { #ifdef VMS64BIT makestr(&(optlist[noptlist++]),"VMS64BIT"); /* VMS on non-VAX */ #endif /* VMS64BIT */ -#ifdef VMSI64 - makestr(&(optlist[noptlist++]),"VMSI64"); /* VMS on IA64 */ -#endif /* VMSI64 */ #ifdef _POSIX_SOURCE makestr(&(optlist[noptlist++]),"_POSIX_SOURCE"); #endif /* _POSIX_SOURCE */ diff --git a/kermit/k95/ckuus6.c b/kermit/k95/ckuus6.c index 23881bbf..958ba243 100644 --- a/kermit/k95/ckuus6.c +++ b/kermit/k95/ckuus6.c @@ -9,12 +9,14 @@ Jeffrey E Altman Secure Endpoints Inc., New York City - Copyright (C) 1985, 2023, + Copyright (C) 1985, 2024, Trustees of Columbia University in the City of New York. All rights reserved. See the C-Kermit COPYING.TXT file or the copyright text in the ckcmai.c module for disclaimer and permissions. Last updates: + Tue Mar 26 15:00:12 2024 (fix debug(F110,"GREP tmpstr","",tmpstr);) + Mon Aug 22 20:11:01 2022 (for TYPE /INTERPRET) Mon Aug 22 20:11:01 2022 (for TYPE /INTERPRET) Wed Aug 31 15:46:35 2022 (to disable TYPE /INTERPRET in Windows) Tue Sep 20 15:40:49 2022 (for COPY /TOSCREEN and /INTERPRET) @@ -5045,7 +5047,7 @@ dogrep() { } else { ckmakmsg(tmpstr,tmplen,rp3,NULL,NULL,NULL); } - debug(F110,"GREP tmpstr","",tmpstr); + debug(F110,"GREP tmpstr",tmpstr,""); makestr(&(ap[arrayslot++]),tmpstr); } else { #endif /* NOSPL */ diff --git a/kermit/k95/ckuus7.c b/kermit/k95/ckuus7.c index 764085dd..0083fa2c 100644 --- a/kermit/k95/ckuus7.c +++ b/kermit/k95/ckuus7.c @@ -7754,7 +7754,7 @@ dormt(xx) int xx; #endif /* datageneral */ #endif /* VMS */ rcdactive = 1; - sstate = setgen('C',s,s2,""); + sstate = setgen('C',s,"",""); retcode = 0; break; diff --git a/kermit/k95/ckuusr.c b/kermit/k95/ckuusr.c index 7edf631f..9bca3791 100644 --- a/kermit/k95/ckuusr.c +++ b/kermit/k95/ckuusr.c @@ -1951,7 +1951,7 @@ struct keytab savtab[] = { }; int nsav = (sizeof(savtab) / sizeof(struct keytab)) - 1; -/* Parameter keyword table */ +/* Parameter keyword table (SET command) */ struct keytab prmtab[] = { { "alarm", XYALRM, 0 }, @@ -2352,6 +2352,9 @@ struct keytab prmtab[] = { { "variable-evaluation", XYVAREV, CM_INV }, #endif /* NOSPL */ #endif /* NOXFER */ +#ifdef VMS + { "vms_text", XYVMSTF, CM_ARG }, /* VMS Text-file Format */ +#endif /* VMS */ { "wait", XYSLEEP, CM_INV }, #ifndef NOPUSH #ifdef UNIX @@ -3178,6 +3181,9 @@ struct keytab shotab[] = { #ifndef NOFRILLS { "versions", SHVER, 0 }, #endif /* NOFRILLS */ +#ifdef VMS + { "vms_text", SHOVMSTXT, 0}, +#endif /* VMS */ #ifdef OS2 { "vscrn", SHVSCRN, CM_INV|CM_LOC }, #endif /* OS2 */ diff --git a/kermit/k95/ckuusr.h b/kermit/k95/ckuusr.h index 1d7a350c..d3f90f0a 100644 --- a/kermit/k95/ckuusr.h +++ b/kermit/k95/ckuusr.h @@ -1065,6 +1065,7 @@ struct stringint { /* String and (wide) integer */ #define TT_MAX TT_VTNT #define TT_VT420 96 /* DEC VT-420 */ #define TT_VT520 97 /* DEC VT-520/525 */ +#define TT_XTERM 98 /* XTerm */ #define TT_TEK40 99 /* Tektronix 401x */ #define TT_KBM_EMACS TT_MAX+1 #define TT_KBM_HEBREW TT_MAX+2 @@ -1125,6 +1126,7 @@ struct stringint { /* String and (wide) integer */ #define ISVTNT(x) (x == TT_VTNT) #define ISADM3A(x) (x == TT_ADM3A) #define ISADM5(x) (x == TT_ADM5) +#define ISXTERM(x) (x == TT_XTERM) #endif /* OS2 */ #define XYTCS 2 /* Terminal Character Set */ @@ -1770,6 +1772,11 @@ struct stringint { /* String and (wide) integer */ #define XYEXTRN 135 /* SET EXTERNAL-PROTOCOL */ #define XYVAREV 136 /* SET VARIABLE-EVALUATION */ #define XYLOCALE 137 /* SET LOCALE */ +#ifdef VMS +#define XYVMSTF 138 /* SET VMS_TEXT */ +#define VMSTFS 1 /* STREAM_LF */ +#define VMSTFV 2 /* VARIABLE */ +#endif /* VMS */ /* End of SET commands */ @@ -2021,6 +2028,7 @@ struct stringint { /* String and (wide) integer */ #define SHOREN 72 /* SHOW RENAME */ #define SHOLOC 73 /* SHOW LOCALE */ #define SHOTMPDIR 74 /* SHOW TEMP-DIRECTORY */ +#define SHOVMSTXT 75 /* SHOW VMS_TEXT */ /* REMOTE command symbols */ diff --git a/kermit/k95/ckwart.c b/kermit/k95/ckwart.c index 8de98095..cb345c25 100644 --- a/kermit/k95/ckwart.c +++ b/kermit/k95/ckwart.c @@ -136,7 +136,14 @@ typedef struct transx *trans; /* Function prototypes */ -_PROTOTYP( VOID setwstate, (int, trans) ); +#ifdef OS2 +typedef VOID WMAINTYPE; +#else +typedef int WMAINTYPE; +#endif /* OS2 */ +_PROTOTYP( WMAINTYPE main, (int argc, char **argv) ); +_PROTOTYP( VOID fatal, (char *msg) ); +_PROTOTYP( VOID setwstate, (int state, trans t) ); _PROTOTYP( int teststate, (int, trans) ); _PROTOTYP( trans rdinput, (FILE *, FILE *) ); _PROTOTYP( VOID initial, (FILE *, FILE *) ); @@ -215,10 +222,14 @@ char *txt3 = "\n }\n }\n}\n\n"; /* * turn on the bit associated with the given state - * */ VOID -setwstate(state,t) int state; trans t; { +#ifdef CK_ANSIC +setwstate(int state, trans t) +#else +setwstate(state,t) int state; trans t; +#endif /* CK_ANSIC */ +/* setwstate */ { int idx,msk; idx = state/8; /* byte associated with state */ msk = 0x80 >> (state % 8); /* bit mask for state */ @@ -227,10 +238,14 @@ setwstate(state,t) int state; trans t; { /* * see if the state is involved in the transition - * */ int -teststate(state,t) int state; trans t; { +#ifdef CK_ANSIC +teststate(int state, trans t) +#else +teststate(state,t) int state; trans t; +#endif /* CK_ANSIC */ +/* teststate */ { int idx,msk; idx = state/8; msk = 0x80 >> (state % 8); @@ -240,11 +255,14 @@ teststate(state,t) int state; trans t; { /* * read input from here... - * */ - trans -rdinput(infp,outfp) FILE *infp,*outfp; { +#ifdef CK_ANSIC +rdinput(FILE *infp, FILE *outfp) +#else +rdinput(infp,outfp) FILE *infp,*outfp; +#endif /* CK_ANSIC */ +/* rdinput */ { trans x; lines = 1; /* line counter */ nstates = 0; /* no states */ @@ -265,14 +283,17 @@ rdinput(infp,outfp) FILE *infp,*outfp; { return(x); } - /* * initial - read initial definitions and state names. Returns * on EOF or %%. - * */ VOID -initial(infp,outfp) FILE *infp, *outfp; { +#ifdef CK_ANSIC +initial(FILE *infp, FILE *outfp) +#else +initial(infp,outfp) FILE *infp, *outfp; +#endif /* CK_ANSIC */ +/* initial */ { int c; char wordbuf[MAXWORD]; while ((c = getc(infp)) != EOF) { @@ -289,28 +310,40 @@ initial(infp,outfp) FILE *infp, *outfp; { } /* - * boolean function to tell if the given character can be part of - * a word. - * + * boolean function to tell if the given character can be part of a word. */ int -isin(s,c) char *s; int c; { +#ifdef CK_ANSIC +isin(char *s, int c) +#else +isin(s,c) char *s; int c; +#endif /* CK_ANSIC */ +/* isin */ { for (; *s != '\0'; s++) if (*s == (char) c) return(1); return(0); } int -isword(c) int c; { +#ifdef CK_ANSIC +isword(int c) +#else +isword(c) int c; +#endif /* CK_ANSIC */ +/* isword */ { static char special[] = ".%_-$@"; /* these are allowable */ return(isalnum(c) || isin(special,c)); } /* * read the next word into the given buffer. - * */ VOID -rdword(fp,buf) FILE *fp; char *buf; { +#ifdef CK_ANSIC +rdword(FILE *fp, char *buf) +#else +rdword(fp,buf) FILE *fp; char *buf; +#endif /* CK_ANSIC */ +/* rdword */ { int len = 0,c; while (isword(c = getc(fp)) && ++len < MAXWORD) *buf++ = (char) c; *buf++ = '\0'; /* tie off word */ @@ -319,10 +352,14 @@ rdword(fp,buf) FILE *fp; char *buf; { /* * read state names, up to a newline. - * */ VOID -rdstates(fp,ofp) FILE *fp,*ofp; { +#ifdef CK_ANSIC +rdstates(FILE *fp, FILE *ofp) +#else +rdstates(fp,ofp) FILE *fp,*ofp; +#endif /* CK_ANSIC */ +/* rdstates */ { int c; char wordbuf[MAXWORD]; while ((c = getc(fp)) != EOF && c != '\n') { @@ -336,11 +373,15 @@ rdstates(fp,ofp) FILE *fp,*ofp; { } /* - * allocate a new, empty transition node - * + * Allocate a new, empty transition node */ trans -newtrans() { +#ifdef CK_ANSIC +newtrans(void) +#else +newtrans() +#endif /* CK_ANSIC */ +/* newtrans */ { trans new; int i; new = (trans) malloc(sizeof (struct transx)); @@ -350,14 +391,16 @@ newtrans() { return(new); } - /* * read all the rules. - * */ - trans -rdrules(fp,out) FILE *fp,*out; { +#ifdef CK_ANSIC +rdrules(FILE *fp, FILE *out) +#else +rdrules(fp,out) FILE *fp,*out; +#endif /* CK_ANSIC */ +/* rdrules */ { trans head,cur,prev; int curtok; head = cur = prev = NULL; @@ -397,10 +440,14 @@ rdrules(fp,out) FILE *fp,*out; { /* * read a list of (comma-separated) states, set them in the * given transition. - * */ VOID -statelist(fp,t) FILE *fp; trans t; { +#ifdef CK_ANSIC +statelist(FILE *fp, trans t) +#else +statelist(fp,t) FILE *fp; trans t; +#endif /* CK_ANSIC */ +/* statelist */ { int curtok,sval; curtok = COMMA; while (curtok != RBRACK) { @@ -420,7 +467,12 @@ statelist(fp,t) FILE *fp; trans t; { * */ VOID -copyact(inp,outp,actno) FILE *inp,*outp; int actno; { +#ifdef CK_ANSIC +copyact(FILE *inp, FILE *outp, int actno) +#else +copyact(inp,outp,actno) FILE *inp,*outp; int actno; +#endif /* CK_ANSIC */ +/* copyact */ { int c,bcnt; fprintf(outp,"case %d:\n",actno); while (c = getc(inp), (isspace(c) || c == C_L)) @@ -451,7 +503,12 @@ copyact(inp,outp,actno) FILE *inp,*outp; int actno; { * */ int -faction(hd,state,chr) trans hd; int state,chr; { +#ifdef CK_ANSIC +faction(trans hd, int state, int chr) +#else +faction(hd,state,chr) trans hd; int state,chr; +#endif /* CK_ANSIC */ +/* faction */ { while (hd != NULL) { if (hd->anyst || teststate(state,hd)) if (hd->inchr == ('.' - 32) || hd->inchr == (char) chr) @@ -466,7 +523,12 @@ faction(hd,state,chr) trans hd; int state,chr; { * */ VOID -emptytbl() { +#ifdef CK_ANSIC +emptytbl(void) +#else +emptytbl() +#endif /* CK_ANSIC */ +{ int i; for (i=0; ihnxt) if (strcmp(cur->name,name) == 0) return(cur->val);