From: Ian Beckwith Date: Sun, 10 Jul 2011 14:12:03 +0000 (+0100) Subject: imported 9.0.300 X-Git-Tag: upstream/302~3 X-Git-Url: http://erislabs.net/gitweb/?p=ckermit.git;a=commitdiff_plain;h=d67a876428f8c6dec71b4fe76d75f3994abc031c imported 9.0.300 --- diff --git a/COPYING.TXT b/COPYING.TXT index 9e8180a..200f236 100644 --- a/COPYING.TXT +++ b/COPYING.TXT @@ -1,6 +1,6 @@ THE C-KERMIT 9.0 LICENSE - Thu Jun 2 12:37:40 2011 +Fri Jun 24 14:43:35 2011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -14,7 +14,7 @@ are met: the documentation and/or other materials provided with the distribution. - + Neither the name of the nor the names of its + + Neither the name of Columbia University nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/ck_ssl.c b/ck_ssl.c index 561e056..5f5e1fa 100644 --- a/ck_ssl.c +++ b/ck_ssl.c @@ -1,4 +1,4 @@ -char *cksslv = "SSL/TLS support, 9.0.227, 04 Aug 2020"; +char *cksslv = "SSL/TLS support, 9.0.227, 04 Aug 2010"; /* C K _ S S L . C -- OpenSSL Interface for C-Kermit diff --git a/ckaaaa.txt b/ckaaaa.txt new file mode 100644 index 0000000..51a7a5b --- /dev/null +++ b/ckaaaa.txt @@ -0,0 +1,380 @@ +ckaaaa.txt June 2011 + + C-KERMIT VERSION 9.0.300 + OVERVIEW OF FILES + + Communications software for UNIX and (Open)VMS. + + And in former versions also for: + Stratus VOS, AOS/VS, QNX, + Plan 9, OS-9, Apollo Aegis, and the Commodore Amiga. + The Apple Macintosh, the Atari ST. + + The Kermit Project - Columbia University + + http://kermit.columbia.edu/ - kermit@columbia.edu + + + Copyright (C) 1985, 2011, + 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. + BRIEFLY: C-Kermit 9.0 has the OPEN SOURCE 3-clause MODIFIED BSD LICENSE. + + +DOCUMENTATION + + C-Kermit is documented in the book "Using C-Kermit", Second Edition, by + Frank da Cruz and Christine M. Gianone, Digital Press, ISBN 1-55558-164-1, + supplementated by Web-based updates for C-Kermit 7.0, 8.0, and 9.0. + +PLATFORMS + Security + Name Included Last Updated + + Unix Yes 9.0.300 30 Jun 2011 + (Open)VMS Yes 9.0.300 30 Jun 2011 + Windows (K95) Yes 8.0.208 14 Mar 2003 (K95 2.1) + OS/2 (K95) Yes 8.0.208 14 Mar 2003 (K95 2.1) + DG AOS/VS No 7.0.196 1 Jan 2000 + Stratus VOS No 7.0.196 1 Jan 2000 + Bell Plan 9 No 7.0.196 1 Jan 2000 + Microware OS-9 No 7.0.196 1 Jan 2000 + Commodore Amiga No 7.0.196 1 Jan 2000 + Macintosh No 5A(190) 16 Aug 1994 (Mac Kermit 0.991) + Atari ST No 5A(189) 30 Jun 1993 + +QUICK START FOR FTP USERS + + If you have a Web browser, go to: + + http://www.columbia.edu/kermit/ckermit.html + + And take it from there. Otherwise... + + The definitive FTP source for Kermit software is kermit.columbia.edu. + Kermit software obtained from other FTP sites is not necessarily complete + or up to date, and may have been modified. + +C-Kermit for UNIX computers that have a C compiler and 'make' program: + + Directory kermit/archives, binary mode, file cku211.tar.Z or cku211.tar.gz + + This is a compressed tar archive of UNIX C-Kermit source code, makefile, and + other files. It unpacks into its current directory, so download it into a + fresh directory. Transfer in binary mode, uncompress (or gunzip), untar (tar + xvf cku211.tar), and then give the appropriate "make" command to build for + your UNIX system; read the comments in the makefile and ckuins.txt for + further info. + +C-Kermit for VMS: + + If you have VMS UNZIP, get the file kermit/archives/ckv211.zip in binary + mode, unzip -aa, and build with CKVKER.COM (@ckvker.com). Read the comments + at the top of CKVKER.COM for details. + +Others: In the kermit/f or kermit/test directories under the appropriate +prefixes, explained below. + + +INSTALLATION + +Installation procedures depend on the operating system. Please read the +CK?INS.TXT, if any, file for your operating system (?=U for UNIX, V for VMS, +etc). Please note the naming and placement for the initialization files: + + CKERMIT.INI + .kermrc in the user's home directory (UNIX). + CKERMIT.INI in the user's home directory (other OS's). + + + CKERMOD.INI + .mykermrc in the user's home directory (UNIX). + CKERMOD.INI elsewhere. + + DIALING DIRECTORIES + Dialing directory files can be system-wide, per-group, or per-user, or + any combination. For example, there can be a corporate wide directory + shared by all users, a supplemental directory for each division or + department, and a personal directory for each user. Simply be sure the + dialing directory files are identified a SET DIAL DIRECTORY command in + the user's (or the system-wide) C-Kermit initialization file, or in the + environment variable (logical name, symbol) K_DIAL_DIRECTORY. (The + standard initialization file looks by default in the user's home or login + directory.) When installing C-Kermit on multiuser platforms from which + users will dial out, you can also set environment variables for area + code, country code, and the various dialing prefixes as described on page + 478 of "Using C-Kermit" (second edition), so users don't have to worry + about defining these items themselves. Network directories and service + directories can also be set up in a similar manner. + + DOCUMENTATION + In UNIX, the general C-Kermit man page (or one of the versions tailored + for a specific platform, like HP-UX or Solaris) should be installed in + the appropriate place. In VMS, the VMS help topic (CKVKER.HLP) should + be installed as described in CKVINS.TXT. Plain-text documentation such + as CKERMIT2.TXT should be put in whatever place people are accustomed + to looking. + +FILES AND FILE NAMING CONVENTIONS + +C-Kermit is a family of Kermit programs for many different computer systems. +The program shares a common set of system-independent file transfer protocol +modules, written in the C language. System-dependent operations are collected +into system-specific modules for each system. + +C-Kermit file names all start with the letters "CK", followed by a single +letter indicating the subgroup. When referring to these files in the UNIX, +AOS/VS, or VOS environments, use lowercase letters, rather than the uppercase +letters shown here. Subgroups: + + _: Security/Authentication/Encryption code, possibly regulated by law + a: General descriptive material and documentation + b: BOO file encoders and decoders (obsolete) + c: All platforms with C compilers + d: Data General AOS/VS + e: Reserved for "ckermit" files, like CKERMIT.INI, CKERMIT80.TXT + f: (reserved) + g: (reserved) + h: (reserved) + i: Commodore Amiga (Intuition) + j: (unused) + k: (unused) + l: Stratus VOS + m: Macintosh with Mac OS + n: Microsoft Windows NT + o: OS/2 and/or Microsoft Windows 95/98/ME/NT/2000/XP/... + p: Bell Labs Plan 9 + q: (reserved) + r: DEC PDP-11 with RSTS/E (reserved) + s: Atari ST GEMDOS (last supported in version 5A(189)) + t: DEC PDP-11 with RT-11 (reserved) + u: UNIX or environments with UNIX-like C libraries + v: VMS and OpenVMS + w: Wart (Lex-like preprocessor, used with all systems) + x: (reserved) + y: (reserved) + z: (reserved) + 0-3: (reserved) + 4: IBM AS/400 (reserved but probably never will be used) + 5-8: (reserved) + 9: Microware OS-9 + +Examples: + + ckaaaa.txt - This file + ckufio.c - File i/o for UNIX + ckstio.c - Communications i/o for the Atari ST + makefile - makefile for building UNIX C-Kermit + ckpker.mk - makefile for building Plan 9 C-Kermit + ckvker.com - build procedure for VMS C-Kermit + +IMPORTANT FILES (use lowercase names on UNIX, VOS, or AOS/VS): + + ckaaaa.txt - This file (overview of the C-Kermit files). + For system-specific distributions, this will normally + be replaced by a system-specific READ.ME file. + + ckermit70.txt - Updates: Supplement to "Using C-Kermit", 2nd Ed, for 7.0. + ckermit80.txt - Updates: Supplement to "Using C-Kermit", 2nd Ed, for 8.0. + ckututor.txt - C-Kermit Tutorial for Unix (plain text) + ckcbwr.txt - "Beware file" (limitations, known bugs, hints), general. + ckermit.ini - Standard initialization file (rename to .kermrc in UNIX, OS-9) + ckermod.ini - Sample customization file (rename to .mykermrc in UNIX, OS-9) + +The following can be found at the Kermit FTP site: + + ckermit.kdd - Sample dialing directory file (rename to .kdd in UNIX, OS-9) + ckermit.knd - Sample dialing directory file (rename to .knd in UNIX, OS-9) + ckermit.ksd - Sample services directory file (rename to .ksd in UNIX, OS-9) + ckedemo.ksc - Demonstration macros from "Using C-Kermit" + ckepage.ksc - Ditto + ckevt.ksc - Ditto + +UNIX-specific files: + + ckuins.txt - UNIX-specific installation instructions. + ckubwr.txt - UNIX-specific beware file. + ckuker.nr - "man page" for UNIX. + +VMS-specific files: + + ckvins.txt - VMS-specific installation instructions. + ckvbwr.txt - VMS-specific beware file + ckvker.hlp - VMS C-Kermit HELP topic (needs updating). + +DG AOS/VS-specific files: + + ckdins.txt - Data General AOS/VS C-Kermit installation instructions + ckdbwr.txt - AOS/VS "beware" file + ckd*.cli - Procedures for building AOS/VS C-Kermit + +The following files are of interest mainly to programmers and historians +(find them at the Kermit ftp site in the kermit/f directory): + + ckcker.ann - Release announcements. + ckccfg.txt - Configuration information (feature selection), general. + ckcplm.txt - Program logic manual (for programmers). + ckc300.txt - Program update history for edit 212-300 (C-Kermit 9.0). + ckc211.txt - Program update history for edit 201-211. + ckc200.txt - Program update history for edit 198-200 (big) + ckc197.txt - Program update history for edit 195-197 (big) + ckc190.txt - Program update history for edits 189-190 (big). + ckc188.txt - Program update history, edits 179-188 (big). + ckc178.txt - Program edit history, 5A edits through 178 (very big). + ckcv4f.txt - Program edit history, version 4F. + ckcv4e.txt - Program edit history, version 4E. + +BINARIES + +If you have FTP access to kermit.columbia.edu (also known as +kermit.cc.columbia.edu, ftp.cc.columbia.edu), you can also retrieve various +C-Kermit binaries from the directory kermit/bin/ck*.*, or more conventiently +from the web page: + + http://www.columbia.edu/kermit/ck80binaries.html + +Test versions would be in kermit/test/bin/ck*.*. Be sure to transfer these +files in binary mode. The READ.ME file in that directory explains what's +what. + +SOURCE FILES + +The source files for the UNIX version (all UNIX versions) are available in +kermit/archives/ckuNNN.tar.Z, approximately 1MB in size. Transfer this file +in binary mode. This is a compressed tar archive. There is also a gzip'd +version, cku211.tar.gz. To get the binary tar archive: + + mkdir kermit (at shell prompt, make a Kermit directory) + cd kermit (make it your current directory) + + ftp kermit.columbia.edu (make an ftp connection) + user: anonymous (log in as user "anonymous", lower case!) + password: (use your email id as a password) + cd kermit/archives (go to the archives directory) + type binary (specify binary file transfer) + get cku300.tar.Z (get the tar archive) (or get cku192.tar.gz) + bye (disconnect and exit from ftp) + + uncompress cku300.tar.Z (at the shell prompt, uncompress the archive) + tar xvf cku300.tar (extract the files from the tar archive) + make xxx (build C-Kermit for your system) + +(where "xxx" is the makefile entry appropriate for your system.) + +All C-Kermit source and other text files are also kept separately in the +kermit/f directory. The files necessary to build a particular implementation +of C-Kermit are listed in the appropriate makefile or equivalent: + + UNIX: makefile (or rename ckuker.mak to makefile) + 2.11 BSD: ckubs2.mak (rename to makefile), ckustr.sed + Plan 9: ckpker.mk (rename to mkfile) + Macintosh: ckmker.mak (rename to kermit.make, use MPW C 3.2) + VMS: CKVKER.COM (DCL) (and optionally also CKVKER.MMS) + or CKVOLD.COM (for VMS 4.x) + Amiga: CKIKER.MAK (Aztec C) or CKISAS.MAK (SAS C) + Atari ST: CKSKER.MAK + OS-9: ck9ker.mak or ck9ker.gcc + AOS/VS: ckdmak.cli, ckdcc.cli, ckdlnk.cli +Stratus VOS: cklmak.cm + +Minimal source files for building selected versions (these patterns get all +the files you need, and in some cases maybe a few extra): + + UNIX: ck[cuw]*.[cwh] (including QNX, Plan 9, and BeBox) + UNIX: ck[cuw_]*.[cwh] (Unix with security modules) + VMS: ck[cuwv]*.[cwh] VMS + VMS: ck[cuwv_]*.[cwh] VMS with SSL/TLS + Mac: ck[cuwm]*.[cwhr] Old Mac OS, not Mac OS X, which is UNIX. + AOS/VS: ck[cuwd]*.[cwh] + VOS: ck[cwhl]*.[cwh] + Amiga: ck[cuwi]*.[cwh] + Atari: ck[cuws]*.[cwh] + OS-9: ck[cuw9]*.[cwha] + +Finally, here is a more detailed description of the C-Kermit file naming +conventions. A C-Kermit filename has the form: + + CK. + +where: + + is described earlier in this file; + + is the file type (use lowercase on UNIX, VOS, or AOS/VS): + + c: C language source + h: Header file for C language source + w: Wart preprocessor source, converted by Wart (or Lex) to a C program + r: Macintosh resource file (8-bit text) + a: Assembler source + + txt: Plain text. + nr: Nroff/Troff text formatter source for UNIX "man page" + mss: Scribe text formatter source + ps: Typeset material to be printed on a PostScript printer + pdf: An Adobe PDF file + hlp: A VMS Help topic + + ini: Initialization file + ksc: A Kermit Script to be executed by the TAKE command + kdd: A Kermit Dialing Directory + knd: A Kermit Network Directory + ksd: A Kermit Services Directory + + mak: A Makefile or other build procedure (often needs renaming) + com: (VMS only) a DCL command procedure + cli: (AOS/VS only) a command procedure + cmd: (OS/2 only) a Rexx command procedure + + boo: "boo"-encoded executable program, decode with CKBUNB program. + hex: "hex"-encoded executable program, decode with CKVDEH program (VMS only). + hqx: BinHex'd Macintosh Kermit program, decode with BinHex version 4.0. + uue: A uuencoded binary file, decode with uudecode or (DG only) CKDECO. + + def: An OS/2 linker definitions file. + sh: A UNIX shell script. + sed: A UNIX sed (editor) script. + str: A file of character strings extracted from C-Kermit (BSD 2.1x only). + + is mnemonic (up to 3 characters) for what's in the file: + +NOTE: After C-Kermit 6.0, text filetypes such as .DOC and .HLP were changed +to .TXT to avoid confusion in Windows-based Web browsers, which would +otherwise mistake them for Microsoft Word or Windows Help documents. + + aaa: A "read-me" file, like this one + ins: Installation instructions or procedures + bwr: "Beware" file -- things to watch out for, hints and tips + plm: Program Logic Manual + ker: General C-Kermit definitions, information, documentation + + nnn: Digits: C-Kermit edit number (e.g. cku300.tar.gz) + cmd: Command parsing + con: CONNECT command + cns: CONNECT command (UNIX only - version that uses select(), not fork()) + deb: Debug/Transaction Log formats, Typedefs + dia: Modem/Dialer control + fio: System-depdendent File I/O + fns: Protocol support functions + fn2: More protocol support functions (and FN3, ...) + lib: Common library routines module + mai: Main program + net: Network i/o module + pro: Protocol + scr: SCRIPT command + tel: Telnet protocol module + tio: System-dependent communications i/o & control and interrupt handing + sig: Signal handling module + usr: Interactive/script user interface + us2: More user interface (mainly help text) + us3: Still more user interface (and USR4, USR5, USR6, USR7) + usx: Common user interface functions + usy: Command-line parsing + xla: Character set translation module + uni: Unicode support + pty: Pseudoterminal support + mdb: Malloc-debugging module (not included in real builds) + str: Strings module (only for 2.xBSD) + +(End of ckaaaa.txt) diff --git a/ckc300.txt b/ckc300.txt new file mode 100644 index 0000000..294b126 --- /dev/null +++ b/ckc300.txt @@ -0,0 +1,7820 @@ +C-KERMIT 9.0 CHANGE LOG (Changes since 8.0.207 / K95 2.1.3 January 2003) + + Chronological order. + Go to the bottom to find the newest edits. + + F. da Cruz, The Kermit Project, Columbia University, NYC. + Last update: 28 June 2011. + +FTP USER, FTP ACCOUNT, plus the various prompts and switches for FTP username, +password, and account all neglected to strip quotes, and in most cases quotes +are necessary to specify a username that contains spaces. ckcftp.c, +15 Jan 2003. + +FTP MPUT f1 f2 f3... gets a parse error if any of the fn's do not match an +existing file. This is bad for scripts. In doftpput(), cmfdb() looks for +keywords (switches) or CMIFI. When it hits CMIFI, it exits from the initial +parse loop and then does additional cmifi()s in a loop until done. The most +obvious fix is to parse each field with cmfdb(CMIFI,CMFLD), i.e. fall back to +CMFLD if CMIFI doesn't match anything. Then if CMFLD was used, we don't add +the filespec to the list. This is a rather big change but it seems to work. +No error messages or failures happen for non-matching fields, but an error +message is printed (and the MPUT command fails) if none of the fields match +any files. This fix got in too late for 2.1.3; workaround: use C-Shell +like wildcard list (ftp mput "{*.abc,foo.*}"). ckcftp.c, 16 Jan 2003. + +GREP did not pass its pattern through the expander, thus variables could +not be used for patterns. This must have been an oversight -- I can't find +anything in my notes about it. Fixed in dogrep(): ckuus6.c, 24 Jan 2003. + +New makefile target for HP-UX 11.xx with OpenSSL from Tapani Tarvainen. +makefile, 31 Jan 2003. + +From Jeff: + . Avoid core dump when dereferencing tnc_get_signature(): ckuus4.c. + . Bump version numbers to 8.0.208, 2.1.4: ckcmai.c. + +Added /NOLOGIN to FTP [OPEN]. ckcftp.c, 10 Feb 2003. + +Don't dump core if FTP DEBUG is ON and FTP OPEN does not include a service. +openftp(): ckcftp.c, 10 Feb 2003. + +HELP PATTERN text incorrectly identified commands and functions with +floating and anchored patterns. The corrected lists are: +Floating: GREP, TYPE /MATCH:, /EXCEPT: patterns, \farraylook(), +Anchored: IF MATCH, file-matching wildcards, \fsearch(), \frsearch() +ckuus2.c, 10 Feb 2003. + +INPUT n \fpattern(xxx) did not work for case-independent comparisons. +Fixed in doinput(): ckuus4.c, 10 Feb 2003. + +It seems \fpattern() didn't work with MINPUT at all. There was no code to +handle \fpattern() in the MINPUT parse loop, so it never worked. The code +had to be totally rewritten to use cmfld() in a loop, rather than cmtxt() +and then cksplit(). Furthermore, whenever any of the fields was an +\fjoin(), this had to be split. ckuusr.c, 10 Feb 2003. + +Macro replacement via \m() and \fdefinition() does not work as advertised +(i.e. case sensitively) for associative array elements; e.g. \m(xxx) is +treated the same as \m(xxx), contrary to section 7.10.10 of the C-Kermit +7.0 update notes, and to the fact that the two really do exist separately. +Fixed by adding a static function isaarray(s) which succeeds if s is an +associative array reference and fails otherwise, and then having \m() +and \fdef() call mxxlook() (case-sensitive lookup) if isaarray(), otherwise +(as before) mxlook()). ckuus4.c, 11 Feb 2003. + +Fixed FTP OPEN to allow the /USER switch to override SET FTP AUTOLOGIN OFF, +just as /NOLOGIN overrides SET FTP AUTOLOGIN ON. ckcftp.c, 11 Feb 2003. + +In K95, "set key \1234 \27H" (any SET KEY command in which the first char of +the definition was backslash, and the ONLY character after the backslash +quantity was an uppercase letter, that letter would be lowercased). Diagnosis: +xlookup() poking its argument (see notes from July 2000). Jeff sent a fix. +ckucmd.c, 15 Feb 2003. + +Ran my S-Expression torture test to make sure Sexps still worked. They do, +except the bitwise & and | operators were broken, e.g. (& 7 2) and (| 1 2 4) +get "Invalid operand" errors. Jeff's code had added an early failure return +from the lookup loop when when a single-byte keyword matched a keyword that +started with the same byte but was more than one byte long. So "&" would hit +"&&" and fail instead of continuing its search (xlookup tables aren't sorted +so there can be no early return). Fixed in xlookup(): ckucmd.c, 16 Feb 2003. + +Got rid of "krbmit" target from makefile. It's still there, but we don't +use it any more. All secure targets now use "xermit", and produce a binary +called wermit, just like the regular ones do (except the old ckucon.c ones). +Non-secure targets, since they don't define any of the security symbols, +wind up compiling and linking to (mostly) empty security modules. makefile, +15 Feb 2003. + +Added \fcvtdate(xxx,3) to format its result in MDTM format (yyyymmddhhmmss, +all numeric, no spaces or punctuation). Of course these numeric strings +are too big to be 32-bit numbers and are useless for arithmetic, but they're +useful for lexical comparison, etc. ckuus[24].c, 16 Feb 2003. + +The following FTP commands did not set FAILURE when they failed: RMDIR, +CD, CDUP, Fixed in the corresponding doftpblah() routines. ckcftp.c, +16 Feb 2003. + +RENAME would sometimes not print an error message when it failed, e.g. in K95 +when the destination file already existed. ckuus6.c, 17 Feb 2003. + +Fixed COPY error messages, which did not come out in standard format when +/LIST was not included. ckuus6.c, 17 Feb 2003. + +Fixed #ifdefs in ck_crp.c to allow nonsecure builds on old platforms like +System V/68 R3. 19 Feb 2003. + +Similar treatment for ck_ssl.c. 20 Feb 2003. + +From Jeff, 21 Feb 2003: + . AIX53 and AIX52 symbols for ckcdeb.h, makefile. + . New gcc targets for various AIX 4.x/5.x versions: makefile. + . Copyright date updates: ck_crp.c, ck_ssl.c. + . ENABLE/DISABLE QUERY broken because keyword table out of order: ckuusr.c. + . Fixed the use of HTTP proxies for HTTP [RE]OPEN for Unix: ckcnet.c. + +Also for K95 only: Allow file transfer when K95 is invoked on the remote end +of a connection to a Pragma Systems Terminal Server connection; automatically +SET EXIT HANGUP OFF when invoked with open port handle ("k95 -l nnnn"). + +"cd a*" failed even when "a*" matched only one directory. Fixed in cmifi(): +ckucmd.c, 21 Feb 2003. + +In the Unix version, replace "extern int errno;" with "#include " +if __GLIBC__ is defined, since glibc now defines a thread-specific errno. +ckcdeb.h, 26 Feb 2003. + +Added #ifdefs to skip compilation of ckuath.c in nonsecure builds. Tested +by building both secure and regular versions in Linux. ckuath.c, 26 Feb 2003. + +Ran the build-in-84-different-configurations script on Linux to make sure it +still builds with all different combinations of feature selection options. +All OK. 26 Feb 2003. + +Built on VMS. Needed to add a prototype for mxxlook*() to ckuusr.h; built +OK otherwise. 26 Feb 2003. + +From Jeff: More #ifdef shuffling for nonsecure builds: ckuath.c, ck_ssl.c, +27 Feb 2003. + +Added code to ensure \v(download) ends in a directory separator in Unix, +Windows, and OS/2. ckuus7.c, 27 Feb 2003. + +Added code to K95 zfnqfp() to tack on directory separator when returning +a directory name. ckofio.c, 27 Feb 2003. + +Somehow an old copy of ckuath.c popped to replace the new one. Put the new +one back. 28 Feb 2003. + +From Jeff: Fix typo in my K95 zfnqfp() code from yesterday; fixes for handling +UNCs uniformly, no matter which way their slashes are leaning. ckofio.c, +28 Feb 2003. + +At Jeff Mezei's suggestion, separate text and binary mode open sequences +for VMS session log. ckvfio.c, 28 Feb 2003. + +Added freebsd48 target for FreeBSD 4.8. makefile, 1 Mar 2003. + +Changed Mac OS X entries to include -DUSE_STRERROR. makefile, 2 Mar 2003. + +Fixed GETOK /GUI to evaluate its text argument. ckuus6.c, 3 Mar 2003. + +Jeff fixed the K95 Dialer QUICK dialog to (a) allow templates, and (b) have +a Save-As option. 3 Mar 2003. + +Jeff fixed a problem with the Xmodem-CRC checksum being crunched whenever +there was a retransmission. 7 Mar 2003. + +Added target/banner for Tru64 5.1B. makefile, ckuver.h, 5 Mar 2003. + +In Unix, the zcopy() routine (used by the COPY command) reset the user's umask +to 0 for the remainder of the Kermit process lifetime. The bug was in +ckufio.c 8.0.194, 24 Oct 2002, and is fixed in ckufio.c 8.0.195, 6 Mar 2003. +Of course this happened after building 155 C-Kermit 8.0.208 binaries. (But +before officially releasing 8.0.208.) + +In the VMS version, changed: + + while ((n--) && xx_inc(2) > -1) ; +to: + while ((n--) && xx_inc(2) >= 0) ; + +to suppress the "...is being compared with a relational operator to a constant +whose value is not greater than zero" warning. ckvtio.c, 7 Mar 2002. + +Added a debug call to dologend in hopes of catching overzealous Locus +switching, which seems to happen only in K95. ckuus3.c, 7 Mar 2002. + +Rebuilt binaries for some of the more current Unix releases: AIX 4.3.3-5.1, +Solaris 7-9 , Red Hat 7.0-8.0, Slackware 8.1, Freebsd 4.7-4.8, NetBSD 1.6, +OpenBSD 3.2, Unixware 7.1.3, Open Unix 8, OSR5.0.6a, etc. A Unix binary with +COPY umask fix shows a 6 Mar 2003 date for "UNIX File support" in SHOW +VERSIONS; a binary without the fix shows 24 Oct 2002. + +C-Kermit 8.0.208 dated 14 March 2003 released on 10 March 2003. + +---8.0.208--- + +From Jeff 13 Mar 2003: + . Updated SSL module allows importation of tickets from host. + . freebsd50+openssl target: makefile. + . FTP PUT /PERMISSIONS error message for K95: ckcftp.c. + +Fixed MINPUT to strip quotes or braces from around targets (this was broken +on Feb 10th). Thanks to Jason Heskett for discovering and reporting this +(killer) bug. ckuusr.c, 14 Mar 2003. + +Changed version number to 209 Dev.00. ckcmai.c, 14 Mar 2003. + +While debugging the alphapage script, I found that the command "minput 8 \6\13 +\21\13 \13\27\4\13 \30\13" gets "?Not confirmed" in 8.0.208 and 8.0.209, but +not in 206 and earlier. This problem too was introduced on Feb 10th by +changing MINPUT parsing from cmtxt() followed by cksplit() to cmfld() in a +loop. cmfld() uses setatm() to return its result and of course setatm() +breaks on \13. Changing setatm() not to do this would break everything else. +But cmfld() has no arguments that let us tell it to do anything different in +this case. Changing the API would be a disaster. The only solution is to add +an "MINPUT ACTIVE" (minputactive) global variable that tells cmfld() to tell +setatm() not to break on CR. Now MINPUT with braced targets containing CR +and/or LF works in 209, 206, and 201 (but not 208). ckucmd.c, ckuusr.c, +ckuus5.c, 15 Mar 2003. + +MINPUT n \fjoin(&a) works OK if all the members of \&a[] are text strings, but +if they are strings of control chars (as above), they don't get separated by +the spaces. For example in: + + dcl \&a[] = "\4\5" "\6\7" xxx + minput 10 \fjoin(&a) + +MINPUT gets two targets: "aaa" and "\4\5 \6\7 xxx". The bug was in the +cksplit() call in the \fjoin() case of MINPUT: it needed to specify an +include set consisting of all the control characters except NUL. ckuusr.c, +16 Mar 2003. + +But there's still a problem: + + dcl \&a[] = "\4\5\13\10" "\6\7" "xxx" + +creates an array whose first member is "^D^E (one doublequote included). But +if braces are used instead, there's no problem. Same deal as MINPUT: cmfld() +breaks on CR or LF, thus the end quote is lost. If I set minputactive for +DECLARE initializers too, that fixes it. Is there any reason not to do this? +Can't think of any (famous last words)... ckuusr.c, 16 Mar 2003. + +Since it has multiple applications, changed the flag's name from minputactive +to keepallchars. ckucmd.c, ckuus[r5].c, 16 Mar 2003. + +\v(exedir) wasn't being set correctly (it included the program name as well +as the directory). Fixed in getexedir(): ckuus4.c, 16 Mar 2003. + +SET CARRIER-WATCH "auto matic" (spurious space in supplied keyword). +Cosmetic only; it still worked. Fixed in setdcd(): ckuus3.c, 16 Mar 2003. + +"directory a b c" listed too many files -- all files whose names END WITH a, +b, or c, rather than the files whose names WERE a, b, or c. Diagnosis: The +filespec is changed into a pattern: {a,b,c}, which is the correct form. It is +passed to nzxpand(), which goes through the directory getting filenames and +sending each one to ckmatch() with the given pattern. ckmatch() receives the +correct pattern but then prepends a "*" -- that's not right. It's not just +in filename matching either. The following succeeds when it shouldn't: + + if match xxxxc {{a,b,c}} + +Changing ckmatch() to not prepend the "*" to each segment fixes the command +above but breaks lots of others. Running through the "match" torture-test +script shows the problem occurs only when the {a,b,c} list is the entire +pattern, and not embedded within a larger pattern. Testing for this case +fixed the problem. ckmatch(): ckclib.c, 16 Mar 2003. + +Fixed FTP MODTIME to not print anything if QUIET ON. ckcftp.c, 16 Mar 2003. + +Picked up a new ckuath.c from Jeff, not sure what the changes are. 16 Mar 2003. + +Did a few regular and secure builds to make sure I didn't wreck anything. + +Changed version number to 209 (final). ckcmai.c, 16 Mar 2003. + +Jason Heskett found another bug: if you define a macro FOO inside the +definition of another macro BAR, and FOO's definition includes an odd number +of doublequotes (such as 1), FOO's definition absorbs the rest of BAR's +definition. Example: + + def TEST { + .foo = {X"} + sho mac foo + } + do test + sho mac foo + +Results in: + + foo = {X"}, sho mac foo + +Diagnosis: the TEST definition becomes: + + def TEST .foo = {X"}, sho mac foo + +and the macro reader is erroneously treating the doublequote as an open +quote, and then automatically closes the quote at the end of the definition. +The error is that a doublequote should be significant only at the beginning of +a field. But the macro reader isn't a command parser; it doesn't know what +a field is -- it's just looking for commas and skipping over quoted ones. +First we have to fix an oversight: SET COMMAND DOUBLEQUOTING OFF should have +worked here, but it wasn't tested in this case. Fixed in getncm(): ckuus5.c, +17 Mar 2003. + +There are only certain cases where it makes sense to treat doublequotes as +signicant: + + . An open quote must be at the beginning or preceded by a space. + . A close quote is only at the end or else followed by a space. + +This too was fixed in getncm(): ckuus5.c, 17 Mar 2003. + +A fix from Jeff SSL/TLS FTP data decoding. ckcftp.c, 18 Mar 2003. + +Tried building C-Kermit on a Cray Y-MP with UNICOS 9.0. "int suspend", +declared in ckcmai.c and used in many modules, conflicts with: + + unistd.h:extern int suspend __((int _Category, int _Id)); + +The "=Dsuspend=xsuspend" trick doesn't work for this; there is no way around +the conflict other than to rename the variable: ckcmai.c, ckutio.c, +ckuus[35xy].c. 26 Mar 2003. VMS and K95 not affected. + +OK that gets us past ckcmai.c... Then in ckutio.c I had to add a new #ifdef +around the LFDEVNO setting, because the Cray didn't have mkdev.h. Could not +find a Cray-specific manifest symbol, so I made a new makefile target (cray9) +that sets this symbol. Having done this I have no idea what kind of lockfile +would be created, but I also doubt if anybody dials out from a Cray. The +binary should run a C90, J90, or Y-MP. makefile, 26 Mar 2003. + +Added a target for SCO OSR5.0.7. makefile, ckuver.h, 30 Mar 2003. + +Changed since 208: +makefile ckuver.h ckcmai.c ckclib.c ckcftp.c ckucmd.c ckuus*.c ckutio.c. + +---8.0.209--- + +From Mark Sapiro, a fix for the March 17th doubleqote fix, getncm(): ckuus5.c, +4 Apr 2003. + +From Jeff, 29 Apr 2003: + . Corrected target for HP-UX 11.00 + OpenSSL: makefile, + . Do not allow WILL AUTH before WONT START_TLS: ckctel.h ckctel.c + . Add hooks for SFTP and SET/SHOW SFTP: ckcdeb.h ckuusr.h ckuusr.c ckuus3.c + . Add SKERMIT ckuusr.h ckuusr.c + . Add ADM-5 terminal emulation: ckuus7.c, ckuus5.c + . Uncomment and update HELP SET SSH V2 AUTO-REKEY: ckuus2.c + . Enable IF TERMINAL-MACRO and IF STARTED-FROM-DIALER for C-Kermit: ckuus6.c + . Fix conflicting NOSCROLL keyword definition: ckuusr.h + . Set ttname when I_AM_SSH: ckuusy.c + . Add extended arg parsing for SSH, Rlogin, Telnet: ckuusy.c, ckuus4.c + . Security updates: ckuath.c, ck_ssl.c + . Change K95 version number to 2.2.0: ckcmai.c + . Save K95 term i/o state before executing keyboard macro: ckuus4.c + . Add tests for SSH Subsystem active during INPUT/OUTPUT/CONNECT: ckuus[45].c + . Enable K95 SET SSH V2 AUTO-REKEY: ckuus3.c + +SFTP and SET SFTP subcommands are implemented up to the case statements. + +Files of mine that Jeff hadn't picked up: + ckuver.h ckcftp.c ckutio.c ckuusx.c (just minor changes for last build-all) + +On 4 Jan 2003, SET RECEIVE MOVE-TO was changed to convert is argument to an +absolute path, which made it impossible to specify a relative path, then +move to different directories and have it apply relatively to each directory. +Changed this as follows: + + . Parser uses cmtxt() rather than cmdir() so it won't fail at parse time. + . If path is absolute, we fail at parse time if directory doesn't exist. + . In reof() we run the the path through xxstring (again, in case deferred + evaluation of variables is desired) and then, if not null, use it. + . If the directory doesn't exist, rename() fails and reof() returns -4, + resulting in a protocol error (this is not a change). We do NOT create + the directory on the fly. + +I also fixed SET SEND/RECEIVE RENAME-TO to parse with cmtxt() rather than +cmdir(), since it's parsing a text template, not a directory name, e.g. +"set receive rename-to file-\v(time)-v(date)-\v(pid)". This was totally +broken, since when I don't know. We don't call xxstring() in this parse, so +evaluation is always deferred -- I'd better not change this. ckuus7.c, +ckcfns.c, 1 May 2003. + +From Jeff, Sat May 3 14:15:23 2003: + . Pick up the right isascii definition for K95: ckctel.c + . malloc... ckuath.c (new safe malloc routines for K95) + . Add author listing: ckuus5.c + . SSH Heartbeat support (K95 only): ckuus[23].c + . Prescan --height and --width to avoid window resizing at startup: ckuusy.c + . Add checks for fatal() or doexit() called from sysinit(): ckuusx.c + . Move some K95-specific definitions to ckoker.h: ckcdeb.h + . Add support for ON_CD macro in zchdir(): ckufio.c + . Add a command to let FTP client authenticate with SSLv2: ckcftp.c + . Fix parsing of FTP file facts like "UNIX.mode": ckcftp.c + +ON_CD will need some explaining (to be done). It's implemented for Unix, +VMS, WIndows, and OS/2. + +The FTP file facts fix came from first exposure to the new OpenBSD FTP +server: ftp://ftp7.usa.openbsd.org/pub/os/OpenBSD/3.3/i386/ +The period in "UNIX.mode" caused an erroneous word break, adding junk to +the filename. + +About the malloc changes, Jeff says "K95 is not behaving well in low memory +environments. I'm not sure that C-Kermit does much better. The program does +not crash but it certainly does not behave the way the user expects it to. +I'm beginning to think that any malloc() error should be treated as fatal." + +Not visible in these changes because it's in K95-specific modules: Jeff made +SET ATTRIBUTES OFF and SET ATTRIBUTES DATE OFF apply to XYZMODEM transfers. + +From Jeff, 11 May 2003: + . Add support for SSH Keepalive to relevant SET command (K95): ckuus3.c + . Reduce max overlapped i/o requests from 30 to 7 (K95): ckuus7.c + . Don't call sysinit() in fatal(): ckuusx.c. + . Some new conditionalizations for SSL module: ck_ssl.c + +The doublequote-parsing fixes from March and April broke the SWITCH statement, +which is implemented by internally defining, then executing, a macro. If I +drop back to the old dumb handling of doublequotes, everything is fixed except +the problem of March 17th. But can we really expect getncm() to pre-guess +what the parser is going to do? getncm()'s only job is to find command +boundaries, which are represented by commas. Commas, however, is needed IN +commands too. We take a comma literally if it is quoted with \, or is inside +a matched pair of braces, parens, or doublequotes. It is not unreasonable to +require a doublequote in a macro definition to be prefixed by \ when it is to +be taken literally. The proper response to Jason Heskett's complaint of March +17th should have been to leave the code alone and recommand an appropriate +form of quoting: + + def TEST { + .foo = {X\"} + sho mac foo + } + +And this is what I have done. Another reason for sticking with the old method +is that it's explainable. The "improved" method, even if it worked, would be +be impossible to explain. Btw, in testing this I noticed that the switch-test +script made 8.0.201 dump core. Today's version is fine. The problem with +quoted strings inside of IF {...} clauses and FOR and WHILE loops is fixed +too. Perhaps "unbroken" would be a better word. ckuus5.c, 11 May 2003. + +Vace discovered that FTP MGET /EXCEPT:{... (with an unterminated /EXCEPT list) +could crash Kermit. Fixed in ckcftp.c, 11 May 2003. + +CONTINUE should not affect SUCCESS/FAILURE status. ckuusr.c, 11 May 2003. + +Fixed an oversight that goes back 15 years. While \{123} is allowed for +decimal codes, \x{12} and \o{123} were never handled. ckucmd.c, 11 May 2003. + +Added support for Red Hat and /usr/sbin/lockdev. Supposedly this +allows Kermit to be installed without setuid or setgid bits and still be able +to lock and use the serial device. Compiles and starts, but not tested. +ckcdeb.h, makefile, ckutio.c, ckuus5.c, 16 May 2003. + +From Jeff: FTP ASCII send data to host when FTP /SSL was in use was broken. +ftp_dpl is set to Clear when FTP /SSL is in use. This was causing the data to +be written to the socket with send() instead of the OpenSSL routines. +ckcftp.c, ckuath.c, 21 May 2003. + +From Jeff: Stuff for Kerberos 524: ckcdeb.h. Fixes for FTP; "FTP ASCII send +data did not properly compute the end of line translations. On Unix (and +similar platforms) the end of line was correct for no character sets but +incorrect when character sets were specified. On Windows/OS2, the end of line +was correct when character sets were specified and incorrect when they were +not. On MAC, both were broken. Also, FTP Send Byte counts were incorrect +when character sets were specified." ckcftp.c. 17 Jun 2003. + +From Jeff: fixes to HTTP /AGENT: and /USER: switch action: ckcnet.c ckuus3.c +ck_crp.c ckcftp.c ckuus2.c ckuusy.c ckuusr.c ckcnet.h, 21 Jun 2003. + +From Jeff: Fix SET DIALER BACKSPACE so it can override a previous SET KEY +(e.g. from INI file): ckuus7.c. Some SSL/TLS updates: ck_ssl.c. HTTP support +for VMS and other VMS improvements (e.g. a way to not have to hardwire the +C-Kermit version number into the build script) from Martin Vorlaender: +ckcnet.h, ckuus[r3].c, ckcdeb.h, ckvtio.c, ckcnet.c, ckvker.com. Built on +Solaris (gcc/ansi) and SunOS (cc/k&r). The new VMS script tests the VMS +version and includes HTTP support only for VMS 6.2 or later. 2 Jul 2003. + +Tried to build on our last VMS system but it seems to be dead. Looks like a +head crash (makes really loud noises, boot says DKA0 not recognized) (fooey, I +just paid good money to renew the VMS license). Tried building at another +site with: + + Process Software MultiNet V4.3 Rev A-X, + Compaq AlphaServer ES40, OpenVMS AXP V7.3 + Compaq C V6.4-008 on OpenVMS Alpha V7.3 + +Had to make a few corrections to ckvker.com. But still, compilation of +ckcnet.c bombs, indicating that the SELECT definition somehow got lost +somewhere since the 209 release (i.e. no SELECT type is defined so it falls +thru to "SELECT is required for this code"). But I don't see anything in +ckcdeb.h or ckcnet.[ch] that would explain this. Not ckvker.com either +(putting the old one back gives the same result). OK, I give up, maybe it's +just that I haven't tried building it on MultiNet recently. What about UCX? +Aha, builds fine there except for warnings about mlook, dodo, and parser in +ckvfio.c (because of ON_CD) -- I suppose I have #include ... (done) +Anyhow it builds OK and the HTTP code is active and almost works (HTTP OPEN +works; HTTP GET seems to succeed but creates an empty file every time). Tried +building under MultiNet at another installation; same bad result. + +OK so why won't it build for MultiNet? Comparing ckcnet.c with the 209 +version, not a single #ifdef or #include is changed. Tried building with +p3="NOHTTP" -- builds OK, aha. Where's the problem? Not ckcnet.h... +Not ckcdeb.h... OK I give up, will revisit this next time I get time to +do anything with the code. + +Later Jeff said "Martin did not implement VMS networking for the HTTP code. +All he did was activate the #define HTTP which happens to work because his +connections are using SSL/TLS connections. http_inc(), http_tol(), etc have +no support for VMS networking regardless of whether it is UCX or MULTINET. +The vast majority of HTTP connections are not secured by SSL/TLS. It makes no +sense to support HTTP on VMS until someone is willing to either do the work or +pay have the work done to implement VMS networking in that code base." So the +fix is to not enable HTTP for VMS after all. Removed the CKHTTP definition +for VMS from ckcdeb.h, 6 Jul 2003. + +Fixed ckvfio.c to #include (instead of ) to pick up +missing prototypes. 6 Jul 2003. + +From Arthur Marsh: solaris2xg+openssl+zlib+srp+pam+shadow and the corresponding +Solaris 7 target. makefile, 6 Jul 2003. + +Remove duplicate #includes for , , and from +ckcftp.c. 6 Jul 2003. + +Add -DUSE_MEMCPY to Motorola SV/68 targets because of shuffled #includes in +ckcftp.c. 8 Jul 2003. + +From Jeff: Fix problems mixing SSL and SRP without Kerberos. Plus a few minor +#define comment changes and a reshuffling of #defines in ckcdeb.h to allow me +to build on X86 Windows without Kerberos. ckcdeb.h, ck_crp.c, ckuath.c, +10 Jul 2003. + +From Jeff: updated ckuat2.h and ckuath.c, 29 Jul 2003. + +Mats Peterson noticed that a very small Latin-1 file would be incorrectly +identified as UCS-2 by scanfile(). Fixed in ckuusx.c, 29 Jul 2003. + +Fixed ACCESS macro definition to account for the fact that FIND is now a +built-in command. ckermit.ini, 30 Jul 2003. + +From Jeff: Fix for typo in urlparse() (svc/hos): ckuusy.c, 18 Aug 2003. + +From Jeff: Redhat9 makefile targets (needed for for OpenSSL 0.9.7): +makefile, 19 Aug 2003. + +GREP /NOLIST and /COUNT did too much magic, with some undesirable fallout: +"GREP /NOLIST /COUNT:x args" printed "file:count" for each file. "GREP +/COUNT:x /NOLIST args" did not print "file:count", but neither did it set the +count variable. Removed the magic. Also one of the GREP switches, +/LINENUMBERS, was out of order. Fixed in ckuus6.c, 20 Aug 2003. + +From Jeff: "Reorganizing code to enable building with different subsets of +options; a few typos corrected as well." ckcdeb.h, ckuver.h (for RH9), +ckcnet.c, ckuus7.c, ckuus3.c: 24 Aug 2003. + +Scanfile misidentified a big PDF file as text because the first 800K of it +*was* text (most other PDF files were correctly tagged as binary). Fixed +by adding a check for the PDF signature at the beginning of the file. +scanfile(): ckuusx.c, 25 Aug 2003. + +Ditto for PostScript files, but conservatively. Signature at beginning of +file must begin with "%!PS-Ado". If it's just "%!" (or something nonstandard +like "%%Creator: Windows PSCRIPT") we do a regular scan. Also added "*.ps" +to all binary filename patterns. ckuusx.c, 4 Sep 2003. + +Ditto (but within #ifndef NOPCLSCAN) for PCL (E) and PJL (%) files, +but no binpatterns (note: ".PCL" is the extension for TOPS-20 EXEC scripts). +ckuusx.c, 4 Sep 2003. + +Added comments about OpenSSL 0.9.7 to all linux+openssl targets. +makefile, 4 Sep 2003. + +From Jeff: Added - #define ALLOW_KRB_3DES_ENCRYPT. When this symbol is defined +at compilation Kermit will allow non-DES session keys to be used during Telnet +Auth. These session keys can then be used for Telnet Encrypt. The reason +this is not compiled on by default is that the MIT Kerberos Telnet does not +follow the RFC for constructing keys for ENCRYPT DES when the keys are longer +than 8 bytes in length. ckuath.c, ckuus5.c, 4 Sep 2003. + +"ftp mget a b c" succeeded if one or more of the files did not exist, even +with "set ftp error-action proceed". This is because the server's NLST file +list does not include any files that don't exist, so the client never even +tries to get them. Fortunately, the way the code is structured, this one was +easy to fix. ckcftp.c, 14 Sep 2003. + +From Jeff: Corrected code in ckcnet.c to ensure that Reverse DNS Lookups are +not performed if tcp_rdns is OFF. Fixed ck_krb5_getrealm() to actually return +the realm of the credentials cache and not the default realm specified in the +krb5.conf file. Previously krb5_cc_get_principal() was not being called. +Fixed ck_krb5_is_tgt_valid() to test the TGT in the current ccache and not the +TGT constructed from the default realm. ckcnet.c, ckuath.c, 14 Sep 2003. + +Marco Bernardi noticed that IF DIRECTORY could produce a false positive if +the argument directory had previously been referenced but then removed. This +is because of the clever isdir() cache that was added to speed up recursion +through big directory trees. Changed IF DIRECTORY to make a second check +(definitive but more expensive) if isdir() succeeds, and changed the +directory-deleting routine, ckmkdir(), to flush the directory cache (UNIX +only -- this also should be done in K95 but it's not critical). This was +done by adding a routine, clrdircache() to ckufio.c, which sets prevstat +to -1 and prevpath[0] to NUL. ckcfn3.c, ckuus6.c, ckufio.c, 18 Sep 2003. + +Marco reported the second fix still didn't work for him (even though it did +for me). Rather than try to figure out why, I concluded that the directory +cache is just not safe: a directory found a second ago might have been deleted +or renamed not only by Kermit but by some other process. Why did I add this +in the first place? The log says: + + Some debug logs showed that isdir() is often called twice in a row on the + same file. Rather than try to sort out clients, I added a 1-element cache + to Unix isdir(). ckufio.c, 24 Apr 2000. + +Experimentation with DIR and DIR /RECURSIVE does not show this happening at +all. So I #ifdef'd out the directory cache (see #ifdef ISDIRCACHE in ckufio.c; +ISDIRCACHE is not defined) and backed off the previous changes: ckufio.c, +ckcfn3.c, ckuus6.c, 28 Sep 2003. + +From Jeff: Replace the compile time ALLOW_KRB_3DES_ENCRYPT with a run-time +command SET TELNET BUG AUTH-KRB5-DES which defaults to ON: ckctel.[ch], +ckuus[234].c, ck_crp.c, ckuath.c. 4 Oct 2003. + +Allow DIAL RETRIES to be any positive number, and catch negative ones. +Also added code to check for atoi() errors (e.g. truncation). At least on +some platforms (e.g. Solaris) atoi() is supposed to set errno, but it +doesn't. ckuus3.c, ckucmd.c, 4 Oct 2003. + +Added /DEFAULT: to ASK-class commands (ASK, ASKQ, GETOK): + + . For popups: no way to send defaults to popup_readtext() or popup_readpass(). + . For GUI ASK[Q], pass default to gui_txt_dialog(). + . For GUI GETOK, convert "yes" "ok" or "no" default to number for uq_ok(). + . For Text GETOK, add default to cmkey(). + . For Text ASK[Q], add default to cmtxt(). + . For GETC, GETKEY, and READ: no changes. + +GETOK, ASK, and ASKQ with /TIMEOUT: no longer fail when the timer goes off +if a /DEFAULT was supplied. The GUI functions (uq_blah) don't seem to +support timeouts. Only the text version has been tested. ckuus[26].c, +4 Oct 2003. + +From Jeff: add /DEFAULT: for popups. ckuus6.c. 6 Oct 2003. + +Change SET DIAL INTERVAL to be like SET DIAL RETRIES. ckuus[34].c, 6 Oct 2003. + +Added target for HP-UX 10/11 + OpenSSL built with gcc, from Chris Cheney. +Makefile, 12 Oct 2003. + +From Jeff, 6 Nov 2003: + . #ifdef adjustments: ckcftp.c, ckcdeb.h + . Fix spurious consumption of first byte(s) on Telnet connection: ckctel.c + . Another HP PJL test for scanfile: ckuusx.c. + . K95: Recognize DG4xx protected fields in DG2xx emulation: ckuus7.c. + . Add SSLeay version display to SHOW AUTH command: ckuus7.c + . Improved SET MOUSE CLEAR help text: ckuus2.c. + . Improved Kverbs help text: ckuus2.c (+ new IBM-3151 Kverbs). + . Some changes to ck_ssl.c, ckuath.c. + +From PeterE, 10 Nov 2003: + . Improved HP-UX 10/11 makefile targets for OpenSSL. + . #ifdef fix for OpenSSL on HP-UX: ck_ssl.c. + +Another new makefile from PeterE with improved and integrated HP-UX targets. +12 Nov 2003. + +A couple fixes to the solaris9g+krb5+krb4+openssl+shadow+pam+zlib target +from Jeff. Added a solaris9g+openssl+shadow+pam+zlib target. makefile, +21 Nov 2003. + +From Jeff, 30 Nov 2003: + . Fix SEND /MOVE-TO: ckuusr.c. + . Fix K95 SET TITLE to allow quotes/braces around text: ckuus7.c. + . Improved "set term autodownload ?" response: ckuus5.c. + . Fix SHOW FEATURES to specify the protocol for encryption: ckuus5.c + . Make {SEND, RECEIVE} {MOVE-TO, RENAME-TO} work for XYZMODEM (K95 only). + +From Jeff: 7 Jan 2004: + . At one point Frank started to add a timer parameter to the + uq_txt() function but he only did it for the non-ANSI + compilers. I added it for the ANSI compilers, fixed the + prototypes and provided a default value easily changed + DEFAULT_UQ_TIMEOUT: ckcker.h, ckuus[36].c, ck_ssl.c, ckcftp.c, ckuath.c. + . Fixed SET TERMINAL DEBUG ON (typo in variable name): ckuus7.c. + . Fixed BEEP INFORMATION; previously it made no sound, now uses + MB_ICONQUESTION. ckuusx.c. + +From Ian Beckwith (Debianization), 7 Jan 2004: + . Search dir/ckermit for docs, as well as dir/kermit in cmdini(): ckuus5.c. + . New linux+krb5+krb4+openssl+shadow+pam target (kitchen sink minus SRP, + which Debian does not distribute): makefile. + ? Mangles the DESTDIR support in makefile to install into a staging area: + makefile (I didn't take this one yet). + +Updated copyright notices for 2004, all modules. 7 Jan 2004. + +Added INPUT /NOMATCH, allowing INPUT to be used for a fixed amount of time +without attempting to match any text or patterns, so it's no longer +necessary to "input 600 STRING_THAT_WILL_NEVER_COME". If /NOMATCH is +included, INPUT succeeds if the timeout expires, with \v(instatus) = 1 +(meaning "timed out"); fails upon interruption or i/o error. ckuusr.h, +ckuus[r24].c, 7 Jan 2004. + +Added SET INPUT SCALE-FACTOR . This scales all INPUT timeouts by the +given factor, allowing time-sensitive scripts to be adjusted to changing +conditions such as congested networks or different-speed modems without +having to change each INPUT-class command. This affects only those timeouts +that are given in seconds, not as wall-clock times. Although the scale +factor can have a fractional part, the INPUT timeout is still an integer. +Added this to SHOW INPUT, and added a \v(inscale) variable for it. +ckuusr.h, ckuus[r257].c, 7 Jan 2004. + +undef \%a, \fverify(abc,\%a) returns 0, which makes it look as if \%a is a +string composed of a's, b's, and/or c's, when in fact it contains nothing. +Changed \fverify() to return -1 in this case. ckuus4.c, 12 Jan 2004. + +\fcode(xxx) returned an empty string if its argument string was empty. This +makes it unsafe to use in arithmetic or boolean expressions. Changed it to +return 0 if its argument was missing, null, or empty. ckuus4.c, 12 Jan 2004. + +Updated \verify() and \fcode() help text. ckuus2.c, 12 Jan 2004. + +While setting up IKSD, Ian Beckwith noticed that including the --initfile: +option caused Kermit to start parsing its own Copyright string as if it were +the command line, and eventually crash. I couldn't reproduce on Solaris / +Sparc but I could in Linux / i386 (what Ian is using) -- a change from Jeff +on 28 Apr 2003 set the command-line arg pointer to a literal empty string in +prescan() about line 1740 of of ckuus4.c; the pointer is incremented next +time thru the loop, resulting in random memory being referenced. Fixed by +setting the pointer to NULL instead of "". ckuus4.c, 12 Jan 2004. + +declare \&a[999999999999999] would dump core on some platforms. atoi() +or whatever would truncate the dimension to maxint. When we add 1 to the +result, we get a negative number, which is used as an index, loop test, etc. +Fixed both dodcl() and dclarray() to check for (n+1 < 0). ckuus[r5].c, +12 Jan 2004. + +Unix zchki() would fail on /dev/tty, which is unreasonable. This prevented +FOPEN /READ from reading from the terminal. zchki() already allowed for +/dev/null, so I added /dev/tty to the list of specials. Ditto for FOPEN +/WRITE and zchko(). ckufio.c 13 Jan 2004. + +Added untabify() routine to ckclib.[ch], 13 Jan 2004. +Added FREAD /TRIM and /UNTABIFY. ckuus[27].c, 13 Jan 2004. +Added \funtabify(). ckuusr.h, ckuus[24].c, 13 Jan 2004. + +Dat Nguyen noticed that (setq u 'p') followed by (u) dumped core. This was +caused by an over-clever optimization that skipped mallocs for short +literals, but then went on later to try to free one that hadn't been +malloc'd. Fixed in dosexp(): ckuus3.c, 14 Jan 2004. + +Catch another copyright date. ckuus5.c, 14 Jan 2004. + +Fixed SWITCH to work even when SET COMMAND DOUBLEQUOTE OFF (from Mark +Sapiro). ckuus5.c, 15 Jan 2004. + +Changed version to 8.0.211 so scripts can test for recently added features. +ckcmai.c, 15 Jan 2004. + +Fixed a glitch in K95 "help set port". ckuus2.c, 20 Jan 2004. + +Fix from Jeff: Connections to a TLS-aware protocol which require a reconnect +upon certificate verification failure could not reconnect if the connection +was initiated from the command line or via a URL. ckctel.c ckcmai.c +ckuusr.c ckuus7.c ckuusy.c, 20 Jan 2004. + +From Alex Lewin: makefile target and #ifdef for Mac OS X 10.3 (Panther): +makefile, ckcnet.c, 7 Feb 2004. + +Added KFLAGS to sco32v507 targets to make PTY and SSH commands work. The +same flags could probably also be added to earlier OSR5 targets but they +have not been tested there. makefile, 7 Feb 2004. + +Checked a complaint that "LOCAL &a" did not make array \&a[] local. Indeed +it did not, and can not. You have to use the full syntax in the LOCAL +command, "LOCAL \&a[]", or else it doesn't know it's not a macro named &a. +7 Feb 2004. + +Fixed some confusion in creating IKSD database file and temp-file names. +I was calling zfnqfp() without remembering that the path member of the +returned struct included the filename, so to get just the directory name, +I needed to strip the filename from the right. ckuusy.c, 2 Mar 2004. + +New ckuath.c, ck_ssl.c from Jeff. 2 Mar 2004. + +Updated Jeff's affiliation in VERSION command text. ckuusr.c, 2 Mar 2004. + +Designation changed from Dev.00 to Beta.01. ckcmai.c, 2 Mar 2004. + +Fixed zrename() syslogging -- it had success and failure reversed. +Beta.02: ckufio.c, 4 Mar 2004. + +Problem: when accessing IKSD via a kermit:// or iksd:// URL, and a user ID +is given but no password, doxarg() set the password to "" instead of leaving +it NULL, but all the tests in dourl() are for NULL. Fixed in doxarg(): +ckuusy.c, 5 Mar 2004. + +The logic in dourl() about which macro to construct (login and connect, +login and get directory listing, or login and fetch a file) was a bit off, +so all three cases were not handled. ckcmai.c, 5 Mar 2004. + +Trial Beta builds: + . HP-UX B.11.11 PA-RISC + . HP-UX B.11.23 IA64 + . Tru64 4.0G Alpha + . Tru64 5.1B Alpha + . Debian 3.0 i386 + . Red Hat ES 2.1 i386 + . Slackware 9.1 i386 + . VMS 7.3-1 Alpha + UCX 5.3 + . VMS 7.3-1 Alpha no TCP/IP + . VMS 7.3 Alpha MultiNet 4.3 A-X + . SCO UnixWare 7.1.4 i386 + . SCO OSR5.0.7 i386 + . Solaris 9 Sparc + +Fixed compiler warning in doxarg() caused by typo (NULL instead of NUL) in +the 5 March doxarg() edit. ckuusy.c, 9 Mar 2004. + +IKSD (kermit://) command-line URLs did not work right if the client had +already preauthenticated with Kerberos or somesuch because they tried to log +in again with REMOTE LOGIN. The macros constructed in doxarg() needed to +check \v(authstate) before attempting REMOTE LOGIN. ckcmai.c, 10 Mar 2004. + +Added ckuker.nr to x.sh (ckdaily upload) and updated ckuker.nr with current +version number and dates. 10 Mar 2004. + +Replaced hardwired references to /usr/local in makefile with $(prefix) +(which defaults to /usr/local, but can be overridden on the command line), +suggested by Nelson Beebe for use with Configure. 10 Mar 2004. + +From Nelson Beebe: In the Kermit makefile in the install target commands, +line 981 reads: + + cp $(BINARY) $(DESTDIR)$(BINDIR)/kermit || exit 1;\ + +Could you please add this line before it: + + rm -f $(DESTDIR)$(BINDIR)/kermit;\ + +Some sites (mine included) keep multiple versions of software around, +with hard links between $(prefix)/progname and $(prefix)/progname-x.y.z. +Failure to remove the $(prefix)/progname at "make install" time then +replaces the old $(prefix)/progname-x.y.z with the new one, destroying +an old version that the site wanted to be preserved. makefile, 10 Mar 2004. + +Minor syntax and typo fixes (mostly prototypes): ckcdeb.h, ckcfns.c, +ckclib.c, ckufio.c, ckuusr.h, ckuusx.c, 10 Mar 2004. (I still have a few +more to do.) + +Added CC=$(CC) CC2=$(CC2) to many (but not all) makefile targets that +reference other makefile targets. On some platforms (notably AIX, Solaris, +SunOS) there are specific targets for different compilers, so I skipped +those. makefile, 10 Mar 2004. + +Added error checking to kermit:// URL macros, so they don't plow ahead +after the connection is closed. ckcmai.c, 11 Mar 2004. + +Added FreeBSD 4.9 and 5.1 targets (only the herald is affected). +makefile, ckuver.h, 11 Mar 2004. + +Added "LIBS=-lcrypt" to bsd44 targets since nowadays crypt is almost always +unbundled from libc. Also added explanatory notes. makefile, 11 Mar 2004. + +Changed MANDIR to default to $(manroot)/man/man1, and manroot to default +to $(prefix). More adding of CC=$(CC) clauses: {Free,Net,Open}BSD, 4.4BSD. +makefile, 11 Mar 2004. + +Miscellaneous cleanups: ckuusx.c, ckcnet.c, ckufio.c, 11 Mar 2004. + +Corrected the check in the linux target to see if /usr/include/crypt.h +exists, and if so to define HAVE_CRYPT_H, which is used in ckcdeb.h to +#include to get the prototype for crypt() and prevent bogus +conversions on its return type on 64-bit platforms (the previous test wasn't +quite right and the resulting symbol wasn't spelled right). makefile, +12 Mar 2004. + +From Jeff, 14 Mar 2004: + . Initialize localuidbuf[] in tn_snenv(): ckctel.c. + . Remove remote-mode checks in hupok() for K95G only (why?): ckuus3.c. + . Add help text for new K95-only TYPE /GUI switches: ckuus2.c. + . TYPE /GUI parsing, ...: ckuusr.c. + . TYPE /GUI action, dotype(): ckuus6.c + . Change Jeff's affiliation: most modules. + +20 Mar 2004: Looked into adding long file support, i.e. handling files more +than 2GB (or 4GB) long. Discovered very quickly this would be a major +project. Each platform has a different API, or environment, or transition +plan, or whatever -- a nightmare to handle in portable code. At the very +least we'll need to convert a lot of Kermit variables from long or unsigned +long to some new Kermit type, which in turn is #defined or typedef'd +appropriately for each platform (to off_t or size_t or whatever). Then we +have to worry about the details of open() vs fopen(); printf() formats (%lld +vs %Ld vs %"PRId64"...), platforms like HP-UX where you might have to use +different APIs for different file systems on the same computer, etc. We'll +need to confront this soon, but let's get a good stable 8.0.211 release out +first! Meanwhile, for future reference, here are a few articles: + +General: http://freshmeat.net/articles/view/709/ +Linux: http://www.ece.utexas.edu/~luo/linux_lfs.html +HP-UX: http://devrsrc1.external.hp.com/STK/partner/lg_files.pdf +Solaris: http://wwws.sun.com/software/whitepapers/wp-largefiles/largefiles.pdf + +Looked into FTP timeouts. It appears I can just call empty() (which is +nothing more than a front end for select()) with the desired timeout before +any kind of network read. If it returns <= 0, we have a timeout. This is +not quite the same as using alarm() / signal() around a recv() (which could +get stuck) but alarm() / signal() are not not used in the FTP module and are +not naturally portable to Windows, but select() is already in use in the FTP +module for both Unix and Windows. This form of timeout could be used +portably for both command response and data reads. What about writes to the +command or data socket? They can get stuck for hours and hours without +returning too, but the select() approach won't help here -- we need the +actual send() or recv() to time out, or be wrapped in an alarm()/signal() +kind of mechanism. But if we can do that for sends, we can also do it for +receives. Better check with Jeff before I start programming anything. +20 Mar 2004. + +Later: Decided to postpone the above two projects (ditto IPv6) until after +8.0.211 is released because both will have major impacts on portability. +Grumble: all i/o APIs should have been designed from the beginning with a +timeout parameter. To this day, hardly any have this feature. + +3-4 Apr 2004: More 8.0.211 Beta.02+ test builds: + + . FreeBSD 3.3 + . FreeBSD 4.4 + . Linux Debian 2.1 + . Linux RH 6.1 + . Linux RH 7.1 + . Linux RH 7.2 + . Linux RH 9 (with 84 different combinations of feature selection) + . Linux SuSE 6.4 + . Linux SuSE 7.0 + . NetBSD 1.4.1 + . NetBSD 1.5.2 + . OpenBSD 2.5 + . OpenBSD 3.0 + . QNX 4.25 + . SCO UnixWare 2.1.3 + . SCO UnixWare 7.1.4 + . SCO OpenServer 5.0.7 + . SCO XENIX 2.3.4 (no TCP) + +Changes needed: None. + +Problem: SCO XENIX 2.3.4 network build failed in the FTP module with +header-file syntax and conflicting-definitions trouble. I'm not going to +try to fix it; 8.0.209 built OK with FTP, so we'll just keep that one +available. + +Got access to VMS 8.1 on IA64. Building the nonet version of C-Kermit +required minor modifications to ckvvms.h, ckv[ft]io.c, and ckvcon.c, to +account for a third architecture. Also to SHOW FEATURES in ckuus5.c. Once +that was done, the UCX 5.5 version built OK too. Starts OK, makes Telnet +connection OK, sends files. Has some obvious glitches though -- "stat" +after a file transfer reports 0 elapsed time (in fact it was 00:09:48) and +1219174400 cps (when in fact it was 10364). This doesn't happen on the +Alpha. Btw, the IA64 binary is twice as big as the Alpha one. Changed +to Beta.03. 5 Apr 2004. + +Fixed the ckdaily script to include the makefile and man page in the Zip +file (they were not included because the Zip file was intended mainly for +VMS users, but some Unix users prefer Zip to tar.gz). 6 Apr 2004. + +Traced problems in VMS/IA64 statistics report to rftimer()/gftimer() in +ckvtio.c, which use sys$ and lib$ calls to figure elapsed time. These work +on VAX and Alpha but not IA64. Sent a report to the chief engineer of the +IA64 VMS port; he says it's probably a bug in VMS 8.1 (which is not a real +release); he'll make sure it's fixed in 8.2. As an experiment, tried +swapping in the Unix versions of these routines (which call gettimeofday() +etc). They seem work just fine (it hung a couple times but I think that's +because the underlying system hung too; trying it later on a new connection, +it was fine; however I noticed a BIG discrepancy in throughput between +sending and receiving). Moved definitions for VMS64BIT and VMSI64 to +ckcdeb.h so all modules can use them and added them to the SHOW FEATURES +display. Added VMSV80 definition to build procedure. Beta.03+. ckcdeb.h, +ckcuus5.c, ckcvvms.h, ckvtio.c, ckvker.com, 6 Apr 2004. + +While doing the build-all, I noticed the VMS version did not build with +Multinet or older UCX versions, always with the same errors -- undeclared +variables, undefined symbols, all TCP/IP related. This didn't happen a +couple weeks ago... Somehow the order of #includes was messed up -- +ckuusr.h depended on symbols that are defined in ckcnet.h, but ckcnet.h +was being included after ckuusr.h... this was compounded by two missing +commas in ckvker.com. 11 Apr 2004. + +Removed Beta designation, released as 8.0.211, 10 Apr 2004. + +I had somehow lost the edit to ckutio.c that changed the UUCP lockfile for +Mac OS X from /var/spool/uucp to /var/spool/lock. So I slipped it in and +re-uploaded version 8.0.211. You can tell the difference because SHOW +VERSIONS has 17 Apr 2004 for the Communications I/O module. Also the 10.3 +executable now has a designer banner: "Mac OS X 10.3". makefile, ckuver.h, +ckutio.c, ckuus[45].c, 17 Apr 2004. + +---8.0.211--- + +Removed "wermit" from "make clean" (how did it get there?). makefile. + +From Jeff, applied 10 May 2004. + . Rearrange #ifdefs that define OS/2-only features. ckcdeb.h. + . Fix two strncat()s that should have been ckstrncat()s. ckuus7.c. + . Fix two strncat()s that should have been ckstrncat()s. ckuus4.c. + . Fix one strncat(). ckcfns.c. + . SET FTP CHAR ON used backwards byte order when output to screen. ckcfns.c. + . Fix two strncat()s. ckuus3.c. + . Add SET NETWORK TYPE NAMED-PIPE for K95. ckuus3.c. + . Add "No active connections" message to hupok(). ckuus3.c. + . Fix many strncat()s. ckcnet.c. + . Fix some strncat()s. ckcftp.c + . Make FTP port unsigned short for 16383 < port < 65536. ckcftp.c. + . Improvements to FTP USER command. ckcftp.c. + . Fix FEAT parsing to allow for various forms of whitespace. ckcftp.c. + +S-Expression (AND FOO BAR) would not short-circuit if FOO's value was 0, +even though short-circuiting code has been there since Day 1. Similarly for +(OR BAR FOO). Turns out the first operand was a special case that bypassed +the short-circuit check. Fixed in dosexp(): ckuus3.c, 10 May 2004. + +Red Hat 7.3 (and maybe others) referenced open() without first +ensuring it was declared. The declaration is in , which is after + in ckutio.c series of #includes. Made a special case for this. +ckutio.c (see comments), 10 May 2004. + +If the local Kermit's parity is set to SPACE and then a file arrives via +autodownload, automatic parity detection improperly switches it to NONE. +Fixed in rpack() by switching parity automatically only if parchk() returns +> 0 (rather than > -1), since NONE and SPACE are indistinguishable. A +bigger problem still remains: autodownload does not work at all if the +sender is using actual parity bits (even, odd, or mark) and the receiver's +parity is NONE. ckcfn2.c, 10 May 2004. + +When a DIAL MACRO is defined and the phone number is comprised of more than +one "word" (i.e. contains spaces), the dial macro loses the second and +subsequent words after the first call. Fixed in xdial() by inserting quotes +around phone number before passing it to xdial(). ckuus6.c, 10 May 2004. + +DIAL MACRO fix was not right; the quotes were kept as part of the phone +number and sent to the modem. dodo() pokes its argument to separate the +macro argument string into its component arguments. xdial() is called +repeatedly on the same string, so after the first time, a NUL has been +deposited after the first word of the telephone number. The fix is to have +xdial() create a pokeable copy of its argument string before calling +dodo(dial-macro,args...). It might seem odd that dodo pokes its argument, +but making copies would be would be prohibitive in space and time. +ckuus6.c, 23 May 2004. + +FTP CD did not strip braces or quotes from around its argument. Fixed in +doftprmt(): ckcftp.c, 23 May 2004. + +Added client side of REMOTE MESSAGE/RMESSAGE/RMSG: ckuus[r27].c, 23 May 2004. + +Server side of REMOTE MESSAGE: ckcpro.w, 23 May 2004. + +From Dave Sneddon: an updated CKVKER.COM containing a fix where the +COMPAQ_SSL symbol was not defined but later referenced which generated an +undefined symbol error. ckvker.com, 5 Jan 2005. + +From Andy Tanenbaum (28 May 2005): + . Fix an errant prototype in ckcker.h and ckucmd.h - () instead of (void). + . Add support for MINIX 3.0. makefile, ckutio.c, ckufio.c, ckuver.h. + +Fixed messed-up sndhlp() call which apparently had been jiggered to +compensate for the bad prototype which has now been fixed, ckcpro.w, +12 Jun 2005. + +From Jeff (12 June 2005): + . Security updates. ck_ssl.c, ck_crp.c, ckuath.c. + . Fix bug in K95 SET PRINTER CHARACTER-SET. ckuus3.c. + . Add printer character-set to K95 SHOW PRINTER display. ckuus5,c + . Add SET MSKERMIT FILE-RENAMING to K95. ckuus7.c, ckuusr.h. + . Add help for K95 SET MSKERMIT. ckuus2.c. + . Add SET GUI CLOSE to K95. ckuusr.h, ckuus2.c, ckuus3.c + . Add help text for K95 SET GUI MENUBAR and TOOLBAR. ckuus2.c. + . Add --noclose command-line option for K95. ckuusy.c + . Add PAM support for Mac OS X. ckufio.c. + . Add GSSAPI support for Mac OS X. ckcftp.c. + . Pick up more URL options. ckcker.h, ckuusy.c. + . Fix bug in delta-time calculation across year boundary. ckucmd.c. + . Add Secure Endpoints to copyright notices. ckcmai.c. + . Fix FTP HELP to override unverbose setting. ckcftp.c. + . Fix assorted minor typos. + +From Matthias Kurz: automatic herald generation for NetBSD 2.0 and later, +"make netbsd2". ckuver.h, makefile, 12 Jun 2005. + +Added SET TERMINAL LF-DISPLAY, like CR-DISPLAY but for linefeed rather than +carriage return. ckuusr.h, ckuus[257x].c, 12 Jun 2005. + +Made a command-line option --unbuffered to do what the -DNONOSETBUF +compile-time option does, i.e. force unbuffered console i/o. Unix only. +ckuusr.h, ckuusy.c, ckutio.c, 12 Jun 2005. + +Fixed getiact() (which displays TERM IDLE-ACTION setting) to display +space as \{32}. ckuus7.c, 12 Jun 2005. + +Added LMV as a synonym for LRENAME, which is itself a synonym for LOCAL +RENAME. ckuusr.c, 12 Jun 2005. + +Put HELP SET TERMINAL DG-UNIX-MODE text where it belonged. ckuus2.c, +12 Jun 2005. + +Added IF LINK (Unix only) to test if a filename is a symlink. Uses the most +simpleminded possible method, calls readlink() to see if it succeeds or fails. +No other method is dependable across different Unixes. This code should be +portable because I already use readlink() elsewhere within exactly the same +#ifdefs. ckufio.c, ckuus2.c, ckuus6.c, 12 Jun 2005. + +Fixed a bug in which \fdir() wouldn't work when its argument was the nonwild +name of a directory file. zxpand(): ckufio.c, 12 Jun 2005. + +Made \fdirectory() a synonym for \fdirectories(). Made \fdir() an +acceptable abbreviation for these, even though it clashes with \fdirname(), +which still works as before. ckuus4.c, 12 Jun 2005. + +Added the long-needed \flopx() function, to return rightmost pieces of +strings, such as file extensions. \fstripx() and \flopx() are the +orthogonal functions we need to pick filenames apart from the right: +\stripx(foo.tar.gz) = foo.tar; flopx(foo.tar.gz) = gz. ckuusr.h, ckuusr.c, +ckuus2.c, 12 Jun 2005. + +Removed reference to defunct fax number, ckcmai.c, 12 Jun 2005. + +Added -DHAVE_PTMX to linux+krb5+openssl+zlib+shadow+pam. From Timothy Folks. +makefile, 12 Jun 2005. + +Built on Solaris 9 and NetBSD 2.0. + +From Jeff: New build target for Mac OS X 10.3 with Kerberos 5 and SSL. +makefile, 14 Jun 2005. + +Fixed error in ckuver.h NetBSD #ifdefs. 15 Jun 2005. + +Fixed SET TERMINAL IDLE-ACTION OUTPUT to work as documented, namely if the +output string is empty, to send a NUL. Previously there was no way to make +it send a NUL. ckuus7.c, 15 Jun 2005. + +Suppose (in Unix, for example) a filename contains wildcard characters, such +as {abc}.txt. When referring to such a file (e.g. in a SEND command), these +characters can be quoted, e.g. \{abc\}.txt. But if the file list has been +obtained programmatically, e.g. stored in an array, there is no way, short +of tedious, complicated, and error-prone string processing, to reference the +file. For this we need a way to disable wildcard processing. I added { ON, +OFF } choices for the SET WILD and SHOW FILE commands: ckuusr.h, ckuus[234].c. +{ ON, OFF } turns wildcarding off and on without affecting the { KERMIT, +SHELL } agent choice; it does this by setting a new and separate global +variable, wildena. Added semantics to ckufio.c. Crude but effective. It +might have been more Unixlike to add Yet Another form of quoting but we +have enough of that already (later maybe I'll add a \function() for this). +Needs to be propogated to Windows and VMS. 15 Jun 2005. + +Improved and fixed typos in HELP WILDCARD and HELP PATTERN. ckuus2.c, +15 Jun 2005. + +The GREP command, and probably anything else that uses ckmatch() for pattern +matching, failed on patterns like */[0-3]*.html. The [a-b] handler, when +failing to match at the current position, neglected to back up the pattern +and try again on the remainder of the string. I also fixed another case, in +which matching a literal string a*b?c against the pattern a[*?]*[?*]c caused +ckmatch() to recurse until it blew up. ckclib.c, 16 Jun 2005. + +Added builds and designer banner for Solaris 10. makefile, ckuver.h, +27 Jun 2005. + +Defined CKHTTP for NetBSD, the HTTP code builds and works fine there. +ckcdeb.h, 2 Jul 2005. + +Added #ifndef OSF40..#endif around definition of inet_aton() in ck_ssl() +to allow building in Tru64. Added tru64-51b+openssl to makefile. +15 Jul 2005. + +HTTP GET would fail if the URL contained any metacharacters, no matter how +much you quoted them. Although it uses cmfld() to parse the (partial) URL, +it then uses cmofi() to get the output filename, which by default is the +"filename" from the URL, which might be something like "rankem.asp?id=1639". +cmofi() refuses to accept unquoted metacharacters in "filenames" and that's +what happens in this case if the output filename is not specified. Worked +around this by disabling wildcard processing around HTTP GET using the new +"wildena" variable from June 15th. ckuusr.c, 18 Jul 2005. + +Fixed the June 16th fix to the pattern matcher. I fixed a real problem, but +I made an unrelated optimization that introduced new ones. ckclib.c, +18 Jul 2005. + +Added missing help text for \fb64encode() and \fb64decode(). ckuus2.c, +18 Jul 2005. + +Changed SET WILD OFF help text to warn that this setting prevents the +creation of backup files (later I'll have to see if something more useful +can be done about this). ckuus2.c, 18 Jul 2005. + +Built OK on Mac OS X 10.4.2 using macosx103 target (but with some +"signedness" warnings in ckcnet.c and ckcftp.c). Built on Unixware 7.1.4 +with uw7 target. 27-28 Jul 2005. + +Added -DCKHTTP to Mac OS X 10.3-.4 KFLAGS. Makefile, 4 Aug 2005. + +Built on BSDI 4.3.1. Added -DCKHTTP. + +Compact substring notation extended to accept not only start:length but also +start-end notation. Thus \s(foo[12:18]) means the substring of foo starting +at position 12 of length 18, and tne new \s(foo[12-18]) means the substring +of foo starting at position 12 and ending with position 18. Ditto for +\:(\%a), etc. ckuus4.c, 9 Aug 2005. + +See correspondence with Mark Sapiro, Nov 2003 and Sep 2004, about certain +variations on IF syntax having been broken by the introduction of "immediate +macros" circa 1999. It seems the problem -- variables not being expanded -- +always occurs in the ELSE part when (a) the IF condition is false; (b) the +ELSE command is "standalone", i.e. expressed as a separate command after the +IF command (original C-Kermit 5A syntax), and (c) its command list is a block. +This would suggest the problem is in the XXELS parser. + +Going back to 1999, I find this: + Fixed a problem Jim Whitby noticed with quoting in ELSE statements. This + problem was introduced when I unified IF and XIF, and occurs only when + ELSE begins on a line, followed by a { command list } rather than a single + command. The solution (gross) was to make a special version of pushcmd() + (called pushqcmd()) for this situation, which doubles backslashes while + copying, BUT ONLY IF it's a command list (i.e. starts with "{"); otherwise + we break lots of other stuff. Result passes Jim's test and still passes + ckedemo.ksc and iftest.ksc. ckucmd.c, ckuus6.c, 27 Sep 99. + +I undid this change and it made no difference to all the other IF +constructions (in fact, it fixed an urelated one that was broken, so now +iftest scores 54 out of 54, instead of 53). However, it does not fix the +ELSE problem; in fact it pushes it all the way in the other direction: + + The opposite occurs any time you try to execute an immediate macro inside a + macro or any other { block }: not only is the variable evaluated, it is + evaluated into nothing. It looks like this happens only in immediate + macros, i.e. *commands* that start with '{'. So maybe we really have two + isolated problems, that can each be fixed. + +The situation is illustrated by this simple script: + + def xx { + if false { echo \%1, echo \%2 } + else { echo \%3, echo \%4 } + } + xx one two three four + +With pushqcmd() it echoes the variable names literally; with pushcmd() it +echoes empty lines. Since ELSE, when its argument is a block, dispatches +to the immediate-macro handler, it seems we have unified the two problems, +so fixing one should fix the other. + +The problem is that we define a new temporary macro and then call dodo() to +execute it. But if the definition contains macro arguments, we have added a +new level of macro invocation, thus wiping out the current level of args. +The cure is to expand the variables in the immediate macro in the current +context, before executing it. This means simply changing the cmtxt() call +that reads the immediate macro to specify xxsting as its processing +function, rather than NULL, which is used for real macros to defer their +argument evaluation until after the macro entered. ckuusr.c, 11 Aug 2005. + +Added a new makefile target, macosx10.4, for Mac OS X 10.4. This one uses +an undocumented trick to get the otherwise unavailable-except-by-clicking +Mac OS X version number (in this case 10.4.2) and stuff it into the HERALD +string. makefile, 11 Aug 2005. + +Built OK on Solaris 9, Solaris 10 (with a few implicit declaration warnings +in ckuusx.c), Mac OS X 10.4.2 (with some warnings in ckcnet.c and ckcftp.c), +Mac OS X 10.3.9 (also using the macos10.4 entry, which gets the right +version number, and gets no warnings at all), RH Enterprise Linux AS4 on AMD +x86_64, Tru64 Unix 4.0F, SCO UnixWare 7.1.4 + +For docs and/or scriptlib: Unix C-Kermit can be a stdin/out filter. The +trick is to use the ASK, ASKQ, or GETC command for input, specifying no +prompt, and ECHO or XECHO for output, e.g.: + +while true { + ask line + if fail exit 0 + echo \freverse(\m(line)) +} +exit 0 + +FOPEN didn't do anything with the channel number if the open failed, so any +subsequent command that tried to reference it would get a parse error it was +undefined or non-numeric, not very helpful. Changed FOPEN to set the +channel number to -1 if the file can't be opened. Now subsequent operations +on the channel fail with "Channel -1: File not open". I also added two +magic channel numbers: -8 means that any FILE command (besides OPEN and +STATUS) on that channel is a noop that succeeds silently; -9 is a noop that +fails silently. So now it's possible to simply set a channel number to one +of these values to disable i/o to certain file without getting lots of error +messages. dofile(): ckuus7.c, 12 Aug 2005. + +Added automatic herald construction for UnixWare 7. makefile, 12 Aug 2005. + +Unix isdir() never allowed for arguments that started with tilde, so gave +incorrect results for ~/tmp/ or ~fdc. The problem was mainly invisible +since most commands that parsed file or directory names used cmifi(), cmdir(), +etc, which did the conversions themselves. But IF DIRECTORY was an exception, +since its operand had to be treated as just text, and then tested after it +was parsed. ckufio.c, 13 Aug 2005. + +Fixed the following: +"ckuusx.c", line 8959: warning: implicit function declaration: ckgetpeer +"ckufio.c", line 1869: warning: implicit function declaration: ttwait +"ckufio.c", line 2941: warning: implicit function declaration: mlook +"ckufio.c", line 2943: warning: implicit function declaration: dodo +"ckufio.c", line 2944: warning: implicit function declaration: parser +"ckcftp.c", line 2625: warning: implicit function declaration: delta2sec +"ckcftp.c", line 4071: warning: no explicit type given for parameter: prm +"ckcftp.c", line 8389: warning: no explicit type given for parameter: brief +ckuusx.c, ckufio.c, ckcftp.c, ckucmd.h. 13 Aug 2005. + +Unbuffered stdout code has never worked because the setbuf(stdout,NULL) call +has to occur before the stdout has been used. The reason it's needed is +that some Kermit code writes to stderr (which is unbuffered) and other code +writes to stdout, and therefore typescripts can come out jumbled. Robert +Simmons provided the needed clue when he insisted it +worked only when executed at the very beginning of main(). So I moved the +code to that spot. But since now we also want to make unbuffered a runtime +(command-line) option, I had to do a clunky by-hand pre-prescan inline in +main() to look thru argv[], even before prescan() was called. ckcmai.c, +ckutio.c, ckuusy.c, 13 Aug 2005. (Now that this works, it might be a good +idea to remove all use of stderr from Kermit.) + +Managed, after some finagling, to build a 64-bit version on Solaris 10 at +Utah Math with Sun cc. (Can't make any gcc builds at all, 32- or 64-bit, +they all blow up in .) New target: solaris10_64. makefile, +15 Aug 2005. + +The 64-bit Solaris 10 version compiles and links OK and transfers files in +remote mode. It can make FTP connections and use them, but Telnet connections +always fail with "network unreachable". This is with all default libs and +include files. Nelson has a separate set in /usr/local, which he references +explicitly in all his 64-bit builds, but using these makes no difference. +Some data type is wrong in ckcnet.c. But telnet works fine in 64-bit Linux +and Tru64 builds. Debug logs trace the difference to netopen() (of course), +the spot where we test the results of inet_addr(), which is already marked +suspicious for 64-bit builds. It seems that inet_addr() is of type in_addr_t, +which in turn is u_int32, i.e. an unsigned 32-bit int. Yet the man page says +that failure is indicated by returning -1. I guess this doesn't matter in +32-bit builds, but in the 64-bit world, the test for failure didn't work +right. I made a Solaris-specific workaround, and checked that it works in +both 32-bit and 64-builds. I really hate typedefs. ckcnet.c, 15 Aug 2005. + +Changed the plain-text version (as opposed to the popup or GUI version - the +GUI version, at least, already does this) of ASKQ to echo keystrokes +asterisks rather than simply not echo anything, so it's easier to see what +you're doing, the effects of editing, etc. Experimental; for now, there's +no way to disable this. Not sure if there needs to be. Anyway, to get this +working required a fair amount of cleaning up of gtword(), which was echoing +different ways in different places. ckuus6.c, ckucmd.c, 15 Aug 2005. + +Added a solaris9_64 target for building a 64-bit version on Solaris 9 with +Sun cc. Verified, using the DIR command and \fsize() function on a 4.4GB +file, that the Solaris 64-bit version of Kermit gets the size correctly, and +that it can copy such a file (thus its fopen/fread/fwrite/fclose interface +works right). Initiated a large-file transfer between here and Utah over +SSH and verified that it puts the correct file size in the A packet when +sending; the right quantites are shown on the file transfer display (file +size CPS, percent done, etc). But even at 5Mb/sec, it takes a good while to +transfer 4.4GB, more than 2 hours (not streaming; 30 window slots, 4K +packets, maybe it would go faster with streaming)... After an hour or so, +it filled up the partition and gave up (gracefully) before it reached the +2GB frontier (drained its pending packets, closed the partial file). +Restarted at 12:54, this time with streaming and 8K packets (the speed +wasn't significantly different). This time it transferred 95% of the file +(4187660288 bytes) before failing because the disk filled up. Went to Utah +and started a transfer between two Solaris 10/Sparc hosts; this goes about 8 +times faster. The transfer completed successfully after 17m41s. All fields +in the f.t. display looked right the whole time. Then I verified various +other 64-bit combinations transferring the same 4.4GB file: + + To................ + From Sol Amd i64 Tru + Sol OK OK OK OK Sol = Solaris 10 / Sparc + Amd OK Amd = AMD x86_64 RH Enterprise Linux AS4 + i64 OK i64 = Intel IA64, RH 2.1AS + Tru Tru = Tru64 Unix 4.0F Alpha + +(The other combinations are difficult to test for logistical reasons.) + +Tried sending the same long file with Kermit's FTP client. It chugged along +for a while until I stopped it; it would have taken hours to complete. +There is no indication that it wouldn't have worked, assuming the FTP server +could also handle long files, which who knows. Anyway, Kermit showed all +the right data on the display screen. 17 Aug 2005. + +On AMD x86_64 and IA64 native 64-bit Linux builds, the pty routines did not +work at all. ptsname() dumped core. If I commented out ptsname(), then the +next thing dumped core. The same code works on the other 64-bit builds. +Poking around, I see that this version of Linux has an openpty() function, +which I could try using instead of the current API -- grantpty(), etc. Then +I see that openpty() is already coded into Kermit's pty module, +conditionalized under HAVE_OPENPTY, which has never before been defined for +any build. I added a test to the makefile linux target (look for the +openpty() prototype in , if found define HAVE_OPENPTY as a CFLAG and +also add -lutil to LNKFLAGS). Works fine on the problem builds, and also +on previously working 32-bit builds. makefile, 17 Aug 2005. + +Fixed a bug in the ASKQ echo asterisks code, which made the VMS version of +C-Kermit always echo asterisks. Turns out that some code in the main parse +loop to reset command-specific flags was in the wrong place, which had other +effects too, for example ASKQ temporarily turns off debug logging as a +security measure, but the code to turn it back on was skipped in most cases. +Some other side effects related to the DIRECTORY and CD commands might have +been possible but I haven't seen them. ckuus[56].c, 23 Aug 2005. + +Problem reported when sending a file to VMS when the name in the F packet +starts with a device specification and does not include a directory field, +and PATHNAMES are RELATIVE. Example: dsk:foo.bar becomes f_oo.bar. The +code assumes that if there is a device field, it is followed by a directory +field, and it inserts a dot after the '[', which in this case is not there. +Later the dot becomes '_' because of the only-one-dot rule. Solution: only +insert the dot if there really is an opening bracket. nzrtol(): ckvfio.c, +23 Aug 2005. + +A report on the newsgroup complains that C-Kermit and K95 servers were +sending REMOTE DIR listings with only #J line terminators, rather than #M#J. +Yet all the other REMOTE xxx responses arrived with #M#J. snddir() was +neglecting to switch to text mode. ckcfns.c, 26 Aug 2005. + +Back to long files. What happens if 32-bit Kermit is sent a long file? +It gets an A-packet that looks like this: + + ^A_"A."U1""B8#120050815 18:28:03!'42920641*4395073536,#775-!7@ )CP + +The 32-bit receiver reacts like so: + + gattr length[4395073536]=100106240 + +the first number being the string from the A-packet, the second being the +value of the long int it was converted to by atol(). Clearly not equal in +this case. When this happens Kermit should reject the file instead of +accepting it and then getting a horrible error a long time later. Added +code to gattr() to convert the result of atol() back to a string and compare +it with the original string; if they're not equal, reject the file on the +assumption that the only reason this could happen is overflow. Also some +other code in case the sender sends the only LENGTHK attribute. Now files +whose lengths are too big for a long int are rejected right away, provided +the sender sends the length in an A packet ahead of the file itself. If +this new code should ever cause a problem, it can be bypassed with SET +ATTRIBUTE LENGTH OFF. ckcfn3.c, 26 Aug 2005. + +As I recall from when I was testing this a few weeks ago, when the too-big +length is not caught at A-packet time, the transfer fails more or less +gracefully when the first attempt is made to write past the limit. I went +to doublecheck this by sending a big file from the 64-bit Solaris10 version +to a 32-bit Mac OS X version that does not have today's code. The Mac +thinks the incoming file is 2GB long when it's really 4GB+. But in this +case, something new happens! Although the percent done and transfer rate go +negative, the file keeps coming. It would seem that Mac OS X lets us create +long files without using any special APIs. The transfer runs to completion. +Mac OS X Kermit says SUCCESS (but gets the byte count and cps wrong, of +course). But then a STATUS command says FAILURE. The file was, however, +transferred successfully; it is exactly the same length and compares byte +for byte with the original. This tells me that in the Mac OS X version -- +and how many others like it??? -- today's rejection code should not be +enabled. Meanwhile I put today's new code in #ifndef NOCHECKOVERFLOW..#endif, +and defined this symbol in the Mac OS X 10.4 target. Over time, I'll have +to find out what other platforms have this characteristic. And of course +I'll also have to do something about file-transfer display, statistics, and +status. makefile, ckcfn3.c, 26 Aug 2005. + +From now on I'm going to bump the Dev.xx number each time I upload a new +ckdaily. This one will be Dev.02. ckckmai.c, 26 Aug 2005. + +Got rid of all the extraneous FreeBSD 4 and 5 build targets. Now there's +one (freebsd) for all FreeBSD 4.1 and later. makefile, 27 Aug 2005. + +Mac OS X 10.4 (Tiger) is a 64-bit OS. Building C-Kermit 0n 10.4.2 without +any special switches stilll gives a 32-bit executable. Ditto building with +-mpowerpc64. Further investigation turned up a tip sheet on MySQL that says +you have to include all of these: -mpowerpc64 -mcpu=G5 -mtune=G5 -arch +ppc64. That did the trick. New makefile target: macosx10.4_64. But the +10.4.2 system I tried did not have 64-bit [n]curses or resolv libs, so this +build has no -DNOCURSES -DNO_DNS_SRV. makefile, 27 Aug 2005. + +Created a symbol CK_64BIT to indicate true 64-bit builds at compile time. +Added 64-bit announcement to the startup herald and the VERSION text. +ckcdeb.h, ckuus[r5].c, 27 Aug 2005. + +Added a built-in variable \v(bits) to indicate the size of the build +(16, 32, 64, or whatever else sizeof() might report). ckuusr.h, ckuus4.c, +27 Aug 2005. + +Got rid of all the warnings in 64-bit Mac OS X about args to getsockopt(), +getsockname(), and getpeername(), and the comparisons on the return value +of inet_addr(). ckcnet.[ch], 27 Aug 2005. + +Now to check the effects on other builds... + Linux on AMD64: ok. + Linux on IA64: ok. + Linux on i386: ok. + Mac OS X 10.3.9 32-bit: ok. + Solaris 10 64-bit: ok. + Solaris 9 32-bit: ok. + Tru64 4.0F: ok. + FreeBSD 4.11: ok. + FreeBSD 5.4 ia64 (64-bit): ok. + FreeBSD 5.4 i386 (32-bit): ok. + +The Tru64 5.1B build totally blew up because they have their own unique +sockopt/etc length-argument data type (int!), so I had to roll back on using +socklen_t for this in all 64-bit builds. Checked to make sure it still +builds on Tru64 4.0F after this change (it does). ckcnet.h, 27 Aug 2005. + +The HP-UX 11i/ia64 build comes out to be 32-bit but thinks it's 64-bit. +CK_64BIT is set because __ia64 is defined. So how do I actually make a +64-bit HP-UX build? I tried adding +DD64 to CFLAGS, and this generates +64-bit object files but linking fails to find the needed 64-bit libs +(e.g. -lm). For now I added an exception for HPUX to the CK_64BIT +definition section. ckcdeb.h, 27 Aug 2005. + +Took the time to verify my recollection about the "graceful failure" on a +regular Pentium Linux system when receiving a too-big file... OK, it's not +exactly graceful. It gets a "File size limit exceeded" error; the message +is printed in the middle of the file-transfer display, apparently not by +Kermit, and Kermit exits immediately. Looks like a trap... Yup. "File +size limit exceeded" is SIGXFSZ (25). What happens if we set it to SIG_IGN? +Just the right thing: The receiver gets "Error writing data" at 2147483647 +bytes, sends E-packet to sender with this message, and recovers with total +grace (drains packet buffers, returns to prompt). ckutio.c, 27 Aug 2005. + +Backed off from rejecting a file because its announced size overflows a +long. Now instead, I set the file size to -2 (a negative size means the +size is unknown, but we have always used -1 for this; -2 means "unknown and +probably too big"). In this case, the f-t display says: + + File Size: POSSIBLY EXCEEDS LOCAL FILE SIZE LIMIT + +then the user can interrupt it with X or whatever, or can let it run and +see if maybe (as in the case of Mac OS X) it will be accepted anyway. This +way, we skip all the bogus calculations of percent done, time remaining, etc. +ckcfn3.c, ckuusx.c, 27 Aug 2005. + +Discovered that VMS C-Kermit on Alpha and IA64 is a 32-bit application; +sizeof(long) == sizeof(char *) == 4. Tried adding /POINTER_SIZE=64 to VMS +DECC builds on Alpha and IA64, but the results aren't great. Tons of +warnings about pointer size mismatches between Kermit pointers and RMS ones, +and the executable doesn't run. It appears that access to long files +would require a lot of hacking, similar to what's needed for 32-bit Linux. + +--- Dev.02: 27 Aug 2005 --- + +From Jeff, 28 Aug 2005. + . Fix SSH GLOBAL-KNOWN-HOSTS-FILE / USER-KNOWN-HOSTS-FILE parsing, ckuus3.c. + . Pick up K95STARTFLAGS from environment, ckuus4.c. + . Fix some typos in command-line processing (-q), ckuus4.c. + . Be sure to suppress herald if started with -q, ckuus7.c. + . Fix ssh command-line switches, ckuusy.c. + +Eric Smutz complained that HTTP POST was adding an extraneous blank line, +which prevented his application from successfully posting. RFC 2616 states +(in Section 4.1): + + In the interest of robustness, servers SHOULD ignore any empty + line(s) received where a Request-Line is expected. In other words, if + the server is reading the protocol stream at the beginning of a + message and receives a CRLF first, it should ignore the CRLF. + + Certain buggy HTTP/1.0 client implementations generate extra CRLF's + after a POST request. To restate what is explicitly forbidden by the + BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an + extra CRLF. + +This seems pretty clear. One section of code in http_post() (just above the +postopen: label) was appending a CRLF to a buffer whose last already was +terminated by CRLF, and then appended a second CRLF; thus two empty lines. +I removed the second one. ckcnet.c, 28 Aug 2005. + +I looked into the 64-bitness of NetBSD, it seems to be like Linux and +FreeBSD on 64-bit hardware, i.e. you just build it there and it works, at +least on Alpha and AMD64, going back to NetBSD 1.4 or 1.5. But I don't have +access to any of these for verification and documentation on the Web is +scanty. + +Checked PeterE's complaint again of warnings in ckutio.c about parameter +list of get[ug]id() and gete[ug]id(). When I "make hpux1100o" on HP-UX +11.11 (PA-RISC), there are definitely no warnings. He says the same thing +happens on 10.xx, but I don't have access to that any more. I also did +"make hpux1100o" on HP-UX 11.23 (11i v2) (PA-RISC), also no warnings. +(Except in both cases, a warning about a comment within a comment in +/usr/include/sys/ptyio.h). On HP-UX 11i v2 on Itanium, however, there are +TONS of warnings, mostly of the "variable set but never used" kind. Also +"dollar sign used in identifier". Tracking this last one down, I see it's +complaining about code that's in #ifdefs for other platforms, such as +Apollo Aegis. Is "aegis" defined in HP-UX 11i v2/IA64? No! (It would show +up in SHOW FEATURES if it was.) Some phase of the compiler is complaining +about code that it should be skipping (and that, in fact, it *is* skipping +it because the build is successful). It's as if cc is running lint for me +but not telling lint which macros are defined and which are not. + +Verified that 64-bit linking fails in the same way for HP-UX 11i v2 on both +IA64 and PA-RISC. Sent a query to HP. + +Compiling ckcnet.c and ckcftp.c got the familiar sockopt-related warnings on +HP-UX 11i v2; turns out it is just like Tru64 Unix in using an int for the +length argument. Added another special case and the warnings went away. +ckcnet.h, 28 Aug 2005. + +Added some stuff to SHOW FEATURES to see what kinds of macros are exposed +(e.g. INT_MAX, LONG_MAX, LLONG_MAX, etc) and also show sizeof(long long) and +sizeof(off_t). Building this code all over the place will give me an idea +of how widespread these data types are, and to what extent I can tell +whether they are available from clues in the header files. (At first +glance, it appears that I'm not picking up , but adding an +#include for it is just asking for trouble.) No complaints about long long +or off_t from Solaris 9 or recent Linuxes. ckuus5.c, 28 Aug 2005. + +Fixed a warning in HP-UX 10 and 11 stemming from some old-style prototypes +in ckutio.c for get[re][gu]id(). ckutio.c, 29 Aug 2005. + +Updated minix3 target from Andy Tanenbaum. makefile, 29 Aug 2005. + +PeterE confirms that "long long" and off_t are available in all HP-UX 10 and +11, and in HP-UX 9 on PA-RISC but not Motorola. 30 Aug 2005. + +Got 64-bit builds to work on HP-UX. According to my notes, John Bigg of HP +said (in 1999) that HP-UX 10.30 and later require PA-RISC 1.1, and do not +work on PA-RISC 1.0. But is PA 1.0 64-bit or what? Today, Alex McKale of +HP said "The 64-bit binaries will work on all machines that have the same or +later release of HP-UX (excluding PA-RISC 1.1 machines)". Still need +clarification... Maybe it's that all IA64 builds can be 64-bit but I need +dual builds for PA-RISC. Meanwhile I started transfer of a 4GB+ file from +Solaris to HP-UX 11i but it exceeded some quota on the HP long before it +approached the 2G point. It failed cleanly and up until then it was working +fine (numbers, stats, etc). 30 Aug 2005. + +Support of large files in 32-bit builds began in 10.20. 64-bit application +support began in 11.00, but not all machines that run 11.00 support 64 bits. +About long files, see HP /usr/share/doc/lg_files.txt. + +PeterE found that certain patterns can still make Kermit loop; example: + + if match T01011-00856-21-632-073 *[abc] { echo GOOD } else { echo BAD } + if match T01011-00856-21-632-073 *[a-z] { echo GOOD } else { echo BAD } + +The minimum offending pattern is * followed immediately by an [xxx] +construction, followed by anything else, including nothing. Previous +versions of Kermit handled this one correctly, without looping (but failed +certain matches that should have succeeded). The new section of code I +added on 15 June, upon failure to match, advances the string pointer and +backs up the pattern to the previous pattern, and starts again +(recursively). However, there needed to be a corresponding check at entry +for an empty target string. ckmatch(): ckclib.c, 12 Sep 2005. + +PeterE discovered that "kermit -y filethatdoesnotexit" gives an erroneous +error message that names the user's customization, rather than the name +given on the command line. doinit(): ckuus5.c, 12 Sep 2005. + +FREAD does not get an error if it tries to read a record or file or piece of +file that is too big for its buffer. In particular, FREAD /SIZE:xxx seems +to succeed even if less than xxx was read. It should fail unless, perhaps, +it successfully read up to the end of the file. Furthermore, if xxx is +bigger than the file buffer size, it should complain. The buffer is +line[LINBUFSIZ], 32K. The lack of failure was due to code in dofile() that +adjusted the given size silently if it was greater than the buffer size, +which I removed, and also added a check when parsing the /SIZE: switch. +dofile(): ckuus7.c, 12 Sep 2005. + +That still didn't help with FREAD /SIZE:n returning less than n bytes, even +when they were available. That's because the underlying routine, z_in(), +didn't check fread()'s return code, which is the number of bytes read. +If fread() has smaller buffers, it needs to be called in a loop. z_in(): +ckuus7.c, 12 Sep 2005. + +Flen() fails on strings of length 8192 or more. The limitation is in the +callers of zzstring, which seem to be specifying an 8K buffer, in this case +fneval(). The operable symbols are FNVALL (max length of value returned by +a function) and MAXARGLEN (maximum length of an argument to a function). I +changed both of these for BIGBUFOK builds to be CMDBL. Buffers can never be +infinite, there has to be a limit. It's important to make everything work +consistently within that limit, and to make something useful happen when the +limit is exceeded. At this point, I can probably also increase the limits +for modern 32-bit systems, and certainly for 64-bit ones. Also there's no +point in worrying about 16-bit platforms any more; earlier C-Kermit versions +can still be used on them if necessary. ckuusr.h, 12 Sep 2005. + +Special #ifdefs for finding resolv.h and nameser.h in MINIX3 from Andy +Tanenbaum. ckcnet.c, 20 Sep 2005. + +PeterE noticed that ckmatch(), even though it works pretty well now, does a +lot of extra and unnecessary recursion after determining the string and +pattern do not match, at least when the pattern is of the form *[abc]. +After several false starts I was able reduce this effect to a minor level +(but not eliminate it all together) by changing a while loop into a do loop. +ckmatch(): ckclib.c, 15 Oct 2005. + +Added -DNOLONGLONG to HP-UX 8.00 and earlier builds, and to Motorola-based +HP-UX 9.00 builds. This is simply to inhibit the test for whether "long +long" is supported by the compiler, since when it isn't, the module +containing the test won't compile. makefile, ckuus5.c, 16 Oct 2005. + +Making ASKQ always echo askterisks is a bad idea, because when it doesn't +echo, it's the perfect way to read silently from stdin, e.g. in a CGI script +(INPUT can also be used for this but it's not as straightforward). So I put +the default for ASKQ back to no echoing, then gave ASKQ its own switch +table, which is the same as for ASK with the addition of an /ECHO:x switch, +which tells what character to echo. ckucmd.c, ckuus[26].c, 17 Oct 2005. + +Fixed a bug in FTP GET /COMMAND filename commandname; it always dumped core +dereferencing a null string (the nonexistent local asname). ckcftp.c, +17 Oct 2005. + +For docs: if you don't like the funny business that happens when you type +an IF command at the prompt, use XIF instead and it won't happen. Also note +that commands like "if xxx { echo blah } else { echo blah blah }" don't +work when typed at the prompt; you have to use XIF for this. + +Back to ckmatch()... Under certain conditions (e.g. patterns like *[abc]) +failure to match would not stop the recursion because the string and pattern +arguments are on the stack, as they must be, so there was no way for level +n-1 to know that level n had detected a definitive nonmatch and that no +further attempts at matching were required. The right way to handle this is +to recode the whole thing as coroutines, the cheap way out is with a global +static flag. Works perfectly, in the sense that the match.ksc test results +are identical to what they were before and the extra backing up and +recursion are eliminated. (The Oct 15th fix wasn't really a fix, it broke +a couple of cases.) ckclib.c, 20 Oct 2005. + +ckuus7.c(2987): warning #267: the format string requires additional arguments +(in PURGE command); fixed 20 Oct 2005. + +From Andy Tanenbaum, final changes for MINIX3: #ifdef out the inline +definitions for gettimeofday() and readlink(). ckutio.c, 23 Oct 2005. + +From Jeff: struct gss_trials initializers changed from gss_mech_krb5 to +ck_gss_mech_krb5. ckcftp.c, 23 Oct 2005. + +From Jeff: some improvements to K95 GUI SHOW TERMINAL. ckuus5.c, 23 Oct 2005. + +Found and corrected some misplaced #ifdefs in shofeat(), ckuus5.c, 23 Oct 2005. + +--- Dev.03 --- + +Fixed a compiler warning in a debug() statement in zzstring() by adding +parens. ckuus4.c, 24 Oct 2005. + +Added -DNOLONGLONG to sv68r3v6 target, makefile, 25 Oct 2005. + +New makefile targets for HP-UX from PeterE to handle the 'long long' +situation. 26 Oct 2005. + +From Jeff: changes to support OpenSSL 0.9.8, ck_ssl.h. ckcasc.h has had +short names defined for ASCII control characters for 20-some years but now +they are causing conflicts, so EM becomes XEM (also for OpenSSL 0.9.8). +Changed K95's default terminal type from VT320 to VT220 because VT320 +termcaps/terminfos are disappearing from Unix hosts: ckuus7.c. Reorganize +the data-types section of SHOW FEATURES to add more macro tests for integral +sizes and to provide for the proper printf formatting in order to allow the +sizes to be output ("You are going to need to be careful because %llx is not +supported on all platforms. On Windows, it is the same as %lx, 32 bits"): +ckuus5.c, 26 Oct 2005. + +Defined NOLONGLONG ckcdeb.h for various old platforms where we know we are +never going to need 64-bit ints (even if they support a long long datatype, +chances are pretty slim they supported 64-bit file sizes). ckcdeb.h, +26 Oct 2005. + +PeterE noticed that GOTO targets can only be 50 characters long. This was +by design, a long time ago, on the assumption that nobody would make longer +labels. But in SWITCH statements, case labels can be variables that expand +to anything at all. If we chop them off at 50, we might execute the wrong +case. Changed the maximum label size to be 8K, and added code to dogoto() +to check when a label or target is too long and fail, to prevent spurious +GOTO or SWITCH results. ckuusr.h, ckuus[r6].c, 26 Oct 2005. + +Testing revealed there was still a problem with SWITCH case labels that were +variables that expanded into long strings. Turns out that I was being +too clever when I decided that, if the SWITCH macro was n1 characters long +and the case-label search target was n2 characters long, I only had to +search the first n1-n2+1 characters of the macro definition. That was true +before I allowed case labels to be variables, but not any more! Fixed in +dogoto(): ckuus5.c, 26 Oct 2005. + +--- Dev.04 --- + +Dev.04 didn't actually contain Jeff's data-type changes to shofeat(), +I think I saved the wrong buffer in EMACS... Fixed now. 27 Oct 2005. + +PeterE corrected a typo in the HP-UX 7.00 makefile target. 27 Oct 2005. + +PeterE had been reporting problems stress-testing the new SWITCH code, but +only on HP-UX 9, primarily stack overrun. Turns out to be the HP-UX 9 +optimizing compiler's fault. No optimization, no problems. + +PeterE found that even when dogoto() detects a string that is too long +and fails, this does not stop SWITCH from producing a result, which can not +possibly be trusted. Changed the part of dogoto() that handles this to +not just fail, but also to exit the script immediately and return to top +level. ckuus6.c, 28 Oct 2005. + +An idea popped into my head after having typed too many commands like "dir +ck[cuw]*.[cwh]" to check the list of matching files, and then having to +retype the same filespec in a SEND command: Why not unleash some unused +control character such as Ctrl-K to spit out the most recently entered input +filespec? It was easy, just a few lines in cmifi2() and gtword(), plus a +couple declarations. To see all the changes, search for "lastfile" (all the +new code is protected by #ifndef NOLASTFILE). ckucmd.c, 28 Oct 2005. + +I added a new variable \v(lastfilespec) that expands to the same last +filespec, for use in scripts. ckuusr.h, ckuus4.c, 28 Oct 2005. + +The Unix version of C-Kermit failed to put anything in the session log if +SET TERMINAL DEBUG ON. Rearranged the pertinent clause so logging happens +independent of TERMINAL DEBUG. For now, since the user who noticed this +wanted debug format to go into the session log, that's what I do. The +alternative would be to just log the raw incoming stream as usual, or to add +Yet Another SET Command to choose. ckucns.c, 11 Nov 2005. + +Fixed HELP INTRO text. ckuus2.c, 11 Nov 2005. + +Added NOLONGLONG for SV68. ckcdeb.h, 11 Nov 2005. + +--- Dev.05 --- + +Added a debug() statement in FTP secure_getbyte() to see what's going on +with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads. + +--- Dev.06 --- + +Result: nothing, SSL_get_error() does not report any errors. Suggested +testing SSL_read()'s return code, if 0 don't update the screen. + +Created a new data type CK_OFF_T in ckcdeb.h that will eventually resolve +to whatever each platform uses for file sizes and offsets. ckcdeb.h, +17 Nov 2005. + +Made a new library routine ckfstoa() that converts a file size or offset to +a string. This is to solve the problem with having to use different +printf() formats for different representations of file size (int, long, long +long, off_t, signed, unsigned, etc). Replaced a few printf("%l",size) with +printf("%s",ckfstoa(size)) with the expected results. This is just a start, +the definitions will need adjustment for many platforms, variables need to +be redeclared, and all the offending printf's (and printw's) will have to +hunted down and converted. ckclib.[ch], ckuus4.c, 17 Nov 2005. + +Built a minimal version on Linux with: +make linux "KFLAGS=-DNOLOCAL -DNOICP -DNOCSETS -DNODEBUG" +Worked fine, result was 260K on i686. 21 Nov 2005. + +Discovered that Kermit's date parser, contrary to the documentation, failed +to handle strings like "Wed, 13 Feb 2002 17:43:02 -0800 (PST)", which are +commonly found in email. This was because of an overzealous and misguided +check in the code; once removed, all was well. ckucmd.c, 26 Nov 2005. + +Added a new format code 4 to \fcvtdate() to emit asctime() format, used in +BSD-format email message envelopes (i.e. the "From " line). shuffledate(), +ckucmd.c, ckuus[24].c, 26 Nov 2005. + +Added a new function \femailaddress(). Given a From: or Sender: header line +from an RFC2822-format email address, extracts and returns the actual email +address, such as kermit@columbia.edu. ckuusr.h, ckuus[42].c, 26 Nov 2005. + +Using the new functions, I wrote a script to fetch mail from a POP3 server +over a TLS connection. But the line-at-a-time input (needed for changing +line terminators and byte-stuffing text lines that start with "From ") is +slow, 17 sec to read 29 messages totaling 175K. + +Added INPUT /CLEAR so INPUT can be started with a clean buffer without +requiring a sepearate CLEAR INPUT command. ckuusr.h, ckuus[r24].c, +27 Nov 2005. + +One thing that INPUT was never able to do well was read and save the +complete incoming data stream. That's because, while waiting for its +target, the buffer might overflow wrap around. Yet there was never a way to +tell it to stop when its buffer fills up and let me save it. I added a +/NOWRAP switch that does this. If the buffer fills up before any other +completion criterion is met, INPUT returns failure, but with \v(instatus) +set to 6 (the next available instatus value). Thus a program that wants to +read and save (say) an email message from a POP server, which could be any +length at all, and which terminates with . could do this: + + set flag off + while open connection { + input /nowrap 10 \13\10.\13\10 # Wait for . + if success { + frwrite /string \%o {\freplace(\v(input),\13\10.\13\10,\13\10)} + set flag on + break + } else if ( == \v(instatus) 6 || == \v(instatus) 1 ) { + frwrite /string \%o {\v(input)} + continue + } + break + } + if flag (handle success) + +Note carefully the braces around the FWRITE text; without them, trailing +spaces would be lost. + +Previously the only way to INPUT an entire data stream without losing +anything (assuming it was ordinary lines of text that were not "too long"), +was line-by-line: + + while open connection { + input /clear 10 \13\10 + if fail break + if eq "\v(input)" "$ \13\10" break + fwrite /string \%o {\freplace(\v(input),\13\10,\10)} + } + +The new code is 3 times faster using the default INPUT buffer length of 4K. +Raising it to 16K makes it 3.6 times faster (not worth it). Changing the +POP3 script to use INPUT /NOWRAP makes it about twice as fast (it does more; +it has to do all the byte-stuffing and unstuffing). 27 Nov 2005. + +Changed ssl_display_xxx() to just return if SET QUIET ON. Otherwise there +is no way to suppress the messages. Also protected a previously unprotected +printf("[SSL - OK]\r\n"); by if ( ssl_verbose_flag ). ck_ssl.c, +28 Nov 2005. + +Discovered that FOPEN /APPEND doesn't work if the file doesn't exist. It +uses cmiofi() which is a super-hokey front end to cmifi2(). I had code to +call it but for some reason it was commented out, with a note to the effect +it didn't work. I uncommented it but that didn't help much. So I wrote an +entirely new cmiofi() that works exactly as it should, using chained FDBs, +_CMIFI to _CMOFI (I think the original cmiofi() predated chained FDBs). +ckuus7.c, ckucmd.c, 29 Nov 2005. + +Getting rid of the awful hacks required to call cmiofi() meant I also had to +change the EDIT command, which is the only other place where it's used. +Unfortunately now it's no longer possible to give EDIT without a filename +(to just start an empty editor) but I doubt anyone will notice. ckuusr.c, +29 Nov 2005. + +IF KERBANG didn't always work right. If a kerbang script TAKEs another +kerbang script, the second one should have IF KERBANG false, but it didn't. +Added a check for \v(cmdlevel) == 1. Now you can write a wrapper that runs +a kerbang script in a loop, and the latter can use IF KERBANG to know +whether to EXIT (if called at top level) or END (if called by another +script, thus allowing -- in this case -- the loop to continue). ckuus6.c, +29 Nov 2005. + +Changed \flop() and flopx() functions to take a third argument, a number +signifying at which occurrence of the break character to lop, so: + + \flopx(sesame.cc.columbia.edu) = edu + \flopx(sesame.cc.columbia.edu,,2) = columbia.edu + +ckuus[24].c, 1 Dec 2005. + +Built OK on VMS 7.2-1 with MultiNet 4.4. Built with and without OpenSSL on +Linux OK, ditto Solaris 9. Built OK on RH Linux AS4 on X86_64 (64-bit); +"show var fsize" (using new ckfstoa()) works OK there. Also Mac OS X 10.3.9 +(32-bit), Tru64 UNIX 4.0F (64-bit), HP-UX 11iv2 (64-bit) (picky new compiler +spews out tons of useless warnings), FreeBSD 6.0 on ia64 (64-bit). + +--- Dev.07 --- + +Changed "make netbsd" to be a synonym for "make netbsd2" because the +original netbsd target was ancient. Renamed it to netbsd-old. makefile, +3 Dec 2005. + +Updated INPUT and MINPUT help text. ckuus2.c, 3 Dec 2005. + +Discovered that on a SET PORT /SSL connection, Kermit treats incoming +0xff data bytes (e.g. sent from the POP server) as IACs and goes into Telnet +negotiations. Jeff says "You will need to implement NP_SSLRAW and NP_TLSRAW +that do the same as NP_TCPRAW but negotiate SSL or TLS as appropriate." +This was not as easy as it sounded, because apparently a lot of the Telnet +code is used by SSL and TLS even when Telnet protocol is not being executed. +I wound up doing this as follows: I added /SSL-RAW and /TLS-RAW to the +switch table. Rather than disable Telnet, they do exactly what the /SSL and +/TLS switches do, but also set a special flag. This flag is checked in only +two place: netclos() (to prevent Kermit from sending TELNET LOGOUT when +closing the connection), and tn_doop() (to prevent Kermit from reacting to +incoming IACs; it makes tn_doop() return(3), which means "quoted IAC", which +causes the caller to keep the IAC as data). ckcnet.h, ckctel.h, ckctel.c, +ckuus7.c, 4 Dec 2005. + +The INPUT command did not account for tn_doop() returning 3. Fixed in +doinput(), ckuus4.c, 4 Dec 2005. + +Added another debug() statement in FTP secure_getbyte() to see what's going on +with Muhamad Taufiq Tajuddin's 205-byte-per-second FTP/SSL downloads, plus +new code to test SSL_read()'s return code (byte count); if 0 don't update +the screen. ckcftp.c, 4 Dec 2005. + +--- Dev.08 --- + +Fixed a typo in the non-ANSIC definition of ckfstoa(). ckclib.c, 7 Dec 2005. + +Our Ctrl-C trap (the ON_CTRLC macro) wasn't working for kerbang files. +Rearranged some code to make it work. ckcmai.c, 8 Dec 2005. + +Started converting code to use CK_OFF_T for file sizes and offsets, and +all [s]printf's to replace "%ld" or whatever with "%s", and the size +variable with a call to ckfstoa(). Since I haven't actually changed the +definition of CK_OFF_T from what all the size variables were to begin +with (i.e. long), it shouldn't do any harm. So far just ckcfn3.c +10 Dec 2005. + +An updated HP-UX 9.xx makefile target from PeterE to fix a core dump that +happens on that platform due to insufficient resources. 14 Dec 2005. + +Added debug() statements to http_blah() routines to tell whether the +connection is "chunked". There seems to be a bad performance problem. +ckcnet.c, 14 Dec 2005. + +PeterE complained about ugly DIRECTORY error message, ?No files match - +"{blah}". The braces are used internally in case the user typed more than +one filespec. I changed the error message to remove them. Ditto DELETE. +ckuus6.c, 15 Dec 2005. + +The problem with HTTP downloads is that Kermit always does single-character +read() or socket_read() calls (or the SSL equivalent); see http_inc(). I +added buffering code for non-SSL connections only but it's gross because it +has to swap ttyfd and httpfd before calling nettchk(). I tried making a +nettchk() clone that accepts a file descriptor as an argument but it didn't +work because too many other routines that are invoked directly or implicitly +by nettchk() (such as in_chk()) are still hardwired to use ttyfd. HTTP GETs +are now 20 times faster on the local network (the improvement is less +dramatic over a clogged Internet). ckcnet.[ch], 15 Dec 2005. + +--- Dev.09 --- + +HTTP file-descriptor swapping is not thread safe. Doing it right, of +course, is a big deal, so for now I just don't define HTTP_BUFFERING for +Windows. ckcnet.c, 15 Dec 2005. + +Noticed that HTTP not included in FreeBSD and OpenBSD builds. Fixed in +ckcdeb.h, 22 Dec 2005. + +Fleshed out 32/64-bit data type definitions and changed struct zattr +(file attribute structure) members length and lengthk to have the new +CK_OFF_T type. Changed final arguments of debug() and tlog() to be the new +LONGLONG type. ckcdeb.h, 22 Dec 2005. + +Changed ckfstoa() to return a signed number in string form, rather than an +unsigned one. That's because off_t is signed (thank goodness). Added the +inverse function, ckatofs() so we can convert file sizes and offsets back +and forth between binary number and string. ckclib.c, 22 Dec 2005. + +Changed Attribute Packet reader to convert incoming file size attribute +with ckatofs() rather than atol(). ckcfn3.c, 22 Dec 2005. + +Converted debug(), tlog(), ckscreen(), etc, to handle potentially "long long" +arguments by making their "n" argument CK_OFF_T. ckuusx.c, ckcdeb.h, +22 Dec 2005. + +Converted the rest of the source files to use CK_OFF_T for all file size +and offset and byte-count related variables, and converted all references to +these variables in printfs to go through ckfstoa(). Then I built it on +Linux/i386 with: + + make linux "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +which makes off_t be 64 bits and magically makes all the regular file APIs +use 64-bit sizes and offsets without changing the API calls in the source +code. It's going to be a lot of work to get through all the kinks but I was +able to send a long file, do directory listings of long files, do +\fsize(longfile), etc. When it sends a file, the length is shown correctly +in the A packet. If the receiver does not support big numbers, it receives +the file OK anyway, without showing the size, the thermometer, or percent +done (and then will get an error when the file keeps coming after the 2G +mark). Kermit 95 actually refuses long files for "Size", but only if the +announced is less than 2^63 bytes. When today's Linux version receives a +file, it shows the length correctly in the file-transfer display, as well as +percent done, thermometer, etc. Also built this version on true 64-bit +Linux, and it worked fine. Many files changed, 22 Dec 2005. + +For the record, this API is specified in X/Open's Single UNIX Specification +Version 2, which is branded as UNIX 98. It is called Large File Support, or +LFS, and was developed at the Large File Summit. + +It looks like the operative feature-test macro in glibc for transitional +large file support is __USE_LARGEFILE64. So if this is defined, we can also +supply _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64 automatically for 32-bit +Linux builds. But there's a Catch-22, you don't know if this is defined +until you read the header files, but you have to define _LARGEFILE_SOURCE +and _FILE_OFFSET_BITS before you read the header files. Maybe it's good +enough to grep through for __USE_LARGEFILE64. makefile, +23 Dec 2005. + +Checked this on true 64-bit Linux. The same symbols are defined in CFLAGS, +but they do no harm; it builds without complaint and works fine. 24 Dec 2005. + +Built it on Red Hat Linux 6.1 from 1999. This picked up the long file +support too. Guess 6.1 isn't old enough to not have it! Kermit seems to +work OK on regular files but I don't have enough disk space to create a long +file, and my bigfile.c program (which creates a long file containing only 1 +byte) doesn't work ("fseeko: invalid argument"). It looks like parts of +this API were visible in Linux before they were actually working. +24 Dec 2005. + +Converted all fseek() and ftell() to macros that expand to fseek() and ftell() +or fseeko() and ftello() depending on whether _LARGEFILE_SOURCE is defined. +ckufio.c, ckuus7.c, ckuusx.c, 24 Dec 2005. + +Made a CK_OFF_T version of cmnum(). It would be a very big deal to just +change cmnum() to return a new type, so another idea is to rename cmnum() to +something else, cmnumw(), change its result argument to CK_OFF_T, and then +make a stub cmnum() to call it to get an int, then call cmnumw() explicitly +any time we need a big number. ckucmd.c, 24 Dec 2005. + +Calling cmnumw() directly requires changes to each routine that uses it. +The INCREMENT and DECREMENT commands, for example, required changes to +doincr(), varval(), and incvar(), and all references to them. ckuusr.[ch], +ckuus[56].c, 24 Dec 2005. + +Calling cmnumw() in chained FDBs required defining a new function code, +_CMNUW, adding a new member to the OFDB struct for returning wide results, +and adding a new case to cmfdb(). ckucmd.[ch], 24 Dec 2005. + +Changed FSEEK and FCOUNT to use the new chained FDB interface, now we can +seek and look past 2GB. ckuus7.c, 24 Dec 2005. + +Next come switches, which store their results in a struct stringint. This +struct was defined in each module where it was used (ckuus[r367].c, ckcftp.c). +I moved the definition to ckuusr.h and added a wval member, which can be +referenced by any switch-parsing code that calls cmnumw(). 24 Dec 2005. + +Changed SEND /CALIBRATE:n to allow big values of n. This makes it possible +to test the protocol aspects of long-file transfer without actually having a +long file handy. ckuusr.c, 24 Dec 2005. + +SEND /SMALLER-THAN:n, SEND /LARGER-THAN:n, and and SEND /START:n also now +allow large values of n. ckuusr.c, 24 Dec 2005. + +Changed the algebraic expression evaluator to use wide values. +ckuus5.c, 24 Dec 2005. + +Fixed ckfstoa() to handle the case when n is negative and (0 - n) is also +negative, which happens for numbers 2^(n-1) or greater, where n is the +number of bits in the word size we're dealing with, e.g. 64, in which case +2^63 has its sign bit set so seems to be negative. In such cases, ckfstoa() +returns "OVERFLOW" instead of a numeric string. We'll have to see how this +plays out but I think it's better to cause a parse error and stop things +dead than to return a spurious number. ckclib.c, 24 Dec 2005. + +Converted the S-Expression handler to use wide integers. ckuus3.c, 24 Dec 2005. + +Took all the LONGLONG stuff out of ckcdeb.h, we don't need it. + +All of these changes result in 64-bit arithmetic (more or less) on 32-bit +Linux, as well as on true 64-bit platforms. + +Rebuilt today's code on Solaris 9 in the 32-bit and 64-bit worlds, on Red +Hat 6.1, Red Hat AS4.2. I haven't bothered trying a 32/64 hybrid build for +Solaris, since I can build a pure 64-bit version there. Quick tests show +the large-number arithmetic works OK in all cases except, of course, on pure +32-bit builds (unfortunately I can't find a running Linux system old enough +to verify this for Linux, but it's true for other 32-bit platforms). +24 Dec 2005. + +Tried building a hybrid version on Solaris 9 after all since the LFS API is +ostensibly the same as for Linux: + + make solaris9 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +It built smoothly and the resulting binary is 2.5MB compared to 3.4MB for +the 100% 64-bit version. Looks like a keeper. For now, added solaris9lfs +and solaris10lfs entries to the makefile but if these work on PCs we can +make these the regular entries for Solaris 9 and 10. 27 Dec 2005. + +Built on Mac OS X 10.4 with the regular target. It seems that in that case, +off_t is 64 bits anyway. Noticed that a lot of stuff didn't work, like +exponentiation in S-Expressions. Tried building it as above, which worked, +and now CK_OFF_T is 64 bits instead of 32, but (^ 2 30) is still 2.0. In +fact 2-to-the-any-power is 2.0. It seems that the Mac OS X version did not +have FNFLOAT defined. It also seems that every test in dosexp() like: + + if (result != fpresult) fpflag++; + +should have been protected by #ifdef FNFLOAT..#endif /* FNFLOAT */ -- a +double-ended break, as they say in the nuclear power industry. ckuus3.c, +27 Dec 2005. + +Added GREP /EXCEPT:pattern. ckuus[26].c, 27 Dec 2005. + +Fixed a problem with uninitialized pv[].wval (switch-parsing parameter-value) +members that showed up on certain platforms or with certain compilers. Now +the Mac OS X 10.4 version works. ckuus[r367].c, ckcftp.c, 28 Dec 2005. + +Built on Unixware 7.1.1, a pure 32-bit build, seems fine. Rebuilt on Red +Hat AS 4.2 just to make sure I didn't break anything, it's OK. No testing +on HP-UX, etc, because HP testdrive file sytem is full, can't upload anything. +29 Dec 2005. + +Commented out the SHOW FEATURES section that displays constants like +INT_MAX, CHAR_MAX, etc, because printing each value in the appropriate +format is too tricky, and we don't need them anyway. ckuus5.c, 29 Dec 2005. + +Updated ckvfio.c to use CK_OFF_T for the relevant variables. Built and +tested on VMS/Alpha 7.2: file transfer in remote mode; making a Telnet +connection and then local-mode file transfer; S-Expressions, all OK. Also +built a no-net version OK. 29 Dec 2005. + +Built and tested on Red Hat AS4 AMD X86_64, used it to upload new sources to +FreeBSD 4.11. Built on FreeBSD 4.11/i386. Here's another one where off_t +is 64 bits, even though long is 32 bits. But it seems to work ok, not sure +why, when CK_OFF_T is 32 bits. There is no _LARGEFILE_SOURCE stuff in the +header files. 29 Dec 2005. + +Built on Mac OS X 10.3.9 using the new macosx10.4 target to pick up LFS. +Works fine. + +Built on Red Hat Linux 4WS on IA64 (64-bit). Now this one is odd, stat() +fails on big files. It happens also if I use the "linuxnolfs" target, which +does not define _USE_LARGEFILE or _FILE_OFFSET_BITS=64. DIRECTORY BIGFILE +shows the size as -1, but if "log debug", it says "no files match", i.e. +different behavior, observer effect. I hate when that happens. + +Let's see if that's an anomoly... Built on Tru64 Unix 4.0F (64-bit Alpha). +It sees long files just fine. Rebuilt and checked on x86_64 again... fine. +OK, let's not worry about IA64 yet. + +Another small fix to the HP-UX 9.0 target from PeterE. makefile, 29 Dec 2005. + +---Dev.10--- + +Code adjustments from Jeff, mainly to the SSL and TLS Raw mode code from +several weeks ago, plus changing some data types in the security code to +CK_OFF_T, plus a different data type for CK_OFF_T for K95 because Windows +size_T isn't signed. This presumably will allow large-number arithmetic but +it will not give large file access because that will require replacing all C +library file i/o calls (esp. in ckofio.c) with native Windows APIs. Build +on Solaris 9 with and without SSL and on Linux RH AS4.2 with and without +SSL. ck_crp.c, ck_ssl.c, ck_ssl.h, ckcdeb.h, ckcftp.c, ckcmai.c, ckcnet.c, +ckcnet.h, ckctel.c, ckuat2.h, ckuus4.c, ckuus7.c, ckuusr.c, 30 Dec 2005. + +It was reported that WRITE SESSION always returned a failure status, even +when it succeeded. The problem was that Unix versions of zsout() and +zsoutl(), for the session log only, were using write() and returning +write()'s return code, which is different from what zsout() and zsoutl() are +documented to return. Also plugged a couple potential holes in zsoutx() +that I noticed while I was in the neighborhood. ckufio.c, 30 Dec 2005. + +Added FSEEK /FIND:pattern. This form of FSEEK accepts all the other +switches and arguments and performs the desired seek. Then, if the seek was +successful, it starts from that point and reads through the file, line by +line, searching for the first line that contains the given string or matches +the given (unanchored) pattern and, if found, sets the file pointer to the +beginning of that line. Useful, e.g., for very long timestamped logs, where +you want to start processing at a certain date or time; searching for a +particular string is much faster than doing date comparisons on each line. +ckuus[27].c, 30 Dec 2005. + +It was annoying me that FILE STATUS (FSTATUS) required a channel number to +be given even if only one file was open, so I supplied the correct default +in that case. ckuus7.c, 30 Dec 2005. + +INPUT /NOWRAP, added recently, is used for efficiently copying the INPUT +stream intact, but it's not good for matching because if the INPUT target is +broken between the end of the previous buffer and the beginning of the next +one, the context is lost and the match does not occur. I thought of several +ways around this, but they all involve saving a huge amount of context -- +old input buffers, the arrays of target strings and corresponding match +positions, etc. The alternative is fairly simple but it's not transparent +to the user. Here's what I did in a POP script: + + .eom := "\13\10.\13\10" + set flag off # FLAG ON = success + while ( open connection && not flag ) { + .oldinput := \fright(\v(input),8) # Save tail of previous INPUT buffer + input /clear /nowrap 4 \m(eom) # Get new INPUT buffer + if success { # INPUT matched - good + .s := {\freplace(\v(input),\m(eom),\13\10)} + set flag on + } else { # No match + .s := \v(input) # Check if target crossed the border + .oldinput := \m(oldinput)\fsubstr(\v(input),1,8) + if \findex(\m(eom),\m(oldinput)) set flag on + } + ... + } + +I think this will be easier to explain than any dangerous and grotesque +magic I might put into doinput() itself. For now, added a few words about +this to HELP INPUT. ckuus2.c, 30 Dec 2005. + +Back to the pattern matcher. Noticed that "IF MATCH index.html [a-hj-z]*" +succeeded when it should have failed. In ckmatch(), the clist section +needed one more clause: it can't float the pattern if an asterisk does not +occur in the pattern before the clist. This change fixes the problem +without breaking any other cases that weren't already broken, most of which +involve slists, i.e. {string,string,string,...}. ckclib.c, 30 Dec 2005. + +Tried FSEEK /FIND: on a largish file (over 100,000 lines), using it to seek +to a line near the end. It took 0.756 seconds, compared with Unix grep, +which did the same thing in 0.151 sec. That's because C-Kermit is using +ckmatch(). But if the search target is not a pattern, it should be a bit +faster to use ckindex(). Yup, 0.554 sec, a 36% improvement. Can't expect +to compete with grep, though; it's highly tuned for its single purpose. +ckclib.[ch], ckuus7.c, 1 Jan 2006. + +Updated visible copyright dates to 2006: ckcmai.c, ckuus2.c, ckuus5.c, +1 Jan 2006. + +Noticed that NetBSD 2.0.3 has 64-bit off_t, and that _LARGEFILE_SOURCE is +mentioned in . Tried building Kermit with _LARGEFILE_SOURCE added +to CFLAGS, it's good. Added it to the netbsd target. makefile, 1 Jan 2006. + +Fixed typo, #ifdef CK_NOLONGLONG in ckuus5.c should have been #ifndef +CK_LONGLONG (which, it turns out, we don't use anyway). 2 Jan 2005. + +Observed that FreeBSD 4.x has a 64-bit off_t, but does not use the +_LARGEFILE_SOURCE convention. Reasoning that all versions of FreeBSD have +off_t (I was able to check back to FreeBSD 3.3), I simply #define CK_OFF_T +to be off_t in ckcdeb.h within #ifdef __FreeBSD__ .. #endif. Another one +down. This can be done for any platform that is guaranteed to have off_t. +Turns out FreeBSD 3.3 has 64-bit off_t too. 2 Jan 2005. + +OpenBSD, same as FreeBSD. Also, added OS-version-getting thing to makefile +target for the program herald, as in the other BSDs. Built on OpenBSD 2.5 +from 1998, it has 64-bit off_t too. ckcdeb.h, makefile, 2 Jan 2005. + +Dumping the command stack every time there's an error is really too much. +I added SET COMMAND ERROR-DISPLAY {0,1,2,3} to set the verbosity level of +error messages. Only level 3 dumps the stack. ckuus[235].c, 2 Jan 2005. + +Built on HP-UX 11.11 with _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64. The +result works fine as far as I can tell. It sees big files, it can open +them, seek to positions past the 2^31 boundary. It can send large files. +It can do large-number arithmetic (^ 2 62). The only problem is that during +compilation, every single modules warns: + + cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of + "sendfile" with a different storage class specifier: "sendfile" will have + internal linkage. + cc: "/usr/include/sys/socket.h", line 505: warning 562: Redeclaration of + "sendpath" with a different storage class specifier: "sendpath" will have + internal linkage. + +These warnings should be perfectly harmless since they are not coming from +C-Kermit code, nor does C-Kermit use either one of those functions. These +warnings don't come out in HP-UX 11i v2, but on that one we get tons and tons +of picky compiler warnings (variables set but not used, defined but not +referenced, etc). A couple, however, turned out to be valid; one case of +"expression has no effect", and two of "string format incompatible with +data type" (I missed a couple file-size printfs). + +There were also numerous warnings about signedness mismatch or sign +conversion of constants like IAC (0xff). Does the HP-UX Optimizing Compiler +have a compiler flag to make all chars unsigned? Yes, +uc, but the man page +says "Be careful when using this option. Your application may have problems +interfacing with HP-UX system libraries and other libraries that do not use +this option". Sigh, better not use it. + +After reviewing "HP-UX Large Files White Paper Version 1.4" and HP's +"Writing Portable Code" documents, I added -D_LARGEFILE_SOURCE +-D_FILE_OFFSET_BITS=64 to the hpux1000 target, which is the basis for all +HP-UX 10.00 and later builds. Large files are available in HP-UX 10.20 and +later. 10.00 and 10.10 were not real releases, and anyway these flags +should be harmless there unless the large-file implementation was only +partly done. Built OK on both PA-RISC and IA64, optimized and plain. +makefile, 4 Jan 2006. + +Built on FreeBSD 6.0 on IA64. All OK except I got a warning about the +argument passed to time() in logwtmp() in ckufio.c. This section had +already been partially fixed; thus I put the improved version into +#ifdef CK_64BIT, which is our newly available symbol that should be +automatically defined for any true 64-bit build. ckufio.c, 4 Jan 2006. + +Finally got around to testing Jeff's changes to SSL/TLS RAW mode from +December 30th against our POP server. It didn't work, couldn't log in. +Tried backing off the ckctel.c changes first; that allowed login and +communication, but it did not suppress activation of Telnet protocol +whenever a 0xff byte arrived. Backed off the rest of the changes and now +all is OK again. ckctel.c, ckcnet.c, ckuus7.c, 9 Jan 2006. + +Built on NetBSD 1.4.1 (1999), found that it did not like the large file +assumption -- fseeko() and ftello() do not exist; added a clause to the +netbsd target to check for fseeko and not define _LARGEFILE_SOURCE if not +found. Oddly enough, off_t is 64 bits anyway, but it doesn't look like the +APIs are half-done. For example, stat() uses off_t (64 bits) for the file +length, but fseek() uses long (32 bits) and there is no 64-bit analog. +Anyway the new netbsd target works on both 1.4.1 and 1.5.2 (no large files) +and on 2.0.3 (large files). makefile, 9 Jan 2006. + +Built on QNX-32 4.25, which has no large file support. Got a few strange +compiler (WatCom) warnings, but it built and runs OK. Noticed that file +transfers into QNX over a Telnet connection can't use streaming, but that's +nothing new to this version; same thing happens with C-Kermit 7.0. 9 Jan 2006. + +Built on IRIX 6.5. I didn't bother with large files there because it does +not support the _LARGEFILE_SOURCE interface; you have to change all the APIs +at the source level from blah() to blah64(). Seems to work fine as a 32-bit +app even though its off_t is 64 bits. Tried a pure 64-bit IRIX 6.5 build +but it dies in ckcnet.c when it hits SOCKOPT_T and GSOCKNAME_T with "The +identifier 'socklen_t' is undefined". + +Looks like I no longer have access to SCO OSR5. + +Made a pure 32-bit build on SCO UnixWare 7.1.4, all OK. Found that this +version also supports LFS, added it to the uw7 target. makefile, 9 Jan 2006. + +--- Dev.11 --- + +Evidently the HP-UX bundled (non-ANSI non-optimizing) compiler doesn't like +long integers in switch expressions. Changed three examples of these in the +S-expression code. ckuus3.c, 10 Jan 2006. + +A section of tstats() where GFTIMER isn't defined (e.g. on Motorola +sv68r3v6) was garbled. Fixed in ckcfn2.c, 10 Jan 2006. + +A fix for setting 921600 bps on Linux from Paul Fulghum, Microgate Systems Ltd. +ttgspd(): ckutio.c, 11 Jan 2006. + +Noticed that when I changed the compact substring notation code back on +August 9th, I broke the ability to use arithmetic expressions within the +brackets, which explains some rather odd behavior I saw with some of my +scripts. Looking more deeply into this, I also see that all the parsers I +have been using up to now for this, as well as for array bounds pairs, have +been inadequate because they never allowed for nested constructions, such as +a member of a bounds pair that itself was an array element, possibly with +another array element as a subscript. I wrote a new routine for this, +called boundspair(), which is like arraybounds() except it accepts an extra +argument, an array of characters that can serve as bounds-pair delimiters, +and it returns the pair separator that was encountered in another new +argument. For the alternative substring notation for [startpos-endpos] I +had to change the delimiter from '-' to '_' because '-' can be used in +arithmetic but '_' is not a recognized operator. This is so I can parse, +e.g. [a:b] or [a_b] in the same context, and then find out which form was +used, e.g. \s(line[9:12]) or \s(line[9_12]); the first string is 4 bytes +long, the second is 12. Everything seems to be OK now. \s(line[10]) gives +everything starting at 10, but \s(line[10:0]) gives the null string. Bad +syntax in the bounds pairs results in a null string; missing pieces of the +bounds pair result in defaults that should be compatible with previous +behavior. ckuus[45].c, ckuusr.h, 13 Jan 2005. + +Changed arraybounds() to call boundsdpair(). This was a rather drastic +change, not strictly necessary, but I think I got all the kinks out. +ckuus5.c, 13 Jan 2005. + +Changes from PeterE to the makefile for HP-UX 6 and 7, to accommodate bigger +symbol tables, etc. 19 Jan 2005. + +Determined that SCO OSR5.0.6 (and earlier) do(es) not support large files. +Don't know about 5.0.7. 30 Jan 2005. + +Created a new build target for SCO OSR6.0.0. Gets the exact 6.x.x version +dynamically. Supports large files and big-number arithmetic via CK_OFF_T. +The sockopt() family of functions changed the data types of some of their +arguments since OSR5. It was already possible to define SOCKOPT_T and +GSOCKNAME_T from the command line but I had to add code to also allow this +for GPEERNAME_T too. ckcnet.c, makefile, 30 Jan 2005. + +Apparently, ever since C-Kermit 7.0 was released, it has never been possible +to use a variable for the as-name in a RECEIVE command in Kermit 95. This +is because evaluation of the as-name field was deferred until after we could +check whether it might be a directory name (which, in Windows, could start +with a backslash). This little bit of magic was not a good idea, magic +hardly ever is. I changed the code to evaluate both as-name fields in the +normal way. If they want to receive to a directory called "\%1", they'll +just have to spell it differently. The workaround is to turn the whole +command into a macro and evaluate it before executing it, e.g.: + + assign xx receive /as-name:\%1 + do xx + +ckuus6.c, 1 Feb 2006. + +Built OK on FreeBSD 6.1 on AMD64. Adjusted some copyrights and date stamps. +ckcmai.c, makefile, 8 Feb 2006. + +--- Dev.12 --- + +Fixed a signed/unsigned char warning in the new boundspair() calling code +in the compact substring notation handler. ckuus4.c, 9 Feb 2006. + +Removed a spurious extra linux+openssl label from the makefile, added +solaris10g_64 synonym. 9 Feb 2006. + +Satisfied myself that LFS is OK on Solaris 10 i386, and I'm going to assume +it's also OK on Solaris 9. Made LFS standard for all Solaris 9 and 10 +builds (including the secure ones) except the explicitly 64-bit ones, and +made the provisional solarisXXlfs targets into synonyms. makefile, 9 Feb 2006. + +--- Dev.13 --- + +Further attempts at SSL/TLS message suppression when QUIET is ON. +ck_ssl.c, 16 Feb 2006. + +From J.Scott Kasten: (quote...) I just uploaded a patch to /kermit/incoming. +The file name is "jsk-patch-for-cku211.diff". I have also included the +patch as ASCII text in this email below. This patch may be applied to the +cku211.tar.gz source code via: + cd cku211, patch -p1 <../jsk-patch-for-cku211.diff +The patch adds 4 new build targets: + netbsdwoc - a stripped no curses target for iksd used. + netbsdse - security enhanced target with srp, ssl, and zlib. + irix65gcc - build on SGI Irix 6.5 platform using gcc. + irix65se - security enhanced target with srp, ssl, and zlib. +The patch fixes one build target: + irix64gcc - The "-s" option is not supported by gcc under Irix. +I thank all of you in the Kermit Project for such a fine utility. I +recently had to get a 16 MB file overseas across a spotty communications +link to repair a computer remotely. Kermit was the only thing that could do +the job, so I wanted to contribute these patches back to the mainstream to +say thanks. This digitally signed email is a binding contract that +officially assigns the rights to the source code patch (shown below) that I +developed to the Kermit Project at Columbia University. (...end quote) +ck_ssl.c, makefile, 23 Feb 2006. + +Changed the new NetBSD target names to be consistent with the conventions +used in most other targets: + + netbsdwoc -> netbsdnc + netbsdse -> netbsd+ssl+srp+zlib + irix65se -> irix65+ssl+srp+zlib + +and removed old, now superfluous, NetBSD targets (old-netbsd, netbst15, +netbst16), leaving synonym labels in their place. Also updated (crudely) +the Linux target variations (curses instead of nocurses, no curses at all) +to be (appropriately modified) copies of the current linux target. It would +be nicer to combine them, but this gets the job done. makefile, 23 Feb 2006. + +--- Dev.14 --- + +Fixed the HELP command when used with tokens like @, ^, #, and ;. The first +two had been omitted from the table. The second two required a new path +into the guts of the parser, since comments are normally stripped at a very +low level. ckuus[r2].c, ckucmd.c, 24 Feb 2006. + +Built on AIX 5.1 ("make aix51") without incident. Then I tried: + + make aix51 "KFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +This had no effect. I found the relevant document ath the IBM website. It +says to use -D_LARGE_FILES instead. I added this to the AIX 4.2 target +since (a) IBM says large files are supported by AIX 4.2 and later, and (b) +all Kermit AIX targets past 4.2 use the 4.2 one. Plus a clause to make +sure CK_OFF_T is defined appropriately. ckcdeb.h, makefile, 6 Mar 2006. + +Added a 32-bit aix51+openssl target. Builds OK, works fine (tested against +our SSL POP server). Tried I tried adding -D_LARGE_FILES. It seems to work +fine, so we'll keep it. Cleaned up the other aix5blah entries a bit also. +makefile, 6 Mar 2006. + +Fixes from J. Scott Kasten to the IRIX 6.4 and 6.5 makefile targets. They +were badly wrong. makefile, 6 Mar 2006. + +The reason Kermit was looping on directories in IRIX was a classic +"double-ended break". The makefile targets failed to define DIRENT so +Kermit was open/read on directories rather than opendir()/readdir(). But +then it was also failing to account for the fact that read() would return -1 +on error. The makefile fix adds -DDIRENT, and the read() case in traverse() +now properly terminates its loop on error. ckufio.c, 6 Mar 2006. + +--- Dev.14 --- + +In response to a complaint that C-Kermit would not build on HP-UX 11 with +OpenSSL, I tried it myself on both 11.11/PA-RISC and 11i v2/Itanium. It built +OK on both but I had to add a new target (hpux1000o+openssl-nozlib) for no +Zlib since these boxes did not have it installed. makefile, 9 Mar 2006. + +Added OpenSSL version number display to SHOW FEATURES. ckuus5.c, 9 Mar 2006. + +Gavin Graham noticed that FTP [M]GET /DELETE /MOVE-TO: was rejected with +"?Sorry, /DELETE conflicts with /MOVE or /RENAME". This check belongs in the +PUT code but not in the GET code. Commented it out and tested the result. +The combination is now accepted but then Kermit refuses the incoming file as +if it had been given a /SMALLER-THAN: or /LARGER-THAN: switch, which it didn't +happen. Turns out there was one more place where I wasn't initializing the +new "wide int" member of the switch-parsing pv[] struct. Once this was fixed, +the /MOVE-TO part still didn't work. Turned out the /DELETE case was part of +a long if-else-if-else- chain, which effectively made /DELETE and /MOVE-TO: or +/RENAME-TO: mutually exclusive. Fixed this, now it works fine. ckcftp.c, +13 Mar 2006. + +Got access to AIX 5.3, built there, all OK, including large files. 13 Mar 2006. + +--- Dev.16 --- + +Patches from Mark Sapiro to suppress getsockopt() and getsockname() warnings +in Mac OS X. ckcnet.[ch], 18 Mar 2006. + +In response to a complaint from Clarence Dold, tried "make redhat9" (which +is the rather dated target that tried to include all forms of security) on +RH Linux AS4.3, it failed miserably. I made a new makefile target, removing +Kerberos IV and got a lot farther. But then in ckcftp.c, the following +struct definition: + + struct { + CONST gss_OID_desc * CONST * mech_type; + char *service_name; + } gss_trials[] = { + { &ck_gss_mech_krb5, "ftp" }, + { &ck_gss_mech_krb5, "host" }, + }; + +refers to a variable, ck_gss_mech_krb5, that is not defined anywhere. Up +above, however, is a static definition for gss_mech_krb5, so I changed the +struct definition to match. Next, in ckuath.c, the compiler could not find +the com_err.h file. Turns out in Linux this is in a subdirectory, et, so we +have to add a -I clause to the makefile target for this. Made a target for +Linux+SSL only. Made a target for Linux+Krb5 only; this required moving an +#ifdef in ckuus7.c to prevent an unguarded reference to SSLEAY_VERSION. +New targets: linux+krb5+ssl, linux+krb5, linux+krb5. ckcftp.c, ckuus7.c, +makefile, 27 Mar 2006. + +New targets of HP-UX 10/11 with OpenSSL from PeterE. makefile, 27 Mar 2006. + +Added large file/integer support to SHOW FEATURES. ckuus5.c, 27 Mar 2006. + +Built OK on Solaris 9 and 10 with gcc (someone was complaining that this +didn't work, but that was 8.0.211). + +Started build on a Sun 3/80 mc68030 with NetBSD 2.0 and gcc 3.3.3. But it +died with an assembler error in ckcfn2.c (compiler bug). 27 Mar 2006. + +--- Dev.17 --- + +NebBSD 2.0 build completed by turning off optimization on ckcfn2.c +("KFLAGS=-O0"). Result supports 64-bit ints and, presumably, large files. +uname -p = "m68k", -m = "sun3". 29 Mar 2006. + +Corrected an omission in applying PeterE's updates to the HP-UX targets. +makefile, 28 Mar 2006. + +solaris2xg+krb5+krb4+openssl+shadow: + +Tried resurrecting the solaris2xg+krb5+krb4+openssl+shadow target. It asks +to link with libdes but there is no libdes. Removed -ldes from the target, +now at least it builds and runs wart. The compilation blows up in ckcftp.c +for missing header files: + + ckcftp.c:462: kerberosIV/krb.h: No such file or directory + ckcftp.c:500: gssapi/gssapi_generic.h: No such file or directory + ckcftp.c:501: gssapi/gssapi_krb5.h: No such file or directory + +Got a bit farther by adding appropriate -I's and -L's to KFLAGS but it still +dies compiling (or linking?) ckcftp.c, but it doesn't say exactly why. OK, +deferred. + +Added SET SEXPRESSION TRUNCATE-ALL-RESULTS { ON, OFF }. This can be used +for force integer arithmetic in any kind of calculation that requires it, +such as date calculations. This is a global setting, not on any kind of +stack. Also, updated SHOW SEXP and added HELP SET SEXP which wasn't there +before. ckuus[23].c, 30 Mar 2006. + +To make the RENAME command a bit more useful, need to add some switches. +But it shares a switch table, qvswtab[], with some other commands. Broke +this off into its own switch table. ckuus6.c, 17 Apr 2006. + +Added RENAME switch values that can be used in the same table with the DELETE +switch values, which are shared by many commands. ckuusr.h, 17 Apr 2006. + +Discovered that the RENAME command could be entered without any arguments +and it would still succeed. Fixed in dorenam(): ckuus6.c, 17 Apr 2006. + +Added parsing for RENAME /UPPER:option (to uppercase the file name(s)), +/LOWER:option (to lowercase), and /REPLACE:{{s1}{s2}} (to do string +replacement on the filename(s)), but not the semantics. When any of these +switches is given, the target ("to") name is not parsed; they act on the +source name. The /LOWER: switch takes keyword args to specify whether it +should act only only files that have all UPPER case latters, or on ALL files +(i.e., including files with mixed-case names); similarly for the /UPPER: +switch. There is some creative parsing allowing these to be given with or +without a colon and keyword argument, which works fine except if you include +the colon but no argument, execute the command (which works fine), and then +recall the command. I haven't yet decided about the interaction among these +switches. Clearly if /UPPER is given after /LOWER, it overrides. But if +/UPPER (or /LOWER) is given with /REPLACE, what should happen? ckuus6.c, +17 Apr 2006. + +Filled in actions for RENAME /UPPER: and /LOWER: for the single file case, +and tested all combinations of switch values and filename configurations. +Once that was OK, moved the code out into a separate routine, renameone(), +and then called it from both the single-file case and the multifile case. +ckuus6.c, 19 Apr 2006. + +Added RENAME /SIMULATE. Filled in the code for string replacement, needs +testing. ckuus6.c, 20 Apr 2006. + +Changed /REPLACE options to allow a negative number to specify an occurrence +from the right, so -1 means the last occurrence, -2 means the next-to-last, +etc. ckuus6.c, 24 Apr 2006. + +Added RENAME /COLLISION:{OVERWRITE,PROCEED,FAIL}. This is implemented but +not tested. ckuus6.c, 24 Apr 2006. + +Worked on RENAME /COLLISION:FAIL. I decided it was less than useful to ... + +Added SET RENAME { COLLISION, LIST } to let user change default collision +and listing actions. ckuusr.[ch], ckuus[36].c, 25 Apr 2006. + +Experimented with parsing for /CONVERT:cset1:cset2. The problem here is +that there is no straightforward way for a switch to have multiple +arguments. Or is there...? If I parse cset1 with cmswi() rather than +cmkey(), it almost works; the only problem is that the character-set +keywords don't have CM_ARG set, so they don't know to stop on, and ignore, a +colon. If I make a copy of the table and set CM_ARG in the flags field for +each keyword, it works fine: if I Tab in the first name, it fills itself +out, supplies a colon, and waits for the second name. So in the code, the +first time that RENAME /CONVERT is invoked, I put code to copy fcstab[] and +set CM_ARG in each flags field. Works fine, and now we know how to make a +switch that takes multiple arguments. ckuus6.c, 24 Apr 2006. + +I thought I had a function to convert the character set of a string but I +don't, so actually implementing /CONVERT: will be difficult. + +Actually the parsing wasn't that easy either. It works OK interactively, +but not in a TAKE file. To make a long story short, I had to change +gtword() and cmkey2() to not require "/" at the beginning of a switch, and +then to parse arguments-that-are-followed-by-other-arguments as if they were +switches, so that they can end with colon rather than space. This might +seem dangerous, but switches always have "/" at the beginning, so the check +is superfluous. ckucmd.c, 26 Apr 2006. + +Back to /CONVERT... Once I was able to get the code to call cvtstring() I +was able to debug it (at first it was skipping every second character). And +now we have a general-purpose string-translating function we can call from +anywhere. Requires that C-Kermit be built with Unicode support. +ckuus6.c, 26 Apr 2006. + +Added SHOW RENAME. ckuusr.h, ckuus[r5].c, 26 Apr 2006. + +Conditionalized some Unix/Windows assumptions in renameone() so the code +could work in VMS. ckuus6.c, 2 May 2006. + +Added RENAME /FIXSPACES to change all spaces in the filename(s) to +underscore or any other character or string that is given. This is just a +special case of RENAME /REPLACE:{{ }{x}} with easier syntax. +ckuusr.h, ckuus6.c, 2 May 2006. + +Added an "all-but" control to the /REPLACE options: +/REPLACE:{{.}{_}{~1}} means replace all but the first (this one works); +/REPLACE:{{.}{_}{~-1}} means replace all but the last (this one not yet). +ckuus6.c, 2 May 2006. + +Filled in the second one ("all but" the given occurrence). The algorithm is +simply to reverse the three strings and then use the same code as we use in +the left-right-case, and then unreverse the result. At first I used +yystring() for this but yikes, what a bad design! So I made a better +string-reversal routine, gnirts(), for this (luckily yystring() is only used +in one place, for which its design is appropriate). ckuus6.c, 3-4 May 2006. + +Added code to handle the case where the file being renamed includes a path +specification. In this case we separate the path, apply the renaming +functions to the filename only, and then at the end rejoin the original +filename with the path, and join the new name with same path or, if a +destination directory was given, with that. ckuus6.c, 4 May 2006. + +Added HELP SET RENAME and updated HELP RENAME. ckuus2.c, 4 May 2006. + +"Tom Violin" (Tom Hansen) noticed that the first time you FOPEN a file, +Kermit's memory consumption goes way up. In fact there's a warning to that +effect in the code, where, upon first open, a potentially big array of +potentially big structs is allocated. I rewrote the code to allocate each +array member (struct ckz_file) as needed, i.e. when a file is opened, and to +free it when the file is closed (or the open fails). This was actually +quite a lot of work, which is why I didn't do it the first time around: +every single "." had to be changed to "->". Every check for a valid +channel first had to check if the channel's struct was allocated and every +other reference to z_file[i]->anything had to be prechecked that z_file[i] +was not a NULL pointer. Also I made some improvements to FILE STATUS, and I +fixed FILE CLOSE to default the channel number if only one channel was open, +as I did for FILE STATUS a while back. ckuus7.c, Cinco de mayo 2006. + +Ran my old BUILDS script that builds C-Kermit with about 100 different +combinations of feature-selection switches. Fixed a few small glitches so +now they all build OK (except can't do NOANSI builds any more on recent +Linuxes because of varargs()). ckuus3.c, ckuus5.c, ckuus6.c, ckuus7.c, +ckucmd.c, ckcfns.c, 6 May 2006. + +Fixed RENAME /LOWER and /UPPER, when given with no colon or agrument, to +default to ALL. ckuus6.c, 13 May 2006. + +Built on VMS 7.2-1, tested new RENAME command there; seems to be OK. +13 May 2006. + +--- Dev.18 --- + +I wanted to test large files against RESEND but I don't have access to any +system that can run C-Kermit and that also has enough space for a large +file. I created a "fake" large file on Linux (3G hole plus 1 byte), and +sent it over a localhost connection, and interrupted it repeatedly and then +initiated a RESEND at the sender. In each case, it picked up where it left +off. But before the 2G boundary was crossed the disk filled up. +Inconclusive. 14 May 2006. + +PeterE got a warning in the new FILE OPEN code when building in HP-UX 9. +I added a cast, built on HP-UX 11, no more complaint. However there +are warnings about internal vs external bindings of sendpath and sendfile +in every module. Too bad, these are not Kermit tokens, it's a conflict in +HP's header files. Marc Sapiro doesn't see them; probably it's something +on the HP testdrive site. ckuus7.c, 17 May 2006. + +Fixed the tru64-51b+openssl target -- the terminating doublequote of KFLAGS +was missing -- and also the osf target, which failed to import the LIBS +definition from whatever other target invoked it. Now the SSL build goes OK +on Tru64 5.1B. Replaced x.tar.z in the download areas without declaring a +new Dev number. The new one has a makefile with today's date. Software +engineering at its best! makefile, 18 May 2006. + +Scott Kasten noted that the estimated-time-remaining calculation would go +bonkers on LFS systems when RESENDing a large file. It looks like the +shocps() and shoetl() functions escaped the CK_OFF_T conversion. I made +what seemed to be the right adjustments, and then was lucky enough to find a +computer that had enough free disk space for me to send a large file, +interrupt it several times, resend it, all seems to be OK. 28 May 2006. +Later Scott verified these changes independently for Linux, but the problems +in IRIX remain. + +Patches from Scott Kasten for large files on IRIX 6.5: ckcdeb.h, makefile, +12 Jun 2006. + +--- Dev.19 --- + +Added a new function for dealing with JPGs and GIFs: + +\fpicture(filename,&a) + returns 0 if file not recognized or can't be opened; + returns 1 if landscape, 2 if portrait or square. + If array given, element 1 is width, element 2 is height. + +ckuusr.h, ckuus4.c, 19 Jun 2006. + +Scott Kasten reports that the FTP client can transfer large files OK, at +least in Linux, but has trouble with recovery: + + . Kermit takes a very long time to start the transfer, sometimes over + 30 minutes. Suspect the ftp server is counting the bytes in a long file? + Or maybe it's a text-mode transfer and it's counting the lines? Probably + in response to Kermit's SIZE command. + + . The size shown in the FT display is wrong by a random amount. And of + course so are the progress bar, percent done, and time remaining. + + . The file, however, is transferred correctly. REGET works correctly too. + +I tried setting up a test scenario locally but our Solaris FTP server does +not support large files: + + FTP SENT [SIZE BIGFILE] + FTP RCVD [550 BIGFILE: not a plain file.] + FTP SENT [PASV] + FTP RCVD [227 Entering Passive Mode (128,59,48,24,246,37)] + FTP SENT [RETR BIGFILE] + FTP RCVD [550 BIGFILE: Value too large for defined data type.] + +Created the same 3GB on a Tru64 Unix system that allows FTP access. Made +the connection from C-Kermit on Solaris (32-bit with LFS): + + 16:46:12.908 FTP SENT [SIZE BIGFILE] + 16:46:12.947 FTP RCVD [213 3000000001] + +Note that it takes less than half a second to get the reply. Now I start +the download and then interrupt it at about 2%: + + 16:46:12.979 FTP SENT [TYPE I] + 16:46:13.174 FTP RCVD [200 Type set to I.] + 16:46:13.226 FTP SENT [PASV] + 16:46:13.262 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,37)] + 16:46:13.299 FTP SENT [RETR BIGFILE] + 16:46:13.337 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..] + 16:47:24.895 FTP RCVD [426 Transfer aborted. Data connection closed.] + 16:47:24.934 FTP RCVD [226 Abort successful] + 16:47:24.991 FTP SENT [MDTM BIGFILE] + 16:47:25.028 FTP RCVD [213 20060706204458] + +Now I do a REGET: + + 16:51:55.321 FTP SENT [PASV] + 16:51:55.357 FTP RCVD [227 Entering Passive Mode (15,170,178,171,11,43)] + 16:51:55.394 FTP SENT [REST 122736640] + 16:51:55.430 FTP RCVD [350 Restarting at 122736640. Send STORE or RETRIEVE..] + 16:51:55.431 FTP SENT [RETR BIGFILE] + 16:51:55.469 FTP RCVD [150 Opening BINARY mode data connection for BIGFILE..] + +This worked perfectly, as far as I can tell; the FT display picked up in the +right place; the thermometer, percent done, and estimated time remaining +were the same as when we left off last time. I did the same thing several +more times, everything was OK. It would have taken a really long time to +let this run to completion, but I think this demonstrates that Scott's +symptoms are server-dependent. No changes. 6 July 2006. + +Checked current code on VMS 8.2-1 on IA64 / UCX 5.5, builds fine. +No changes. Updated listing at HP. 6 July 2006. + +Checked FTP GET of large file in ASCII mode against Tru64 FTP server. It +was fine, and there was no delay in the server's response to our SIZE command +(as there would be if it were scanning the entire file to count how many +bytes would be required to send it in text mode). 7 Jul 2006. + +Tested FTP PUT big file against Tru64, OK. Ditto FTP RESEND big file: + + C-Kermit>resend BIGFILE + PUT BIGFILE (binary) (3000000001 bytes)---> PASV + 227 Entering Passive Mode (15,170,178,171,13,186) + ---> SIZE BIGFILE + 213 343211280 + ---> MDTM BIGFILE + 213 20060707141243 + ---> APPE BIGFILE + 150 Opening BINARY mode data connection for BIGFILE (128.59.59.56,45470). + +Made REPUT a synonym for RESEND. ckuusr.c, 7 Jul 2006. + +Added FTP REPUT and FTP RESEND since previously there was no FTP-prefixed +command for recovering uploads, only the regular RESEND command, which might +not have been obvious to people. ckcftp.c, 7 Jul 2006. + +Added help text for FTP RESEND and REPUT and amended RESEND help text. +ckcftp.c, ckuus2.c, 7 Jul 2006. + +Changed name of \fpicture() to \fpictureinfo() and added help text. By the +way, ImageMagick can do this too: identify -format "%w %h" dscf0520.jpg. +The advantage of having it in Kermit is that not everybody has ImageMagick. +ckuus[24].c, 7 Jul 2006. + +Changed the numeric comparisons = < > <= >= != to allow long integers by +changing the data type to CK_OFF_T, etc. ckuus6.c, 7 Jul 2006. + +Noticed that \fkeywordvalue(foo=this is a string) only kept the first word. +Fixed it to keep the whole definition. Also added \fkwvalue() as a briefer +synomym. ckuus4.c, 7 Jul 2006 + +Sometimes we want to check if a file's status before we've FOPEN'd it, in +which case the channel variable is likely to be empty and \f_status(\%c) +would get an error. Making the obvious change didn't fix this, however. It +turns out that the function evaluator failed to adjust argn (argument count) +when trailing arguments were empty, and argn was being used in this case, +and probably others, to test whether an argument existed. I added code to +adjust argn to reflect the number of aruments up to and including the +rightmost non-empty one. ckuus4.c, 7 Jul 2006. + +Fixed \fstripb() to not dump core if second argument is missing. +ckuus4.c, 7 Jul 2006. + +Discovered that it was not obvious what pattern to use to match strings +enclosed in square brackets. "if match [abc] \[*\]" didn't work. Neither +did various other tricks like NCRs for the brackets. However, "if match +[abc] \\[*\\]" does work. Trying to fix this would no doubt break 100 other +things, so let's call it a feature. 7 Jul 2006. + +Added \fgetpidinfo(n) to return info about a process ID; for now it simply +returns 1 if the process is alive and 0 if not (or -1 if the argument is +bad or missing or on any kind of error). ckuusr.h, ckuus[24].c, 7 Jul 2006. + +The "where-did-my-file-go" message seemed to be ending with a LF rather +than CRLF, probably because the terminal modes had not yet been restored, +leaving the next prompt hanging below it, rather than on the left margin, +if C-Kermit exited immediately after the transfer. Fixed by changing +all \n's to \r\n's in wheremsg(): ckcpro.w, 8 Jul 2006. + +Added \v(lastkwval) so we can retrieve programmatically the keyword most +recently processed by \fkeywordval(). ckuusr.h, ckuus4.c, 9 Jul 2006. + +--- Dev.20 --- + +Added #ifdef SV68, #include , #endif because Unix System V/68 on +Motorola choked on the SEEK_CUR reference without it. ckuus4.c, 10 Jul 2006. + +Make \fkeywordval(xxx) undefine xxx (i.e. when a keyword is given with no +value). This way command-line keywords will always override preexisting +default definitions, whether they have a value or not, which makes it easier +to parse command lines like "foo=bar blah xx=yy". ckuus[24].c, 12 Jul 2006. + +On 29 Nov 2005 I changed IF KERBANG to solve a problem (see entry for that +date), but introduced a new one; namely that you can't have (e.g.) a FATAL +macro that uses IF KERBANG to decide whether to EXIT all the way or STOP +back to the prompt. Changed it again, this time to require not that the +command level be 1, but that the command *file* level be 0 (i.e. that we are +in the top-level command file, irrespective of the command or macro level, +but not in a subfile). ckuus6.c, 12 Jul 2006. + +It is unhelpful when Kermit gets a syntax error in the middle of a big +compound statement block (e.g. FOR or WHILE loop) and dumps out the whole +thing in an error message. I changed the two places where this can happen +to call a new routine that, instead of dumping out the entire cmdbuf, +checks its length first and if it's more than a line long, truncates it +and adds an ellipsis. ckuus6.c, 12 Jul 2006. + +The new RENAME command didn't give very good error messages, e.g. if the +filespec didn't match any files. Fixed in dorenam(): ckuus6.c, 12 Jul 2006. + +Fixed DIR /TOP to work if the /TOP:n argument was omitted, defaulting +to 10. domydir(): ckuus6.c, 12 Jul 2006. + +Added DIR /COUNT:v to count the number of files that match the given +criteria and store result in the variable v. ckuusr.h, ckuus[r26].c, +24 Aug 2006. + +Added HDIRECTORY as an invisible synonym for DIR /SORT:SIZE /REVERSE. +Can be used with other switches, of course, so (e.g.) HD /TOP shows the +ten biggest files. ckuusr.h, ckuus[r26].c, 24 Aug 2006. + +DIR /FOLLOWLINKS and /NOFOLLOWLINKS always did the same thing; the switch +was ignored, a symlink is always followed. Fixed in ckuus6.c, 24 Aug 2006. + +Added DIR /NOLINKS, which means don't show or count symlinks at all. +ckuusr.h, ckuus[r26].c, 24 Aug 2006. + +Build on Solaris 9 and NetBSD 3.0, 24 Aug 2006. + +Added a missing definition for LOCK_DIR in the Linux HAVE_BAUDBOY case, +suggested by Gerry Belanger. ckutio.c, 6 Oct 2006. + +Suggested by Jim Crapuchettes: \v(dialmessage) is the text string +corresponding to \v(dialstatus). ckuusr.h, ckuus4.c, 6 Oct 2006. + +Soewono Effendi sent code for exit sequence to leave DTR on; this amounted +to unsetting HPUCL in c_cflag. I did it a simpler way, hopefully portable +to all Unixes, but who knows at this late date. The code is inside +#ifndef CK_NOHUPCL..#endif in case it causes trouble. It is executed if +SET EXIT HANGUP is OFF and a serial port was open at the time Kermit exits +(or closes it explicitly). ttclos(): ckutio.c, 6 Oct 2006. + +Built on Solaris9/Sparc; FreeBSD 6.2/AMD64; NetBSD 3.0/i386; HP-UX 11i v2; +SCO OSR6.00. + +--- Dev.21 --- + +Added netbsd+openssl target to makefile. Built OK (NetBSD 3.0, OpenSSL +0.9.7d) except with some warnings in ck_crp.c. Connects and logs in OK to a +secure site. 10 Oct 2006. + +Added a debug statement to ftp_hookup() to record the TCP port that was used. +ckcftp.c, 11 Oct 2006. + +Built with OpenSSL 0.9.7l on Solaris 9. Built with OpenSSL 0.9.8d on +Solaris 9; connects and logs in to a secure site. 11 Oct 2006. + +The new RENAME command didn't work if both the source and destination names +included directory segments, e.g. "rename /tmp/foo ~/bar" (see notes of +4 May 2006). This was fixed in renameone() by a special case in which +the second argument is given but it is a filename, not a directory name. +ckuus6.c, 11 Oct 2006. + +Fixed unguarded reference to dialmsg[] for \fdialmessage(), noticed by +Gerry Belanger. ckuus4.c, 12 Oct 2006. + +Added a TOUCH command that does what UNIX touch does: creates the file if it +does not exist, updates the timestamp if it does. If a wildcard is given, +it operates only on existing files. It shares the DIRECTORY command parser, +so all the same file selection switches can be given. ckuusr.[ch], +ckuus[26].c, 12 Oct 2006. + +PeterE noticed that if you FOPEN a file, do some seeks or reads, then FCLOSE +it, then FOPEN it again (or open a different one), some of the old +information is still there (e.g. current line number). This is an artifact +of the changes of May 4th. Now the file closing and opening routines are a +bit more careful about scrubbing and initializing the file info struct. +ckuus7.c, 12 Oct 2006. + +--- Dev.22 --- + +Built OK on Red Hat Linux AS4 with both "make linux" and "make linuxnc". +15 Oct 2006. + +DIRECTORY /BRIEF ignored file selection switches and always listed all +files. This was because of how I cleverly called filhelp() (the routine +that lists matching files when ? is typed in a filename field) and, of +course, filhelp() doesn't know anything about the DIRECTORY command's file +selections. Changed filhelp() to accept all the args needed for passing +along to fileselect(), renamed it to xfilhelp(), and made a filhelp() stub +that chains to xfilhelp() with null selections. ckcker.h, ckucmd.[ch], +ckuus6.c, 29 Nov 2006. + +SHOW CONNECTION for an SSH connection said the connection type was "NET" +rather than "SSH". Fixed in dolognet(): ckuus3.c, 29 Nov 2006. + +SHOW CONNECTION didn't show the TCP port number. This command works by +parsing the current connection log entry string, which doesn't have a field +for this, but which sometimes shows the port number as part of the hostname +(but more often not). Added code to dolognet() to log the TCP port number, +if known. This involved adding a gettcpport() function to ckcnet.c. +ckcnet.[ch], ckuus3.c, 29 Nov 2006. + +This was impossible: def \%1 upper, echo \f\%1(abc) -- i.e. to "compose" a +function name. Fixed in zzstring(). But note that it's still not possible +to do this: def \%1 \fupper, echo \%1(abc) -- because at the point where +"\fupper" is encountered, which is automatically fed to fneval(), the +argument list hasn't been read yet. ckuus4.c, 29 Nov 2006. + +The meaningless Lisp command (=) would cause Kermit to hang. Due to some +idiosyncracy in the parser, it would see this as ((=) and would go into +"wait for the closing paren" mode. There was already a hack in the code to +compensate for this, but it didn't work. I fixed the hack but I don't +understand the real problem. Anyway, comparing Kermit with real (Franz) +Lisp I discovered that comparison operators do not require two arguments, as +Kermit has been doing, although they do require at least one. I changed +Kermit to not require two, so now all the comparison predicates behave +exactly like Franz Lisp, including getting an error if there are no args). +ckuus[r3].c, 29 Nov 2006. + +From to-do list: Make a way to inhibit pattern matching in SWITCH labels. +It's already there; just quote the wildcard characters; the only trick is +that for some reason (such as that SWITCH is really an internally defined +macro), a double quote is needed: + + switch \%1 { + :a\\*z, echo literally "a*z", break + :abcxyz, echo literally "abcxyz", break + :a*z, echo a...z, break + :default, echo NO MATCH + } + +In first case, the asterisk is taken literally; in the third it's a +metacharacter and the label matches any string that starts with 'a' and +ends with 'z'. + +Array initializion would quit early if any initializers were undefined, +e.g. "decl \&a[] = \%a \%b \%c" would stop at the first element if \%b +was not defined, even though \%c might be defined. Fixed in dodcl(): +ckuusr.c, 30 Nov 2006. + +DIR /ARRAY:a filespec, when the filespec does not match any files, +terminates with the array undeclared. It would be better to return a +declared but empty array (\&a[0] = 0). The code is already there to do +that, but isn't working. And yet "declare \&a[0]" does indeed create a +0-element array ("show array" shows a dimension of 0). Turns out there were +two problems; one was the careless recycling of a local variable ("array"), +resulting in failure to create \&a[] (but not any other array). Fixed in +domydir(): ckuus6.c, 30 Nov 2006. + +The other problem was that dclarray(), when called with an array name and a +dimension of zero, does two different things depending on whether the array +already existed. There is still a fair amount of confusion about whether a +dimension of 0 indicates an array with 1 element (as it should) or a +nonexistent array. We call dclarray() with a size of 0 to undeclare an +array but we also need to able able to declare an array with only element 0. +I changed dclarray() to treat a negative dimension as a command to destroy +the array, and 0 or positive as a command to create the array with the given +dimension. ckuus[r56].c, 30 Nov 2006. + +Next problem: when chkarray() returns 0, this should not be interpreted to +mean the array does not exist. Looks like the only place this happened was +in \fcontents(); fixed in ckuus4.c, 30 Nov 2006. + +If we include file selectors with DIR /ARRAY:&a and some of the files that +match the given filespec but don't fit the selectors, the array's dimension +is bigger than its number of elements. Added code at the end of domydir() +to resize the array so \fdim() returns the number of filenames in the array, +and also made sure that element 0 contains that number too. ckuus6.c, +30 Nov 2006. + +This would be a nice elegant way to loop over a bunch of files, if it worked: + + for \%i 1 \ffiles(*) 1 { rename \fnextfile() xxx_\flpad(\%i,3,0) } + +But in this loop, Kermit skips every other file (beginning with the first) +and then runs out of files halfway through the loop. Why? Because in +commands like RENAME and DELETE, the filename parser is in a chained FDB +with the switch parser. First the switch parser, cmswi(), gets its hands on +\fnextfile(), passing it through the evaluator and thus getting the first +filename, which it then sees is not a switch, so now the field is parsed by +the next parser in the chain, cmifi(), which causes \fnextfile() to be +executed again. In fact, the FOR loop has nothing to do with; the same +thing happens like this: + + void \ffiles(*) + delete \fnextfile() + +This deletes not the first file, but the second one. Obviously users can be +told not to refer to \fnextfile() in chained-fdb fields: + + for \%i 1 \ffiles(*) 1 { .f := \fnextfile(), delete \m(f) } + +but this is hardly intuitive. I had some clever ideas of how to make +\fnextfile() work as expected in this context but it's way too much magic. +Better to simply document that \fnextfile() is "deprecated" and the array +format should be used: + + for \%i 1 \ffiles(*,&a) 1 { delete \&a[\%i] } + +The difference is, an array element doesn't change every time it's referred to! + +Added a /PRESERVE switch to the COPY command to preserve the timestamp and +permissions of the file. I did this using the Kermit APIs so it should work +for any version of C-Kermit or K95. ckuus[26].c, 30 Nov 2006. + +Added COPY /OVERWRITE:{ALWAYS,NEVER,OLDER,NEWER} to control name collisions +when copying across directories. ckuus[26].c, 1 Dec 2006. + +--- Dev.23 --- + +Fixed a bug in SET TELNET PROMPT-FOR-USERID, SET AUTH KERBEROS[45] PROMPT, +and SET AUTH SRP PROMPT in which the user's string was compared with a +literal (s == ""), reported by Pavol Rusnak. Worse, empty strings (if the +test succeeded) were turned into null pointers, and then fed to strlen(). +Fixed in ckuus3.c, 5 Dec 2006. + +Added an optional 4th argument to \findex(), \frindex(), \fsearch(), and +\frsearch(): the desired occurrence number of the searched-for string. +\frsearch() was a bit tricky. ckuus[24].c, 7 Dec 2006. + +Added \fcount(s1,s2) to tell the number of occurrences of s1 in s2. +ckuus[24].c, 8 Dec 2006. + +Added \ffunction(s1) to tell if a given built-in function is available. +ckuus[24].c, 8 Dec 2006. + +Changed RENAME /COLLISION:PROCEED to be /COLLISION:SKIP, which is clearer. +ckuus[26].c, 8 Dec 2006. + +For communication protocols: INPUT /COUNT:n to read exactly n characters +without any matching. Can be used, for example, with CONTENT_LENGTH in CGI +scripts; NUL characters are counted but not collected. ckuusr.[ch], +ckuus4.c, 8 Dec 2006. + +There was a bad bug in the date-parsing routines; it's been there for years. +If a date string includes a timezone, e.g. "Sat, 9 Dec 2006 19:26:23 EST", +and converting to GMT changes the date, the variables for day, month, and +year (which are used later) were not updated, and the final result was a day +off. Fixed in cmcvtdate(): ckucmd.c, 10 Dec 2006. + +Built OK with SSL/TLS. Tested with the POP script, found that I broke INPUT +when adding the /COUNT feature; there was a path through the code that could +leave the "anychar" variable unset and therefore random. Fixed in +doinput(). The POP script, which does not use /COUNT, works again and so +does a new CGI script, which does use /COUNT. ckuus4.c, 10 Dec 2006. + +Supplied a missing comma in the help-text array for HELP SET TERMINAL, which +resulted in bad formatting in K95 around SET SNI-FIRMWARE-VERSIONS. +ckuus2.c, 10 Dec 2006. + +Made "help locus" a synonym for "help set locus". ckuusr.[ch], ckuus2.c, +11 Dec 2006. + +This morning the Columbia FTP server was malfunctioning in a perfect way +for me to implement and test an FTP timeout mechanism. The server would +close the data connection after sending the file, but the client never saw +the close and was stuck forever in a recv(). I added code to do a select() +on the data connection prior to entering the recv(), with a timeout on the +select() that the user can establish with SET FTP TIMEOUT. Built and tested +on Solaris 9, clear-text FTP. Also built cleanly for FTPS and tested +against a server that does not hang; I don't have access to an FTPS server +that would tickle the timeout code. ckcftp.c, 11 Dec 2006. + +--- Dev.24 --- + +Fixed a bug in the INPUT /COUNT: parser: the array of search strings was +never initialized, which didn't matter before, but with /COUNT:, if the +first element was not a NULL pointer, we'd treat it as a search string, and +then if it happened to match something in the input stream, the operation +would stop before the count was exhausted. Fixed by (a) initializing the +array, and (b) ignoring any search strings if /COUNT: was given. ckuusr.c, +13 Dec 2006. + +Removed a debug() statement from zsattr() that suddenly started making some +version of gcc complain, reported by Gerry Belanger. ckufio.c, 13 Dec 2006. + +--- Dev.25 --- + +Some casts for the 3 interior args of the new select() call in ckcftp.c +for HP-UX 9. 14 Dec 2006. + +Changed \fkeywordvalue() to accept a string rather than a single word +as its second argument, so that more than one separator could be specified, +and to return -1 on error, 0 if it found nothing, 1 if given a kewyord but +no value, and 2 if there was a keyword and a value. dokwval(): ckuus[24].c, +14 Dec 2006. + +Checked FTP timeout on command channel with FTP DIRECTORY of a big directory +using a path into our ftp server that preserves the hanging behavior. The +timeout was actually working, but the failure condition wasn't propogating +back to the user, and there was no error message. Fixed in doftprecv2() and +failftprecv2(): ckcftp.c, 15 Dec 2006. + +Added the obvious timeout checks for FTP uploads, but I have no way to test +the code since our misbehaving FTP server does not hang when receiving +files, only when sending them. But uploads work both with and without a +timeout set, so at least no harm is done. ckcftp.c, 17 Dec 2006. + +When downloading with FILE DESTINATION NOWHERE (= /CALIBRATE), Kermit still +checked the size of the incoming file and refused it if there wasn't enough +free disk space, on platforms (such as VMS) where zchkspa()) actually works; +reported by Bob Gezelter. ckcfn3.c, 18 Dec 2006. + +Built on Mac OS X 10.4.8 and NetBSD 3.1_RC3, all OK. 19 Dec 2006. + +--- Dev.26 --- + +Built on VMS 7.3-2/Alpha. Had to squelch a couple compiler warnings by +changing some ints in the new \fpictureinfo() code from unsigned to signed, +and fix a typo in the prototype for the new gettcpport() function. +ckcnet.h, ckuus4.c, 22 Dec 2006. + +--- Dev.27 --- + +Parameterized pty routines and all references to them for file descriptor, +rather than to use global ttyfd, thus allowing ptys to be created for +different purposes. Tested on Solaris 9 and Mac OS X 10.4.8, with "set host +/connect /pty emacs" (fine in both cases), and (more to the point) "set host +/connect /pty kermit" -- here we make a connection from one Kermit process +to another and transfer a file; works fine and wasn't especially slow either; +a good sign. ckcdeb.h, ckutio.c, ckupty.c, 22 Dec 2006. + +Created a new version of ttruncmd() called ttyptycmd(), which works by +calling do_pty() to get a pty to run the command on, and then in a loop, +reads from the pty and writes to the net and reads from the net and writes +to the pty, using select() to which of those it should do on each pass. +First cut just uses single-byte reads and writes. Tested using Kermit +itself as an external protocol. Works but slowly: 6000cps. Zmodem doesn't +work at all. ckutio.c, 24 Dec 2006. + +Changed single-character read() and write() to buffered reads and writes, +with ttxin() and ttol() used for network i/o. Using Kermit as the external +protocol, this gives 450Kcps (about 1/3 normal on this connection). + +But now there's a problem: the loop doesn't know when to stop. How does it +know when the process that is running on the pty has exited? With single +character read()'s that are executed unconditionally when select() says the +pty has data waiting, as in the first pass, I get EIO if there actually +isn't any, and can exit the loop. But now, to avoid blocking, I call +in_chk() to see how much data is waiting, and I don't try to read anything +if it says nothing is waiting. If the process associated with the pty file +descriptor has terminated, in_chk() would presumably get some kind of error, +but it doesn't. I changed do_pty to return the pid of the fork where it +execs its command so we can check the pid with kill(pid,0) when in_chk() of +the pty says 0, but this doesn't help either; it seems like the process is +not exiting, but of course it is. + +I could not find any legitimate way to test when the pty fork terminated. +Select() always says the pty file descriptor was ready, no matter what. +Select() never reports an exception on the pty file descriptor; +in_chk(ptyfd) returns 0 and not an error. read(ptyfd,...) gets 0 but not an +error. fcntl(ptyfd,...) doesn't get an error. Finally I tried +write(ptyfd,c,0) and this indeed gets EIO (i/o error). With this, using +Kermit as the external protocol works fine in Solaris but I tend to think +this trick will not be very portable (it isn't). 24 Dec 2006. + +Made ttptycmd() use a more intelligent buffering scheme, fixed a few things +about how I was setting up the select() call that should address some of +yesterday's problems. Still doesn't work but it's progress. A: 25 Dec 2006. + +Debugging yesterday's code... Still, the error conditions are never set, +we never detect when the pty closes. In Solaris, if select() says ptyfd is +ready to read but in_chk() says there are no characters there, we can treat +this as a loop-exit condition. But in NetBSD, in_chk() always says 0 when +used on a pty (but works OK on a serial or net connection). + +Realized I could not use in_chk() on the pty because there is too much +baggage with the communication path -- myread(), etc etc) -- so I replaced +this with a simple ioctl(ptyfd,FIONREAD,&n). This works fine in Solaris but +always returns 0 in NetBSD, despite what the man page says (i.e. that this +function can be used on any file descriptor). + +OK, let's see.... select() does not return useful results. It says +characters are waiting on ptyfd when they are not, and it never detects the +closure of the pty..... Well of course not, because we are the ones who +have to close it. Just because the process has stopped doesn't mean the pty +is closed. So we're back to square one, how do we know when to close it? +ckupty.c seems to keep the process ID in a global variable, pty_fork_pid +(which is not the same as the pid now returned by do_pty(), which is +useless, but I don't understand why). But it doesn't matter because when we +kill(pty_fork_pid,0), we still get no error of any kind, even after we know +the process has exited. I am completely flummoxed. select() lies, and even +if it didn't, there is simply no completion criterion. In the loop, +select() always says that the pty is ready to read. To be continued. +26 Dec 2006. + +Back to Square One, single-byte reads and writes. + + . This works for both ripple and Kermit. + . Doesn't work for Zmodem but we'll deal with that later. + . In this case FD_ISSET(ptyfd) is still true after pty closes. + +But the ensuing read() gets EIO so we know the pty is gone. That means the +same thing should happen in the buffered version, no? Yes; I went back to +the buffered version and replaced all the other nonworking tests by a +blocking read of 1 byte on the pty and this detects the termination. Now: + + . ripple works perfectly (of course it's only one-way). + . Kermit fails + +Let's call the remote, forked, redirected, external Kermit A and its +local partner B. A sends its S-packet, B receives it OK and Acks. +A apparently does not receive the ACK in time, so sends the S again, but OK. +followed immediately by the F. B Acks the F. A sends the A, B Acks it. +But now A sends a piece of the previous F packet and the the first piece +of a D packet. + +Clearly the buffering is messed up. Sure enough, there was an extraneous +statement incrementing a read pointer in a write section. Removing that +cleared up the problems with Kermit, now we can send and receive substantial +files efficiently in remote mode. Zmodem seems to work too, except that at +the beginning a bunch of "**B0800000000022d"'s are stuffed into Kermit's +command buffer, so after the transfer we get some error messages. + +In local mode, over a Telnet connection, Kermit works fine. Zmodem works +OK too except it doesn't finish right, so at the very end rz on the far end +is still waiting for something; if I cancel out of it with ^X^X^X^X^X, it +deletes the file. So there still is something wrong with the termination +test. + +Also you don't see anything on your screen when running Kermit or Zmodem +this way. That's to be expected, since they are using stdio for the +transfer, so they can't also be displaying progress or other messages. + +Built this on NetBSD again... Seems to work this time, but has trouble +finishing, like Zmodem. Hmmm, on closer examination, it turns out that +since in_chk() always returns 0 on the ptyfd, we fall into our new +single-byte read code, so it's really slow, like 10K cps on a connection +where 1M is the norm. 27 Dec 2006. + +Switched the pty from buffer peeking (FIONREAD) and blocking reads to to +nonblocking reads (O_NONBLOCK / O_NDELAY). Works just fine on NetBSD except +now we no longer get EIO at the end when trying to read from the pty process +that has exited. In fact, we're back to square one again. not ioctl(), not +fcntl(), not select(), not even read() gets an i/o error after the pty +process exits. But in NetBSD, we have to use nonblocking reads because ... +Hmmmm, maybe switch the fd between blocking and nonblocking for the test... +Nope, NetBSD seems to be hopeless (later, Ed Ravin confirmed that similar +problems have been observed with other applications that try to do this). + +Switching to Linux, I see that yesterday's Solaris code (blocking reads) +works exactly the same way on Linux. + +Tried today's O_NDELAY method on Solaris. It works perfectly. And then I +moved this one to Linux and it works perfectly there too. Except in both +cases we have the wierd thing with Zmodem at the end, but I think that's +because rz/sz don't use standard i/o. On NetBSD, it still hangs at the end. + +Turns out that testing the pid works in NetBSD, even though it didn't in +Solaris. Turns out read() gets an i/o error in Solaris and Linux but not +in NetBSD. So checking the read result first, and then checking the pid +if read() got zero bytes catches all three. 28 Dec 2006. + +Now the question of return code. In the original ttruncmd() function, we do +a fork() and a wait(). When the external protocol program finishes, wait() +gives us its return code and we can pass it on through \v(pexitstat) as well +ttruncmd's own return code. But ttptycmd() has to interact with the pty +continuously, so it can't just sit back and wait() for it. Instead we have +to detect when the process has exited and then call waitpid() on the fork +pid, before shutting down the pty. Tested on Solaris using Kermit as the +external protocol and then inducing failure, or letting it run to +completion. FAILURE and SUCCESS set appropriately in each case. Tested +with Zmodem too, works OK except for the aforementioned cosmetic glitch at +the end. Tested on NetBSD, all OK. + +To make K5 connection to Panix from Spam: + + set telnet debug on + authenticate K5 init /realm:PANIX.COM /password:xxxxx + set host shell.panix.com 23 /k5login + +Good... Now I try to send a file from Spam to Panix over the K5 connection +using Kermit itself as the external protocol. It fails. Inspection of the +debug log on the far side shows that the S-Packet was received correctly, +good! This means we are reading the clear-text S-Packet from the external +Kermit program, and that ttol() is encrypting appropriately. + +The remote Kermit sends the Ack and goes to read the next packet: ttinl() +calls myfillbuf() and: + + SVORPOSIX myfillbuf calling read() + SVORPOSIX myfillbuf=0 <-- read returns 0 + SVORPOSIX myfillbuf ttcarr=2 + SVORPOSIX myfillbuf errno=0 <-- and reports no error + HEXDUMP: mygetbuf read (-3 bytes) + mygetbuf errno=0 + ttinl myread failure, n=-3 + ttinl myread errno=0 + ttinl non-EINTR -3[closing] + +This happens because myfillbuf() deliberately returns -3 when read() gets 0 +bytes. I don't understand why this happens but the real problem is yet to +come. The local Kermit (the one that has made the secure connection and is +running the external protocol through ttptycmd()) eventually figures out +that the transfer failed and when we reconnect, we get total garbage -- the +encryption either stopped happening, or got out of sync. + +Looking at the local debug log, ttol() is doing its job, converting the +initial "kermit -r\13" from plaintext to cyphertext, as shown by the +hexdumps. Then it enters ttptycmd()... Hmmmm, wait, how can it send the +"kermit -r" before it starts the external protocol? Never mind, worry about +that later... Anyway, ttptycmd() says: + + ttptycmd loop top have_pty=1 + ttptycmd loop top have_net=1 + ttptycmd FD_SET ptyfd in + ttptycmd FD_SET ttyfd in + ttptycmd nfds=5 + ttptycmd select=1 + ttptycmd FD_ISSET ttyfd in + ... + ttptycmd in_chk(ttyfd) n=11 + ttptycmd ttxin n=11 + +ttxin() asks for 11 bytes, myfillbuf() gets 11 bytes, and hexdump() shows +the cyphertext, there doesn't seem to be any decrypting going on. Hmmm, it +looks like the regular code calls ttinc() in a loop, rather than ttxin(). +Maybe ttxin() doesn't have decryption hooks. No, that's not it, the code is +there, but the Kermit packet reader does not use ttxin(), it uses ttinl(). +But of course we can't use that for external protocols because it's designed +only to read Kermit packets. Substituting a loop of ttinc()s for the ttxin() +call fixes things (and stangely enough, it seems to be faster). And now we +have our first external protocol transfer over a secure connection (external +Kermit program, Linux over Kerberos 5 to NetBSD). Zmodem worked too for a +short file but "something happens" with longer ones. 29 Dec 2006. + +New makefile target for Linux with Kerberos 5, linux+krb5, that doesn't +include anything extra from SSL or other security methods (but apparently it +is still necessary to include -DOPENSSL_097 in order to get the right names +for the DES routines?). Ditto netbsd+krb5 for NetBSD, except in this case +-DOPENSSL_097 is not necessary. makefile, 30 Dec 2006. + +Note to myself: On Panix: + + export LD_LIBRARY_PATH=/usr/local/kerblib + make netbsd+krb5 "K5LIB=-L/usr/local/kerblib" "K5INC=-I/usr/local/include" + +Can't telnet-k5 from newly built Kermit on NetBSD; partway through the +negotiations, just after "TELNET RCVD SB ENCRYPTION SUPPORT DES_CFB64 +DES_OFB64 IAC SE" it dumps core. The last two lines in debug.log after +this are: + + tn_sb[len]=5 + encrypt_support[cnt]=2 + +Rebuilding with -DOPENSSL_097 doesn't change anything. Ed Ravin said they +have two different Kerberos installations, Heimdahl and MIT; maybe some +mixup between the two explains the problem (Jeff concurs). The core dump +occurs in ck_crp: encrypt_support(): + + debug(F100,"XXX ep not NULL","",0); + type = ep->start ? (*ep->start)(DIR_ENCRYPT, 0) : 0; <-- Here + debug(F101,"XXX new type","",type); + +Anyway, I can log in with Kerberos 5 to Panix OK from Columbia (sesame) +using 8.0.201. So let's try to resurrect the Solaris version with everything: + + solaris9g+krb5+krb4+openssl+shadow+pam+zlib + +I hunted around to find where the current library and header file +directories were... Last time I tried this (March 2006) it bombed, not +finding libdes. Instead we have /opt/kerberos5125/lib/libdes425.a. Made a +new cu-specific target that includes this; now we get farther; it blows up +in ckcftp.c with tons of errors and warnings, which we can worry about +later. Building again with -DNOFTP, it gets to ckuath.c (the first security +module) and: + + ckuath.c:151:18: error: krb5.h: No such file or directory + ckuath.c:152:21: error: profile.h: No such file or directory + ckuath.c:153:21: error: com_err.h: No such file or directory + ckuath.c:176:28: error: kerberosIV/krb.h: No such file or directory + In file included from /opt/openssl-0.9.8d/include/openssl/des.h:101, + from ckuath.c:219: + +Found krb5.h in /opt/kerberos5125/include/krb5.h, added a -I for this +directory ... Now we get lots of warnings in ckuath.c, but it completes OK, +then we wind up bombing out in ck_crp.c; I don't know why -- there are all +the same warnings (related to argument passing to DES functions), but no +errors. I have no clue. + +Tried to resurrect the solaris2x+krb4 target; this required changing -lkrb +to -lkrb4 and -ldes to -ldes425. Lots of warnings in ckutio.c, ckcnet.c, +ckctel.c, then it bombs out in ckcftp.c because it can't find krb.h. I +found it, adjusted the -I flags, but now it bombs because krb.h itself +#includes , which of course it can't find because the +brackets mean it's looking in /usr/include/kerberosIV/, which, of course, +the sys folks have removed. Giving up on Solaris again. Later, Jeff said +"Solaris does not publicly export the krb5 libraries. You need to build +the MIT Kerberos libraries separately and link to them." 30 December 2006. + +Changed copyright date to 2007. ckcmai.c, 1 Jan 2007. + +With Ed Ravin's help, successfully built C-Kermit with Kerberos 5 and +OpenSSL (netbsd+krb5+openssl+zlib), but it does not make K5 connections; it +gets hung up in the Telnet negotiations. 3 Jan 2007. + +Downloaded MIT Kerberos 5 v1.4.4 to Solaris 9, 54MB worth. This is just so +I can build a Kerberized C-Kermit for testing ttyptycmd(). Ran the +configure program, got a few warnings but it didn't fail (should it?) Did +"make install", specifying a private directory but it failed immediately +with "cannot stat libkrb5support.so.0.0: No such file or directory". +OK, I tried. 3 Jan 2007. + +Made a new makefile target for Mac OS X, macosx10.4+krb5+ssl, ran it on Mac +OS X 10.4.8. It bombs out in ckcftp.c with: ckcftp.c:551: error: static +declaration of 'gss_mech_krb5' follows non-static declaration +/usr/include/gssapi/gssapi_krb5.h:76: error: previous declaration of +'gss_mech_krb5' was here". Ditto for gss_mech_krb5_old, gss_nt_krb5_name, +and gss_nt_krb5_principal. Tried again with -DNOFTP. We get lots of +warnings in the network modules, but they complete. But ck_ssl.c bombed +with a conflict between its own declarations of encrypt_output and +decrypt_input and the ones in ckuat2.h; removed the prototypes from the +latter (as Jeff advised) it built OK and it works OK too. Built with FTP +too, but with link-time warnings about the aformentioned gss_* symbols. +#ifdef'd them out (gss_mech_krb5, gss_mech_krb5_old, gss_mech_name, and +gss_mech_principal) for MACOSX, where these symbols are exported by the +library. Now it all compiles and links OK, and runs OK too. 3 Jan 2007. + +Spent a day hunting around for a version of Zmodem that would build and +execute on Mac OS X, finally found one. Now at last I could try a Zmodem +external-protocol transfer over a secure connection. But phooey, C-Kermit's +pty support didn't work on this box. Kermit finds master /dev/ptypa OK, +then in ptyint_void_association() tries to open /dev/tty but gets ERRNO=6 +"device not configured" (which is apparently OK, because the same thing +happens on other platforms where this works), then tries to open slave +/dev/ttypa and gets ERRNO=13 "permission denied" because, indeed, I don't +have r/w permission on the device. Left a message. 4 Jan 2007. + +Changed TRANSMIT /BINARY output buffer size from 252 to 508 to avoid +TCP fragmentation. Need to add a SET command for this later. +ckuus4.c, 5 Jan 2007. + +Found another Mac where the ptys weren't protected against me, make a K5 +connection and transferred a largish file with Zmodem with zero glitches, +except it was kind of slow, 84K cps. Well, we're doing single-character +reads on the net (ttinc()'s instead of ttxin()). Hmmm, but then I did it +again and got 2.2Mcps. Success was reported, but it actually didn't work; +it only sent the first quarter of the file.... Oh well, at least now we +have a testbed. 5 Jan 2007. + +Tried again, saw that the file is actually transferred instantly but then +we're not picking up the protocol at the end. Theory: after the transfer +finishes, we come back to the prompt on the remote host, which means we have +something to read from the net and write to the pty, but the pty has already +exited. AFTER THE PTY IS GONE, WE DO NOT WANT TO READ FROM THE NET ANY +MORE. Adding this test makes Kermit succeed right away when sending the +same largish file, with a transfer rate of 4M cps, that's better. But the +rz program on the far end is evidently not receiving the goodbye handshake +from the receiver, because it sits there foreever in its *B09002402009418 +mode until I ^X^X^X^X^X out of it, at which point it deletes the file it +already received, not very helpful. In the code, I read from the pty if the +pty is open and there is room in the buffer. This means that when we get to +the end, either there is no room in the buffer (unlikely) or the last bit +sent by sz before exiting was cut off when the fork closed. Why do we get +in this fix only with Zmodem and not with Kermit? + +In Mac OS X, after sz exits, we get ERRNO=5 if we try to write to the pty, +but we still get no errors after that if we try to read from it. Still, +prior to this we did more than 20 unproductive nonblocking reads from the +pty (no error, no bytes) without incident; there did not seem to be anything +waiting. In fact, the last thing we read from the pty were the text +messages that are issued at the end of the transfer: "rz 3.73 1-30-03 +finished." After which it pauses a second and spits out a message about +UNREGISTERED COPY. + +Figured out how to build lrzsz, in hopes that the previous problems were +with rzsz and crzsz's fiddling with file descriptors, but I get the same +behavior. Which is good, I guess, because if I can fix one, I fix them all. +Or not... Testing lrz by itself (not under C-Kermit), I see that it doesn't +work at all with Kermit's own Zmodem implementation. + +OK, here's one problem: at the end of the transfer, the Omen Zmodems print +stuff like "Please read the license agreement", Kermit dutifully reads this +from the pty and sends it to the host, the host shell says "Please: command +not found", issues its prompt again, which Kermit reads, feeds to the pty, +and apparently the pty echoes it, so we send it back to the host, and there +ensues an infinite loop of getty babble until the pty closes. Now, there +ought to be a way to make the external protocol shut up, like Kermit's +-q(uiet) flag, but these are unregistered versions so you can't shut up the +messages. In fact, the transfer works, but the getty babble at the end +ruins the experience. Now I'm beginning to wonder how any of these programs +ever worked as external protocols. Hmmm, now that I try it, I see the +same thing happens the old way, when using ttruncmd() rather than ttptycmd(). + +Reading the crzsz documentation I see it says that messages come out on +stderr. OK, that's progress. In ckupty.c I try redirecting 2 to /dev/null. +Well good, this filters out the messages from csz, but we still get getty +babble on the prompt. In the debug log, we read the last bunch of stuff +from net, 618 bytes of Zmodem stuff... Now what happens? + +Zmodem on the remote exits, the host prints its prompt. Kermit, of course, +reads the prompt from the net, now come to the bottom of the loop and we +have 7 bytes to write to the pty, and no error condition, so we continue the +loop. select() says that the pty is ready for writing. We write the 7 +bytes and and get no error. Loop again, this time select() says the pty has +data waiting. Sure enough we get the prompt back, and send it to the net, +and thus begins the getty babble. There are two causes for this: + + 1. crzsz does not exit immediately; it sleeps for 10 seconds after + printing its nag message. + + 2. During this interval the pty seems to be echoing what is sent to it. + csz is not echoing; I checked. Anyway, removing the pause doesn't + seem to make a difference. + +ttptycmd() needs to: + + . TELL the pty module to redirect stderr to /dev/null + . SET PTY TO NOECHO (master or slave?) + +Tried setting the pty to noecho: + + termbuf.c_lflag &= ~(ECHO|ECHOE|ECHOK); + +and this seemed to stop the getty babble. After the file transfer, I read +back the prompt from the host shell, I write the prompt bytes to the pty; +there is no error. And now select() simply hangs forever (or times out if +a timeout is set). The question here is: why didn't writing to the pty +produce an error? And, because we never detect the pty has exited, we can't +set a good return code. 5 Jan 2007. + +Moved pty fork testing to a separate routine, pty_get_status(), and +added a call to it from the place where we time out, in case the fork +terminated; then we can get and return its status. 6 Jan 2007. + +Added calls to pty_get_status() to every place where we suspect a pty error, +tried again with lrzsz, crzsz, and regular rzsz. All three work, but in +each case waitpid() indicates that the sz program gave exit code 1 (failure). +ckutio.c, 7 Jan 2007. + +Changing the subject... On my test system, every time I execute ttptycmd(), +I get "permission denied" on /dev/ttyp3. Then I run it again and get to +ttyp4 which is OK. I wanted to skip past any pty for which I lack +permission and try the next without raising an error. Added debugging code: + + 16:25:23.524 pty_getpty() pty master open error[/dev/ptyp0]=5 + 16:25:23.524 pty_getpty() pty master open error[/dev/ptyp1]=5 + 16:25:23.524 pty_getpty() pty master open error[/dev/ptyp2]=5 + 16:25:23.524 pty_getpty() found pty master[/dev/ptyp3] + 16:25:23.524 pty_getpty() slavebuf [2][/dev/ttyp3] + +So it already was skipping past open errors; ttyp3 was opened successfully. +The problem is that ptyp3 is rw-rw-rw-, but the corresponding master, +ttyp3, is rw--r----. It seems the code assumes that if the master can be +opened, then so can the corresponding slave. Unfortunately, the code is +not structured to allow us to skip ahead to the next master if the slave +can't be opened. 7 Jan 2007. + +Spent a couple hours trying to rearrange the code in the pty module to skip +past inaccessible slaves but it was a rabbit hole, not worth it, backed off. +8 Jan 2008. + +Tried an upload over a secure connection using lsz. Unexpectedly, this time +it worked; not only was the file (about 0.5MB) transferred correctly, but +Kermit detected the fork's termination and got the pid's exit status, and, +for the first time, correctly reported a successful transfer. I have no +idea why this works today and not yesterday. More tests; it works most of +the time. It works with csz and with regular sz too. + +(days later...) + +ckucns.c seems to do the right thing; it recognize the ZSTART string, +activates the Zmodem-Receive APC, and returns. doconect() sees the APC and +begins to execute it. The RECEIVE command results in a call to the GET +command parser, doxget() (IS THAT RIGHT?), then comes a ttflui(), which +throws away a bunch of stuff. Finally we get to ttptycmd(), we get a pty +and run lrz in it, select() says stuff is waiting from the pty, but read +returns 0, errno 0. Skipping the ttflui() in doxget() if the protocol was +not Kermit didn't seem to make difference. ckuus6.c, 8 Jan 2007. + +The problem is that in this case, reads from the pty never get anything (no +data, no error), write always gets an error. It's as if the pty was not +being set up right, or we're using the wrong file descriptor. And if we +skip the autodownload? Same thing. + +OK, putting downloads aside for a moment, let's get uploads working as well +as possible. At this point we have the odd situation (at least in this +configuration) that the upload succeeds, but now for some reason we are +unable to read the exit status from the process, even though this was +working before, so ttptycmd() returns 0 (failure), yet Kermit reports +success. + +Well, it turns out that kill(pty_fork_pid,0) was gumming up the works. +If we use only waitpid() all is well, I think. waitpid() with WNOHANG +returns -1 with status -1 errno 0 if the pid has not exited, and it returns +the pid and status > -1 if the process has exited. Fixed pty_get_status() +to do it this way. ckutio.c, 7 Jan 2007. + +Let's move this from Mac OS to NetBSD and see how it works. Well, the file +transfer was just fine, but then I used some sexps to calculate the elapsed +time and transfer rate, and Kermit hung in dosexp(). Fine, ignoring that... +The debug log shows that ttptycmd() gets the pty OK, master and slave, the +i/o goes smoothly, and waitpid() does its job perfectly. Solaris, same +deal; ttruncmd() goes smoothly, but then the sexps afterward get "Arithmetic +exception". Turns out there was a BAD bug in dosexp() that allowed an +integer division by 0 to occur under certain circumstances; it's always been +there. Fixed in dosexp(): ckuus3.c, 8 Jan 2007. + +After noticing a few problems running the pop.ksc script in production over +the past year, rewrote \femailaddress() to be more reliable and a lot +simpler. ckuus4.c, 9 Jan 2007. + +Back to ttptycmd()... When we left off, we could send but not receive. Set +up a test case using Kermit as the external protocol for receiving a short +file. If I SET STREAMING OFF and use short packets, it actually does work, +so it's not a complete failure to function, but apparently a lack of flow +control for the pty. Began by completing the parameterization of the pty +module, so it can be called for interactive use (fc 0) or for running +protocols (1). Confirmed that everything works at least as well as before +(e.g. "set host /pty emacs" vs external protocols). ckcdeb.h, ckutio.c, +ckupty.c, 9 Jan 2007. + +Found in HP-UX "man 7 pty" a description of ioctl(fd,TIOCTTY,fc) which is +exactly what we want: fc 0 turns off all termio processing and guarantees an +ininterrupted, unmolested, flow-controlled stream of bytes in both +directions. This function also exists in Linux, but not in Solaris, NetBSD, +or Mac OS X (TIOCNOTTY is not what we want, it does something else entirely). + +Another possibility is TIOCREMOTE, which "causes input to the pseudoterminal +to be flow controlled and not input edited, regardless of the terminal +mode". This one exists in at least HPUX, NetBSD, Solaris, and Mac OS X. + +Solaris: builds OK, but at runtime we get ENOTTY ("Inappropriate ioctl for +device"). By the time this happens, it's hard to tell from the code whether +the fd we're using is for the master or the slave; TIOCREMOTE can be used +only on the master. Close inspection shows that I am indeed doing that; +ptyfd as seen by ttptycmd() is truly the master, i.e. the /dev/ptyXX device, +not the /dev/ttyXX device (the slave fd can't be seen at all, as it exists +only in a separate fork). OK, so now we know that TIOCREMOTE can't be used +on Solaris. + +NetBSD: Somehow, whether as a result of today's fiddling or the phase of the +moon, the code in pty_open_slave() that tries to open /dev/tty started +failing on NetBSD ("Device not configured"). Changing it to be run only if +fc == 0 (which doesn't seem to hurt anything), once again I get ENOTTY on +the TIOCREMOTE ioctl. Zmodem works but Kermit totally fails (the fork exits +immediately with an exit code of 0, even though it didn't do anything). + +Mac OS X: Exactly the same sequence and results as NetBSD. + +Linux: It did not execute the new ioctl at all; apparently the TIOC symbols +are hidden or not exported or something. + +Where we stand: + . Downloads don't work + . Uploads got slow again + . Kermit doesn't work at all as an external protocol + +Actually if I take the debugging out it goes fast, but it doesn't finish. + +All today's work on ttptycmd() looks like a dead end. To roll back to +yesterday: + + cp ckutio.c-20070108 ckutio.c + cp ckupty.c-20070108 ckupty.c + cp ckupty.h-20070108 ckupty.h + +or to continue with today's: + + cp ckutio.c-20070109 ckutio.c + cp ckupty.c-20070109 ckupty.c + cp ckupty.h-20070109 ckupty.h + +Comparing Monday's and Tuesday's pty-related code, the differences are: + 1. Passing of function code to and among pty modules. + 2. Skipping the TIOCSCTTY ioctl and the open("/dev/tty") test. + 3. Attempting to put pty in TIOCTTY or TIOCREMOTE mode. + +Commenting out 2 and 3 should put us back where we were on Monday if the +parameterization was done right. And with this, on Solaris, downloading +with Kermit external protocol works but slowly, 8K cps, with or without +debugging. Debug log does not show any obvious bottlenecks; select() takes +anywhere between no time at all and 0.1 seconds to return. If I increase +the pty-net buffer size from 1K to 4K, the rate goes up to 55K cps. If I +make it 8K I get 136K cps. With 16K I get 346K cps. 32K: 395K cps -- this +last one isn't worth the doubling. But at 24K I get 490K cps, sometimes +twice that. Let's stick with 24K for now. Downloading with Zmodem (rzsz) +works at the same rate, but now we're back to seeing the getty babble +(Several "**B0800000000022d") at the end. 10 Jan 2007. + +Moving to Mac OS X, everything works the same as on Solaris, except I don't +get the Zmodem getty babble there, not even with Omen rzsz. Tested sends +in both remote and local mode, the latter over a secure Kerberos 5 Telnet +connection, using C-Kermit, rzsz, lrzsz, and crzsz, all good. 10 Jan 2007. + +Now we're back where we were yesterday morning, but with better throughput. +The big issue then was receiving files. But yikes, now it works! Not only +that, I got a transfer rate of 2.1M cps. That's using Kermit protocol, +streaming, and big (4K) packets. Which didn't work before. Not a fluke +either, I uploaded bigger and bigger files up to 6MB, they all went +smoothly, at rates between 1 and 2 MBps. 10 Jan 2007. + +Not so great in Zmodem land, however. If I start the external-protocol +receiver on the far end, escape back and start a Zmodem send... nothing. +If I leave the remote C-Kermit at its prompt (where it supposed to recognize +the Zmodem start string), still nothing. On the other hand, if I do it +with a script instead of by hand: + + def xx output take blah\13, send /proto:zmodem \%1 + +it works, at least intermittently. But that's in remote mode. We won't be +using this in remote mode. In local mode, where we have a secure connection +to another computer, it seems we can read from the pty and write to the net, +but we time out waiting to read from the net; nothing arrives. Well, we +know that i/o works both ways, so there is some kind of screwup with the +Zmodem protocol start itself. Increasing the (still hardwired timeout) from +5 to 22sec and driving the whole process with a script so as to avoid +autodownload as well as manual dexterity effects... It just sits there +forever, way longer than 22 sec. ^C'ing out, I see that sz was indeed +started on the far end and the protocol was executing. But it looks like +the receiver (the one running under ttptycmd()) is getting trashed packets, +because (a) it seems to be sending the same thing over and over again, and +(b) sometimes it waits as long as 10 seconds before anything arrives from +the remote. Maybe I was too impatient; I interrupted it after 4 minutes but +it seems to have been making some progress. Whenever there was data +available to read from the net, it was always 65 bytes, and it was not +actually the same data over and over. This is using lrz as the external +protocol. crz gets a bit farther. In this case we read up to 24K at a +gulp, but the amount varies a lot. It looks like we took in about 1.2MB of +Zmodem protocol data, but were only able to output the first 20K of the +file. Clearly there were lots of errors. In the end, the crz exits with +status 1 (failure). + +Anyway it looks like we're back at needing to find a way to accomplish +something like TIOCREMOTE on the pty, which is where we came in. 10 Jan 2007. + +Without any way to make the pty transparent and flow controlled, it would +seem to make sense to write to the pty in smaller chunks than we do to the +net. I left the read-from-pty-write-to-net buffer at 24K and changed the +read-from-net-write-to-pty buffer to 48 bytes. + +Upload using lsz worked but took about 3 minutes. Actually it didn't work. +On the local end it seemed to work, but the file did not appear on the +remote end. Tried this several times, each time with different results, +adding more debugging each time. The problem this time was that the pty +read could get EWOULDBLOCK. Changed the code to not treat this as an error, +now Zmodem uploads are solid again except I never got EWOULDBLOCK again +either, even though I repeated the same upload about 1000 times (with +throughput of over 2MBps even with debugging on), so the test for it has +not been exercised. + +OK, uploads still work. Back to downloading... The very first pty read +gets 0 bytes, followed by the fork test that shows that it exited with +exit status 2. + +Next we try starting sz with some different options on the far end: + + -q: quiet (no messages): + for some reason this gets totally stuck. + it looks as if this option is misdocumented; + sz seems to be sending the letter C (as in Xmodem 1K or whatever) + + -e: escape (all control chars): + first attempt to read pty finds the process gone with exit status 2. + + -k: send 1k blocks: + this one didn't stop immediately. It reads 48 bytes from net, writes + 48 to the pty with no error. Then reads 21 bytes from the pty, writes + them to the net OK. Then reads 48 bytes from net, writes them to pty OK, + reads 21 from pty, writes to net OK, etc etc... It appears to have + worked but (final read from pty returned 0, fork test showed lrz exited + with status 0), but only 754 bytes were received from the net when the + file is 420K... + +Well this only goes to show that the faster we shove stuff into the pty, the +worse it gets. Zmodem downloads won't work unless we can make the pty +transparent and flow-controlled. So to summarize today's developments: + + . separated in/out buffer sizes + . handled EWOULDBLOCK + . found out that sz options don't help much + +11 Jan 2007. + +Next day. This has got to be the most delicate code ever, it's like +Whack-A-Mole, fix A and B pops up. Even without touching it, something that +worked perfectly a 2:00 doesn't work at all an hour later. Maybe I could +have used pipes instead of ptys, but pipes have problems of their own. +There has to be a way to do this. The telnet server, the SSH server, etc -- +they all run on ptys, and we can upload files to them with Kermit. Why? +Because Kermit puts its terminal into all the right modes using the +time-honored methods of ttpkt() and ttvt(). Perhaps all we need is a copy +of ttpkt() that operates on the pty. + +On that theory, let's go back to Kermit as the external protocol. +It's important to suppress all messages and displays. With that, +uploads work fine, no hitches. + +Downloads: We fail right away. The debug log shows the Kermit program that +we are starting in the pty says: + + "" - Invalid command-line option, type "kermit -h" for help. + +But of course we are not giving it an invalid command-line option. +Switching to gkermit for the external protocol, now we see that no matter +command-line options we use, we read 0d 0d 0a from the pty and then the +next time we go to read from the pty we get 0 bytes and waitpid() says the +program has exited with status 1. + +Why should downloading be different from uploading? ttptycmd has no idea, +it does everything the same. The only difference would seem to be which +side sends first, but even that tends to get washed out by each program's +startup messages. + +Downloading with Kermit worked 2 days ago, what's different now? The buffer +sizes. Putting the net-to-pty back up to 24K (from 48 bytes)... Now it +works again. + +Conclusion: Kermit conditions the pty correctly, Zmodem does not. Therefore +ttruncmd() must duplicate what ttpkt() does. + +Or not. Because rz works fine on ssh/telnet ptys too. But not on our pty. +lrz exits immediately with status code 2 = 01000 but there are no clues in +the lrz.c source code, I don't even see this exit status set anywhere. +Unredirecting stderr, I see that the error is "lrz: garbage on command line". + +Why do both Kermit and Zmodem sometimes think they are receiving an invalid +command line? If I could capture the garbage... + +Side trip #1: ("pty.log",O_WRONLY) gives "no such file or directory". +Changed this to ("pty.log",O_CREAT,0644) and now it doesn't get an error, +and it creates the file, but not with 0644 permissions, and with nothing +written in it. How come nothing works? + +Fine, the debug log shows that ttptycmd() receives the correct string +(e.g. "lrz -v"). It passes it to do_pty() correctly, and do_pty() passes it +to exec_cmd(), which runs cksplit() on it, coming up (in this case) with +"lrz" and "-v", which is right, and then: + + args = q->a_head + 1; + execvp(args[0],args); + +execvp() wants the args array to have a null element at the end. cksplit() +does indeed do that, or at least the code is there. Added code to exec_cmd() +to verify the argument list and that it is null-terminated. So far it is. + +Anyway, we have traffic between the Zmodem partners, but no joy. +Commenting out the bit that redirects stderr, now I can see it on my screen +in real time: + + lrz waiting to receive.Retry 0: Bad CRC + Retry 0: Got ERROR + Retry 0: TIMEOUT + Retry 0: TIMEOUT + Retry 0: TIMEOUT + Retry 0: TIMEOUT + +etc etc, forever. Trying sz -e on the far end, I get: + + Retry 0: Bad CRC + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + ... + Retry 0: Got ERROR + Retry 0: Bad CRC + Retry 0: Got ERROR + Retry 0: Got ERROR + lrz: xxufio.c removed. + +So apparently it's not a matter of escaping. Trying some other stuff, I +caught the command-line problem in the act: + + lrz: garbage on commandline + Try `lrz --help' for more information. + +Debug log shows: + + cksplit result[lrz]=1 + cksplit result[-v]=2 + exec_cmd arg[lrz]=0 + exec_cmd arg[-v]=1 + exec_cmd arg[]=2 + +An empty string at the end instead of a null pointer. I really do not see +any way that could happen, but rather than dig into cksplit() again after +all these years I added a test for this in exec_cmd(), which, of course +after adding it, never encountered this behavior again. + +Fiddled with pty buffer size again. Made it 512 bytes instead of 24K. +Zmodem downloads are the same (Rety 0: TIMEOUT, over and over). But I don't +see what the problem is -- every time we receive n bytes from the net, we +write n bytes successfully to the pty and there are no errors. But it also +looks like the remote sender is sending the file header over and over +because it's not receiving an acknowledgment. If we're not losing data, +then maybe it's a transparency problem. + +Tried uncommenting the TIOCblah stuff I commented out before. Now instead +of only timeouts I get: + + lrz waiting to receive.Retry 0: Bad CRC + Retry 0: Got ERROR + Retry 0: Bad CRC + Retry 0: Got ERROR + Retry 0: Bad CRC + Retry 0: Got ERROR + Retry 0: TIMEOUT + +which is odd because the TIOCREMOTE ioctl failed with errno 14, EFAULT, +bad address, which should indicate it had no effect. We're still receiving +data from the remote in tiny chunks (from 12 to 65 bytes), apparently the +same stuff (file header), and writing them to the pty successfully but +nothing... + +Looked at cloning ttpkt() for the pty, but these stupid routines use global +tty mode structs so it's not going to be easy. + +Well, we got exactly nowhere today, but I think I'll leave stderr as it is +so users will see some feedback; no reason not to. + +WHY DO KERMIT DOWNLOADS WORK AND ZMODEM NOT? + +Is it 8-bit transparency? Up til now I've been testing with text files. +If I try to download a binary what happens? Fails after 99 seconds. Packet +log from the far end shows that as soon as the first packet containing 8-bit +data is sent, everything stops. At least I got one of these: + + 17:23:56.475 exec_cmd arg[gkermit]=0 + 17:23:56.475 exec_cmd arg[-qr]=1 + 17:23:56.475 exec_cmd arg[]=2 + 17:23:56.475 exec_cmd SUBSTITUTING NULL=2 <-- the code I just added + +Doing this again shows the same thing on the near end. All the 7-bit-only +packets are sent and acknowledged OK. Three 8-bit data packets arrive and +nothing else happens after that. This is with G-Kermit. + +The same thing happens with C-Kermit receiving. But if I change C-Kermit's +.kermrc to turn off streaming and use a short packet length: + +The transfer works, even though it's sending 8-bit bytes. So the problem is +not 8-bit data after all, per se. Facts: + + . Kermit can receive streaming transfers of 7-bit files. + . Kermit can not receive streaming transfers of 8-bit files. + . Kermit can receive nonstreaming transfers of 8-bit files with short packets. + . Kermit can receive nonstreaming transfers of 8-bit files with 1K packets. + . Kermit can receive nonstreaming transfers of 8-bit files with 4K packets. + +So it's the combination of streaming and 8-bit data? 12 Jan 2007. + +As a test I made a new routine pty_make_raw() that does cfmakeraw() (a +nonportable "POSIX-like" function known to be used on ptys in applications +that do approximately what we're attempting). Results: + + Solaris: errno 25 - inappropriate ioctl for device. + +This happens even when we try to get the terminal modes with tcgetattr(), +which is completely nuts. We pass it the file descriptor of the pty master, +which is supposed to work. But in Mac OS X, there are no errors. But +downloads still don't work; lots of errors but the pattern is different. +Using a very small buffer: + + Retry 0: Bad CRC + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Bad CRC + Retry 0: Bad CRC + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: TIMEOUT + Retry 0: Got ERROR + Retry 0: TIMEOUT + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Bad CRC + +Using a bigger buffer: + + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + (several screensful) + +Various other combinations... Nothing seems to work. + +Insight: telnetd does exactly what we want to do, sort of. +But it uses TIOCPKT, so every time it reads from pty, it receives +one control byte and then the data bytes, which would complicate our +buffering scheme considerably. Anyway the TIOCPKT ioctl() fails on +Mac OS X with 14 "Bad address". + +Also see: snoopserver.c (found in Google). It seems to do things in a +slightly different way -- it sets stdout to raw and then dups it to the +slave side of the pty? + +Maybe it's a mistake to use the ckupty.c routines. They are designed for +creating and accessing an interactive session. Maybe just copy one of the +other programs. + +18 Jan 2007. Tried going back to blocking rather than nonblocking reads +to see if it would make a difference, after all the other changes. Nope. +OK, let's look at some of these other programs... + +snoopserver.c. I don't know exactly what this is or where it's from or what +platform it runs on and there are no comments to speak of, but it does +approximately what ttptycmd() does. To get a pty it uses openpty(): + + if (openpty(&pty, &tty, NULL, NULL, NULL) == -1) + +then creates a fork. In the fork, it closes the pty (master) and +manipulates the modes of the tty (slave), dups tty to be stdio, and then +doex execv() on the command. Meanwhile the upper fork closes the tty +(slave), gets the attributes of stdin, using atexit() to have them +automatically restored on exit. Then it sets stdin to raw mode and enters +the select() loop on stdin, the pty master, and the net. It uses regular +blocking reads. It does not use TIOCPKT or anything like it. + +openpty() is supported on: Linux, Mac OS X, NetBSD, FreeBSD, ... +openpty() is NOT supported on: Solaris, HP-UX, ... + + 1. Try copying the pty code, but keep everything else the same. + +I did this; it compiles and starts OK, upper fork (ttptycmd) debug log shows +no errors, but nothing happens. Logs show that the Kermit program that is +started in the subfork seems to die as soon as it reaches eof on its init +file. The good news, at least, is that select() doesn't report report that +the pty is ready to be read. Clearly the file descriptors aren't being +assigned as expected, or as before. + +In ckupty.c getptyslave() dup2's the slave fd to 0 and 1. The new code +does exactly the same thing. Debug log makes it look like the forked kermit +is not receiving its command line. But now I'm not even sure that the +forked kermit started at all. ps from another terminal doesn't show it. + +19 Jan 2007: Noticed that in snoopserver, the select() calls use standard +input and output file descriptors, rather than the pty master. Made that +change... In doing that I had to look at every file descriptor in every +line of code and discovered a couple mistakes, fixed them, put back the +original code but with the fixes, tried it, but no change; can upload OK but +still can't download with Zmodem without lots of errors and ultimate +failure. Going back to the alternative version and trying to get the the +file descriptors sorted out, now it appears that the external Kermit program +never even starts in the lower fork. After a bit more fiddling I sort that +out, but now when the lower Kermit program goes to open "/dev/tty" it gets +errno 6 "Device not configured". Forcing it to use stdio with "-l 0", it +gets past this and actually sends its first packet. But the Kermit on top +reads nothing from the pty. + +Next, I change the pty fd from STDIN_FILENO and STDOUT_FILENO to slavefd. +No difference. Next I comment out the dup2() calls. This time I get some +action. The transfer starts, but only one packet comes. Log shows that +the lower Kermit sends its S packet. The upper Kermit receives the ACK +but the lower Kermit never gets it. The write to the pty succeeds, no +error. Different combinations give different results. If write to master +and read from the slave, I get packets in both directions but tons of +errors.... This happens only if I comment out the dup2()'s. + +25 Jan 2007: After leaving it sit for a while, and realizing that what I'm +trying to do has to be possible because so much other software does the same +thing (e.g. Telnet servers), I put things back to how they were originally +-- the upper fork (Kermit) uses the master and the lower fork the slave. +The upper fork puts the master in raw mode, the lower fork puts the slave in +raw mode. The lower fork dup2's the slave fd to stdin/out. Send file in +remote mode using external Kermit: works OK but select() times out at the +end. This means that the self-contained pty code in ttptycmd() is sorted +out -- all the file descriptors go to the right place, etc, and now we can +use this routine as a testbed, rather than the original ckupty.c-based one. + +But send with lsz, csz, and regular rz: Nothing happens, times out after 0 +bytes of i/o. Once again, Kermit works, Zmodem doesn't. The reason for +running Zmodem in a pty is so its i/o will work as it does on a terminal, +no matter how it may fiddle the file descriptors. So why don't we see a +single byte come out? + +Commenting out pty_make_raw(), I get a successful Zmodem send using lsz. +csz manages to get the filename across, but then gets stuck. regular sz, on +the other hand, works perfectly. Testing csz by itself (not under Kermit), +I see it fails in exactly the same way ("Got phony ZEOF", etc). OK, forget +crzsz. + +OK, let's move to local mode over a Kerberized Telnet connection... +Uploading (sending) with external Kermit protocol... works. +Downloading (receiving) with external Kermit protocol... works. +Uploading with sz... works. +Downloading with lrz... Gets tons of errors and fails. + +Running pty_make_raw() on the slave but not on the master: no difference. +Running pty_make_raw() on the master but not on the slave: no difference. + +Back where we started... Either: + + . Zmodem is overdriving the pty, no matter what modes we put it in. + . It's a transparency problem. + +Theoretically we should be able to test these by using different sz switches: + -q: quiet (should always use this) + -e: escape all control characters + -B n: Buffer n bytes (rather than whole file) + -L n: Packet length + -l n: Frame length (>= packet length) + -w n: Window size + -4: 4K blocksize (doesn't help) + +-q by itself doesn't help. +-q -e, this one worked but still got about 100 errors and was very slow. +-q -e -l 200 -L 100, failed fast and bad. +-q -e -w 1. Failed quickly. +-q -e -w 1 -B 100. Eventually failed. +-q -w 1, Eventually failed. +-q -l 1024, this gets much more errors, definitely need -e. +-q -e -l 1024, got pretty far before failing. +-q -e -w 1 -l 1024, also got pretty far before failing. +-q -e, this one got farthest of all, about 48K, before getting errors. + +In the latter combinations that work somewhat better, we always get up to +16K, or 32K, or 48K, before the errors start coming out and piling up. +Sometimes the errors are recoverable and we receive as much as 300K +successfully before giving up. + +Now that we have data flowing pretty well (but not well enough), tried +reinstating pty_make_raw(), but it hurt more than helped. + +As a sanity check, I tried transferring from the same host over the same +kind of connection (Kerberized Telnet) directly to K95's built-in Zmodem +protocol, and that worked fine. So the problem is definitely in the pty. +Or more precisely, where Kermit writes incoming net data to the pty master. + +26 Jan 2007: Tried changing the size of the net-to-pty buffer from 24K to +1K. Result: total failure. Set both buffers to 1K. Still total failure. +Set both to 4K: now we get about 45K of data, then failure. Put them both +back to 24K, still fails totally -- the same code that worked pretty well +yesterday. Actually, no downloads work, not even Kermit, not even of +text files. + +27 Jan 2007: Since I have not been able to find a way to make ptys work for +this, I made a third copy of this routine, this time using pipes instead of +ptys. The disadvantage here is that if the external protocol does not use +stdio, the pipes won't work, but one thing a time... + +Inferior Kermit starts in lower fork, but when it tries to send its first +packet it gets errno=9 EBADF, Bad File Descriptor. Substituting G-Kermit as +the external protocol, which is simpler, reveals that the problem is that +the external protocol gets errors when it tries to manipulate the its stdio +file descriptors with ioctls, etc; these are not valid for a pipe. The pipe +mechanism itself works. If I take out the test for ttpkt() failing in +gkermit, the file transfer works OK. Trying Zmodem... Sending works OK; +receiving works a lot better than with ptys (it got 360K into the file +before failing). Making the buffers smaller, doesn't help. + +I'm starting to wonder if the problem might be in my buffering code, rather +than in the pty or pipe interface... Try making a version that does +single-character reads and writes. + +This one reads the first packet from the lower Kermit and sends it. It is +recognized by the other Kermit, which sends an ACK. We see the ^A of the +ACK, but then select() times out on the next character -- OF COURSE: because +at a lower level, it has already been read. We have to check the myread +buffer, and then call select() only if it's empty. Making this change: + + . SEND with G-Kermit works (but very slowly). + . SEND with lsz works but gets a lot of errors, eventually succeeds. + +Let's work our way back... With the same changes to the buffered pipe version: + + . SEND with G-Kermit/streaming works (fast). + . SEND with lsz works too (fast), but we get gubbish at the end. + . RECEIVE with Kermit fails because "/dev/tty is not a terminal device". + . RECEIVE with rsz... lots of errors ("garbage count exceeded") but succeeded. + +But maybe now we're seeing pipe artifacts, so going back one more step to +the version that gets its own pty and starts its own fork: + + . SEND with G-Kermit/Streaming works (fast) but select() times out at the end. + +Another breakthrough: Moved the write pieces to below the read pieces. This +is what was preventing the buffer reset code from working -- with the writes +done before the reads, we never catch up and can never reset the buffers. + + . SEND with G-Kermit/streaming works (fast) (but there's a pause at the end) + . SEND with lsz works (fast) (but there's a pause at the end) + . RECEIVE with rsz... lots of errors ("garbage count exceeded") and fails. + . RECEIVE with Kermit -- nothing happens (it thinks it succeeded), then we + reconnect, terminal sees S packet and goes into autodownload + +From the log it looks like ttpkt() fails in the lower Kermit. Switching +this with the hacked G-Kermit... it gets "transmission error on reliable +link". Tried again with real Kermit below, this time with "-l 0" and not +streaming. This was actually working, but slowly, I don't see any NAKs in +the packet log, but then select() timed out. + +28 Jan 2007: Restored both the calls to pty_make_raw(): + + . SEND with C-Kermit streaming works, but slow (54Kcps) + . Ditto, but with debugging off -- hangs forever. + . Ditto, but using G-Kermit instead of C-Kermit -- also hangs forever. + +Backed off on calling pty_make_raw(). Same thing. +Reduced size of net-to-pty buffer. Same thing. + +15 Feb 2007... Decided to give up on this and publish it as is, in hopes +that somebody with more experience with ptys can make it work, because I'm +just going in circles. So today I just have to get the code into shape so +people could choose among the three alternative routines. The second one, +yttyptycmd(), is the one that uses openpty(), which is not portable, so it +can be enabled only for Mac OS X, NetBSD, FreeBSD, and Linux, or by also +defining HAVE_OPENTPY at compile time. Anyway, if you build Kermit in the +normal way, you get the regular behavior -- ttruncmd() is used to execute +external protocols. If you build it with -DXTTPTYCMD, you get the first +version of ttptycmd(); with -DYTTPTYCMD the second, and with -DZTTPTYCMD the +third. + +(Then some interruptions, then...) + +From Jeff, fix hostname comparison in X.509 certificate checking to work +right in the case of names that contain no periods. dNSName_cmp(): cl_ssl.c, +21 Feb 2007. + +John Dunlap noticed some strange behavior when transferring files between +home base and the EM-APEX oceanographic floats via satellite... long story, +but every so often the transfer would get stuck for a long time, and it +happened only when C-Kermit was sending a file and received two or more +packets (Ack or Nak) back to back from the float. Years ago I added some +lookahead code to ttinl() to clear the input buffer of any interpacket junk +so that, in the windowing case, we wouldn't be tricked next time around into +thinking a packet was waiting to be read when there wasn't. The code, which +has been there for a while, was a bit fractured; luckily, it would be +executed only when the debug log was active so it didn't have much effect. +The problem was that if the SOP came immediately after the EOP, it could be +missed because the loop read the next character before checking the current +one. Fixed by rearranging the loop. Also I changed it so it would execute +in all cases, not only when the debug log was active. Also, cleaned up a +bunch of confusing #ifdefs and removed some chunks that had been commented +out for years, decades maybe. ttinl(): ckutio.c, 21-22 Feb 2007. + +Added NOW keyword info to HELP DATE, plus a tip about how to convert to UTC; +suggested by Arthur Marsh. ckuus2.c, 22 Feb 2007. + +When an FTP client sends NLST to the server and no matching files are found, +the server is supposed to respond with an error message on the control +channel and nothing on the data channel. However it seems that at least one +server sends the error message back on the data channel, as if it were a +filename ("/bin/ls: blah: No such file or directory"), and on the control +channel there is no error indication ("226 ASCII Transfer complete"). At +this point remote_files() has a listfile and, if a match pattern was given, +it looks through list to see if any of the lines match the given filename, +e.g. "blah". This makes FTP CHECK give false positives. The problem +(diagnosed by Jeff) is that the match pattern was not given in this case, so +it takes some random default action, resulting in the spurious success +return. Fixed by using the user's string as the pattern. Not tested, +however, since I don't have access to a server that behaves this way. +ckcftp.c, 22 Feb 2007. + +If an external-protocol file transfer fails, don't print Kermit-specific +hints. ckuus5.c, 22 Feb 2007. + +One more time with ttinl(). Got rid of the "csave" junk, which never could +have worked (which is no doubt why it was in a debugging section). The +problem was that saving the beginning of the next packet locally did not +synchronize with the buffer clearing (ttflui()) done at a higher level, +between calls to ttinl(). So now, the lookahead code, if it finds the +beginning an as-yet unread packet, puts it back at the head of the input +queue. This way, if the protocol engine clears the input buffer, it will +get the whole packet, not just the part after the SOH. ckutio.c, 24 Feb 2007. + +From Steven M Schweda, Saint Paul, MN: adaptation of large file support to +VMS (it was already possible to transfer large files in VMS C-Kermit but the +file-transfer display and statistics were wrong). And a minimal adaptation +of the FTP client to VMS -- no RMS, no special VMS file stuff, Stream_LF and +binary files only, developed and tested only with UCX. SSL/TLS is +supported. The source-code changes are minimal; most have nothing to do +with VMS, but with header files, prototypes, and data types (e.g. ftp_port +int rather than short, various signed/unsigned conflicts) to shut up +compiler warnings. Some of these could be dangerous in terms of +portability; I've marked them with /* SMS 2007/02/15 */. ckcfns.c, +ckcnet.h, ck_ssl.h, ckuus3.c, ckuus4.c, ckvfio.c, ckcftp.c, ckvker.mms +(which was rewritten to actually reflect the source module dependencies), +ckvker.com (also heavily modified). ckvker.com (the "makefile" for VMS +C-Kermit) now indludes "F" and "I" option flags for the large File and +Internal ftp features, plus better handling of Vax/Alpha/IA64 distinction. +26 Feb 2007. + +Changed NetBSD targets to include -DHAVE_OPENPTY and -lutil, so they +can use openpty(). makefile, 26 Feb 2007. + +Built on Solaris without and with SSL OK. +Built on NetBSD with Kerberos 5, OK. +Built on Mac OS X 10.4, regular version, OK. +Built on Mac OS X 10.4 with SSL and Kerberos 5, OK. + +On VMS 7.2-1/Alpha with MultiNet 4.4A-X... + +'CC' 'CCOPT' KSP:ckuus3 +%DCL-W-TKNOVF, command element is too long - shorten + \CKUUS4.OBJ "'CC' 'CCOPT' KSP:ckuus4" "KSP:ckuus4.c KSP:ckcsym.h KSP:ckcdeb.h + KSP:ckclib.h" "KSP:ckcasc.h KSP:ckcker.h KSP:ckcnet.h KSP:ckvioc.h" +"KSP:ckctel.h KSP:ckuusr.h KSP:ckucmd.h KSP:ckuver.h" "KSP:ckcxla.h + KSP:ckuxla.h KSP:ckcuni.h KSP:ckuath.h" + +The new rule for ckuus4.c was too long. I removed one file from the +dependency list (ckcxla.h, which will probably never change again) and that +made it OK. Built Nonet and Net versions OK, but this is without the new +stuff. + +"make f" (large-file support) on VMS 7.2-1... +'CC' 'CCOPT' KSP:ckuus4 + if (CKFSEEK(fp,(CK_OFF_T)j,SEEK_CUR) != 0) { +........................^ +%CC-I-IMPLICITFUNC, In this statement, the identifier "fseeko" is implicitly +declared as a function. + +Ditto for ftello and fseeko in various other places, and then fseeko and +ftello come up up undefined at link time. + +The rule for ckcftp in "make i" (Internal FTP support) had the same problem. +I removed ckcxla.h from its dependency list too, but "utime" comes up +undeclared at compile time and undefined at link time. + +Verdict: neither one of the two new features can be used in VMS 7.2 or +earlier, but the code still builds OK if you don't ask for them. + +VMS 8.3 on IA64... Can't build anything: +%MMS-F-BADTARG, Specified target (WERMIT) does not exist in description file + +27 Feb 2007: Changed CKVKER.COM to keep all its dependencies but use a +shorter logical name (Steven M Schweda). The problem on VMS 8.3 is that MMS +now supports case-sensitive file systems, and so it can't find anything. +Workaround: bypass MMS (include "m" in P1). With this, "@ckvker.com ifm" +builds OK on HP Testdrive, but I can't test the new features since outbound +connections are not allowed there. As for fseeko(), ftello(), and utime(), +they simply are not availble prior to VMS 7.3. It would probably be a good +idea to test for this in CKVKER.COM, but actually it is possible to install +newer C's and CRTLs on older VMS versions, so don't stand in their way. + +28 Feb 2007: With additional chages from SMS, and then some further +adjustments, I was able to build the FTP version on VMS 7.2-1. First I +tested it with GET of a binary file, but it transferred it in text mode. +After a few more attempts with PUT and GET, it crashed with "floating/decimal +divide by zero" in ckscreen, ckuusx.c line 27859. Of course, that's the +listing line, not the source line, and I don't have a listing. + +To get a listing, I deleted CKUUSX.OBJ and then did: + + $ make i "" "" "/LIST" + +Surprisingly, it recompiled everything. + +Anyway, the divide by zero happened in a section of code where the divisor +was not checked, but it was a section of code we should not have been +executing at all, since the file-transfer display was fullscreen, and this +was in the "brief" section. Anyway, I added the needed check. Again, it +recompiles everything. Maybe there's no MMS on grumpy -- right, there isn't. + +ANYWAY... Try to GET a binary file like this: + + binary + ---> TYPE I + 200 Type set to I. + get gkermit + ---> TYPE A + 200 Type set to A. + ---> SIZE gkermit + 550 gkermit: file too large for SIZE. + GET gkermit (text) (-1 bytes)---> TYPE A + +Anyway... "get /binary gkermit" downloads it, seemingly correctly (the byte +count is right). + +But "put /binary gkermit.;1" results in a 0-length GKERMIT file being sent. +Here's the debug log: + +FTP PUT gnfile[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1 +ftp putfile flg[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0 +zltor fncnv[DISK$MSA4:[C.FDC.NET]gkermit.;1]=-1 +FTP PUT nzltor[GKERMIT] +zfnqfp 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=675 +zfnqfp 2[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31 +zfnqfp 3[DISK$MSA4:[C.FDC.NET]GKERMIT.;1]=31 +zrelnam result 2[gkermit.;1] +ftp sendrequest restart[DISK$MSA4:[C.FDC.NET]gkermit.;1]=0 +openi name[DISK$MSA4:[C.FDC.NET]gkermit.;1] +openi sndsrc=-1 +openi file number=2 +zopeni[DISK$MSA4:[C.FDC.NET]gkermit.;1]=2 +zopeni fp=0 +chkfn=2 +chkfn return=0 +zopeni fixed file format - using blk I/O +zopeni binary flag at open=1 +zopeni ifile_bmode=1 +zopeni binary=1 +zopeni RMS operations completed ok +openi zopeni 1[DISK$MSA4:[C.FDC.NET]gkermit.;1]=1 +ftpcmd cmd[PASV] +FTP SENT [PASV] +FTP RCVD [227 Entering Passive Mode (166,84,1,2,233,216)] +initconn connect ok +FTP SENT [STOR GKERMIT] +FTP RCVD [150 Opening BINARY mode data connection for 'GKERMIT'.] +doftpsend2 ftpcode[STOR]=150 + + Here is where the file is supposed to be read and sent but there is nothing + in the log between the "doftpsend2 ftpcode" line and the following line. + +rftimer status=1 +gftimer status 1=1 +gftimer status 2=1409025 +gftimer status 3=1409025 +gftimer s[0.000000] +zclose n=2 +chkfn=2 +chkfn return=1 +zclose ZIFILE RMS operations completed ok +ftp getreply lcs=0 +ftp getreply rcs=-1 +ftp getreply fc=0 +FTP RCVD [226 Transfer complete.] +ftp getreply[226 Transfer complete.]=2 +doftpsend2 ok=0 + +Everything is OK up until we go to send the file, then it behaves as if we +got EOF immediately and so closes the data connection, and reports success; +an empty copy of the file is left on the far end. + +Starting over with a text file.... PUT LOGIN.COM gets another divide by +zero. But it happened in the code I just fixed, which is impossible. Swell. +I recompiled everything and this time the upload worked, and downloading it +again worked too. + +But a binary file still can't be uploaded. Trying to upload a text file +after doing this seems to succeed (reports the right number of bytes sent) +but nothing appears on the far side. + +SUMMARY: + + To download a text file: GET /ASCII blah.txt (/ASCII is optional) + To download a binary file: GET /BINARY blah.bin (/BINARY is required) + To upload a text file: PUT blah.txt (/ASCII switch not needed) + To upload a binary file: PUT /BINARY blah.bin (doesn't work) + +Problems: + . Why doesn't BINARY "stick"? + . Why don't binary uploads work? + +The culprit seems to be the VMS version of zxin(). In the FTP module, +zxin() is called only when sending binary files. In VMS, zxin() is just +a front end for C-Library fread(). It probably needs to do just do +zminchar() in a loop, like binary mode does, but calling zzout instead +of xxout. Or something like that. FINISH THIS TOMORROW (debug on grumpy). + +2 Mar 2007: New logs from John Dunlap. + +ema-1636-log-0175.dbg: C-Kermit uploads a short file. It receives an Ack for +the Z packet it just sent, tailgated by the beginning of a Nak for the next +packet. When the second SOH is encountered, it is put back in the myread +queue. Then the protocol engine, to which we return the Ack, says, "I have +the packet I wanted so I'm clearing the buffer", and away go the first two +bytes of the Nak from the myread buffer. Then, having just received the Ack +of our Z packet, we send our B, and go to read the reply. in_chk finds 0 in +the myread buffer (which we just cleared) and 6 waiting to be read from the +comms channel, which it does, obtaining the remaining 6 bytes of the Nak, +which it properly discards. (The reason this is proper is that, having +already received the Ack for the last packet it sent, no Ack or Nak that +arrives subsequently -- in the non-windowing case -- could possibly affect +what it does next.) Since it hasn't yet found a good packet, it keeps +reading, and now it finds the Ack to the B, as soon as it showed up. This +is how it's supposed to work. No time was lost because of anything that +C-Kermit did. + +ema-1636-log-0174.dbg: C-Kermit uploads a short file. It sends Data packet +#3 and receives the Ack followed immediately by the first 3 bytes of a Nak +for packet 4. When it gets to the SOH of the second packet, it pushes it +back in the queue. Again, input() flushes the input buffer (myread queue +and device buffer). C-Kermit detects EOF on the file it is sending, and +sends the Z packet. Then it reads the remaining bytes of the Nak, +which it discards, and then it finds the Ack for Z which comes in 23 seconds +later, sends the B, gets a Nak for the B, sends the B again, gets the Ack +for the B 4 seconds later, and done. Again, it's working right and losing +no time. + +The question remains: what would happen if the protocol engine did not clear +the buffer? Would ttinl() retrieve all packets in sequence even when they +come back to back? To test this, I had C-Kermit send a file using 30 window +slots and observed the stream of Acks in the reverse direction: + + HEXDUMP: mygetbuf read (16 bytes) + 01 25 23 59 2f 52 39 0d | 01 25 24 59 2b 26 31 0d .%#Y/R9. .%$Y+&1. + ttinl lookahead my_count=9 + ttinl lookahead removed=^M + ttinl lookahead pushback SOP=^A + HEXDUMP: ttinl got (7 bytes) + 01 25 23 59 2f 52 39 | .%#Y/R9 + RECEIVE BUFFERS: + buffer inuse address length data type seq flag retries + 0 1 29212 9667 0 Y 3 0 + [%#Y] + ... + in_chk my_count=8 + ... + ttinl lookahead my_count=1 + ttinl lookahead removed=^M + HEXDUMP: ttinl got (7 bytes) + 01 25 24 59 2b 26 31 | .%$Y+&1 + RECEIVE BUFFERS: + buffer inuse address length data type seq flag retries + 0 1 29212 9667 0 Y 4 0 + [%$Y] + +Here we can see that the pushed-back SOH was properly retrieved next time +around, and the tailgating Ack was not lost. This scenario repeats itself +212 times in the log, and there are no screwups. + +Back to VMS FTP... The problem with sending binary files is that zxin() +uses C-Library fopen()/fread() instead of RMS, so it can't access the input +file, which was opened by zopeni(), which is totally RMS-ified in VMS +C-Kermit. For VMS only, I replaced the zxin() loop by a zminchar() loop +like the one used in text mode, except without the character set or +record-format conversion. Tested by PUT /BINARY of some binary files, which +worked fine. ckcftp.c, 2 Mar 2007. + +Next problem... VMS C-Kermit ftp client sending binary files in text mode. +Variation 1: We just send the file. zopeni() is supposed to detect that +it's a binary file and automatically set the mode. And it does: + + zopeni fixed file format - using blk I/O + zopeni binary flag at open=0 + zopeni ifile_bmode=1 + zopeni binary=0 + zopeni autoswitch from TEXT to BINARY + zopeni RMS operations completed ok + +but then in gnfile(): + + if (!server || (server && ((whatru & WMI_FLAG) == 0))) + binary = gnf_binary; /* Restore prevailing transfer mode */ + +Well, since VMS sets text/binary mode automatically when sending files, +this code can (and should) be skipped in VMS. gnfile(): ckcfns.c, 2 Mar 2007. + +Variation 2: BINARY or SET FILE TYPE BINARY doesn't force binary mode. But +SET FTP TYPE BINARY does. But BINARY does indeed call doftptyp() so what's +the problem? We do indeed set ftp_typ to 1 but it gets reset somewhere +before we call zopeni(). But then zopeni() puts it back to 1. Tracing +through a transfer, it looks like all of this works right, it's only that +the file transfer display says TEXT when the transfer is really in binary +mode. This is because screen() is called before openi(). I wonder if we +can call scrft() from the ftp module... No, that would be too easy. OK, +sendrequest calls openi() and sets the file mode; putfile() calls +screen(SCR_FN), which prints the transfer mode. But putfile calls +sendrequest() after it puts up the screen that says the file type. So it +looks like sendrequest() has to call screen(SCR_FN) again if it changes the +file type. OK, that did it. ckuusx.c, ckcftp.c, 2 Mar 2007. + +The BINARY and TEXT (ASCII) commands do not inhibit automatic type switching +in VMS. They don't in Unix either. They never have. Should they? I think +so, otherwise what good are they? Plus we want the Kermit FTP client to +behave like the others. I added code for this but it doesn't work, due to +the layers and layers of text/binary detection and switching and +if-this-but-then-if-that... Anyway, no harm done. The normal rule is: +when you PUT a file, Kermit figures out on a per-file basis whether to use +text or binary mode unless you include a /TEXT (/ASCII) or /BINARY switch +in the PUT (or MPUT) command. ckuus[r3].c, ckcftp.c, 2 Mar 2007. + +Wed Mar 7 16:21:13 2007 WROTE SHORT TEST PROGRAM for ttruncmd (the openpty +version) on Mac OS X. On dulce: ~/kermit/ttpty.c / ttpty.sh. It starts the +external protocol in the lower fork. The command to run is a command-line +argument. Sending and receiving files with Kermit works OK. But again, the +standalone program totally fails when I use sz or lsz as the external +protocol. So it looks like we can rule out any environmental effects of +running the code inside C-Kermit. + +Mon Mar 12 16:52:20 2007: Put some effort into making ttpty.c more useful; +added a debug log. Found that for some reason, at least on Mac OS X, +select() always timed out at the the end. I added a SIGCHLD alarm and that +seems to handle the fork exit condition very nicely. Now we can send (say) +a 3MB file at good speed on Ethernet (1Mcps) considering the debugging, etc, +and it terminates instantly. But when sending a file into ttptycmd (with +"gkermit -r"), things go wrong at the end -- the Z packet is never +acknowledged. This is reproducible. Maybe this is a good lead.... The log +shows that select() timed out, even though the gkermit fork had not yet +exited (or finished). It looks like gkermit sent the Ack, ttpty.c read it +from the pty and sent it out the net: + + 0003: read pty=8 <-- read Ack from pty + 0003: loop top have_pty=1 + 0003: loop top have_net=1 + 0003: FD_SET pty_in + 0003: FD_SET ttyfd in + 0003: FD_SET ttyfd out=8 + 0003: nfds=5 + 0003: select=1 + 0003: FD_ISSET ttyfd out + 0003: write net=8 <-- send ack to net + 0003: loop top have_pty=1 + 0003: loop top have_net=1 + 0003: FD_SET pty_in + 0003: FD_SET ttyfd in + 0003: nfds=5 + 0009: select=0 + 0009: select timeout - have_pty=1 + +But Ack never arrived. This is a streaming transfer. But nope, streaming +is not the problem. If I disable streaming ("gkermit -Sr"), we hang in in +the middle of sending the data. If I use small packets, we don't hang: +1000 is OK, 2000 is not. In fact, the cutoff is 1024. OK, TBC... + +Wed 14 Mar 2007: Receiving a file thru ttpty "gkermit -e 1200 -Srd" +produces a debug log that shows that gkermit gets a lot of EAGAIN errors +when it tries to read from its stdin. In fact, it takes 6 tries (read() +calls) to read the S packet (27 bytes). Then when the first data packet +arrives (1200 bytes), read() never returns even one single byte. The +timeout interval is 15 seconds and it times out repeatedly. Added a +primitive hex dump to the ttpty debug log for each read/write (showing only +the first 24 characters and the last character, so it fits on one line). +Tried uploading a file. The S, F, and A packets (short) are received and +Ack'd OK, but then ttpty select() times out, never receiving even one byte +from the D packet. Clearly, when the pty driver receives a burst of > 1K +bytes, stops working. As before, if I limit the packets to < 1K, it works +fine. + +Can I send an 8-bit binary file? Nope. ttpty reads the binary data just +fine from the net and writes it exactly as it was received to the pty, but +the first time we write an 8-bit byte, we never hear back from the PTY +again. But the log shows that when the initial 7-bit packets from the pty, +it looks like the PTY is not in rawmode, because these packets end with ^J +rather than ^M. Calling pty_make_raw() on the masterfd and slavefd +explicitly, however, doesn't change anything. It doesn't matter if I do +this in the lower fork or the upper fork. So maybe it's the actual +semantics of pty_make_raw() that are wrong. + +Thu 15 Mar 2007: Went thru all the terminal mode flags in Mac OS X; didn't +help. Changed hex dump to show whole packet. Put hex dump routine in a +private copy of G-Kermit. Tried to transfer an 8-bit file, logging both +ttpty and gkermit. Compared what ttpty received on stdin with what it sent +to the pty (same) and what was received by G-Kermit (same). Then I realized +that my little test program was not putting its controlling terminal into +raw mode; when I did that, I could upload binary files (streaming, 2MB/sec). +And with Zmodem too (with rz; lrz doesn't work for some reason). Looking +back at the original in ckutio.c, I see that ttptycmd() never called +ttpkt(). Maybe that was the trouble all along. (Yup, but maybe not the +whole trouble.) + +Moving back to C-Kermit and the original ttptycmd() routine, adding the call +to ttpkt(), and stripping out a lot of cruft, and moving the pty_make_raw() +code to ckupty.c, Kermit uploads and downloads (streaming) work fine in +Solaris. Zmodem sends a file, but then the transfer hangs at the very end, +as if the signoff protocol were lost. This happens on Solaris. If I move +back to Mac OS X, everything works just fine. Then, making a Kerberized +connection from the Mac to NetBSD, I can send files from the Mac with both +Zmodem and Kermit. Receiving... Kermit OK. Zmodem... Nope. "rz: +Persistent CRC or other ERROR" (and created a 265MB debug.log!) + +Fri 16 Mar 2007: ttptycmd() was for sending files with Zmodem across +encrypted connections. But it occurred to me that it's necessary for +clear-text connections too; e.g. Telnet, where 0xff has to be doubled. Of +course Zmodem doesn't do that itself, so there's no way Zmodem external +protocol could work when executed over a Telnet connection, and in fact +it doesn't. I wonder why I ever thought it did. + +Wed 21 Mar 2007: Back to where we left off a week ago. Trying C-Kermit's +ttptycmd() on the Mac again, in remote mode: + + . G-Kermit send txt (kst): OK 832Kcps + . G-Kermit recv txt (kr): OK 425Kcps + . G-Kermit send bin (ksb): OK 1000Kcps + . G-Kermit recv bin (kr): OK 188Kcps + +And Zmodem: + + . sz txt (zst): OK 563Kcps + . sz bin (zsb): OK 714Kcps + . rz txt (zr): OK 863Kcps + . rz bin (zr): OK 198Kcps + +So in remote mode, everything works. Now let's try a clear-text Telnet +connection... + + . G-Kermit send txt (kst): OK 841Kcps + . G-Kermit recv txt (krt): OK 391Kcps + . G-Kermit send bin (ksb): OK 811Kcps + . G-Kermit recv bin (krb): OK 171Kcps + +And Zmodem over the same clear-text telnet connection: + + . sz txt (zst): OK 91Kcps (*) + +Kermit is sending sz messages like "sz 3.73 1-30-03 finished." to the +host, which tries to execute them, after the transfer is finished. +Of course "sz" is a command, but: + + sz: cannot open 3.73: No such file or directory + sz: cannot open 1-30-03: No such file or directory + sz: cannot open finished.: No such file or directory + +Did I lose that code that dis-redirects stderr when I went back to using the +pty code from the ckupty module? No, it's there and it's being executed. +Apparently the copy of sz I have is writing its "finished" message to stdout +because "sz blah 2> /dev/null" does not suppress it. Starting again with +lsz instead of sz: + + . sz txt (lzst): OK 413Kcps + . sz bin (lzsb): OK FAILED (*) + . rz txt (lzrt): OK + . rz bin (lzrb): OK + +(*) Sigh. Using lsz, we get "garbage count exceeded" errors and eventual +failure. But using regular sz, we get the extraneous message that starts +sz on the far tend, and the resulting getty babble. + +But even without changing the code, it will work one minute, and then fail +consistently the next. For example, I was able to send files with sz +successfully over and over, but with the getty babble at the end. Then, +after trying lsz and then going back to sz, every attempt at sending a file +quits with "Got ZCAN". The difference has to be that Kermit always does at +least some minimal encoding of C0/C1 control characters such NUL and DEL and +IAC, and I doubt that Zmodem does. + +http://zssh.sourceforge.net/ says: + + If file transfer is initiated but never completes (ie a line like : + + Bytes Sent: 0/ 513 BPS:0 ETA 00:00 Retry 0: Got ZCAN + + can be seen, but transfer never completes), chances are the pty/tty on one + of the systems are not 8-bit clean. (Linux is 8-bit clean, NetBSD is not). + Using the -e (escape) option of rz should solve this problem. + +It doesn't, at least not with lrz. And yes, the receiving end happens to be +NetBSD. But it looks like the zssh people have been down this road too. + +But with rz and sz, it worked. Once. Twice. Three times. But of course, +with the getty babble at the end. This can be taken care of by doing: + + rz -eq ; cat > foo + +which puts "sz 3.73 1-30-03 finished" and any other messages in foo (but you +have to type ^D to finish the cat). Using this method I was also able to +send an 8K binary file that contained a test pattern of all 256 possible byte +values. Then I tried a 3MB binary executable. All OK. So here we go again: + + . sz txt (zst): OK + . sz bin (zsb): OK + . rz txt (zrt): + . rz bin (zrb): + +Downloading fails about halfway through a fairly large file. I tried an +even bigger file, guaranteed to be 100% ASCII; same thing -- halfway +through: "rz: Persistent CRC or other ERROR". But it worked with a smaller +version of the same file (82K versus 2MB). Tried again with the bigger +version, it failed in exactly the same way at exactly the same spot: byte +number 1048320. But this is just ASCII text so it can't be a transparency +problem. Substituting another plain ASCII file of the same size but totally +different contents, it doesn't fail (2.36MB). Back to the previous file, it +fails again, but in a different spot (832960). So it's not totally +deterministic. + +To round things out, I tried downloading the binary test-pattern file; it's +only 8K. This failed. + + -4, --try-4k go up to 4K blocksize + -B, --bufsize N buffer N bytes (N==auto: buffer whole file) + -e, --escape escape all control characters (Z) + -E, --rename force receiver to rename files it already has + -L, --packetlen N limit subpacket length to N bytes (Z) + -l, --framelen N limit frame length to N bytes (l>=L) (Z) + +Tried again with "sz -L 256 -B 256 -4aeq". Doesn't change anything. + +NOTE: Mac OS X rz 3.73 1-30-03 does not support -e. +NetBSD rz 0.12.20 does support -e. + +Thu 22 Mar 2007: It occurs to me that ttpkt() might still be a problem; +maybe it's the network connection and not the pty that is not transparent +enough. To test this theory I did "stty raw ; stty -a" and then copied all +of the flag values into ttpkt in the BSD44ORPOSIX section: + + . rz txt (zrt): OK (2.36MB file, worked 2 out of 3 times) + . rz bin (zrb): "rz: Persistent CRC or other ERROR" + +A little more fiddling with the flags and I got the 8K binary test pattern +to SEEM to download OK (in the sense that rz gave a 0 return code) but the +file itself was truncated, always at 224. If I changed the test pattern +file to not include any bytes with value 224 (0xe0) or 255 (0xff), the +download worked. So we have a transparency problem somewhere. The debug +log shows that all byte values are being received from the network correctly +so the problem has to occur when we try to feed them to the pty. + +But no amount of twiddling with the termios flags seems to let these +characters pass through. Of course, since they are not in the C0 or C1 +control range, "sz -e" doesn't quote them (which it does by prefixing with +Ctrl-X and then adding 0x40 to the byte value so (e.g.) NUL becomes ^X@. +Note that 255 does not cause problems because it coincides with the IAC +character; the remote Telnet server doubles outbound IACs, and Kermit's +ttinc() undoubles them automatically (as the log shows). + +Trying to send a different file (a C-Kermit binary) shows that 255 is the +real killer; the file is truncated where the first one appears (at about +6K), even though some 224's precede it. Going back to the remote-mode test, +I see the same thing happens with the binary test-pattern file, if I send it +from K95 direct to rz-under-C-Kermit-in-remote-mode. So it has nothing to +do with C-Kermit having a network connection. Yet if I send the same file +direct from K95 to rz, it goes OK and the result is not truncated, so it's +not Zmodem either. The data arrives to C-Kermit intact, so the failure is +definitely in writing it to the rz process through the slave and master ptys. + +BUT if I send the same file from K95 to rz-under-ttpty, that works. What's +the difference? Suppose I just transplant ttpty literally into C-Kermit... +It makes no difference. When receiving the test-pattern, it truncates it +in exactly the same place. + +Well, all this is on Mac OS X. What if I move it to a different platform? +OK, building on Solaris and following the exact same procedure, ttptycmd() +doesn't even use the network connection. I think that's because rzsz on +Solaris is hardwired to use the controlling terminal and can't be +redirected, even in a pty? + +Moved to NetBSD. + + . sz txt (zst): Failed ("Got ZCAN") + . sz bin (zsb): + . rz txt (zrt): OK + . rz bin (zrb): + +Well, this is a big mess. Sending doesn't work (or sometimes it does but +reports that it didn't). Receiving... well, actually it's the same thing; +the file is completely transferred but then the final protocol handshake is +lost. The local C-Kermit returns to its prompt, but rz is still running: + + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Got TIMEOUT + Retry 0: TIMEOUT + Retry 0: Got TIMEOUT + +I don't see how that is even possible. Even after I exit from Kermit the +messages keep coming, even though ps doesn't show the rz process anywhere. +Looking at the code, I see a place where end_pty() was still commented out +from the ttpty.c episode, I uncommented it. But still: + + . sz txt (zst): Fails ("Got ZCAN") + . sz bin (zsb): Fails instantly (but with no diagnostic) + . rz txt (zrt): OK + . rz bin (zrb): Fails with tons of "Bad CRC", "Gargage Count exceeded" + +Conclusion for the day: I think this is hopeless. Even if I can get it to +work somewhere, the results depend on the exact Zmodem software, how it uses +stdin/out vs stderr versus getting its own nonredirectable file descriptor, +versus the Zmodem version on the other end and which options are available +on each, versus the pty and select() quirks on each platform, and on and on. +It will be so hard to explain and to set up that nobody would ever use it. +It would be better to just implement Zmodem internally. + +Fri 23 Mar 2007: Went back to the small test program, ttpty.c. Tried +setting both the master and the slave pty to rawmode, even though I have +never seen any other software that did this. I had it receive the binary +test pattern file; it worked. I made a bigger test-pattern file, 3MB, +containing single, double, and triple copies of each byte in byte order and +in random order, this one was accepted too. + +So it would seem that the ckupty.c module is something to avoid after all. +It's full of stuff I don't understand and probably should not undo. So +changing C-Kermit's ttptycmd() to manage its own pty again, using openpty() +(which is not portable), I got it all to work in remote mode: Kermit +text/binary up/down and Zmodem text/binary up/down. But in local mode on +the client side of a Telnet connection... + + zst: OK, but we still get the getty babble at the end that starts sz. + zsb: OK, ditto. This is with the 3MB test-pattern file. + zrt: Not OK -- "Persistent CRC or other ERROR" + zrb: Not OK -- got the cutoff at 224 again "Persistent CRC or other ERROR" + +It's close. But actually this was still with USE_CKUPTY_C defined. When I +undefined it, it was back to being totally broken. Start over. (Check the +new cfmakeraw() code.) + +Tue 27 Mar 2007: Starting over. Back to ttpty.c. Let's verify, VERY +CAREFULLY, that it really does work, using the most stressful of the four +tests: sending the big (3.2768MB) binary test pattern from K95 into rz +through ttpty, logging everything. ttpty definitely receives the big file +smoothly with no errors or hiccups when I have it set to use the master side +of the pty for i/o. The application program (Zmodem in this case) runs on +the slave, and the network and/or control program communicates with the +master. This implies that Zmodem controls the terminal modes of the slave, +and ttpty should be concerned with those of the master. Doing it this way +in ttpty confirms this. + +Fine. But if I tell ttpty to SEND a file with sz, nothing happens. Ditto +with lsz. Select times out waiting for input from the pty. But if I +manually tell K95 to RECEIVE /PROTOCOL:ZMODEM it works OK. Somehow sz's +initial B000000 string is being swallowed somewhere, and it's waiting for +a reply from the receiver. sigh... But "ttpty gkermit -s filename" works +fine. What's the difference? It has nothing to do with stdout vs stderr; +sz is not writing to stderr at all. Is it some timing thing between the +forks? Aha. It's that I change the modes of the pty master in one fork +while sz is already starting in the other fork. + +OK, good, now for the first time we have Kermit and Zmodem both able to +upload and download a large worst-case binary test-pattern file... in +remote mode. Now taking today's lessons and fitting them back into +C-Kermit so I can try it local mode... + +Using G-Kermit as the external protocol, first in remote mode... All good: +text/binary up/down. The "halting problem" is solved by SIGCHLD, which +catches fork termination instantly and lets ttptycmd() know there is no more +pty. Zmodem: + + zst: OK + zsb: OK + zrt: OK + zrb: OK + +That's a first. Next, repeat in local mode, in which C-Kermit is the client +and has made a Telnet connection to another host over a secure (Kerberos V) +connection: + + kst: OK zst: ... + ksb: OK + krt: OK + krb: OK + +It seems we can never end a day on a high note. Somehow I seem to have +broken regular internal Kermit protocol transfers over encrypted connections +-- the en/decryption engine loses sync. But they still work OK over a +clear-text Telnet connection. + +Today's code in ~/80/dulce.tar (27 Mar 2007). + +Added makefile target solaris10g+openssl. Gathered all the standard CFLAGS +for Solaris into cdcdeb.h so they don't have to be included in every single +makefile target for Solaris. On local Solaris 10 host OpenSSL is in +/opt/openssl-0.9.8e/. Tried the new makefile target, works OK. Also made +solaris10+openssl for Sun CC, but couldn't test it because I can't find any +Solaris 10 host that has Sun CC. Built with gcc at another site that has +OpenSSL 0.9.8f-dev, all OK. ckcdeb.h, makefile, 24 Jun 2007. + +It occurs to me that Kermit transfers on secure connections might have been +broken by the changes I made back in February to ttinl() for John Dunlap. +Here, for the first time, we invoke myunrd() to push a byte back into the +input queue, and there is also some funny business with "csave", which +changed, and which an old comment notes that it has to be treated specially +when encrypting. So it could be that the broken Kermit transfer has nothing +to do with the work on external protocols, and that putting back the +previous ttinl() will fix it. But now I can't seem to make a Kerberized +connection from Panix to Panix, even though I can make one from Columbia to +Panix. This means I have to build a Kerberized binary from the current +source code on either Solaris or Mac OS X. Trying Solaris +first... [~/solaris9k5/mk5.sh] This didn't work the first time due to +undefined krb5_init_ets, which is referenced if MIT_CURRENT is not defined +(it should be for Kerberos 5 1.05 and later and we have 1.42 here), tried +again with -DMIT_CURRENT=1... Nope, that one totally blew up in ck_crp.c. +Later, Jeff says krb5_init_ets is a no-op in Kerberos 1.4.x and later, +so I added an #ifdef (NO_KRB5_INIT_ETS) for skipping it; now it builds and +runs OK. ckuath.c, makefile, 9 Jul 2007. + +Meanwhile, using C-Kermit on Mac OS X, which makes the Kerberized connection +just fine, but still has the problem transferring files over it. Packet log +shows: + + s-00-01-^A9 Sz/ @-#Y3~Z! z0___F"U1@A^M + r-00-01-^A9 Y~/ @-#Y3~^>J)0___J"U1@I + s-01-01-^A(!Fx.x)(V^M + r-xx-08- + S-01-08-^A(!Fx.x)(V^M + r-xx-08- + S-01-08-^A(!Fx.x)(V^M + r-xx-16- + +Note that S packet is sent, received, and Ack'd OK. The F packet is sent but +is never Ack'd. Tried this several times and noticed that it's just +receiving that is screwed up, not sending. After ^C'ing out of the +transfer, I can still type commands, and they are executed on the far end, +but the results coming back are gibberish. Mon Jul 9 16:08:22 2007 (come +back to this later... substitute Dev.27 ttinl for current one and see if +the problem goes away, and if so, conditionalize the new code for clear-text +connections). + +Built C-Kermit with Kerberos 5 on Solaris with a version of ckutio.c that +uses the old ttinl() and transferred a file OK over a Kerberized connection. +So now it's just a matter of reconciling the old and new ttinl. The easiest +way to do this is to have new ttinl() chain to old ttinl() if the connection +is encrypted, which is what I did and it works fine. At some point the two +versions of ttinl() should be reconciled. ckutio.c, 12 Aug 2007. + +There was a function, islink(), used in only one place (ckuus6.c) that had +the same name as a commonly used scalar variable, and it was missing a +prototype. Changed its name to isalink() and added the prototype (Unix +only), ckuus6.c, ckufio.c, ckcdeb.h. 12 Aug 2007. + +Revisiting the ASCII and BINARY top-level commands, which are supposed to +be like in other FTP clients, but don't seem to have any effect. I added a +new routine to the FTP module, doftpglobaltype(), that sets the global, +sticky, permanent transfer mode (ASCII or BINARY) (TENEX could be added to +if anybody asks). These commands (now that they work) are different from +SET FTP TYPE { ASCII, BINARY }, which set the *default* transfer mode when +automatic switching fails for a given file. ckuusr.c, ckcftp.c, 12 Aug 2007. + (notify: Matt ) + +Even though the code hasn't changed, suddenly we're getting: + + "ckuusx.c", line 5682: warning: implicit function declaration: tgetent + "ckuusx.c", line 6183: warning: implicit function declaration: tgetstr + "ckuusx.c", line 6262: warning: implicit function declaration: tputs + "ckuusx.c", line 6266: warning: implicit function declaration: tgoto + +in ckuusx.c on Solaris 9. is still in /usr/include, dated 2002. +A quick search shows the missing functions are hiding in , which +until now was included only in Linux. Added a USE_TERM_H clause. No, that +doesn't help, the prototypes are not selected at compile time; there are +#ifdefs in that file that skip over these prototypes. I had to put them in +the code under #ifdef BUG999..#endif (I could have used a longer name like +#ifdef ADD_PROTOTYPES_FOR_CURSES_FUNCTIONS, but that would not be portable). +ckuusx.c, 12 Aug 2007. + +Also: + + "ckuusx.c", line 9232: warning: implicit function declaration: creat + +This is called in the IKSD dababase code, used for getting a lockfile. +creat() is a Unixism in code that is supposed to be portable. But IKSD only +runs on Unix and Windows, so I assume the Windows C library has a creat() +function. Anyway, suddenly the Solaris header files seem to have blocked +whatever path previously existed to the creat() prototype (which is in +), so I added an #include in the appropriate spot. ckuusx.c, +12 Aug 2007. + +Kermit functions for converting the number base -- \fradix(), \fhexify(), +\unfhexify() -- did not work with big numbers; ckradix() was missed in the +CK_OFF_T conversion. Fixed in ckclib.c, 12 Aug 2007. + +Updated the help text for ASCII, BINARY, and SET FTP TYPE to clarify the +semantics. ckuus2.c, ckcftp.c, 12 Aug 2007. + +Error messages were printed upon failure to open any of the four log file, +even with SET QUIET ON. Fixed in ckuus4.c, 12 Aug 2007. + +Built OK on NetBSD 1.3_RC3. Tried to build secure version but the libraries +had disappeared. 13 Aug 2007. + +Built OK on Mac OS X 10.4.9. Tried the secure version, macosx10.4+krb5+ssl. +Here we get the usual pile of "pointer targets in passing argument 1 of +(function name) differ in signedness", regarding security functions, but it +built OK. 13 Aug 2007. + +Reconciling the two ttinl's... On encrypted connections myread() returns +encrypted bytes; ttinl() has to decrypt them; it wasn't doing this in the +lookahead section so I fixed it. The new code works on both encrypted and +clear-text connections. I removed the chaining to oldttinl(), and +oldttinl() itself. ckutio.c, 13 Aug 2007. + + (Wouldn't it make more sense and be more efficient and less confusing + for myfillbuf() to do the decrypting?) + +When C-Kermit uses Zmodem as an external protocol, it doesn't seem to scan +files before sending them to set text or binary mode appropriately. It's +that external protocols bypass Kermit's whole "get next file" mechanism; the +(possibly wild) filespec is simply passed to the external protocol program. +Changing this would be a very big deal. But if only one file is being sent +(the filespec is not wild) it's easy enough to check. I added this to the +external protocols section of the protocol module. It can be overridden in +any of the regular ways (/TEXT or /BINARY switch on SEND command, SET +PATTERNS OFF, SET TRANSFER MODE MANUAL, etc). ckcpro.w, 13 Aug 2007. + +[FTP SEND /RECURSIVE] +Peter Crowley reported a problem with FTP recursive uploads getting the +directory tree wrong when the previous pathname was a left substring of the +new pathname (e.g. foo/bar/ and foo/bar2/). The logic did not handle this +case and created the bar2 directory as a subdirectory of bar, rather than as +a parallel directory. Fixed in syncdir() and tested with various edge cases. +ckcftp.c 14 Aug 2007. + + notify + +Added CD messages to FTP BRIEF display to track the ups and downs of +recursive uploads. ckcftp.c, 14 Aug 2007. + +The OUTPUT command gave a misleading error message ("Connection to xxx not +open") when used on a serial port that was, indeed, open but was not +presenting the Carrier signal, when CARRIER-WATCH was not OFF. Added a new +message for this, and some others. ckuus5.c, 14 Aug 2007. + +Sending from the command line, e.g. kermit -s foo, did not give an +informative error message if the file could not be found or opened. Fixed +in ckuusy.c, 14 Aug 2007. + +OK, back to ttptycmd.... It seems that back on March 27th, I got everything +working but I thought that there was still something wrong with it because +an unrelated problem so I put it aside. The version of ttpty.c from that +date worked OK, and it looks like I updated ckutio.c from it, but that +version of ckutio.c was put aside. Since then I have been working on the +ckutio.c version that was NOT put aside and so now I have to reconcile the +two: + + ~/80/ttypty/20070327/ckutio.c + ~/80/ckutio.c + +As a first cut I did this simply by replacing the contents of the #ifdef +CK_REDIR section of the latter with that of the former. Of course in +Solaris this comes up with openty() implicitly declared at compile time and +unresolved at link time. So the first task is to get HAVE_OPENPTY defined +for platforms that have it and have the others use the ttruncmd(). For +starters I put an #ifdef block in ckcdeb.h that defines HAVE_OPENPTY for +Linux, FreeBSD, NetBSD, OpenBSD, and Mac OS X. Ones that don't have +openpty() include AIX, HP-UX, and Solaris. Others like SCO I don't know but +I doubt it. The real solution is to get the ckupty.c module to work but one +thing at a time... This version is supposed work with secure builds on the +openpty() platforms, and on the others like Solaris, if an external protocol +is attempted on a secure (encrypted) connection, an error message is +printed and the command fails. ckutio.c, 14 Aug 2007. + +How to test? Apparently I did all my testing on Panix before, and that's +where all my Zmodem builds are, but now when I build a Kerberized version +(which works if I do it on the right pool host), it won't make a local +connection, and there is no other place I can connect to that has a +Kerberized Telnet server. I can, however, connect to Panix from here, using +the same code, but on Mac OS X... + +Slight detour: Got access to AIX again (5.3.0.0). Picky compiler, some +things needed fixing.... Also it says "1506-507 (W) No licenses available. +Contact your program supplier to add additional users. Compilation will +proceed shortly" and of course it goes kind of slow. For some reason, I +can't do streaming transfers into AIX over a local network (to its SSH +server), but windowed transfers are OK. Anyway, noting that we've been +using the same basic makefile target since AIX 4.2, changing nothing but the +version herald, I made a new target, simply "aix", that picks up the AIX +version automatically and sets the herald from it. Ditto for aix+openssl, +but on this host requires setting SSLINC and SSLLIB to /opt/ssl/include and +/opt/ssl/lib. Also the make program here was extremely sensitive to spacing +so I had to make some minor edits to get the link step to work for the SSL +version. ckuusy.c, makefile, 14-15 Aug 2007. + +Got rid of the special Panix secure NetBSD target, replaced it with a +regular one, which is invoked in the normal way by defining K5INC and K5LIB +to point to to where the stuff is hidden. Cleaned up and modernized the +comments in the makefile a bit. makefile 15 Aug 2007. + +Changed some data types and added some casts to ckctel.c to do away with +tons of "pointer targets in passing argument 1 of 'xxx' differ in signedness" +warnings. 15 Aug 2007. + +Set up Mac OS X as the testbed for ttptycmd(), with Panix as the remote +partner over a Kerberos 5 connection. The first test is to send a 300K +text file with gkermit as the external protocol. It worked fine, and the +debug log showed all the right components were active (namely encryption and +ttptycmd) [kermit/zmodem send/receive text/binary]: + + Kermit Zmodem + kst OK zst OK + ksb OK zsb OK + krt OK zrt OK + krb OK zrb Failed "rz: Persistent CRC or other ERROR" + +We've seen this before. The problem is 0xff, Telnet IAC, as I proved to +myself by constructing a 3MB file that contained every byte but 0xff in every +mixture and order and transferring it successfully over the same connection. +Presumably the Telnet server is doubling IACs, whereas of course rz is not +undoubling, thus the CRC error. This is progress. 15 Aug 2007. + +Log shows that indeed every IAC in the source file arrives doubled. Adding +code to remove the first IAC of every adjacent pair, a small test file with +different-length runs of IACs transfers OK. The 3MB all.bin file does not. + +Starting over... I can receive a big text file with Zmodem OK. The 3.2MB +binary test pattern that contains no IACs failed after 1.8MB, but the part +that it transferred was OK. A second try, almost the whole thing arrived, +it stopped just 584 bytes short of the end. Could be that file size is a +separate problem. Making a new copy exactly 1MB long... Well, that's +interesting, this one too stopped just short of the end. And again, the +same thing. When connecting back to the host, the last Zmodem packet can +be seen on the screen; it's as if the local Zmodem exited before reading +the last packet... But OK, if I change the options on the remote sz +sender to use small blocks, etc, then it works. + +Now, changing from the 1MB no-IAC-binary test pattern, to the 1MB all-values +test pattern, we fail after 81K. But the part that was transferred is +correct. Second try, same thing, but 57K. Third: 40K. Each time, upon +connecting back, the session is completely dead. + +IF I HAVE TO undouble IACs for incoming files, don't I have to double them +going out? To send a block to net we just call ttol(), but ttol() doesn't +do any doubling (because Kermit protocol always quotes 0xff). To see what +happens, I changed the ttol() call to ttoc() in a loop that doubles IACs. I +tested this by sending the full 3.2MB test pattern, which worked fine. + +For receiving, it's slow but it works OK with files that don't contain IACs +(my concern was that IACs might appear in outbound files or in Zmodem +protocol messages). It receives the 1MB no-IAC test pattern, so there are +no problems with protocol or timing. But the full test pattern always gets +cut off, but at different points, as before, with the remote session dead. +Changing the Zmodem receiver from rz to lrz on the local end (since the +sender on the remote end is lsz) does not change the behavior. + +Anyway, I went back and replaced the byte loop with something more +efficient, and it goes about 20 times faster. But this doesn't help either, +it only makes it fail faster. But aha, what if a doubled IAC is broken +across successive pty reads -- we have to make the "previous character" +memory persistent. Well, that was a good insight, but it still didn't fix +it. The log shows the IAC handling code is working fine. + +What does sz say? Capturing its stderr to a file... "Retry 1: Got ZCAN". +Next time: "Retry 1: Got TIMEOUT". Next time: Got ZCAN. + +Trying different Zmodem options... apparently I don't need to use short +blocks. But I do need to use -e, probably because of Telnet NVT treatment +of carriage return; without -e, there is a "persistent CRC error". -O +disables timeouts, but this makes no difference. + +OK, we still have two Big Problems: + + 1. When a long file has no IACs, the final < 1K of the file is not received. + 2. When a long file has IACs, the transfer generally stops very early. + +Problem 1: the transfer consistently fails less than 1K from the end of the +file. Upon CONNECT back to the host, a big Zmodem packet is sitting there +waiting to be read, which means ttptycmd()'s copy of rz is terminating +early. Can we catch it in the debug log? Doing this takes forever and +writes a GB to the disk... And then the problem doesn't happen. Also, I +can receive a HUGE text file almost instantly with no errors at all. + +Switching to lrz on the receiving end, now I see the error messages, about +300 lines like this: + + Retry 0: Garbage count exceeded + Bytes received: 872352/1000000 BPS:85464 ETA 00:01 Retry 0: Bad CRC + Bytes received: 892448/1000000 BPS:86690 ETA 00:01 Retry 0: Bad CRC + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Retry 0: Got ERROR + Bytes received: 898336/1000000 BPS:84293 ETA 00:01 Retry 0: Bad CRC + Retry 0: Garbage count exceeded + Retry 0: Garbage count exceeded + Bytes received: 900384/1000000 BPS:83751 ETA 00:01 Bad escape sequence + 2fRe + try 0: Bad data subpacket + Bytes received: 941472/1000000 BPS:86191 ETA 00:00 Retry 0: Bad CRC + Retry 0: Garbage count exceeded + +Even when it succeeds, it gets these. But if I receive a text file, no +matter how big, no errors or retries or timeouts at all. So it appears that +there is only one problem: a big-time lack of transparency regarding 8-bit +and/or control characters. The odd thing is, it's not that the characters +can't get through -- they all can -- but they seem to cause transitory +blockages. 16 Aug 2007. + +Cleaned up the remaining pointer signedness warnings in ckutio.c, but this +was a mistake, it broke Kerberos connections completely. Undid the changes. +ckutio.c, 17 Aug 2007. + +Changed all return() in the fork()==0 section of ttptycmd() to exit(). +ckutio.c, 17 Aug 2007. + +Tried explicitly setting the slave pty to rawmode. Makes no difference. +Tried using the Mac OS X (curses) raw() function, and also system("stty +raw"); still no difference. Tried doing all of these in different +combinations and orders. I found one combination that cuts the errors about +in half, and the transfer of the no-IAC test pattern almost always succeeds +(but it's slow). Anyway, it doesn't help much with the test pattern that +contains IACs. Well, the code is more solid than it was before but +functionally we have not advanced much if we can't download a binary file +with Zmodem! On the other hand, we can upload them, and we can transfer +text files in both directions, which is an improvement over the previous +situation, in which the entire session would hang due to loss of +synchronization of the encryption stream. + +Tried adding -funsigned-char to CFLAGS of Mac OS X target. It does not +make the "signedness" warnings go away and it doesn't change the runtime +symptoms. + +I tried a simpler version of pty_make_raw(), the one from Serg Iakovlev, but +it was a total failure. That's encouraging though, because it indicates +that pty_make_raw() is the right place to be working. + +Then I made pty_make_raw() set or unset every single terminal flag +explicitly. This made no difference, but didn't hurt anything either. + +Then I made pty_make_raw() explicitly set all the c_cc[] characters to 0 +(but left c_cc[VMIN] as 1). This made no difference either. + +I checked pty_make_raw() against ttpkt() and the only difference I found in +the terminal flags is that ttpkt() sets IGNPAR thinking it means "ignore +parity errors" when really it means "discard any character that has a parity +error" (at least according to Iakovlev) -- exactly the opposite. But I +tried it both ways, no difference. 17 Aug 2007. + +I noticed that even Zmodem text receives can fail. They don't get any +errors, they just get cut off shortly before the end. (But usually they +succeed, and fast too, like 500K cps). + +What if I don't call pty_make_raw() at all on the slave pty? + +zrt: EESSSSSSSS: 80% good (E = stopped just before end but no other errors) + +zrb no-IAC test pattern, short blocks: + 1. S/5 (success with 5 screens of errors. + 2. S/7 + 3. S/7 + 4. S/6 + 5. E/7 (failed just before end) + 6. S/7 + 7. S/6 + 8. S/6 + 9. S/6 +10. S/4 + +So, lots of errors, but it recovered 90% of the time. +Next, same thing, but without requesting short blocks: + + 1. E/5 + 2. S/5 + 3. E/4 + 4. S/5 + 5. S/5 + 6. S/5 + 7. X/0 (hard failure right away: "Got ZCAN" + 8. S/5 + 9. S/5 +10. S/5 + +So it doesn't look like short blocks make that much difference. Now what if +I turn off prefixing? Bad CRC, fails immediately every time. Putting back +pty_make_raw(slave), it still fails hard. + +Tried a new strategy with pty_make_raw(): rather than modify existing flags, +I set all flags to 0, and then turn on only those few that we need like CS8. +Now we get only 2.5 screens of errors instead 4-7 and the transfer rate is +higher for binary files (all of the previous ones were under 100K CPS, while +for text files it was 400-500K CPS): + + 1. S/2 195669 CPS + 2. S/2 194720 + 3. E/3 + 4. S/2 192550 + 5. S/3 192325 + 6. S/3 145066 + 7. S/2 200689 + 8. S/3 188948 + 9. S/2 209461 +10. S/3 181991 + +I noticed that there was no TIOCSTTY ioctl in the pty/fork setup sequence, +which is recommended somewhere, so I tried that and it was a disaster; the +entire session hung. I took it back out. 18 Aug 2007. + +Tried some transfers over a clear-text (not encrypted) connection with the +same results: smooth, fast transfer of a big text file (400K cps); rocky but +successful transfer of the no-IAC binary pattern file (135K cps). Switching +back to ttruncmd(), the same binary file is received at 1.5M cps, and the +no-IAC binary file totally fails after too many "Bad CRC"s; and we already +know that any file that contains IACs will fail. One might say that +ttptycmd() is better in every respect than ttruncmd() except in speed +(when it works). + +Let's see if ttyptycmd still works in remote mode (to local K95): + . sz / text works, but slowly. + . lsz / text works but some wierd errors are reported. + . lsz / binary / no IAC doesn't work at all (CRC-32 mismatch for a header; + Unexpected control character ignored: 13, etc). + . sz / binary / no IAC works OK but slow. + . sz / binary / full test pattern with IAC works OK but slow. + . Sending text into rz fails completely. + +What about ttruncmd() in remote mode? + . send /text works, fast. + . send /binary works, fast. + . receive /text works, not so fast but not bad. + . receive /binary works, not so fast but not bad. + +So we use ttruncmd() for remote mode, and we use it for local mode +serial-port and modem connections, and we use ttptycmd() on network +connections because (a) they might be encrypted, and (b) even if they are +not, they use some protocol that we have to handle, e.g. Telnet, Rlogin. +19 Aug 2007. + +Discovered that Sending binary files no longer works. Text is OK, binary +transfers don't even start. This happens on both encrypted and clear-text +connections. ttptycmd() is being used in both cases. But oddly enough, +receiving binary still works as before. What did I break, and when? +Oh, it was just the script, when I changed it from using sz to lsz. Putting +it back to sz makes it work, even with the full 3.2MB binary pattern with +IACs. + +I backed off the changes I made to ckctel.c to suppress some warnings, in +view of the fact that similar changes to ckutio.c broke things so badly. +19 Aug 2007. + +If sz is not given the -e flag, it sends control characters bare, except ^P, +^Q, ^S, and ^X. ^X is the control prefix, so ^A is sent ^X followed by A. +With -e, all C0 control chars are prefixed, but with ^X, which is, of +course, a control character. Interestingly, the C1 analogs of ^P, ^Q, ^S +(but not ^X and, unfortunately, not IAC) are also prefixed. -e makes no +difference for 8-bit characters. + +If we have a Telnet connection and the server is in ASCII (NVT) mode, CR is +always followed by LF or NUL. Well, it seems the server is putting us +(Kermit) in binary mode in this case, but staying in ASCII mode itself. +Added code to handle NVT byte stuffing and unstuffing in each direction +independently, according to the TRANSMIT_BINARY state in that direction. I +made a file containing just the bytes 0-31 and 127 and 128-159 and 255 (66 +bytes all together) and sending it from the host to C-Kermit, the local log +shows that every control character was received correctly and all TELNET +conversions were done right -- NUL removed after CR (and only after CR); IAC +removed after IAC (and only after an IAC meant as a quote). For the first +time, I can receive the 1MB all-values test pattern, but there are still +tons of (correctable) CRC errors, so the transfer rate is really awful, like +about 5% of what we get with a text file (25Kcps instead of 500). + +Further experimentation shows that the fundamental transparency problem is +fixed; we can receive short files (say, 1K or less) containing absolutely +any byte values in any combination with no errors at all. But once the file +size reaches (say) 10K, we get CRC errors, like one every 2 or 3K of data. +These are not deterministic. In successive transfers of the same file, they +come in different spots. It's tempting to blame pty buffer overruns, but +then text files would show the same behavior. When a binary file size +exceeds, say, 1MB, the chances of successful completion go way down, +independent of whether my external protocol is rz or lrz. I like lrz better +because the error reports come out on the screen as the transfer is going +on. Trying to download a real-world binary file -- a 2.2MB C-Kermit +executable -- I get 4500 error messages but the transfer evenually succeeds, +with an effective throughput of 21Kcps. + +Actually it turns out that "sz -a somebigtextfile" (2.2MB) also gets a lot +of CRC errors. The -e flag (escape all control characters) makes the same +big text file transfer with few or no errors. It's not sure-fire. +Sometimes no errors, sometimes one or two, and sometimes a fatal error that +kills the transfer. + +With binary files... a 32K binary file seems to make it every time. 40K +fails about 50% of the time. 48K fails 60% and every time it fails, it has +created a partial file of exactly 32K (32768 bytes). 96K fails 9 out of 10 +times, when it fails, the partial file is always 0 bytes, or 32768, or +65536, but that just means that rz's file output buffer is 32K. + +Why, then, do binary files cause trouble if it is not a solid transparency +problem? If a certain file can get through once, why can't it get through +every time? When a character arrives at the pty, the pty driver probably +takes a different path through its code, checking the terminal flags that +would affect that character. I tried making Kermit's network read buffers +very small but, surprisingly, this made things worse. I also tried making +them very much bigger, which didn't help either. 24K still seems to be the +right size. + +So, is it that some characters take longer to process than others? So long +that data is lost due to lack of flow control between TCP and the pty? One +way to test this theory is to slow Zmodem down. I tried "-l 32" which, +according to the man page, tells sz to "wait for the receiver to acknowledge +correct data every N (32 <= N <= 1024) characters. This may be used to +avoid network over-run when XOFF flow control is lacking." Makes no +difference. I also tried the -w (Window) switch, ditto. In fact there are +all sorts of options to set the "window size", "packet length", "block +size", and "frame length", but with no explanation of what these mean or how +they are related. If I crank everything down to minimum value: + + lsz q -L 32 -l 32 -w 1 + +I get 50% success with the 96K file instead of 10%. Adding -e, oddly +enough, made it worse. I also tried setting the environment variable +ZNULLS to different numbers like 512, no help there either. + +I tried making the read-from-net-write-to-pty buffer small (1K) but leaving +the pty-to-net one big. This improves chances of success, but it's +intolerably slow (3Kcps when the connection is capable of 500K). + +I also changed the write-to-pty operation from a single write() call of +possibly many K characters to a byte loop, one write() per byte. Same +result: success (but still about 300 recoverable errors), throughput 3Kcps. +20 Aug 2007. + +With ttptycmd() configured to write to the pty in a byte loop, it is +possible to delay each write. Adding a 10msec delay per character results +in a transfer that runs at about 20 cps and (for the 96K test file) would +take about 80 minutes to complete. And yet it still gets just as many +errors. So it's not a matter of timing either. The errors come, on +average, every file 388 bytes, but not at regular intervals. + +I tried the TIOCREMOTE ioctl on the pty master, as discussed somewhat +obliquely in the Mac OS X "man pty" page; "This mode causes input to the +pseudo terminal to be flow controlled and not input edited (regardless of +the terminal mode)" -- sounds like just the ticket but it made no +difference. Actually, looking at a man page on another OS (Solaris), it +says this is only for lines of text, EOLs are supplied, so that would mess +up the protocol. So remember: don't use this. + +Tried without O_NDELAY; the behavior was the same but the speed was much +slower. + +Tried switching back to the ckupty.c routines on Mac OS X and found that it +works now the same as with openpty(), except that I seem to get more getty +babble at the end. But this means I can run some tests on Solaris. I moved +the entire test environment from Mac OS X 10.4.9 to Solaris 9. But it +doesn't work at all. + +Trying to figure out the ckupty.c modules again. + . do_pty() calls pty_getpty() which returns in arg1 the fd of the pty master. + . Then it creates a pipe as a way to tell when the child dies + . Then it creates a fork: + - The parent does a blocking read from the pipe + - The child calls getptyslave() to get the pty slave + and writes one byte to the pipe + and then execs the command it's supposed to run +Note that the file descriptor of the slave is known only to the lower fork. +Therefore the lower fork is the one that has to set all the tty modes, etc. +I took care of all that but the ckupty.c method doesn't work at all on +Solaris. But it works "fine" on Mac OS X (the 32K all-bytes test file +transfers instantly with no errors, but the 96K one errors out). + +The problem on Solaris is that pty_make_raw() fails on the masterfd (but not +on the slavefd) with errno 25 "ioctl inappropriate for device". It doesn't +matter whether I do it in ckupty.c or ckutio.c. I found a web page on +kde.org that says Solaris does not allow tcget/setattr() on a pty master. +But the Sun "knowledge base" is not open to the public. Well, presumably +changes made to the slave are reflected in the master (comments in Solaris +telnetd seem to confirm this...) Let's come back to Solaris later. + +Moving to a Linux with lrzsz installed... Built a Kerberos 5 version with +USE_CKUPTY_C. Like on Mac OS X, it transfers short files OK and chokes on +longer ones. Switched to openpty(), it behaves the same. So the problems +on Mac OS X are evidently not OS-specific, which is good I guess, since that +means finding the way around them will apply to more than one platform. +21 Aug 2007. + +Look into TIOCSCTTY again. On System V based OS's, opening a pty acquires a +controlling terminal automatically. On BSD-based OS's, no; you have to use +the TIOCSCTTY on the slave file descriptor to give it one. I'm not sure why +a controlling terminal would be needed, except that without one, the virtual +device "/dev/tty" does not exist for the process that runs on the pty, and +maybe the application that runs there (e.g. rzsz) checks for it. On the +downside, having a controlling terminal opens the process up to terminal +interrupts like SIGINT and SIGQUIT. Until now I have not been using this +ioctl(). Results (in Linux): + + With TIOCSCTTY: 96K all-bytes test: 11 screens of errors, then success + Without TIOCSCTTY: exactly the same. + +Tried the same thing with TIOCNOTTY instead of TIOCSCTTY, with exactly the +same results (no effect whatsoever). + +There has to be a way to make this work, because Zmodem works through +telnetd, which basically the same thing as ttptycmd(): a relay between the +network and a pty. ttptycmd() is like telnetd backwards. Modern telnetds +are not much help; they don't access ptys or the network directly, they go +through "mux" devices so I can't see what they're doing to get transparency +and flow control. An old BSD telnetd uses packet mode but that would be a +big deal... + +I tried ignoring various signals like SIGTTOU and SITSTP, since some Telnet +clients do this. No effect, no difference. Anyway, in Linux the transfers +almost always finish OK despite the many errors. There is just some trick +I'm missing to make the pty accept a stream of arbitrary bytes without +hiccuping. + +What about Solaris, which uses ckupty.c? In streams-based OS's, where line +disciplines and whatnot are pushed on top of the pty, it looks like the pty +module saves the file descriptor of the "bare" slave pty (as 'spty') before +pushing things onto it, and then later uses spty rather than the regular +slave pty file descriptor when getting/setting terminal modes. I'm not sure +what this is all about but it's definitely SysVish... It happens if +STREAMSPTY is defined, but I noticed that STREAMSPTY is never defined +anywhere. I tried defining it so we take an entirely different path through +the code. It made absolutely no difference. + +Then I noticed that HAVE_STREAMS is not defined for Solaris either. Tried +defining it, but the session didn't work at all, no i/o. Removing the +HAVE_STREAMS definition but keeping the STREAMSPTY defined, I rebuilt and +tried "set host /connect /pty emacs". I got an EMACS screen but could not +type anything into it, which means that STREAMSPTY should not be defined +either. Removed the definition and "set host /pty" works again. So what's +the problem with ttptycmd()? + +In fact, ttptycmd() works on Solaris with Kermit as the external protocol, +but not with Zmodem, not even with text files. So again, there is no +fundamental problem with the code or the logic, it's Just A Matter Of +Transparency to control and/or 8-bit characters -- some trick I don't know +about. + +Looking at the Solaris debug log... I see that ckupty.c is calling +init_termbuf() to set the tty modes of the master, not the slave, and +set_termbuf() to set them, but you can't do that in Solaris, error 25. This +is in getptyslave(). Shouldn't getptyslave() be setting the tty modes of +the slave, not the master? I changed it to do this, but like all other +changes, it made no difference. I checked to make sure that after the change, +"set host /pty /connect emacs" still worked and it did. + +And then what... I had some code to redirect stderr in ckupty.c that was +not being executing due to a typo. When I fixed the typo, poof, Zmodem +binary transfers started working, or working as well as they work in Linux +and Mac OS X. It turns out that if I don't redirect stderr, sz and rz +just don't work. But lsz and lrz do. But if I do redirect it, I don't see +the progress messages from lsz/lrz. 22 Aug 2007. + +Built on HP-UX 11i v3 (B.11.31 U ia64) with optimizing compiler, got tons of +picky warnings, but it finished and linked and runs OK. Many of the +warnings were like this: + + "ckucns.c", line 1606: warning #2068-D: integer conversion resulted in a + change of sign: tnopt[0] = (CHAR) IAC; + +IAC is defined as 255 in ckctel.h. If I define it as 0xff, I don't get the +warnings. I changed the definitions of all the Telnet commands to be in hex +notation rather than decimal. If cuts way down on the HP-UX warnings and +doesn't seem to cause problems elsewhere. ckctel.h, 23 Aug 2007. + +Now it looks like Solaris is working but then it hangs at the end. It +appears as if the ckupty.c module is blocking SIGCHLD. Debug log shows that +when the transfer is complete, we received IAC DM (Telnet Data Mark) after +sz's last gasp and before the shell prompt is printed. But calling +tn_doop() in this case is a mistake because we are reading the number of +bytes that we know are available in a counted loop, but tn_doop() would +consume an unknown number of bytes and we would never know when to exit the +loop. Anyway, C-Kermit doesn't do anything with DM. Skipping over +tn_doop() (and not writing out the Telnet command bytes) fixes the hanging +condition at the end, even though SIGCHLD is never raised. ckutio.c, +23 Aug 2007. + +Some tests, Solaris to NetBSD over K5. +zst sends ascii.txt, a 2.36MB ascii text file (Kcps / Errors). +zrt receives the same file: + + zst 587/0 526/0 542/0 434/0 423/0 + zrt 827/0 800/0 847/0 FAIL 610/0 + +So text is good. Binary not so good. Here we transfer the 1MB all-bytes +pattern file. zrb receives it successfully, but with 1248 errors, at only +15Kcps. Sending the same file out always fails: + + Begin 20070823 16:32:07: SEND BINARY all2.bin [sz] + Sending: all2.bin + Bytes Sent: 5600/1000000 BPS:12446 ETA 01:19 FAILURE + End 20070823 16:32:13 + Elapsed time: 6.617992999999842 + cps = 151103.2121067556 + lsz: caught signal 1; exiting + +Decided to move to Linux but found that something is screwed up in Linux +C-Kermit with tilde expansion: + + send ~/testfiles/all.bin + +doesn't expand at all (but it did yesterday!). The problem was in the +ancient, ancient realuid/setuid handling code; real_uid() no longer works in +Linux. I worked around this in whoami() by setting ruid to getuid() if +real_uid() returned a negative number. Maybe dangerous, worry about it +later. ckufio.c, 23 Aug 2007. + +ANYWAY... after fixing that, I tested zsb on Linux, and it's broken there +too, using openpty(), so it's nothing to do with ckupty.c. After sending +the first Zmodem data packet, it just hangs, nothing comes back. In text +mode it gets farther, but then the same thing happens. Captured stderr from +rz on the far end: + + Bytes received: 608/1000000 BPS:21137 ETA 00:47 Retry 0: Bad CRC + Bytes received: 864/1000000 BPS:23540 ETA 00:42 Retry 0: Bad CRC + Bytes received: 1120/1000000 BPS:25003 ETA 00:39 Retry 0: Bad CRC + Bytes received: 5696/1000000 BPS:56988 ETA 00:17 Retry 0: Bad CRC + Bytes received: 9120/1000000 BPS:62227 ETA 00:15 Retry 0: Bad CRC + Bytes received: 9376/1000000 BPS:60766 ETA 00:16 Retry 0: Bad CRC + Bytes received: 9632/1000000 BPS:60361 ETA 00:16 Retry 0: Got TIMEOUT + Retry 0: Sender Canceled + Retry 0: Got ZCAN + +The local sz, however, doesn't give any error message. ZCAN means: "other +end canceled session by sending 5 ^X's" (or user typed them). What actually +happens is that ttptycmd()'s select() times out waiting for something from +the Zmodem partner and ttptycmd() itself kills the sz fork with SIGHUP. +When lsz receives SIGHUP it sends the ZCAN. So the real problem is that +after some point we're not receiving anything. + +I changed the timeout from 4 seconds to 30 seconds and now I see it just +stops for long periods of time and then resumes. The lrz log on the +receiving end shows tons of timouts, CRC errors, and other errors. The +local log shows that lsz wound up sending ZCAN (2 x (10 x ^H, 10 x ^X)). + +Moving on to another problem... Turns out Ctrl-C (SIGINT) is working right +after all. Since I'm using my test scripts like kerbang scripts, Ctrl-C +exits through trap(), as it should, closing the connection and cleaning up. +If I start Kermit and tell it to TAKE the script, then Ctrl-C brings me back +to the prompt with the connection still open (as it should). However, until +now I haven't done anything about the fork or the ptys. Added code to +trap() to kill the fork and close the master pty. ckuusx.c, 24 Aug 2007. + +Added code to try to break the deadlock. If select() times out, but we have +stuff to write either to the pty or the net, try to do it anyway, even +though select() did not say we could. But this doesn't help because when +select() times out we don't have anything to write. The problem is that +after receiving that last packet from the remote rz, the local lsz doesn't +seem to do anything, as if the lower fork wasn't running (and to confirm +this hypothesis, sometimes I noticed that when I Ctrl-C'd out of this, the +transfer would take off again). + +Backing up and testing with gkermit rather than zmodem: + + kst ripple.txt [824K] OK + kst ascii.txt [1359K] OK + krt ripple.txt -- FAILED + +It seems that we can't handle streaming. If I set up krt to disable +streaming on receipt, it works OK. + + krt ripple.txt [824K] OK + krb all2.bin [1000K] OK + +So here we have no trouble sending but big trouble receiving unless we +disable streaming. Whereas with Zmodem we have trouble receiving. + +But this wasn't happening before, what changed? Using C-Kermit on the far +end to receive the file with debug log on, I see that it is sending 4K data +packet after 4K data packet, with the local gkermit silent, as expected. +About midway through the transfer, the local Kermit sends an error packet +"Transmission error on reliable link". Looking at G-Kermit's debug log... +It receives the first five 4K data packets OK, but gets a CRC error on the +fifth one, and sends the Error packet. So it has received a stream of +20-some thousand bytes OK and then messes up. That number sounds a lot like +ttptycmd()'s buffer size. I changed the buffer sizes to be different: + + Read from pty and write to net: 4K + Read from net and write to pty: 1K + +This time it received the first 4K packet and failed on the second one. +Then I increased the buffers to 98K each, expecting to receive lots more +packets successfully but it bombed out on the 5th one. But that's good, it +confirms there's no logic error in the buffer management. Just to make +sure, though, let's set the buffer size smaller than the packet size and +disable streaming. In this case we get 4 good data packets and a CRC error +on the 5th one and so we request retransmission, and the next 8 times it +arrives it gets a different CRC error, but the 9th copy is OK. Then the +next packet comes and it gets a CRC error every time. And this is nothing +but plain ASCII text. + +Switching to remote mode: + + REMOTE=1 kk kst + +(after tricking myself because it was using ttruncmd() for this...) I see +that nothing works at all. What did I break? 24 Aug 2007. + +Fixed ttptycmd() to restore console modes after a remote-mode transfer. +ckutio.c, 25 Aug 2007. + +Noticed that error codes like ESRCH are not available in all modules. +That's because of some complicated in #ifdefs in ckcdeb.h that wind up not +always #including . But I notice that ckutio.c includes it +unconditionally with no ill effects, and so does ckvfio.c. Does any version +of Unix at all not have ? Added a catch-all clause to ckcdeb.h to +#include (in UNIX only) if, after the other clauses, ESRCH was +still not defined. ckcdeb.h, 25 Aug 2007. + +Now back to debugging ttptycmd()... Remote-mode transfers with ttptycmd() +were broken in two places, maybe as long as 2 weeks ago (this would have +affected non-network transfers too, which I can't test any more). +The logic was missing in a couple places for the non-network and/or +non-Telnet and/or non-encrypting connections (if statements with no else +parts). Fixed in ckutio.c, 25 Aug 2007. + +Testing remote mode: + + kst OK zst OK + ksb OK zsb OK + krt OK zrt OK + krb OK zrb OK + +Functionally it all works but there are hitches with Zmodem as always. +When sending to K95: + + . If I send with lsz, there are hundreds of "Subpacket too long" errors, + and the transfer is very slow, but it succeeds. + + . If I send with the 1994 Omen version of sz, transmission is instantaneous + and without errors, but then it hangs at the end. + + . If I bypass C-Kermit and send direct from lsz or sz, both work fine. + +So clearly the ptys are getting in the way. The hanging at the end would be +caused by the sz process closing before its last output reached the master +pty. It would need to do some form of flushing and/or pausing at the end +but there's nothing I can do about that; these programs were not designed to +be used in this way. Anyway, it only seems to happen with files longer than +100K. + +For local mode, testing in Solaris over our Kerberos 5 connection again: + + gkermit lrzsz + kst OK zst FAIL + ksb OK zsb FAIL + krt OK zrt OK but with errors + krb OK zrb FAIL + +If I use Omen rzsz as the external protocol (e.g. with zst), it blocks +redirection and it sends the file to my terminal, rather than over the +connection. This would probably be because it finds out the device name of +the job's controlling terminal and opens it, to prevent redirection. This +is hard to prevent in Solaris because there is no TIOCSTTY ioctl(). +Supposedly the same thing is accomplished by closing and reopening the slave +pty after doing setsid(). I added code to do this, but it made no +difference. (If I use lsz instead of sz, it is indeed redirected, but jams +up after about 15K.) ckupty.c, 27 Aug 2007. + +On Mac OS X with sz 3.73 1-30-03, however, the redirection works, so I +assume it would also work in Linux, FreeBSD, NetBSD, etc, too. Doing the +full test suite on Mac OS X: + + gkermit lrzsz rzsz + kst OK zst FAIL (1) OK + ksb OK zsb FAIL (2) OK + krt OK zrt OK (3) OK for 100K file, fails for longer. + krb OK zrb FAIL (4) OK (1MB all-bytes test pattern) + +(1) 64K file OK every time; 100K file fails every time. +(2) 10K file fails every time. +(3) Succeeds with 800K file but gets a few recoverable errors. +(4) Succeeds with 48K binary file with some errors, fails with longer ones. + +So actually it looks pretty good, it's just that lrzsz messes up. When +sending with lsz if I include -L 512 it sends the 100K test file with no +errors, but still chokes on longer ones. + +Testing on Mac OS X again, but this time over a clear-text Telnet connection: + + gkermit lrzsz rzsz + kst OK zst FAIL(1) OK + ksb OK zsb FAIL(2) OK + krt OK zrt OK(3) OK + krb OK zrb FAIL(4) OK + +(1) Almost worked, finished 777K out of 824K without errors. +(2) Got tons of errors, failed in first 30K out of 1000K. +(3) OK for 100K file but fails for larger. +(4) OK for 48K binary fail but fails for larger. + +Maybe see if we can do without the OPENPTY part. + +TOMORROW -- just clean up the code, add some SET / SHOW / HELP commands, +document it, and move on. + +Note: In K95, SET WINDOW sets the Zmodem packet length, 32 - 1024, multiple +of 64. + +SEE ~/80/external.txt + +Changed ftp port from int to unsigned int. ckcftp.c, 30 Aug 2007. + +Tried again to build KRB4/KRB5/SSL/TLS version for Solaris 9. Had to update +the build procedure again, of course, because of new file and directory +names, but ran into problems anyway because the +cu-solaris9g+krb5+krb4+openssl+shadow+pam+zlib target was calling another +target that did not know about the hardwired pathnames. Integrated the two +targets and tried building again. It actually compiled ok (but with lots of +warnings from the security modules), but failed at link time with +krb5_init_ets not found; fixed that with an #ifdef NO_KRB5_INIT_ETS, now it +builds OK but without the ftp client. Tried building it WITH the FTP and +that was OK too, no changes needed except to the build procedure. 12 Feb +2008, that is: C-Kermit 8.0.212 : 20080212. + +Tried to build with -DCK_SRP and -lsrp but: + + hash_supported ckcftp.o + hash_getdescbyname ckcftp.o + hash_getdescbyid ckcftp.o + cipher_getdescbyname ckcftp.o + krypto_delete ckcftp.o + krypto_new ckcftp.o + cipher_supported ckcftp.o + krypto_msg_priv ckcftp.o + krypto_msg_safe ckcftp.o + hash_getlist ckcftp.o + cipher_getlist ckcftp.o + cipher_getdescbyid ckcftp.o + +Sent mail to Tom Wu and backed off for now. makefile, 14 Feb 2008. +(Tom Wu never answered; seems like SRP is defunct.) + +The ".blah = xxx" form of variable assignment only worked for variables +names of length 22 or less, noticed and fixed by Wolfram Sang. ckucmd.c, +5 Mar 2008. + +In "set host /pty ssh ..." connections, the INPUT command suddenly stopped +working. This is in Solaris 9. It happens with all 8.0.* versions of +C-Kermit, so it's nothing to do with ttptycmd(). Added some debug() +statements but they don't show anything. Turns out there wasn't a problem +after all. Wed Mar 26 16:04:53 2008 + +Changed cmifi() to not print "?No files match" (or whatever) if SET QUIET ON. +ckucmd.c, 26 Mar 2008. + +Added \v(remoteip) for the IP address of the host we're connected to, +and \v(inmessage) for INPUT status messages corresponding to \v(instatus). +ckuusr.h, ckcmai.c, ckuus[24].c, 26 Mar 2008. + +Made \fkeywordval() strip braces/quotes from the right-hand side so we can +handle things like: + + password="stringwithspaceatend " + +ckuus4.c, 6 Aug 2008. + +Added invisible PUTENV command for UNIX only. Value should not be enclosed +in doublequotes. Requires lge \v(buildid) 20080826. ckuusr.[ch], 26 Aug 2008. + +Added SET VARIABLE-EVALUATION { RECURSIVE, SIMPLE }. This is highly +experimental, but also highly desirable if it works out. SIMPLE inhibits +the default recursive method of evaluating \%x and \&x[] variables, which +is, quite frankly, nuts and makes programming in Kermit at best +counterintuitive. I made an exception in the case of array subscripts, +because changing how they are evaluated could break a lot of scripts, and +anyway there should never be any harm in evaluating them recursively because +their final value is always (or should be) numeric, not some string that +might contain backslashes. The SET VAR setting is on the stack, just like +SET QUIET (it follows the quiet/xquiet code in ckuus[356].c), so macros or +command files that change it can't break the script that invokes them. +Added \frecurse() to force recursive evaluation of a \%x or \&x[] variable +regardless of the VARIABLE-EVALUATION setting. Added \v(vareval) to allow +programmatic setting to current setting. Tested on Solaris 9 but should be +totally portable. ckuusr.[ch], ckuus[356].c, 11 Sep 2008. + +From Günter Knauf: 64-bit builds were failing on SuSE Linux because +libresolv and libcrypt were in lib64 rather than lib; updated the tests in +the linux makefile target to find them. makefile, 12 Jan 2009. + +Tried building on Red Hat Enterprise Linux Server release 5.3 64-bit. +There is no curses or ncurses. "make linuxnc" compiled OK but collapsed at +link time looking for crypt(), res_search(), and dn_expand(). Turned out +the linuxnc (and linuxc) targets needed the same treatment as the Linux one +for 64-bit Linuxes. makefile, 3 Mar 2009. + +Consolidated the linux targets so we no longer need three separate ones for +curses, ncurses, and no curses. "make linux" works ok on computers with and +without (n)curses. "make linux+ssl", ditto. "linux+krb5+ssl builds OK but +needs -DNO_KRB5_INIT_ETS". Makefile, 3 Mar 2009. + +Fixed copyright date announced in herald, ckuus5.c, 3 Mar 2009. + +Patch from Seth Therault to avoid deprecation warning for utmp references +in ckufio.c in Mac OS X 10.5 (later, this became a consolidated makefile +target that works automatically for at least Mac OS X 10.3.9 through +10.5.6). makefile, ckufio.c, 28 April 2009. + +zshcmd() (the function used by RUN and ! to run external commands) was not +falling back as expected in Linux RHEL4/5 if SHELL was not defined in the +environment. Also in all Unix versions, there was no indication if a RUN/! +command failed (other than the return code) because the specified shell +didn't exist or was not executable (e.g. the SHELL environment variable was +misdefined). Now it prints the name of the offending shell and the reason +it couldn't be executed (Not found, Permission denied, etc). ckufio.c, +28 April 2009. + +There is no easy way to get the last field of string; for example, the +extension from a filename, which might have any number of fields. In +general we want to be able to get "word number n" counting from the right; +\fword() lacks this ability. Now if you give it a negative word number, +that says to count from the right; for example \fword(one two three four +five, -2) returns "four". ckclib.c, ckuusr.c, 14 May 2009. + +Fixed a typo in the aix51+openssl (SSLLIBS should have been SSLLIB). +From Jason Lehr. makefile, 27 May 2009. + +Updated the linux+openssl+zlib+shadow+pam target to chain to the new main +Linux target. A bunch of other ones remain un-updated. makefile, 12 Jun 2009. + +Updates to the new Mac OS X 10.5 target from Seth Therault (which is +supposed to work on all Mac OS 10-point-anything) to avoid warnings +that came up on on Mac OS 10.4.11/Intel. Once this one is proven we should +be able to remove/consolidate lots of other ones. makefile, 12 Jun 2009. + +C-Kermit disables SSL with the message "?OpenSSL libraries do not match +required version." if the version of OpenSSL that Kermit was built with is +not exactly the same as the version that is loaded dynamically at runtime. +This is actually the proper behavior, since APIs are not guaranteed not to +change between OpenSSL versions prior to 1.0.0. Made the error message more +informative. ck_ssl.c, 26 Aug 2009, and again 28 Aug 2009. + +AIX 6.1 is out, it is really just a new name for AIX 5.4. Added makefile +targets, plus for the first I made AIX 4.2 and later figure out its version +number in the makefile target so we don't have to keep adding new -DAIXnn +sections to the code, and also get its hardware name (e.g. "powerpc") from +uname at make time, rather than hardwiring "rs6000" as I did before. +Consolidated all AIX 4.2 and later targets so now just "make aix" or "make +aix+ssl" can be used. Except not the gcc ones as they have some quirks so +I'd rather not disturb them. Tested this on AIX 5.3. +makefile, 28 Aug 2009. + +From Kinjal Shah, a correction to the Linux makefile entry that allows it +find the 64-bit curses or ncurses library. makefile, 29 Aug 2009. + +Renamed aix4[23]: to oldaix4[23]: in makefile to fix the warning messages +I didn't notice before. I didn't want to remove them because they have +some special things that might still be needed, if anybody still has these +AIX versions. makefile, 29 Aug 2009. + +Built on RHEL 5.3 64-bit, regular and with OpenSSL 0.9.8e. 31 Aug 2009. + +Built on NetBSD 5.0.1/i386, regular and with OpenSSL 0.9.9-dev, 1 Sep 2009. + +Changed SSL message to mention LD_LIBRARY_PATH (Solaris), SHLIB_PATH (HP-UX), +LIBPATH (AIX), or LD_LIBRARY_PATH (Linux). ck_ssl.c, 3 Sep 2009 + +Noticed that "make linux+openssl" fails to include -lutil a link time, which +it needs for openpty(). That's because this target is obsolete. I renamed +it to be oldlinux+openssl and added linux+openssl as a synonym for +linux+ssl. makefile, 3 Sep 2009. + +Tested linux+openssl+zlib+shadow+pam, it's OK. Also linux+krb5. Also +linux+krb5+ssl. makefile, 3 Sep 2009. + +Tried building on Solaris 9 with OpenSSL 0.9.8k with +solaris9g+openssl+shadow+pam+zlib, it failed like so: + + ck_ssl.c:2875: error: conflicting types for 'inet_aton' + /usr/include/arpa/inet.h:52: previous declaration of 'inet_aton' was here + make[2]: [ck_ssl.o] Error 1 + make[2]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl' + make[1]: [solaris2xg+openssl+zlib+pam+shadow] Error 2 + make[1]: Leaving directory hmt/sirius1/prv0/kd/fdc/solaris9ssl' + make: [solaris9g+openssl+shadow+pam+zlib] Error 2 + +The problem was caused by including an inet_aton() function ck_ssl.c for +the benefit of platforms that don't have one in their libraries. This is +defeated by including NO_DCL_INET_ATON in KFLAGS. I added this, but then +I thought it would be a good idea to automatically sense the OpenSSL +version so we can automatically set OPENSSL_097 or OPENSSL_098 rather than +bombing out, so I added code to do that too, and also to set the Solaris +version number: 9, 10, or 11. The new entry is solaris9g+openssl. +ckcdeb.h, makefile, 3 Sep 2009. + +Fixed a complaint in ckufio.c about implicit declaration of initgroups. +ckufio.c, 4 Sep 2009. + +Built on Solaris 10 with gcc and Sun CC using new solaris{9,10,11} target +that is like the new solaris{9,10,11}g one but without the gccisms. +makefile, 4 Sep 2009. + +Changed solaris{9,10,11}g+ssl target to set only the SSL-specific things and +then chain to the main solaris{9,10,11}g target. Tested OK on Solaris 9 and +10. makefile, 4 Sep 2009. + +Created solaris{9,10,11}+ssl target that is exactly like the +solaris{9,10,11}g+ssl except it chains to the solaris{9,10,11} target +instead of the solaris{9,10,11}g one. That is, it builds an SSL version of +C-Kermit using Sun CC rather than gcc. makefile, 4 Sep 2009. + +Tried building on HP-UX 10.20, bundled (non-ANSI) compiler ("make +hpux1000"). This failed until I: + + . Moved a struct inititialization out of setextern(), ckuus3.c. + . Removed an ANSIism from the declaration of sigchld_handler() in ckutio.c + . Added a cast to strcmp() in zvuser(), ckufio.c. + +Builds OK now. Built OK with "hpux1000o" (the ANSI compiler) too. +And with "hpux1000gcc". Couldn't test "hpux1000o+openssl". 21 Sep 2009. + +The Sony Playstation 2 and 3 are 64-bit PowerPC platforms that can run Linux +if it is installed as an "other OS" on its hard disk; and the Linux kernel +since 2.6.21 supports the PS3 without any patching required. Pawel Rogocz +reported that "make linuxppc" (one of the old targets that has not yet been +integrated into the main "linux" target) compiles OK on 2.6.29-ydl61.3 +(Yellow Dog Linux release 6.2 'Pyxis'), but fails at link time because +'openpty' isn't found, because -lutil was not included, because that part +was added only to the main linux target. I asked him to try "make linux" +and he sent back a transcript in which there were thousands of errors from +the curses code ckuusx.c. Later I tried it myself and it built without a +hitch. My theory is that between then and now, a missing piece of the +ncurses library (/usr/include/ncursesw) was installed. 21 Sep 2009. + +HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900 (bundled compiler): + . ckutio.c compilation failed with PENDIN and FLUSHO not defined in + pty_make_raw(). I dummied definitions for them to handle this situation + on this or any other platform where it might crop up. + ckutio.c, 24 Sep 2009. + . Ditto for the PTY module, + IMAXBEL. ckupty.c, 24 Sep 2009. + . References to endusershell() were fatal in the bundled compiler. Changed + the hpux0900 target to define NODCLENDUSERSHELL, and put a special case + in ckufio.c to not put a cast in front of the call if NODCLENDUSERSHELL + is defined. Now it builds and links OK. makefile, ckufio.c, 24 Sep 2009. + +HP-UX 9.05 on PA-RISC 9000/712 building with hpux0900o (optimizing compiler): + . Warnings in ckutio.c at line 14860 about arguments to select (pointers + are not assignment-compatible). "man select" says arguments are ints. + Defining INTSELECT fixes these warnings but results in fatal errors later + around line 14881 and others in the area involving FD_SET. This was too + involved so I put it back as it was. 24 Sep 2009. + +Built OK on Solaris 10 with Sun CC. A couple warnings about implicit +function declarations for curses routines because apparently they aren't +declared in curses.h. Tuff. 25 Sep 2009. + +Tried building on Solaris 10 with Sun CC and OpenSSL 0.9.8k, and this +uncovered various loose ends in the solaris9+openssl target, which I fixed. +makefile, 25 Sep 2005. + +Fixed four typos in printfs in ck_ssl.c, \% instead of just %. 25 Sep 2009. + +Squelched 20-some complaints about a character array being referred to +directly instead of by a pointer, plus several other similar nits to get rid +of all the compilation warnings on Solaris 10 with Sun C 5.8 Patch 121015-06 +2007/10/03. ckctel.c, ckctel.h, 25 Sep 2009. + +Built the result on the same Solaris 10 system with gcc 4.2.4 using the +new solari10g+openssl target, working out a few kinks here too. +makefile, 25 Sep 2009. + +Made consolidated Solaris 9/10/11 64-bit targets for gcc, solaris9g64, +solaris10g64, solaris11g64, tested on Solaris 10 Sparc. makefile, 25 Sep 2009. + +Made consolidated Solaris 9/10/11 64-bit targets for Sun cc: solaris9_64, +solaris10_64, solaris11_64. These simply set a couple flags and chain to +the main solaris9 target. makefile, 25 Sep 2009. + +Removed a bunch of old superfluous Solaris 9 and 10 targets: oldsolaris9, +oldsolaris9lfs, solaris9g64 solaris9g_64, oldsolaris10 old solaris10lfs, +oldsolaris10+openssl, oldsolaris10g+openssl, solaris10_64, oldsolaris10g, +solaris10g_64, solaris10g64. There are still plenty more to prune but it's +a start. makefile, 25 Sep 2009. + +Added or fixed some missing prototypes in ckctel.h: +fwdx_send_xauth_to_xserver(), fwdx_parse_displayname. 25 Sep 2009. + +Improved the instructions for building secure versions in the makefile, +using this example: + + make solaris9+openssl "SSLINC=-I/opt/openssl-0.9.8k/include" \ + "SSLLIB=-L/opt/openssl-0.9.8k/lib" + +makefile, http://kermit.columbia.edu/security.html, 25 Sep 2009. + +Built on HP-UX 11.11, 26 Sep 2009: + . make hpux1100 (ok) + . make hpux1100gcc (ok) + . make hpux1100o (gets a lot of warnings about sendpath and sendfile, + because they are also declared in , but builds OK) + . make hpux1000gcc+openssl \ + SSLINC=-I/opt/openssl/include SSLLIB=-L/opt/openssl/lib + +Note: sendpath and sendfile are not Kermit symbols. The warnings are coming +from socket.h: 'Redeclaration of "sendfile" with a different storage class +specifier'. This is nothing new; see notes of 2-4 Jan 2005. + +From Peter Eichhorn: + . Update to makefile to make current code build OK on HP-UX 8.00. + . Changes to format of some hints to make them more copy-and-pastable. +makefile, ckuu5.c, 28 Sep 2009. + +From Peter Eichhorn: Changes to HP-UX 7.0 target to increase the switch table +stack size, which was overflowing. makefile, 30 Sep 2009 + +HP-UX 6.5 (1989), "make hpux0650tcpc"... (8:19...) Needed to not include +arpa/inet.h (which doesn't exist) and not use host address lists (add +-DNOHADDRLIST), which gets us past ckcnet.c, but in ckcftp.c we bomb out on +FD_SETSIZE undefined. Somehow we worked around this in ckcnet.c. Patched +in a definition in ckcftp.c, and also added -DINTSELECT to compiler flags. +Compiles ok, bombs at link time on bcopy, bzero, FD_ZERO, FD_SET, FD_ISSET. +Now it compiles and links OK but dumps core when started. Added +-DNOCKGETFQHOST, rebuilt from scratch (takes 35 minutes). It starts OK, but +it dumps core when given a "telnet xxx" command, where xxx is a hostname. +However, it works OK if an IP address is used: "telnet 123.45.6.78". It +took all day to track this down, but now it's fixed (see the #ifdef HPUX6 +sections of ckcnet.c). So now (for the first time, I think) we have both +telnet and ftp in HP-UX 6.x, if anyone cares. ckcnet.[ch], ckcftp.c, +makefile, 2 Oct 2009. + +Changed default SET TERMINAL TYPE type for K95 from vt320 to vt220. This is +because Unix OS's such as Solaris have dropped vt320 as a terminal type. +settrmtyp(), ckuus7.c, 5 Oct 2009. + +I moved the PUTENV command code, which was inline, to a function, doputenv(). +ckuus[r7].c, ckuusr.h, 5 Oct 2009. + +Changed the UNIX version of SET TERMINAL TYPE to take a value and then do +the equivalent of "export TERM=value" by calling doputenv(). This sets +\$(TERM) correctly and passes its value along to inferior processes. +However, to make this take effect within Kermit itself (for the fullscreen +file transfer display and for the SCREEN command, Ctrl-L, etc) I also had to +reinitialize the curses database, which is tricky because normally if you +feed it an unknown terminal name, it just exits. ckuus7.c, 5 Oct 2009. + +Changed the little-known and little-used RESET command (which closes all +open files) to also put command echoing back to normal in case it got +messed up somehow (as in HP-UX 6.5, upon returning from PUSH). +ckuusx.c, 5 Oct 2009. + +For Unix, increased string buffer sizes for wildcard expansion for all +platforms that have BIGBUFOK defined from 500000 (0.5M) to 10000000 (10M) +bytes, and for 64-bit builds to 2000000000 (2G) bytes. No point making +it bigger than that because malloc's argument is a size_t, which is an int. +ckufio.c, 5 Oct 2009. + +Built on Mac OS X 10.4.11, required one minor adjustment to the makefile +(-DNODCLINITGROUPS). This was using the macosx10.5 target, which is +supposed to be universal like the linux and netbsd targets, but not yet +proven. Also built a 64-bit version (-mpowerpc64 -mcpu=G5 -mtune=G5 +-arch ppc64); it compiles and links OK but won't start: "Bad CPU Type +in executable". Fix later... makefile, 5 Oct 2009. + +Changes from Seth Theriault to suppress signed vs unsigned char warnings in +Mac OS 10.5.8 from gcc4, and a new makefile target for Mac OS X (presumably +10.3.9 or later) + Kerberos 5 and OpenSSL. ckutio.c, ckuath.c, ckctel.c, +ckcnet.c, ckcftp.c, ck_crp.c, makefile, 6 Oct 2009. + + Later I had to back out of these, because although it made for a + clean build, in the resulting executable SSL connections didn't work. + +Tue Oct 6 17:23:27 2009 +FTP address resolution is broken, but ftp_hookup() hasn't changed. +So... (see the #ifdef HPUX6 sections of ckcnet.c) (I did, and I rolled +back some of the changes from the other day, but it made no difference.) +Putting back the ckcftp.c from a few weeks ago makes no difference. +Putting back the ckcnet.c from a few weeks ago makes no difference. + +Added patches from Seth Theriault so macosx10.5+krb5+openssl would build +on Mac OS X 10.3.9. makefile, ckcftp.c, 7 Oct 2009. + +Built today's code on Linux RHEL4, NetBSD 5.0.1, Solaris 9, and Mac OS X +10.4.11, both with and without SSL. The NetBSD system has OpenSSL 0.9.9-dev. +7 Oct 2009. + +In Mac OS X 10.6, the following symbols are unresolved at link time: +_des_key_sched, _des_new_random_key, _des_ecb_encrypt, +_des_init_random_number_generator, _des_fixup_key_parity. This is +with OpenSSL 0.9.8k. But it doesn't happen on other platforms that +have 0.9.8k. + +Added SET SESSION-LOG NULL-TERMINATED-TEXT. This is for the benefit of a +speech synthesizer that will speak a line of text only after receiving a +NUL character. A more general solution would be to define a filter or +whatever, but who has time. ckuus[23x].c, 7 Oct 2009. + +Consolidated Mac OS X targets, and removed experimental 64-bit ones, because +they never could work in 10.5 and earlier because 64-bit libs are missing, +and 10.6 and later are 64-bit automatically. makefile, 8 Oct 2009. + +Built on Mac OS X 10.6.1. It came out automatically as a 64-bit build +because __LP64__ is defined somewhere that I can't find. But this explains +why the 0.9.8k on 10.6 comes up with missing symbols when the 0.9.8k lib +10.5 (or on Solaris or on Linux) does not: it's a different library: "Mach-O +64-bit dynamically linked shared library x86_64", rather than "Mach-O +dynamically linked shared library ppc". Probably the 64-bit version has +some things #ifdef'd out. Added -m32 to the CFLAGS and LNKFLAGS for the +macosx+krb5+openssl targets, and it built OK one time. But then the errors +came back. makefile, 8 Oct 2009. + +Updated C-Kermit installation for Mac OS X in ckuwr.html on the website. +8 Oct 2009. + +Tried some things to get around the problem with OpenSSL in Mac OS X 10.6, +to no avail. Asked Jeff. He said, "MacOS X no longer includes DES anywhere +on the system. Not for SSL, not for Kerberos, not for anything. This will +increasingly become the situation on new operating systems. Windows 7 and +2008 R2 will also ship with no DES." Sure enough, the Mac OS X Server +Upgrading and Migrating document for 10.6 says, "Mac OS X Server v10.6 does +not support single DES encryption. It supports AES 128 and 256 encryption +types. However, during a migration or upgrade from v10.4 to v10.6, servers +that were Kerberized by the v10.5 Open Directory server will not use the AES +128 or 256 encryption types. To use the AES 128 or 256 encryption types you +must re-Kerberize all servers." 12 Oct 2009. + +DES and 3DES encryption can be excluding removing the -DCK_DES flag. I +removed this one and -DLIBDES (and -m32) and this makes a working 64-bit +version. Then I added code to the macosx+krb5+openssl target to use these +flags if the Mac OS X version was 10.5 or less and leave them out for 10.6 +or later. Tested on 10.4.11 and 10.6.1. A better way to do it might have +been "nm -gj libssl.dylib | grep des_", but that gives the same results on +10.4 and 10.6. Also, 10.6 still has /usr/include/ssl/des.h. +makefile, 13 Oct 2009. + +Next issue: + In file included from ckutio.c:15674: + /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:4:2: #error "GCC no + longer implements ." + /usr/lib/gcc/i386-redhat-linux/3.4.6/include/varargs.h:5:2: #error "Revise + your code to use ." + +The problem occurs when trying to force a non-ANSIC build with GCC. +Changing the source file to include instead of +doesn't help because evidently requires an ANSI C compiler. +Nothing can be done about this. 13 Oct 2009. + +Next issue: Can't compile ckcftp.c with -DNOCSETS or -DNOSPL; some +#ifdef/#endif doesn't match up. Sigh, this is the hardest kind of thing to +debug. There's 17,622 lines of code in this module and no tool that I know +of.... Wait, I wrote one. But it shows all the #if/#ifdef/#ifndef's and +#endifs matching up just fine. Backing off to ckcftp.c of a few days ago +(before char / unsigned char casts were added), I see that it builds OK, so +I backed off to that one, but put back the special case #ifdef for MACOSX103 +declaring CONST gss_OID_desc, and it builds OK (the other stuff was purely +cosmetic, when will I learn?). ckcftp.c, 13 Oct 2009. + +Protected cvtstring() and related functions with #ifdef NOCSETS..#endif, +and ditto for the character-set conversion code in dorename(). +ckuus6.c, 13 Oct 2009. + +Fixed an #endif /* TNCODE */ that was a line too low in ttptycmd(), +causing -DNONET builds to fail. ckutio.c, 13 Oct 2009. + +There was a reference to doputenv() that wasn't guarded by #ifndef NOPUTENV, +fixed in ckuus7.c, 13 Oct 2009. + +Moved doputenv() and settermtyp() out of an #ifdef NOLOCAL section because +these are useful even when not making connections. ckuus7.c, 13 Oct 2009. + +Moved havelfs declaration outside of #ifdef NOXFER because it was also used +for other things. ckcmai.c, 13 Oct 2009. + +COPY /PRESERVE depended on code from the Kermit protocol module, which +is omitted in -DNOXFER builds. Disabled COPY /PRESERVE in -DNOXFER +builds. ckuus6.c, 14 Oct 2009. + +SHOW PROTOCOL code for external protocols had to be #ifdef'd out for +-DNOPUSH builds. ckuus4.c, 14 Oct 2009. + +There was some confusion between "No XYZMODEM" and "No extermal protocols"; +cleared up in ckuus3.c, 14 Oct 2009. + +After all that, 86 different combinations of feature selections built OK on +Linux. And the Kerberized version (K5) works OK on Linux for Telnet and FTP. +14 Oct 2009. + +Changed version number to 9.0. All modules, 16 Oct 2009. + +Need to make LOG SESSION log to a tty. Right now "log session +/dev/ttyKeySerial1" says "Write permission denied" even though the device is +crw-rw-rw-. This happens in zchko(), which is called by cmofi(). The +problem is that /dev/ is not writeable. I added a Unix-only clause that +attempts to open the file for write access using open(), in order to get a +file descriptor, which then can be passed to isatty() to check if it's a +tty, and if so, to allow access. And then close it. I tested this on Mac +OS X as follows: + + log session /dev/ttyKeySerial1 + telnet somehost + +The Mac's serial port was connected to the serial port of another computer +where Kermit displayed the incoming characters in CONNECT mode. Glitches: + + 1. The port has to be set up as desired in advance, outside of Kermit. + 2. log session /dev/ttyKeySerial1 will hang if any required modem signals + are not present when the port is opened. + 3. Bypasses lockfile mechanism - so we do this only if -DNOUUCP. + +For (2), I tried setting O_NDELAY / O_NONBLOCK, and this allowed zchko() to +continue, but then it freezes in the subsequent fopen(). So I changed +zopeno() to also check if the device is a serial port, and if so, to open() +it with O_NDELAY / O_NONBLOCK, and then convert the file descriptor into a +file pointer with fdopen(). + +Now for the speaking device that needs lines to be terminated by NUL... + + set session-log binary <-- need to put these in SHOW LOG + set session-log null-padded (and in HELP SET LOG) + set line /dev/ttyKeySerial1 + +This part works. + +This feature is enabled only for -DNOUUCP builds because serial ports aren't +like other Unix files; we would have to create a lockfile, but we can't do +that... actually, ttlock() takes a name as an argument, but ttunlck() does +not, so there would be no way to remove the lock. Anyway, there is only one +API for configuring the port (speed, flow control, etc) and it only works +with the SET LINE device, not any random file. To fix this would require +massive redesign and changes. ckuus[23].c, ckufio.c, 19-20 Oct 2009. + +I made -DNOUUCP the default for Mac OS X, since everybody winds up building +it that way anyhow. To undo this, do "make macosx KFLAGS=-UNOUUCP". +makefile, 21 Oct 2009. + +Changed SET SESSION-LOG TEXT to strip out ANSI escape sequences; +previously there wasn't that much difference between TEXT and BINARY logs. +It's still not perfect; for example it doesn't delete characters that the +user erased. (Made sure this still builds with -DNOESCSEQ.) +ckucns.c, 22 Oct 2009. + +Changed SHOW LOG to show the SET SESSION-LOG settings, as well as +SET DEBUG, which was not shown before. ckuus5.c, 22 Oct 2009. + +If a series of PUTENV commands is given, each new one undoes the previous +one, so only the last definition is seen by the new fork (or by Kermit +itself). Turns out you can't feed automatic variables to putenv(); they +have to be static, so to allow for multiple PUTENV commands Kermit has to +maintain an array of static strings. ckuus7.c, 6 Nov 2009. + +From Seth Theriault, a better way for the makefile to determine the +Mac OS X version number; there's a program for this, sw_ver. makefile, +6 Nov 2009. + +Peter Eichhorn reported that file-transfer failure hints were not coming +out since Dev.27. The only change I made since then was to skip them if +the file-transfer protocol was not Kermit. I was using the wrong variable +in the tests, 'proto' instead of 'protocol'. ckuus5.c, 6 Nov 2009. + +Changed Mac OS X targets to correctly extract the Mac OS major version +from uname -r in order to choose correctly between utmp and utmpx; this +wasn't working in 10.6.1. makefile, 6 Nov 2009. + +Fix from Seth T. for an oversight in the previous edit. Also add +MACOSX103 to "show features" display. makefile, ckuus5.c, 10 Nov 2009. + +Added REJECT as a synonym for DISCARD in SET FILE COLLISION; it's more +intuitive and more accurate. ckuus[27].c, 15 Nov 2009. + +\fsplit() and \fword() always break on 8-bit characters unless you explicitly +put every single 8-bit value into the include set, e.g. (for a TSV file): + + undef include + for \%i 128 255 1 { + if == \%i 9 continue + .include := \m(include)\fchar(\%i) + } + .\%n := \fsplit(\m(line),&a,\9,\m(include)) + +I changed cksplit() to treat all 8-bit bytes 128-255 as non-break characters +by default. It might have made more sense to do this for 160-255 (since +128-159 are traditionaly C1 control characters) but thanks to Microsoft +tradition is out the window. To treat one or more 8-bit characters as break +characters, put them in the break set. This might break some scripts, but I +doubt it because this flaw was so awful that if anyone had come up against +they would have let me know. ckclib.c, 16 Nov 2009. + +Changed the netbsd target to set -funsigned-char, since cc on NetBSD is +actually gcc. makefile, 16 Nov 2009. + +Changed macosx targets to get the CPU type from the HOSTTYPE environment +variable. Also added getenv("HOSTTYPE") as a last-resort method to set the +\v(cpu) variable at runtime (maybe it should be the first resort?)... +ckuus4.c, makefile, 16 Nov 2009. + +Made sure the solaris9_64 and solaris10 targets still work. 16 Nov 2009. + +Made sure the current source package builds OK on HP-UX 10.20... Got a lot +of "warning 6062: Optdriver: Exceeding compiler resource limits in xxx; some +optimizations skipped. Use +Onolimit if override desired" but it builds OK. +Tested long file transfer; works OK. 17 Nov 2009. + +Built on FreeBSD 7.2 with and without OpenSSL, all OK. 17 Nov 2009. + +Built on NetBSD 5.0.1 with and without OpenSSL, all OK, but netbsd+krb5 +fails with "can't find -lgssapi_krb5"; worked around this with +"K5LIB=-L/usr/local/kerblib" (where the lib actually is on this host) but +then it failed with "ckcftp.c:13868: error: 'gss_nt_service_name' undeclared". +17 Nov 2009. + +I found a VMS 6.2 system... Takes a loooong time to build there. In +ckuusy.c, DEC C didn't like the prototypes and declarations of dorlgarg() +and dotnarg() as static so I made them not static. But that didn't help, +now it fails at the very end, saying the final #ifdef is an invalid +statement. It looks like an #ifdef mismatch that affects only VMS. I ran +my #ifdef matcher, it turned up nothing. I substituted a copy of ckuusy.c +from 2007, it comes up with the same errors. Then I substituted the copy +from 8.0.211 from 2004, and this one compiled OK and, miraculously, the +whole mess even linked OK and runs OK. The Alpha binary is 2.84MB. Now I +have 4500 lines of code to compare.... I went through the two files line by +line and I can't see a single thing wrong. I gave up and tried building the +TCP/IP version. It builds fine except for ckuusy.c, with the utterly +useless error message: + + #endif /* NOCMDL */ + ...................^ + %CC-E-BADSTMT, Invalid statement. + +Indicating the last line in the file. Just for the heck of it, I put +another line after that one: + + /* This is a test */ + +and got: + + /* This is a test */ + ....................^ + %CC-E-BADSTMT, Invalid statement. + +So it is not objecting to anything in the file. Trying the old LISP trick, +I put an extraneous closing bracket after that. Success! Honestly, I don't +see anything wrong with file. It's DEC C V5.3-006. I suspect a C bug. +I'll leave it like this for now until I get access to some other VMS +versions. Another clue is that when building the network version I get a +horrible warning I never saw before from a module that hasn't been touched +in a very long time (ckvrtl.c). Also, in the network version, I note that +the FTP code is not compiled in. We have to try this again with some +command-line switches, but it'll do for now. ckuusy.c, 18 Nov 2009. + +---C-Kermit 9.0 Alpha.01--- + +From Steven Schweda (SMS), the real solution for the VMS closing brace +problem, it wasn't a DECC bug, it was a me bug. ckuusy.c, 20 Nov 2009. + +Rediscovered the new VMS build options: f for Long Files, i for Internal +FTP. "make mnf" doesn't work on VMS 6.2, it looks like the VMS definition +for CK_OFF_T got lost. Same thing with "make mfi". Come back to this later. + +From Gerry Belanger, a fix to INPUT /COUNT:n. ckuus4.c, 26 Nov 2009. + +Added \fsqueeze(s), returns string s with leading and trailing whitespace +removed, Tabs converted to Spaces, and multiple spaces converted to single +spaces. For now, ASCII only, no options. ckuusr.h, ckuus[24].c, 27 Nov 2009. + +I wrote a Kermit script to read a big file of addresses on Solaris 9, +\fsqueeze()ing each line. After about 14000 lines, there was a malloc +failure in getnct() (the command-file reader). There's nothing wrong with +\fsqueeze(), the failure is on a deeper level, because the same thing +happens if I use \fupper() (which is structurally identical to \fsqueeze()) +in the same script. The problem is not in getnct() either, because every +malloc() is freed (I checked). On the other hand, the same script (with +\fupper() instead of \fsqueeze() completes OK in C-Kermit 8.0.201. If I +remove the function call (\fsqueeze() or \fupper()) from the script, it also +runs OK in 9.0. This seems to point the finger at fnevel(), which contains +countless malloc's and free's. But comparing fneval() between 8.0.211 and +9.0, I don't see any difference that would explain this behavior -- nothing +at all that involves malloc(), makstr(), or free(). Nor any pertinent +change in the caller (zzstring) of fneval(). 27 Nov 3009. + +Another problem is that when this happens, the error is not caught (e.g. by +the IF FAIL statement after the command that contains the function call); +instead, C-Kermit returns immediately to its prompt. 27 Nov 2009. + +It could simply be that some of the buffers we allocate are much bigger now. +But again, I don't see much difference between 8.0.211 and 9.0; we were +already allocating 32K command-related buffers (malloc() takes a size_t, and +size_t is an int almost everywere). I built the same source on NetBSD and +ran the same script (with \fqueeze()), and it worked fine. Let's worry +about this later, if it comes up. 27 Nov 2009. + +Built OK on Silicon Graphics IRIX 6.5 R10000; regular build OK, SSL and +Kerberos builds failed. 30 Nov 3009. + +Tried to build on Digital Unix 4.0F but it blew up in ckutio.c, apparently +not recognizing any of the terminal struct symbols from termios.h. Tried +again with gcc, same thing. Tried explicitly #including +within #ifdef TRU64, same thing. What could have changed? 30 Nov 2009. + +Built OK on Linux RHEL5.4/Itanium-2, make linux. The secure build +required "FLAGS=-DNO_KRB5_INIT_ETS" and built OK. 30 Nov 2009. + +Built OK on Digital Unix 4.0F using "make osf" instead of "make tru64-40f". +I don't know why the specific target doesn't work, but it's not worth +chasing down. 2 Dec 2009. + +Built OK on MirBSD 10, despite a lot of gratuitous compiler warnings. Built +OK on MirBSD 10, OpenBSD 4.5, and Fedora 10. 3 Dec 2009. + +(Various other successful Unix builds in these weeks...) + +Built on VMS 7.2 and 8.3 with and without TCP/IP, no problems. 11 Jan 2010. + +Built on VMS 8.3 with "make fi" to include the FTP client and long-file +support (mid Jan 2010). + +Built on VMS 8.3 with UXC 5.6 and HP SSL 1.3, which is OpenSSL 0.9.7e. +It compiled and linked OK but when I tried to make an FTP SSL connection +it crashed in SSL$LIBSSL_SHR, which is called from ssl_auth(), after having +had TLS accepted as an authentication type, but before actually +authenticating. In Unix: + + 19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx +Connected to ftp.somecompany.com. +220-Somecompany FTP v6.0 for WinSock ready... +220 Welcome to the online storage FTP server. Please check the main web +site for system announcements and AUP. (O) +---> AUTH TLS +234 AUTH command OK. Initializing SSL connection. +TLS accepted as authentication type +SSL DEBUG ACTIVE +=>START SSL/TLS connect on COMMAND + +In VMS: + + 19. ftp open ftp.somecompany.com /user:pge.com/test_quota /password:xxxxxx +Connected to ftp.somecompany.com. +220 Somecompany FTP v6.0 for WinSock ready... +---> AUTH TLS +234 AUTH command OK. Initializing SSL connection. +TLS accepted as authentication type +SSL DEBUG ACTIVE +%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual +address=FFFFFFFF8001A120, PC=000000000068B118, PS=0000001B + +Note: The Unix version received the second 220 response, the VMS version did +not. That's odd, it's the same code... 25 Jan 2010. + +Added some essential details to the HELP FSEEK text. ckuus2.c, 25 Jan 2010. + +Discovered that the result returned by \fsearch() is totally unreliable. +This is probably too hard to fix. + +FSEEK did not pay attention to SET CASE, searches were always case sensitive. +Fixed in ckuus7.c, 26 Jan 2010. + +FSEEK failed to find anything if the search pattern was matched in the first +line of the file. Fixed in ckuus7.c, 26 Jan 2010. + +\fword() and \fsplit().... Another change, but not backwards-incompatible. +One may now put the word ALL (just like that, all uppercase) as the include +set (4th argument) to indicate that there will be no break characters other +than those explicitly given in the break set, e.g. \fsplit(\m(xx),&a,:,ALL) +breaks a line only on a colon (:), nothing else. The original rules for +cksplit() were more than a little counterintuitive: the default break set is +all non alphanums, and the default include set is all alphanums, so if you +wanted to parse (say) a CSV file, breaking only on comma, you had to think +of all the characters you wanted to keep. This way you just say ALL. +ckclib.c, 26 Jan 2010. + +Speaking of CSV files... How can you put comma as a function argument when +comma is the function-argument separator? Use one of these forms: + + \fsplit(\m(xx),&a,",",ALL) + \fsplit(\m(xx),&a,{,},ALL) + \fsplit(\m(xx),&a,\44,ALL) + \fsplit(\m(xx),&a,\fchar(44),ALL) + +From John Dunlap, U. of Washington Applied Physics Lab: 'When "stty -a < +/dev/ttyS0 | grep crtscts" shows "crtscts" (not "-crtscts") and when using a +three wire serial interface and when asking kermit to not use flow control +(set flow none) then "ckutio.c1" (see attachments) fails while "ckutio.c" +works. The result of "diff -u ckutio.c1 ckutio.c" is attached as "diffs"'. +ckutio.c, 26 Jan 2010. + +Changed the year from 2009 to 2010 in the modules I worked on today and in +the heralds, etc. ckckmai.c, ckuus5.c, ckutio.c, ckclib.c, ckuus7.c, +26 Jan 2010. + +Built on Linux Fedora Core 3, regular and with OpenSSL 0.9.7a. Built on +Ubuntu 9.4 OK, but SSL and Kerberos builds failed due to not finding libs +and/or header files. I'm sure this could be fixed... 27 Jan 2010. + +Added SSL, KRB4, and KRB5 to the startup herald for versions that were +built with SSL, Kerberos 4, or Kerberos 5. Built OK on Fedora 3 with +linux+krb5+ssl and new banner shows correctly. ckuus5.c, 27 Jan 2010. + +Set NO_KRB5_INIT_ETS by default in ckuath.h since krb5_init_ets() is a no-op +in Kerberos 1.4.x and later and in some installations it can't be found, +which clobbers the build. ckuath.h, 27 Jan 2010. + +Adapted to MINIX 3 1.5, the first version that has virtual memory according +to Andy T, who should know. On earlier versions (e.g. MINIX 3 1.2) any +attempt to build C-Kermit causes the compiler to crash. Now the compiler +doesn't crash but it spews out countless warnings about old-fashioned +function declarations that I don't get anywhere else. The real problems +came in ckutio.c where numerous symbols were undefined at compile time and +the POSIX function tcgetpgrp() was not found at link time, even though there +is a prototype for it in the MINIX header files, and there is no alternative +(since POSIX doesn't let us use ioctl()). Also note that there is some +confusion over the compile-time symbols MINIX, MINIX2, MINIX3, and MINIX315. +You would expect MINIX to mean "any version of MINIX" but in some parts of +ckutio.c it means MINIX 1.0. I sincerely doubt that C-Kermit 9.0 can be +built on any version of Minix before 3.1.5 so I removed the confusion and +made MINIX mean "any Minix". It builds on 3.1.5 OK now, except for the FTP +client. This can probably be fixed but... Modules changed: ckcdeb.h, +ckuver.h, ckcmai.c, ckuus5.c, ckutio.c, 1 Feb 2010. + +Later.. Andy says MINIX does not support job control, so no program is ever +in the background. That settles that! 1 Feb 2010. + +Built OK on Minix, Linux, Mac OS X, Solaris 9, NetBSD 5.0.1... 1 Feb 2010. + +---C-Kermit 9.0 Alpha.02--- + +From Christian Corti at Uni-Stuttgart.de: fixes to allow building on SunOS +4.1, which once was my main development platform but which is long-gone from +here. ckupty.c, ckutio.c, 9 Feb 2010. (He says it is also necessary to +comment out the "struct winsize" and "struct ttysize" in sys/ioctl.h; +otherwise there will be a conflict with sys/ttycom.h (included by termios.h) +which also declares these structs. But you need both includes.') + +From John Dunlap, a fix for Kermit protocol fixed packet-timeout interval +going to a unexpected value (missing else clause in two places). +ckcfn2.c, 9 Feb 2010. + +Added an aixg target to build on AIX with gcc when gcc is not installed as +cc, and also added CC=$(CC) CC2=$(CC) clauses to the aix and aix+ssl +targets. Wow, AIX really loses bigtime when receiving files through its ssh +server. Streaming can't be used, sliding windows recover from errors but +there are tons of them using the default 4K packets; 500 works much better. +Built with IBM cc and gcc, and also tested (successfully) the new aix+ibmssl +target, in which the OpenSSL headers and libs are in a standard place. +makefile, 9 Feb 2010. + +In ckupty.h, make the #include be #ifndef SUNOS41. +From Christian Corti. 10 Feb 2010. + +Built on VMS E8.4. 12 Feb 2010. + +Tried to build on a real VAX-11/785 but the machine seems to be seriously +wedged. 12-15 Feb 2010. + +Added note to CKVKER.COM to the effect the the 'f' option has no effect +on VAX architecture. 15 Feb 2010. + +Moved the #include "ckvrtl.h" in the FTP module to below the include for +utime.h, because building the VMS version with the 'i' option (meaning +"include internal ftp client") results in "struct utimbuf tp" erroring out +because struct utimbuf is not defined yet (at least in some version of VMS +with some version of C). From Rob Brown, ckcftp.c, 20 Feb 2010. + +From Martin Vorlaender: new code in VMS C-Kermit build procedure to detect +OpenSSL version automatically. ckvker.com, 22 Feb 2010. + +Added code to INPUT command to strip ANSI escape sequences. It's activated +by SET SESSION-LOG TEXT. ckuusr.h: added prototype for chkaes(); +ckucon.c, ckucns.c: made inesc[] and oldesc[] global instead of static; +ckuus4.c: doinput() code for skipping escape sequences. 1 Mar 2010. + +Peter Eichhorn complained that if you make an ssh connection with Kermit, +then log out from the ssh host, and then use a "connect" command to +make a new connection to the same host (which you can do with Telnet), +Kermit says (e.g.): + + DNS Lookup... Can't get address for ssh -e none somehostname + Sorry, can't open ssh -e none somehostname: Error 0 + +I added code to detect and handle this case and it seems to work OK, even +though it's kind of a hack. ckuusr.[ch], ckuus7.c, 1 Mar 2010. + +There has never been a clean way to put debugging messages (ECHO commands) +in a script which are executed only if debugging is desired and ignored +otherwise. You'd have to set a random variable and test it, or define a +macro or whatever. To make this more straightforward, I added SET DEBUG +MESSAGE ON/OFF/STDERR, and added a new MESSAGE (syn: MSG) command for printing +debugging messages to stdout if SET DEBUG MESSAGE is ON or to stderr if SET +DEBUG MESSAGE is STDERR. ckcmai.c, ckuus[r23].c, 12 Mar 2010. + +Also for debugging and error messages, I added \v(lastcommmand) so that +the command that failed can be included in an IF FAIL or DEBUG error message. +This works even for commands that have syntax errors. +ckuusr.h, ckuus5.c, ckucmd.c, 12 Mar 2010. + +From SMS for VMS: 'Added/documented P3 options INTSELECT, OLDFIB, OLDIP. +Disabled (commented out) automatic definition of NOSETTIME for VMS before +V7.2 (vms_ver .lts. "VMS_V72").' ckcdeb.h, ckcftp.c, ckcnet.c, ckuus[2567].c, +ckvfio.c, ckvker.com, ckvrtl.[ch], 15 Mar 2010. + +Exposed inesc[] and oldesc[] for VMS, so new INPUT command escape-sequence +stripping can work (really, chkaes() and related global variables should be +moved out of ck[uvd]con.c/ckucns.c and into a common module; do that later). +ckuusr.h, ckvcon.c, 15 Mar 2010. + +Built OK on Solaris9, Mac OS X 10.4.11, RHEL4 (32-bit), RHEL5 (64-bit), +AIX 5.3, SCO OpenServr 6.0.0... 15 Mar 2010. + +Not so good on VMS, turns out I made a typo in one of the VMS updates +(#ifndef OLDIP instead of #ifdef...). ckcnet.c, 16 Mar 2010. + +More from SMS for VMS, 16 Mar 2010: + . Set MAXPATH correctly for VMS, ckcdeb.h. + . NAM -> NAML, QIO replaces system( "SET PROTECTION"), bugfixes in + cvtdir() and nzltor(), ... (See comments): ckvfio.c, new ckvrms.h. + (The RMS code in ckvfio.c was almost totally rewritten) + . Moved "NAMX$*" (and related) macros to ckvrms.h, and renamed to + "NAMX_*" (and similar "$" -> "_"), moved "FIB_*" macros from ckvrtl.c. + +These changes are mainly to accommodate the ODS5 file system, which has +longer and mixed-case filenames, and also to execute certain commands +(e.g. for setting file protection, deleting directories) directly instead +of using a system() command. + +Built OK on VMS 8.3 (with and without network support). 16 Mar 2010. + +Failed to build on VMS 6.2. 16 Mar 2010. + +FreeBSD 8.0 has a hexdump() prototype that conflicts with the +hexdump macro defined in ckcdeb.h. Since the same thing is likely to happen +elsewhere, I changed the Kermit macro to ckhexdump as well all references to +it: ckcdeb.h, ckcftp.c, ckcnet.c, ckctel.c, ckuath.c, ckutio.c, 16 Mar 2010. + +Built OK on Digital Unix Tru-64 4.0E using "make osf", 16 Mar 2010. + +Tried again to build Digital Unix Tru64 4.0E using "make tru64-40e", but +something prevents it from picking up the termios symbols and it blows up in +ckutio.c, whereas this used to work in earlier C-Kermit versions. This is +the only Tru64 system I still have access to, so I can't tell if it's a +local peculiarity or what. Note that POSIX is not defined for this build. +But if I define it, I get into trouble with "struct timeval". Tried again +with "KFLAGS=-DPOSIX -DNOTIMEVAL" but that doesn't help. Tried "make +dec-osf" and that worked OK but oddly enough it makes a Kermit with less +features than "make osf". 16 Mar 2010. + +To go with MESSAGE and SET DEBUG MESSAGE, I added IF DEBUG, which is true +if SET DEBUG MESSAGE is not OFF and false otherwise. ckuusr.h, ckuus6.c, +16 Mar 2010. + +From SMS: Corrections to my merging of SMS's changes, ckcftp.c, ckvrtl.h. +Builds OK on VMS 6.2 now. Also did an SSL build on VMS 8.3 with OpenSSL +m0.9.7e and "OPENSSL_DISABLE_OLD_DES_SUPPORT" was included in P3 +automatically by Martin V's addition to ckvker.com. 17 Mar 2010. + +From SMS: #include earlier for VMS in ckcdeb.h to pick up off_t +before it is referenced. This allows C-Kermit to compile on VMS/Alpha 6.2 +but linking fails on fseeko() and ftello() (and yet, a functional executable +is created, and FSEEK works right). Builds the same way with no problems at +all on VMS 8.3 / Alpha. In this case we get the full 64-bit arithmetic... +Well, 62 bits: + + ATLAS::C-Kermit>( ^ 2 63) + 9223372036854775000.0 + ATLAS::C-Kermit>( ^ 2 62) + 4611686018427387904 + +whereas on VMS 6.2 we get integers only up to (^ 2 30). 17 Mar 2010. + +Changed the VMS build procedure to enable large file support automatically +for non-VAX and VMS 7.3 or greater. No reason not to include this feature. +Changed the sense of the F option to DISABLE large file support in the +unlikely case that C-Kermit is being built on a suitable platform but the +C library is older than VMS73_ACRTL-V0200, in which case fseeko() and +ftello() will come up missing at link time. ckvker.com, 18 Mar 2010. + +Changed VMS build procedure to include the FTP client in any network build +by default. Changed the sense of the I option to exclude the FTP client, +in case anybody would want to do that. ckvker.com, 18 Mar 2010. + +From SMS: updated dependencies in CKVKER.COM, fix the "don't reinclude me" +clause in CKVRTL.H. 19 Mar 2010. + +Built OK on VMS 6.2 and 8.3 with and without networking. Large file support +included automatically in VMS 8.3 FTP client included automatically in both +network builds. 19 Mar 2010. + +Changed hexdump() to ckhexdump() in ck_crp.c, which I missed before. +19 Mar 2010. + +---C-Kermit 9.0 Alpha.03--- + +In HP-UX with the bundled-non ANSI compiler, we get warnings about functions +such as endusershell(), which are declared void in the header files. But in +non-ANSI builds we defind VOID to be int rather than void, so our prototypes +are wrong. I checked that HP-UX 9, 10, and 11 all have void datatype and +changed the definition of VOID to void in those cases. ckcdeb.h, 29 Mar 2010. + +Fixed a typo in a debug() statement in cksplit() that was causing some +warnings. ckclib.c, 29 Mar 2010. + +Ditto in tls_load_certs(). ck_ssl.c, 29 Mar 2010. + +"make hpux1000o+ssl" files with: +/usr/ccs/bin/ld: Unsatisfied symbols: + __umoddi3 (code) + __udivdi3 (code) + __eprintf (code) + +It appears that OpenSSL (0.9.7c in this case) requires -lgcc. +And indeed hpux1000gcc+ssl builds fine. 29 Mar 2010. + +There are various warnings in the SSL code in ckutio.c, ckcftp.c, and +ckcnet.c about pointers not being assignment compatible, but I have learned +from experience not to try to fix these (see notes from 6 Oct 2009). +29 Mar 2010. + +connect(s, (struct sockaddr *)&hisctladdr, sizeof (hisctladdr)): In FTP, +this doesn't work on RHEL5 / Mac OX X 6.1/2 64-bit. But the connect() in +Telnet works. On Mac OS X 6.2 I tried changing the socket() call to be like +the one in ckcnet.c for Telnet, but it made no difference. On a RHEL5.4 +system on i386, FTP works fine, so it's not the Red Hat version. On Digital +Unix 4.0E 64-bit, same thing: + + 11:23:10.722 ftp_hookup[kermit.columbia.edu]=21 + 11:23:10.722 ftp hookup A[kermit.columbia.edu] + 11:23:10.722 ftp hookup C[kermit.columbia.edu] + 11:23:10.722 ftp hookup socket=4 + 11:23:10.722 ftp hookup HADDRLIST + 11:23:10.723 ftp hookup connect failed=13 + 11:23:10.723 ftp hookup bad + +13 = Permission denied: + + [EACCESS] Search permission is denied for a component of the path prefix; + or write access to the named socket is denied. + +On Gentoo Linux, also on Alpha, the errno is 51: Network is unreachable. +Clearly some data type in the sockets structs is out of whack. + +The third connect() argument is "address length". The address is a +struct sockaddr. About the third argument, RHEL5 "man connect" says: + + The third argument of connect() is in reality an int (and this is what + 4.x BSD and libc4 and libc5 have). Some POSIX confusion resulted in + the present socklen_t, also used by glibc. See also accept(2). + +Building on RHEL5 on x86_64, where size_t is 8 and socklen_t is 4, I get a +warning: + + ckcftp.c: In function 'ftp_hookup': + ckcftp.c:14667: warning: + comparison is always true due to limited range of data + +Referring to: + + if (hisctladdr.sin_addr.s_addr != (unsigned long) -1) + +This seems to be the problem; if I remove the (unsigned long) cast (in two +places), the problem goes away. Actually what I should be comparing it with +is INADDR_NONE, which is defined appropriately in some header file, e.g. as +0xffffffff. Also I define it explicitly as -1 if it is not defined in any +header file (as is the case in Solaris 9). Tested OK on 64-bit RHEL5, +32-bit RHEL5, Digital Unix 4.0E 64-bit, Solaris 9 32-bit, Mac OS X 10.4.11 +32-bit, Mac OS X 10.6.3 64-bit, AIX 5.3, Gentoo Linux 2.6.31 on Alpha +64-bit, NetBSD 5.0.1 32-bit.... ckcftp.c, 29 Mar 2010. + +---C-Kermit 9.0 Alpha.04--- + +Yesterday's VOID redefinition caused problems for HP-UX in ckuusx.c, in the +curses section where VOID is undef'd and not used to avoid a conflict with +curses.h. As a workaround I defined a new macro CKVOID with the same +definition as VOID and used it in the offending section of ckuusx. The real +solution is to replace all references to VOID with CKVOID (since VOID is +increasingly likely to cause conflicts), but a mass search and replace is +not without risks. ckcdeb.h, ckuusx.c, 30 Mar 2010. + +Changed VOID and CKVOID definition to be 'void' for all HP-UX (verified by +PeterE back to HP-UX 6.5, 1989). Still need to check this on HP-UX 5.21; +if that's an exception it can be done in the makefile. ckcdeb.h, 30 Mar 2010. + +The change I made to allow CONNECT to reestablish a previous SSH connection +prevented a new SSH connection to a different host to be made. Fixed in +ckuus7.c, 30 Mar 2010. + +Fixed mistaken extern declarations of krb4_errno and krb5_errno as strings +in nvlook(); they are ints. Built OK on Mac OS X 10.6.3. ckuus4.c, 30 Mar 2010. + +A fix to Trusted HP-UX makefile target from PeterE, to account for the +equivalence of +openssl and +ssl as target suffixes. 30 Mar 2010. + +Added a new function \fcvtcsets(string,cset1,cset1) that converts a string +from one character set to another. The csets are File Character-Set names. +ckuus4.c, 31 Mar 2010. + +Added a new function \fdecodehex(string,prefix) that decodes a string +containing prefixed hex bytes. Default prefix is %%, but any prefix of +one of two chars (such as % or 0x) can be specified. ckuusr.h, ckclib.h, +ckclib.c, ckuusr.c, 31 Mar 2010. + +Richard Nolde reports that Kermit can't find -lpam on Fedora 12 because it's +in /lib rather than /usr/lib. RHEL5 has symlinks, FC12 should too. Added a +note to the makefile. 1 Apr 2010. + +Build on Solaris 11 for the first time. Had to adjust ckuver.h to get the +version herald right. This was on a box that reported its architecture as +i86pc. 1 Apr 2010. + +Added MIME character-set names as invisible synonyms in the file and +terminal character-set tables, fcstab[] and tcstab[]. Note that not all the +character sets known to Kermit are registered in MIME. But at least now +MIME-registered character sets can be referred to by their MIME names, e.g. +ISO-8859-1, ISO646-ES, IBM437, WINDOWS-1252. These are not listed if you +type ? in a field that is parsing them, unless you type a letter first, +e.g. "i?" lists ISO- and IBM set names. Later maybe I'll make parallel +tables, or keyword attribute bit that says whether a name is MIME or not. +The real benefit of this change is that now Kermit can take its +character-set names from external sources like email headers or web logs. +ckuxla.c, 1 Apr 2010. + +Changed the IF command to accept a bare macro name its condition. This will +parse and execute correctly if the macro is defined and if it has a numeric +value, or if it is not defined, in which case it evaluates to 0 (FALSE). If +it is defined but has a non-numeric value, a parse error occurs. ckuus6.c, +2 Apr 2010. + +Added \fstringtype() function. Given a string argument, it tells whether +the string is 7bit, 8bit, utf8, binary, etc. ckuusr.h, ckuus[4x].c, +2 Apr 2010. + +Did a few builds to make sure there were no booboos. Solaris 9, NetBSD +5.01, Linux RHEL4, HP-UX 10.20 (non-ANSI compiler and ANSI optimizing +compiler), Mac OS X 10.4.11, SCO OSR 6.00. 5 Apr 2010. + +---C-Kermit 9.0 Alpha.05--- + +Increased maximum variable name length from 4K to 16K. Verified that +too-long names are caught and recovered from correctly. ckuusr.h, 6 Apr 2010. + +Implemented a new \fsplit() option for parsing CSV files, which turns out to +be a little complicated, because the separator is not just a comma, but a +comma and all its surrounding spaces. Also there are special quoting rules +for fields with embedded commas and fields with embedded quotes. ckclib.c, +7 Apr 2010. + +---C-Kermit 9.0 Alpha.06--- + +VMS changes from SMS. They build OK, Kermit file transfers are still OK, +but FTP text-mode GETs always hang on the 10th 8K network read. Couldn't +get a debug log this time. ckcmai.c, ckvfio.c, ckvrms.h, ckvker.com. +8 Apr 2010. + +Changing VNAML from 4K to 16K broke the build on HP-UX 9. Put it back to +4K. 9 Apr 2010. + +John Dunlap, running days-long stress tests between E-Kermit and C-Kermit, +found a bug in the packet-reading and -decoding code: If a NAK packet +arrives with its length field corrupted to indicate a bigger size, and there +are enough bytes following in the pipeline, ttinl() will return a too-long +packet (if there are not enough bytes waiting to be read, then ttinl() will +properly time out). In the bad case rpack() trusts the packet length, uses +it as the basis for computation of the block-check length, which is then +used to access memory that might not be there, causing (at least on John's +Linux system) a segmentation fault. John added the normal clause to check +the result of the block-check calculation, and I changed ttinl() to always +break on the eol character (normally carriage return), since this can never +appear in a packet, even if we "set control unprefix all". Also added a +check to ttinl() to protect against length fields corrupted into illegal +values. ckcfn2.c, ckutio.c, 13 Apr 2010. + +From Lewis McCarthy: + Based on code inspection, C-Kermit appears to have an SSL-related security + vulnerability analogous to that identified as CVE-2009-3767 (see e.g. + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767). + + I'm attaching a patch for this issue relative to the revision of ck_ssl.c + obtained from a copy of http://www.columbia.edu/kermit/ftp/test/tar/x.zip + downloaded on 2010/07/30, which I believe is the latest. + + When this flaw was first widely publicized at last year's Black Hat + conference, it was claimed that some public certificate authorities had + indeed issued certificates that could be used to exploit this class of + vulnerability. As far as I know they have not revealed specifically which + public CA(s) had been found issuing such certificates. + Some references: http://www.mseclab.com/?p=180 + http://www.theregister.co.uk/2009/07/30/universal_ssl_certificate/ + +Patches added to ck_ssl.c, 4 Aug 2010. + +Peter Eichhorn reported that "RENAME ../x ." didn't work. This is a side +effect of the changes of 2006 to the RENAME command, there was a little +confusion in the renameone() routine; fixed in ckuus6.c, 4 Aug 2010. + +If only one file is FOPEN'd, FCLOSE given with no arguments would close it. +Turns out to be a bad idea. Example: program with an input and output file, +try to close the output file before it is opened by just typing FCLOSE; this +can mess up the input file. For safety FCLOSE has to require a channel +number or ALL. ckuus7.c, 4 Aug 2010. + +Added \fstrcmp(s1,s2,case,start,length), which has the advantage over IF +EQU,LGT,LLT that case senstivity can be specified as a function arg, and +also substrings can be specified. ckuusr.h, ckuus[24].c, 5 Aug 2010. + +The CSV feature of Alpha.06 had a subtle flaw, namely that if the last item +in a comma separated list was enclosed within doublequotes with a trailing +space after the closing doublequote, a spurious empty final element would be +created in the result array. Fixed in cksplit(), ckclib.c, 5 Aug 2010. + +---Alpha.07--- + +The CSV feature of \fsplit() splits a comma-separated list into an array. +To turn the array back into a comma separated list, \fjoin(&a,\44,1) almost +works, except for elements contain literal doublequotes, such as: + + Mohammad "The Greatest" Ali + +This calls for making a symbolic CSV argument for \fjoin() like the one that +was made for \fsplit(): \fjoin(&a,CSV). Also \fjoin(&a,TSV) for +Tab-separated list. Thus if Kermit reads a record in CSV format, splits it +into an array, and then joins the array back into a CSV record, the result +will be equivalent to the original, according to the CSV definition. It +might not be identical, because if the result had extraneous spaces before +or after the separating commas, these are discarded, but that does not +affect the elements themselves. Furthermore it is now possible to convert +a comma-separated list into a tab-separated list, and vice versa (which is +not a simple matter of changing commas to tabs or vice versa). ckuus4.c, +12 Aug 2010. + +From Joop Boonen 26 Juli 2010: "Added HAVE_LOCKDEV as openSuSE >= 11.3 uses +lockdev but not baudboy. They use ttylock directly. The program code has +been added so the the program works without a problem." makefile, ckcdeb.h, +ckutio.c, ckuus5.c, 23 Aug 2010. + +---Alpha.08--- + +From Gary Mills at the U of Manitoba: convert Solaris version from BSD ptys +to streams ptys because there are only 48 BSD-style ptys and he was running +out. No code changes needed, the only change necessary was to add the +following flags to the makefile target: + + -DHAVE_STREAMS -DHAVE_GRANTPT -DHAVE_PTSNAME + -DPUSH_PTEM -DPUSH_LDTERM -DPUSH_TTCOMPAT + +makefile, ckcmai.c, 21 Sep 2010. + +Testing this in Solaris 9 I see that the DES library disappeared. Added +code to the solaris9 targets (also used by Solaris 10 and 11) to check for +this. makefile, 21 Sep 2010. + +The Solaris target checked the OpenSSL version automatically to set the +right flag, the Linux target didn't. Put the OpenSSL-version testing code +in the Linux target too. makefile, 21 Sep 2010. + +A couple minor changes to the tru64-51b makefile targets from Steven Schweda +but there still are some problems with the Tru64 Unix builds. +makefile, 21 Sep 2010. + +---Alpha.09--- + +\fcontents(\&a[3]) got an error if the array was declared but its dimension +was less than 3, which is bad when dealing with (say) an array created +dynamically by \fsplit(), which might or might not have a third element. +In case it doesn't -- i.e. in case we are referring to an out of range +element of any array that is declared -- we should just return a null +string, as we do with other types of variables that are not defined. +For that matter, ditto even if the array is not declared; what useful +purpose is served by throwing an error in this case? +ckuus4.c, 30 Dec 2010. + +cksplit() treats \ as a quoting character. If the source string contains +backslashes, they are swallowed (or, if doubled, one is kept). That's not +good for parsing external data, such as lines read from files, where there +are no quoting rules. This came up when parsing CSV files; as a workaround, +I made \fsplit() treat backslash as an ordinary character for CSV and TSV +splitting (a better solution might be yet another argument that specifies +a quote character). ckclib.c, 30 Dec 2010. + +Began converting C-Kermit to Open Source with the Simplified 3-Clause BSD +license. Updated the text for the INTRO, LICENSE, NEWS, and SUPPORT +commands. Fixed things so the copyright year to be displayed is defined in +one place (ck_cryear in ckcmai.c), rather than hardwired into text strings +all over the place. COPYING.TXT, ckcmai.c, ckuus[256].c, 2 Jun 2011. + +When I added MIME synonyms for Kermit character-set names, I left a bogus +entry in the tables ("windows-1251") that was in the wrong place +alphabetically, thus preventing most references to file character-set names +from working right. Removed the bogus entry. ckuxla.c, 2 Jun 2011. + +Most combinations work OK, but not translating Cyrillic text from UTF-8 +to Latin/Cyrillic, and probably the same would be true for any case of +converting from UTF-8 or UCS-2 to anything else. The problem was in +xgnbyte(), which converts the input stream from the specified character to +UCS2; it needed to make a special case for when the input file was already +Unicode. Believe it or not, this problem occurred at least as far back as +8.0.201 (9.5 years ago) and nobody noticed. So if the fix isn't perfect +probably nobody will notice that either. ckcfns.c, 3 Jun 2011. + +The SET BLOCK CHECK command did not parse all the items in its keyword +list. Fixed in ckuus3.c, 3 Jun 2011. + +For EM-APEX ocean floats project, where buoys in stormy waters have to +transmit data through an earth satellite using non-error-correcting modems, +John Dunlap ran exhaustive stress tests of Kermit protocol transfers through +a simulated connection that injected errors and delays and identified a +weakness in Kermit protocol when it is used under extremely bad conditions: +If a data byte of the S packet (or its Ack) is corrupted and the 1-byte +checksum is also corrupted in such a way that that the checksum matches the +corrupted data, the two Kermit programs will disagree as to the negotiated +parameters. For example, if file Sender's RPT field is changed from '~' to +'^', the receiver will decode the packet incorrectly. Ditto for most of the +other parameters. The result is that a corrupted file is received but +reported correct. John suggested a new mode of operation in which the Type +3 block check is used for all packets. Such a mode can not be negotiated +because the negotiation packet itself is assumed by all Kermit programs to +have a 1-byte checksum. Added SET BLOCK-CHECK 5 to the parser (with +invisible synonym FORCE-3". ckuus3.c, 3 Jun 2011. + +Added supporting code for SET BLOCK 5: ckcfn[23].c, ckcpro.w, ckcmai.c, +ckuus3.c, 3 Jun 2011. + +Added code to skip the heuristic that S and I packets always have block +check type 1. File transfer OK between two C-Kermits with SET BLOCK 5. +rpack(): ckcfn2.c, 5 Jun 2011. + +Made the file receiver put "5" in the block-check-type in its ACK to the +S-Packet. spar(): ckcfns.c, 5 Jun 2011. + +Now the question is: Can we make the file receiver automatically and safely +recognize a three-byte block check on an incoming S or I packet? It's +tricky because the block check field is not self-identified, it's just the +last "n" characters of string indicated by the length field, so correct +decoding of the packet depends on stateful knowledge of "n". How about this: +rpack() already knows what type of packet it is, so if it's an S or I packet +and the 8th byte of the data field is "5" and last 3 bytes, when interpreted +as the CRC, match the packet contents, then we accept the packet and switch +to BLOCK 5 mode. + +On the other hand, if the "5" was put there by corruption, the CRC should +catch the error. In that case we NAK the packet and presumabely get a +different version back. There would be no reason to try to re-read the same +packet with a different block check, because the "5" could not possibly be +there legitimately unless it had a 3-byte CRC. To be clear, this is +cheating. We read the packet contents before we know the packet is correct, +then we check that it *is* correct. I made the 4-line change to rpack() +and it works OK in the absense of transmission errors. ckcfn2.c, 3 Jun 2011. + +So the various combinations should work as desired: + + . Sender and receiver both support and are told to SET BLOCK 5 ("SB5"). + . Sender SB5, but receiver doesn't support it (errors out). + . Sender SB5, receiver supports it but wasn't told (auto-recognizes it). + . Receiver SB5 but sender no (errors out). + +Note in the last case, the receiver should NOT automatically fall back to +standard behavior because if the user said SET BLOCK 5 that means every +packet MUST be protected by CRC to prevent the I/S packets from being +corrupted. + +Installed new HELP SET BLOCK-CHECK text. ckuus2.c, 5 Jun 2011. + +Autodownload didn't work when the S or I packet had a 3-byte block check +because kstart() checked it for a 1-byte checksum. Fixed in kstart(), +ckcfn2.c, 6 Jun 2011. However, older Kermit versions and programs that +claim to do "autodownload" will never recognize this type of packet. No +big deal since even if they did, the transfer would fail anyway. + +Added 'FORCE 3' to E-Kermit, called it EK 1.7. The option is "-b 5". Works +OK for sending and receiving, both with and without the new option. Also +works with "-b 5" if you send an S packet to it with '5' in the BCT field. +Changes were minimal, I have them all in ek17.diff. + +I could probably also make a new G-Kermit in about 10 minutes, but who cares +about G-Kermit... We already have two useful Kermit programs that +interoperate with the new protocol. 6 Jun 2011. + +Replaced the very inadequate help texts for functions \fword() and +\fsplit() with new ones. ckuus2.c, 6 Jun 2011. + +There were a couple reports of file corruption that I was saving for later. +Now that now is later I dug up the messages, files, and logs and it turns +out that nobody had reported a reproducible case of Kermit corrupting a +file. There have been non-reproducible cases though, almost certainly due +to corruption of the S or I packet or its ACK, which is why we now have SET +BLOCK 5. Even with BLOCK CHECK 5, there is no guarantee that the same thing +won't happen, it is just far less likely. Even if we added a 32-bit CRC or +even 64-bit one, there would still be a small chance it could happen. + +7 Jun 2011: + +Corrected various #ifdefs (or lack of them) when building C-Kermit with +different combinations of feature-selection options such as NOCSETS, NOICP, +NOLOCAL, NOSPL, NOUNICODE, etc. ckcfns.c ckcmai.c ckcxla.h ckuus2.c +ckuus4.c ckuus5.c ckuus6.c ckuusr.c, 7 Jun 2011. After running the script +that does all these builds (84 of them) I ran it again to make sure that +none of the changes broke builds that succeeded before the changes were made. + +Built OK on Solaris9 ("make solaris9") +Ditto with Krb5 and OpenSSL 0.9.8q ("make solaris9g+openssl+shadow+pam+zlib") + +Built OK on Mac OS X 10.4.11 ("make macosx"). +Also "make macosx+krb5+openssl. + +Built OK on Linux RHEL4 ("make linux"). +Built OK on Linux RHEL4 with OpenSSL 0.9.7a ("make linux+ssl"). +Built OK on Linux RHEL5 ("make linux"). + +"make linux+ssl" fails on RHEL5 because of DES, even though the target +tests for the presence or absence of the DES libraries. In this case the +libraries are there but they lack the functions des_ecb3_encrypt, +des_random_seed, and des_set_odd_parity. The build succeeds as: + + make linux+ssl KFLAGS=-UCK_SSL + +Since DES is now considered harmful, Jeff Altman suggests that all OpenSSL +builds, even for old versions, should omit it ("If you are building with +openssl and no kerberos or srp, just disable DES. Disabling DES will impact +telnet and rlogin but it won't matter if you have no ability to negotiate a +session key"). + +From Ian Beckwith, patches for Debian Linux: + . Change all '-' to '\(hy' in man page (new pedantry): ckuker.nr. + . Make IKSD authentication (using PAM) ask for a password when an invalid + username has been given, to avoid disclosing which account names are valid: + ckufio.c, ckuus7.c. + . Fix spelling errors: ckcftp.c, ckuus2.c, ckuker.nr, ckcpro.w, ckuusr.h. + . Patch makefile to support install to a staging area with DESTDIR. + . Some other patches (mainly for typos) were for plain-text documentation + files that were generated from Web pages; I updated the web pages. + +A big corporate C-Kermit user has an application where a local C-Kermit +makes a connection to a remote one, uploads some files, and then if the +server has any new patch files for the local, it sends the patches and +does a REMOTE HOST command to run the patch program. This stopped working +in C-Kermit 6.0 or 7.0 when I put a check to prevent it, because "it makes +no sense to send REMOTE commands to the local end, because the results are +sent back to the remote to be displayed on its screen but it has no screen". +That may be true, but if the user needs to control the local from the +remote, they should be able to. I removed the checks. This doesn't solve +the problem of where the output goes; ideally it would go to the local +screen but I don't see any elegant and simple way to make that change. +However the output redirectors can still be used with the REMOTE command +so the results can be captured to a remote file, which could then be sent. +ckuus7.c, 7 Jun 2011. + +Changed SET VARIABLE-EVALUATION to SET COMMAND VARIABLE-EVALUATION, but left +the former version available. ckuusr.c, 9 Jun 2011. + +Documented the SET COMMAND VARIABLE-EVALUATION command, which I added in +2008. ck90.html, 9 Jun 2011. + +Renamed all old Mac OS X makefile targets to have the prefix "old" to avoid +confusing them with the current targets, and made macosx10 a synonym for +macosx, so those who used previous makefiles will get a current target +without having to know the new name. makefile, 9 Jun 2011. + +Added XMESSAGE, which is to MESSAGE as XECHO is ECHO: prints the text +without a line terminator, so it can be continued by subsequent [X]MESSAGE +commands. ckuusr.[ch], 9 Jun 2011. + +Back to "make linux+ssl" on RHEL5... I took the coward's way out and added +code to the makefile target to check whether the build worked (somebody let +me know if there is a better way to check), and if not to give a message +suggesting they "make clean ; make linux+ssl KFLAGS=-UCK_DES". makefile, +9 Jun 2011. + +Noticed that \frecurse() would dump core if called with no arguments. +Fixed in ckuus4.c, 9 Jun 2011. + +Added \q() as an alternative to the more verbose \fliteral() for quoting +strings that contain characters (like \) that would otherwise be significant +to Kermit. It's more efficient because it isn't a function call, and 'q' +is an intuitive letter to mean 'quote'. It also works better than +\fliteral() because functions treat commas and braces specially. ckuus4.c, +10 Jun 2011. + +Built OK on VMS 8.3 on Alpha, no net. DEC C caught a couple glitches in the +new code that gcc didn't catch, which I fixed. ckuus[25].c, 10 Jun 2011. + +Built OK on VMS 8.3 on Alpha with Multinet 5.3. The SSL build failed but +I'm not going to worry about it. 10 Jun 2011. + +Built OK on NetBSD 5.1. 10 Jun 2011. + +Tried to resurrect my old "build-all" machine, an IBM Netfinity 3500 from +1997 with 20-some mountable bootable hard disks with lots of 1990s OS's on +them. No dice. I can see the BIOS but not the hard disks. The +configuration is still correct because it tries to boot from the mountable +hard disk, but it fails (I tried six different ones). + +Tried to resurrect my old Siemens Nixdorf RM 200 MIPS machine. Booted OK, +headless even, but makes a hellish high-pitched whine, like a dentist drill. +It's pretty slow too. "make sinix542" (for SINIX 5.4.2) bombed at link +time on no rdchk(). Fixed by #including . ckutio.c, 10 Jun 2011. + +Tried to resurrect my old SCO Xenix 2.3.4 machine, also headless. Amazingly +it still works; it can't use a monitor but I can Telnet to it. Had to tweak +some #ifdefs but I got a no-net version built successfully. According to my +notes, it hasn't been possible to build with TCP/IP since C-Kermit 8.0, +but how many people ever had SCO Xenix 2.3.4 with TCP/IP anyway? Anyway we +still have the binaries for C-Kermit 7.0. ckuus4.c, 10 Jun 2011. + +Built OK on AIX 5.3. Built OK on Solaris 10. 11 Jun 2011. + +Tried harder to revive the build-all machine, now it sort of works, but not +all of the bootable OS's work. Built C-Kermit 9.0 OK on OpenBSD 3.0. Built +OK on QNX 4.25 but had to #ifdef references to IXANY in ckutio.c and ckupty. +Built OK on NetBSD 1.5.1 (2000). Tried "make netbsd+ssl" on this one, it's +OpenSSL 0.9.5a 1 Apr 2000, but it bombs out in ckuath.c, no big deal. +Another problem in NetBSD 1.5.2 is that even though off_t is 8, CK_OFF_T +is 4. Worth noting but not worth fixing unless someone else notices. +13 Jun 2011. + +SuSE 7.0... boots OK but telnet server doesn't work. Can telnet out but +it's too flaky, connection drops if I try to transfer a file. + +OpenBSD 2.5 [1999] OK. Red Hat 7.1 OK. Red Hat 7.1 with OpenSSL 0.9.6 +not OK, same error as with 0.9.5a: + +ckuath.c +In file included from ck_ssl.h:48, + from ckuath.c:225: +/usr/include/openssl/des.h:77: warning: redefinition of `Block' +ckuat2.h:86: warning: `Block' previously declared here +/usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct' +/usr/include/openssl/des.h:91: warning: redefinition of `Schedule' +ckuat2.h:90: warning: `Schedule' previously declared here + +So it appears that OpenSSL support is broken for pre-0.9.7. Tried +building it again with -UCK_SSL (since the errors are originating from +from des.h)... But it still failed exactly the same way. I found +#includes for des.h in ckuath.c and and ck_ssl.h and #ifdef'd them out, +but it still fails: + +In file included from /usr/include/openssl/evp.h:89, + from /usr/include/openssl/x509.h:67, + from /usr/include/openssl/ssl.h:69, + from ck_ssl.h:51, + from ckuath.c:227: +/usr/include/openssl/des.h:77: warning: redefinition of `Block' +ckuat2.h:86: warning: `Block' previously declared here +/usr/include/openssl/des.h:83: redefinition of `struct des_ks_struct' +/usr/include/openssl/des.h:91: warning: redefinition of `Schedule' +ckuat2.h:90: warning: `Schedule' previously declared here + +Built OK on Debian 2.1. 13 Jun 2011. + +On FreeBSD 4.4, it blows up with: +ckufio.c: In function vpass': +ckufio.c:8201: conflicting types for 'initgroups' +/usr/include/unistd.h:154: previous declaration of 'initgroups' +ckufio.c:8201: warning: extern declaration of 'initgroups' doesn't match global +one. Fixed by defining NODCLINITGROUPS for FreeBSD in ckufio.c. It might not +be the right fix, but I don't have a lot of other FreeBSD versions to +compare with. Anyway now it builds OK on 4.4, and also on FreeBSD 3.3. +ckufio.c, 13 Jun 2011. + +Tried to build on SCO Open Server 5.0.7 but it fails at link time because +it can't find rdchk(). But it's supposed to be there! Come back to this +later... + +Red Hat 6.1 i386 32/64 linux 2332545 +Red Hat 7.1 i386 32/64 linux 2368528 +Red Hat EL4 i386 32/74 linux 2363067 +Red Hat EL5.6 i386 64 linux 2371279 +Solaris9 sparc 32/64 solaris9 2849896 +Solaris9+ssl sparc 32/64 solaris9 5021764 +Solaris10 sparc 32/64 solaris10 2855776 +QNX i386 32 qnx32 2012323 +NetBSD 1.5.1 i386 32/64 netbsd 2198055 +NetBSD 5.1 i386 32/64 netbsd 2159863 +OpenBSD 2.5 i386 32/64 openbsd 2236036 +Mac OS X 10.6.7 x86_64 64 macosx 2.7M +Mac OS X 10.4.11 ppc 32/64 macosx 2496304 +Debian 2.1 i386 32/64 linux 2213221 +FreeBSD 4.4 i386 32/64 freebsd 2291333 +FreeBSD 3.3 i386 32/64 freebsd 2147370 +SINIX 5.42 mips 32 sinix542 3319325 (1995) +SCO Unixware 2.1.3 i386 32 uw213 2242176 +SCO OSR6.0.0 i386 32/64 sco_osr600 2368300 + +More builds, 14 June 2011: + +VMS 6.2 alpha 32 make mn 2556928 No TCP/IP +VMS 6.2 alpha 32 make m 3112960 UCX 4.0 +Solaris 11 i386 32/64 solaris11 2823860 +Solaris 11 i386 32/64 solaris11+ssl 2993660 OpenSSL 0.9.8l +NetBSD 5.1 i386 32/64 netbsd+krb5 2307855 Kerberos 5 +Linux Slackware 12.1.0 i386 32/65 linux 2175754 +Linux Fedora 14 i386 32/64 linux 2256514 +Linux Fedora 14 i386 32/64 linux+ssl ....... OpenSSL 1.0.0d +Linux Fedora 14 i386 32/64 linux+krb 2449614 (*) + +(*) make linux+krb5 "LIBS=$LIBS /lib/libk5crypto.so.3 /lib/libcom_err.so.2" + +Noticed that netbsd+ssl build on NetBSD 5.1 said "NetBSD 1.5" in its banner. +Fixed by replacing the old hardwired target with the new "subroutinized" +target a'la linux+ssl and adapting it to NetBSD. makefile, 15 Jun 2011. + +Same deal for Kerberos 5, make a new netbsd+krb5 target and it builds ok, +at least once one figures out where the Kerberos headers and libs are. +makefile, 15 Jun 2011. + +Same deal for the netbsdnc target, now it simply defined NOCURSES and +chains to the main netbsd target. makefile, 15 Jun 2011. + +Tried to build with Kerberos 5 on Solaris, fails because the DES library +no longer exists. This one is beyond me, sorry. + +Made new targets for MirBSD, mirbsd and mirbsd+ssl, makefile 15 Jun 2011. + +In OpenSUSE 11.2 with OpenSSL 0.9.8r we bomb on undefined references from +various DES library routines. Builds OK without DES. + +Various linux+krb5 builds fail because can't find -lgssapi_krb5 + +SSL builds with OpenSSL < 0.9.7 fail even though there is code to support +the older SSL. + +Fixed some printf %ld vs int instances in the sizeofs section of SHOW FEATURES. +ckuus5.c, 15 Jun 2011. + +Fixed the new linux+ssl target to actually use the SSLINC and SSLLIBS +definitions, oops. makefile, 15 Jun 2011. + +15 June 2011 builds (Beta.01): + +AIX 5.3 ppc 32/64 aix+ssl 3283846 OpenSSL 0.9.8m +NetBSD 5.1 i386 32/64 netbsd 2159863 +NetBSD 5.1 i386 32/64 netbsd+ssl 2350274 OpenSSL 0.9.9-dev +NetBSD 5.1 i386 32/64 netbsd+krb5 2349627 MIT Krb5 1.6.3 +FreeBSD 8.2 i386 32/64 freebsd 2298414 +FreeBSD 8.2 i386 32/64 freebsd+ssl 2448961 OpenSSL 0.9.8q +OpenBSD 4.7 i386 32/64 openbsd 2266132 +OpenBSD 4.7 i386 32/64 openbsd+ssl 2409263 OpenSSL 0.9.8k +MirBSD 10 i386 32/64 mirbsd 2216601 +MirBSD 10 i386 32/64 mirbsd+ssl 2358318 OpenSSL 0.9.8r +OpenSuse 11.2 x86_64 64 linux 2348468 +OpenSuse 11.2 x86_64 64 linux+ssl (*) 2546540 OpenSSL 0.9.8r +RHEL 5.6 ia64 64 linux 4390687 +RHEL 5.6 ia64 64 linux+ssl (*) 4775007 OpenSSL 0.9.8e +Ubuntu 9.10 i386 32/64 linux 2275523 +Ubuntu 9.10 i386 32/64 linux+ssl 2466708 OpenSSL 0.9.8r +Gentoo 1.12.13 ppc 32/64 linux 2386597 +Gentoo 1.12.13 ppc64 64 linux 2749015 +Gentoo 1.12.13 ppc64 64 linux+ssl 3002150 OpenSSL 0.9.8r +Gentoo 1.12.13 sparc 32/64 linux 2478382 +Gentoo 1.12.13 sparc 32/64 linux+ssl 2690499 OpenSSL 0.9.8r +Solaris 9 sparc 32/64 solaris9 2849896 +Solaris 10 i386 32/64 solaris10 2837620 +IRIX 6.5 R10000 32/64 irix65 2869704 + +* and KFLAGS=-UCK_DES + +Tried building on NetBSD 5.1 with Heimdal Kerberos using: + +make netbsd+krb5 \ + "KFLAGS=-DHEIMDAL" \ + "K5INC=-I/usr/include" \ + "K5LIB=-L/usr/lib" + +It found all its headers OK, but it blew up in ckuath.c. Small wonder, +ckccfg.html says: + +HEIMDAL + Should be defined if Kerberos V support is provided by HEIMDAL. Support + for this option is not complete in C-Kermit 8.0. Anyone interested in + working on this should contact kermit-support. + +'krb5-config --version' gives the MIT Kerberos 5 version number. + +Make a new netbsd+krb5+ssl target based on the combination of the new +netbsd+ssl and netbsd+krb5 targets. There were lots of warnings in the +compilation but no errors, but it produced an executable that starts and +does normal things but I have no idea if the SSL or Kerberos functions work. +makefile, 16 Jun 2011. + +Changed the cu-solaris9-krb5 target to test for the presence of DES because +DES isn't there, to see if this would allow a Kerberos build to proceed. +And it worked, amazing. At least the build completed, I have no way to test +the Kerberos part. makefile, 16 Jun 2011. + +Updated the solaris9+ssl target to do the DES testing. makefile, 16 Jun 2011. + +Updated cu-solaris+krb5 target to test whether the GSSAPI library is called +libgassapi or libgassapi_krb5. makefile, 16 Jun 2011. + +Added lots of tests to the Linux Kerberos 5 entries, linux+krb5 and +linux+krb5+ssl, because some have libk5crypto and some don't; some have +libcom_err and some don't; and some have libgssapi_krb5 (e.g. RHEL5, +OpenSuse 11.2) whereas others have libgssapi (Gentoo). + +16 June 2011 builds (Beta.01): + +NetBSD 5.1 i386 32/64 netbsd+krb5+ssl 2451757 OpenSSL 0.9.9 MIT Krb5 1.6.3 +Solaris 9 sparc 32/64 solaris9+krb5 2543036 MIT Kerberos 5 1.7.1 +Solaris 9 sparc 32/64 solaris9+ssl 5021544 OpenSSL 0.9.8q (gcc) +Gentoo... ppc 32/64 linux 2386597 +Gentoo... ppc 32/64 linux+ssl 2593561 OpenSSL 0.9.8r +Gentoo... ppc64 64 linux 2749015 +Gentoo... ppc64 64 linux+ssl 3002150 OpenSSL 0.9.8r +RHEL5 x86_64 64 linux+krb5 (*) 2563878 MIT Kerberos 5 1.6.1 +RHEL5 x86_64 64 linux+krb5+ssl(*) 2563878 MIT Kerberos 5 1.6.1 +Fedora 14 i386 32/64 linux+krb5+ssl 2539891 MIT Krb5 + OpenSSL 0.9.8r + +* KFLAGS=-UCK_DES + +--- C-Kermit 9.0.299 Beta.01 --- + +sizeof() can return a long or an int, so neither printf("%d",sizeof(blah)); +or printf("%ld",sizeof(blah)); can be used everywhere. Changed the +"sizeofs" section of SHOW FEATURES in the dumbest (and therefore most +portable) way to squelch the warnings. ckuus5.c, 17 Jun 2011. + +From John Dunlap: "Watching the server screen led me to offer a cosmetic +patch for ckuusx.c. I noticed that the server screen said it was +"RESENDING" when it really wasn't. The attached patch emits blanks to +insure that old labels are completely erased." ckuusx.c, 17 Jun 2011. + +Nelson Beebe found two places where I had SSLLIBS in the makefile instead of +SSLLIB. makefile, 18 Jun 2011. + +More important he knew how to force gcc to load the right header files for +OpenSSL 1.0.0d (by using '-isystem' rather than '-I'). Previously it was +using the 0.9.8r header files but linking with the 1.0.0d libraries. This +is not in the sources or makefile; it's done when giving the 'make' command: + + export PATH=/usr/bin:$PATH + export SSLINC=-isystem/usr/include + export "SSLLIB=-L/usr/lib -Wl,-rpath,/usr/lib" + make linux+ssl + +Folded the previous linux+openssl+zlib+shadow+pam and linux+openssl+shadow +targets into linux+ssl. Checked the linuxso (scripting only) target, builds +OK, 600K. Made new subroutinized linux+krb5+krb4 target but can't find +anyplace to test it. Made new subroutinized linux+shadow+pam target, works +fine on RHEL4. Revised comments and lists again. makefile, 18 Jun 2011. + +For the pluggable-disk OS's that boot OK but lack a working network, I +rigged up a serial connection using a DB9-FF null modem cable, and then a +DB9-MF modem cable to make it reach. I don't see any modem signals on +either end, but the data goes through OK. COM1 on the desktop PC, +/dev/ttyS1 or whatever on Lab. Since there are no modem signals, can't use +RTS/CTS. At 57600bps with Xon/Xoff, 500-byte packets and sliding windows, +transfers work OK at about 5000cps using 5 window slots; takes 8 minutes to +transfer the gzipped C-Kermit tarball. Kermit to the rescue. 19 Jun 2011. + +Transferred the tarball over serial ports to SCO OSR5.0.5 at 38.4Kbps, the +highest speed supported, 12 minutes, no errors, 3300cps. Unpack, make +sco32v505udk, OK. Also built the TCP/IP version and it almost made an +outbound connection, but only once (not a Kermit program but something with +the TCP/IP stack). 19 Jun 2011. + +Ditto for Solaris 2.6/i386, except 57.6Kbps, 4K-byte packets, no problem. +Solaris 8/i386, ditto. 19 Jun 2011. + +SCO OpenServer 5.0.5 i386 32 sco32v505udk 1940964 No TCP/IP +SCO OpenServer 5.0.5 i386 32 sco32v505udknet 2314668 With TCP/IP +Sun Solaris 2.6 i386 32 solaris26g 4661368 +Sun Solaris 8 i386 32 solaris8g 4675432 + +When using compact substring notation, \s(xx[4]) returns the whole string +xx starting at position 4, but \s(xx[4:]) returns an empty string. Fixed +the latter to be like the former. ckuus5.c, 20 Jun 2010. + +Really it would have been nicer if \s(xx[4]) returned a single character, +the 4th character of xx, but it's too late now. Added another "separator" +character '.' (period) for that: \s(xx[4.]) is the 4th character of xx. +ckuus4.c, 20 Jun 2010. + +Back to SCO OSR5.0.7... This failed before because 'rdchk' came up unknown +at link time, unlike all previous OSR5's, that used rdchk() in place of the +FIONREAD ioctl. Added #ifdefs to make a special case for 5.0.7. I'm not +sure this is the best way, but this is the minimal change to get it to work. +If anybody cares, maybe the same can be done for previous OSR5 releases. +ckutio.c, 20 Jun 2010 (search for SCO_OSR507). + +SCO OpenServer 5.0.7 i386 32 sco32v507 1895724 No TCP/IP +SCO OpenServer 5.0.7 i386 32 sco32v507net 2246792 With TCP/IP + +Checked current code on RHEL4, found that my GSSAPI-lib finding makefile +target didn't look in enough places; added some more. makefile, 21 Jun 2011. + +Got reports back on HPUX from Peter Eichhorn, almost all good on HP-UX 7, 8, +9, 10, and 11. 21-22 Jun 2011. + +Got access to Debian 5.0 and 7-to-be ("Wheezy/Sid"). Regular 'make linux' is +OK in Debian 5, but in 7 can't find crypt, res_search, or dn_expand; had +to add more library search clauses to 'make linux'. makefile, 21 Jun 2011. + +In Debian 7.0, libk5crypto could not be found without adding another clause +to 'make linux+krb5'. That done, the SSL build (1.0.0d) was OK, as well as +the krb5+ssl one. makefile, 21 Jun 2011. + +I found a Linux box that had both Kerberos 4 and 5 installed and tried 'make +linux+krb5+krb4', which failed because of missing DES functions. Tried +'make linux+krb5+krb4 KFLAGS=-UCK_DES', but that fails too, even though it +doesn't fail for Kerberos 5 alone, so probably some Krb4 code is making +unguarded calls to the DES routines. What is really needed is a way to +completely strip all DES references from any given build, code and makefile, +a big deal. 21 Jun 2011. + +Fixed some typos in COPYING.TXT (noticed by Ian Beckwith). 24 Jun 2011. + +Got access to perhaps the last living 4.3BSD VAX system. It doesn't have +SEEK_CUR so I had to #ifdef out the \fpicture() function. Aside from that, +no problems. ckuus4.c, 24 Jun 2011. + +I had been wanting the S-Expression (ROUND x) to allow a second argument n, +which, if given, tells where the rounding should occur. If n is positive, +the number is rounded to n decimal places. If zero, it is rounded to the +nearest integet. If positive, the number is rounded to the nearest power of +10; e.g. -2 means "to the nearest hundred". If ROUND is used as before, +with one argument, it works as before. ckclib.c, ckuus3.c, 25 Jun 2011. + +From Arthur Marsh, a few more directories to test for libresolv in Linux. +makefile, 26 Jun 2011. + +From Martin Vorlaender, a fix for the VMS file-transfer display and +statistics, a place where a file length wasn't being cast to CK_OFF_T +in zchki(). ckvfio.c, 28 Jun 2011. + +Updated version to 9.0.300 and removed the Beta designation. +ckcmai.c, makefile, 28 Jun 2011. + +Removed solaris9_64 target from makefile. It builds but it doesn't work +at all. 30 Jun 2011. + +--- C-Kermit 9.0.300 --- + +--------------------------------- +*************************** diff --git a/ckcbwr.txt b/ckcbwr.txt new file mode 100644 index 0000000..f378d42 --- /dev/null +++ b/ckcbwr.txt @@ -0,0 +1,1503 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + + As of: C-Kermit 9.0.300, 30 June 2011 + This page last updated: Tue Jun 28 08:54:30 2011 (New York USA Time) + + IF YOU ARE READING A PLAIN-TEXT version of this document, it is a + plain-text dump of a Web page. You can visit the original (and + possibly more up-to-date) Web page here: + + [11]http://www.columbia.edu/kermit/ckcbwr.html + + This document contains platform-independent C-Kermit hints and tips. + Also see the platform-specific C-Kermit hints and tips document for + your platform, for example: + + [12]http://www.columbia.edu/kermit/ckubwr.html + + for Unix. This document also applies to [13]Kermit 95 for Windows, + which is based on C-Kermit. + + [ [14]C-Kermit ] [ [15]TUTORIAL ] + +CONTENTS + + 0. [16]PATCHES + 1. [17]INCOMPATIBLE CHANGES + 2. [18]THE C-KERMIT COMMAND PARSER + 3. [19]MULTIPLE SESSIONS + 4. [20]NETWORK CONNECTIONS + 5. [21]MODEMS AND DIALING + 6. [22]DIALING HINTS AND TIPS + 7. [23]TERMINAL SERVERS + 8. [24]TERMINAL EMULATION + 9. [25]KEY MAPPING + 10. [26]FILE TRANSFER + 11. [27]SCRIPT PROGRAMMING + +0. PATCHES + + [ [28]Top ] [ [29]Contents ] [ [30]Next ] + + Source-level patches for C-Kermit 8.0.211: + + (None) + +1. INCOMPATIBLE CHANGES + + [ [31]Top ] [ [32]Contents ] [ [33]Next ] + + These are not necessarily exhaustive lists. + +1.1. C-Kermit 6.0 + + C-Kermit 6.0 was released 6 September 1996 and is completely documented + in [34]Using C-Kermit, 2nd Edition. The following incompatible changes + were made in C-Kermit 6.0: + + * Unless you tell C-Kermit otherwise, if a serial or network + connection seems to be open, and you attempt to EXIT or to open a + new connection, C-Kermit warns you that an active connection + appears to be open and asks you if you really want to close it. If + you do not want these warnings, add SET EXIT WARNING OFF to your + customization file or script, or give this command at the prompt. + * The default for SET { SEND, RECEIVE } PATHNAMES was changed from ON + to OFF, to prevent unexpected creation of directories and + depositing of incoming files in places you might not know to look. + * The default for SET FILE INCOMPLETE was changed from DISCARD to + KEEP to allow for file transfer recovery. + * The default file-transfer block-check is now 3, rather than 1. If + the other Kermit does not support this, the two will drop back to + type 1 automatically unless the other Kermit fails to follow the + protocol specification. + * The default flow-control is now "auto" ("do the right thing for + each type of connection"), not Xon/Xoff. + * Backslash (\) is no longer a command continuation character. Only - + (hyphen, dash) may be used for this in C-Kermit 6.0 and later. + * Negative INPUT timeout now results in infinite wait, rather than 1 + second. + +1.2. C-Kermit 7.0 + + C-Kermit 7.0 was released 1 January 2000. Its new features are + documented in the C-Kermit 7.0 Supplement, + [35]http://www.columbia.edu/kermit/ckermit2.html. The following + incompatible changes were made in C-Kermit 7.0: + * The "multiline GET" command is gone. Now use either of the + following forms instead: + get remote-name local-name + get /as-name:local-name remote-name + + If either name contains spaces, enclose it in braces (or, in + C-Kermit 8.0, doublequotes). + * To include multiple file specifications in a GET command, you must + now use MGET rather than GET: + mget file1 file2 file3 ... + + * C-Kermit 7.0 and later use FAST Kermit protocol settings by + default. This includes "unprefixing" of certain control characters. + Because of this, file transfers that worked with previous releases + might not work in the new release especially against a + non-Kermit-Project Kermit protocol implementation (but it is more + likely that they will work, and much faster). If a transfer fails, + you'll get a context-sensitive hint suggesting possible causes and + cures. Usually SET PREFIXING ALL does the trick. + * By default C-Kermit 7.0 and later send files in text or binary mode + by looking at each file to see which is the appropriate mode. To + restore the previous behavior, put SET TRANSFER MODE MANUAL and the + desired SET FILE TYPE (TEXT or BINARY) in your C-Kermit + initialization file. + * The RESEND and REGET commands automatically switch to binary mode; + previously if RESEND or REGET were attempted when FILE TYPE was + TEXT, these commands would fail immediately, with a message telling + you they work only when the FILE TYPE is BINARY. Now they simply do + this for you. + * SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and + 138) in case rlogin, ssh, or cu are "in the middle", since + otherwise ~ might appear in Kermit packets, and this would + cause rlogin, ssh, or cu to disconnect, suspend,escape back, or + otherwise wreck the file transfer. Xon and Xoff are now always + prefixed too, even when Xon/Xoff flow control is not in effect, + since unprefixing them has proven dangerous on TCP/IP connections. + * In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built + into C-Kermit itself rather than implemented by running an external + command or program. The built-in command might not behave the way + the platform-specific external one did, but many options are + available for customization. Of course the underlying + platform-specific command can still be accessed with "!", "@", or + "RUN" wherever the installation does not forbid. In UNIX, the "ls" + command can be accessed directly as "ls" in C-Kermit. + * SEND ? prints a list of switches rather than a list of filenames. + If you want to see a list of filenames, use a (system-dependent) + construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND + []? (VMS), etc. + * In UNIX, OS-9, and Kermit 95, the wildcard characters in previous + versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and + }, with dash used inside []'s to denote ranges and comma used + inside {} to separate list elements. If you need to include any of + these characters literally in a filename, precede each one with + backslash (\). + * SET QUIET { ON, OFF } is now on the command stack, just like SET + INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458 + of [36]Using C-Kermit, 2nd Edition. This allows any macro or + command file to SET QUIET ON or OFF without worrying about saving + and restoring the global QUIET value. For example, this lets you + write a script that tries SET LINE on lots of devices until it + finds one free without spewing out loads of error messages, and + also without disturbing the global QUIET setting, whatever it was. + * Because of the new "." operator (which introduces assignments), + macros whose names begin with "." can not be invoked "by name". + However, they still can be invoked with DO or \fexecute(). + * The syntax of the EVALUATE command has changed. To restore the + previous syntax, use SET EVALUATE OLD. + * The \v(directory) variable now includes the trailing directory + separator; in previous releases it did not. This is to allow + constructions such as: + cd \v(dir)data.tmp + + to work across platforms that might have different directory + notation, such as UNIX, Windows, and VMS. + * Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and + sticky. In C-Kermit 7.0, there is an array of default flow-control + values for each kind of connection, that are applied automatically + at SET LINE/PORT/HOST time. Thus a SET FLOW command given before + SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can + be guaranteed to have the desired effect only if given after the + SET LINE/PORT/HOST command. + * Character-set translation works differently in the TRANSMIT command + when (a) the file character-set is not the same as the local end of + the terminal character-set, or (b) when the terminal character-set + is TRANSPARENT. + +1.3. C-Kermit 8.0 + + The following incompatible changes were made in C-Kermit 8.0: + * C-Kermit now accepts doublequotes in most contexts where you + previously had to use braces to group multiple words into a single + field, or to force inclusion of leading or trailing blanks. This + might cause problems in contexts where you wanted the doublequote + characters to be taken literally. Consult [37]Section 5 of the + [38]C-Kermit 8.0 Update Notes for further information. + * Using the SET HOST command to make HTTP connections is no longer + supported. Instead, use the new [39]HTTP OPEN command. + +1.4. C-Kermit 9.0 + + The [40]\fsplit() function is incredibly handy, it can do almost + anything, up to and including parsing a LISP program (the underlying + code is the basis of the [41]S-Expression interpreter). But did you + ever try to use it to parse (say) a Tab-Separated-List (TSV file) or + Comma-Separated-List (CSV)? It works as expected as long as the data + contains only 7-bit characters. But if your data contains (say) Spanish + or German or Russian text written in an 8-bit character set such as ISO + 8859-1, every 8-bit character (any value 128-255) is treated as a break + character. This is fixed in C-Kermit 9.0 by treating all 8-bit bytes as + "include" characters rather than break characters, a total reversal of + past behavior. I don't think it will affect anyone though, because if + this had happened to anyone, I would have heard about it! + + Since most standard 8-bit character sets have control characters in + positions 128-160, it might have made sense to keep 128-160 in the + break set, but with the proliferation of Microsoft Windows code pages, + there is no telling which 8-bit character is likely to be some kind of + text, e.g. "smart quotes" or East European or Turkish accented letters. + +2. THE C-KERMIT COMMAND PARSER + + [ [42]Top ] [ [43]Contents ] [ [44]Next ] [ [45]Previous ] + + Various command-related limits are shown in the following table, in + which the sample values are for a "large memory model" build of + C-Kermit, typical for modern platforms (Linux, Solaris, AIX, VMS, etc). + You can see the values for your version of Kermit by giving the SHOW + FEATURES command. The maximum length for a Kermit command (CMDBL) also + determines the maximum length for a macro definition, since DEFINE is + itself a command. The maximum length for a variable name is between 256 + and 4096 characters, depending on the platform; for array declarations + and references, that includes the subscript. + + Item Symbol Sample + Value Definition + Number of characters in a command CMDBL 32763 ckucmd.h + Number of chars in a field of a command ATMBL 10238 ckucmd.h + Nesting level for command files MAXTAKE 54 ckuusr.h + Nesting level for macros MACLEVEL 128 ckuusr.h + Nesting level for FOR / WHILE loops FORDEPTH 32 ckuusr.h + Number of macros MAC_MAX 16384 ckuusr.h + Size of INPUT buffer INPBUFSIZ 4096 ckuusr.h + Maximum files to match a wildcard MAXWLD 102400 ckcdeb.h + Filespecs in MSEND command MSENDMAX 1024 ckuusr.h + Length for GOTO target label LBLSIZ 50 ckuusr.h + \fexecute() recursion depth limit CMDDEP 64 ckucmd.h + + If you need to define a macro that is longer than CMDBL, you can break + the macro up into sub-macros or rewrite the macro as a command file. In + a pinch you can also redefine CMDBL and recompile C-Kermit. All of + these numbers represent tradeoffs: the bigger the number, the more + "powerful" Kermit in the corresponding area, but also the bigger the + program image and possibly disk footprint, and the longer it takes to + load and initialize. + + In the interactive command parser: + + * EMACS- or VI-style command line editing is not supported. + * Editing keys are hardwired (Ctrl-U, Ctrl-W, etc). + + If you interrupt C-Kermit before it has issued its first prompt, it + will exit. This means that you cannot interrupt execution of the + initialization file, or of an "application file" (file whose name is + given as the first command-line argument), or of an alternative + initialization file ("-y filename"), and get to the prompt. There is, + however, one exception to this rule: you *can* interrupt commands -- + including TAKE commands -- given in the '-C "command list"' + command-line argument and -- if there were no action commands among the + command-line arguments -- you will be returned to the C-Kermit prompt. + So, for example, if you want to start C-Kermit in such a way that it + executes a command file before issuing its first prompt, and you also + want to be able to interrupt the command file and get to the prompt, + include a TAKE command for the desired command in the -C argument, for + example: + + kermit -C "take dial.scr" + + At the command prompt, if you use the backslash (\) prefix to enter a + control character, space, or question mark into a command literally, + the backslash disappears and is replaced by the quoted character. If it + was a control character, it is shown as a circumflex (^). This allows + editing (backspace, delete, Ctrl-W) to work correctly even for control + characters. + + Priot to C-Kermit 8.0, the only way to include a comma literally in a + macro definition -- as opposed to having it separate commands within + the definition -- is to enter its ASCII value (44) in backslash + notation, e.g.: + + DEFINE ROWS RUN MODE CO80\{44}\%1 + + In C-Kermit 8.0 you can use constructions like this: + + DEFINE ROWS RUN MODE "CO80,\%1" + + If you quote special characters in a filename (e.g. in the SEND + command), filename completion may seem to work incorrectly. For + example, if you have a file whose name is a*b (the name really contains + an asterisk), and you type "send a\\*", the "b" does not appear, + nor will Ctrl-R redisplay the completed name correctly. But internally + the file name is recognized anyway. + + Question-mark help does not work during execution of an ASKQ command. + The question marks are simply accepted as text. + + In OUTPUT commands only, \B sends a BREAK signal, \L sends a Long BREAK + signal, and \N sends a NUL (ASCII 0). BREAK and Long BREAK are special + signals, not characters, and NUL is a character that normally cannot be + included in a C string, since it is the C string terminator. If you + really want to output a backslash followed by a B, an L, or an N (as is + needed to configure certain modems, etc), double the backslash, e.g. + "output \\B". In C-Kermit 7.0 or later, you can disarm and re-arm the + special OUTPUT-command escapes (\B, \L, and \N) with SET OUTPUT + SPECIAL-ESCAPES { OFF, ON }. + + When using the command-line processor ("kermit -l /dev/tty00 -b 19200", + etc), note that in some cases the order of the command-line options + makes a difference, contrary to the expectation that order of + command-line options should not matter. For example, the -b option must + be given after the -l option if it is to affect the device specified in + the -l option. + +3. MULTIPLE SESSIONS + + [ [46]Top ] [ [47]Contents ] [ [48]Next ] [ [49]Previous ] + + C-Kermit 7.0 and earlier do not support multiple sessions. When you SET + LINE (or SET PORT, same thing) to a new device, or SET HOST to a new + host, the previous SET LINE device or network host connection is + closed, resulting in hangup of the modem or termination of the network + connection. In windowing environments like HP-VUE, NeXTSTEP, Windows, + OS/2, etc, you can run separate copies of Kermit in different windows + to achieve multiple sessions. + + To achieve multiple sessions through a single serial port (e.g. when + dialing up), you can install SLIP or PPP on your computer and then use + C-Kermit's TCP/IP support over the SLIP or PPP connection, assuming you + also have TCP/IP networking installed on your computer. + + C-Kermit 8.0 has the same restriction on SET LINE and SET HOST + sessions: only one regular session (dialout, Telnet, etc) can be open + at a time. However, version 8.0 adds two new kinds of sessions: FTP and + HTTP; one or both of these can be open at the same as a regular + session. + +4. NETWORK CONNECTIONS + + [ [50]Top ] [ [51]Contents ] [ [52]Next ] [ [53]Previous ] + +FTP Client Bugs + + The Unix C-Kermit 8.0.206 FTP client had the following bugs at the time + most of the 8.0.206 binaries were built for the C-Kermit 8.0 CDROM: + + 1. FTP MGET fails when directory segments contain wildcards, as in + "ftp mget */data/*.dat". Work around by doing a separate MGET for + each source directory. + 2. FTP MGET can fail or produce random side effects if you have a + TMPDIR or CK_TMP environment variable definition in effect, or a + SET TEMP-DIRECTORY value, longer than 7 characters. Work around by + giving a SET TEMP-DIRECTORY command with a short value, such as + "/tmp". + + These two bugs are fixed in the source code that is included on the + CDROM, and also in Kermit 95 2.1.1. You can tell if a C-Kermit 8.0.206 + binary has these fixes by typing SHOW VERSION; if it says "FTP Client, + 8.0.200, 24 Oct 2002" it has the fixes; if the edit number is less that + 200, it doesn't, in which case can build a new binary from the source + code (or contact us and we'll try to get get one for you). + +Making TCP/IP Connections Can Take a Long Time + + The most frequently asked question in many newsgroups is "Why does it + take such a long time to make a Telnet connection to (or from) my + (e.g.) Linux PC?" (this applies to Kermit as well as to regular Telnet + clients): + + 1. Most Telnet servers perform reverse DNS lookups on the client for + security and/or logging reasons. If the Telnet client's host cannot + be found by the server's local DNS server, the DNS request goes out + to the Internet at large, and this can take quite some time. The + solution to this problem is to make sure that both client and host + are registered in DNS. + 2. C-Kermit itself performs reverse DNS lookups unless you tell it not + to. This is to allow C-Kermit to let you know which host it is + actually connected to in case you have made a connection to a "host + pool" (multihomed host). You can disable C-Kermit's reverse DNS + lookup with SET TCP REVERSE-DNS-LOOKUP OFF. + 3. C-Kermit 7.0 and later strictly enforce Telnet protocol rules. One + such rule is that certain negotiations must be responded to. If + C-Kermit sends a such a negotiation and the host does not respond, + C-Kermit waits a long time for the reply (in case the network is + congested or the host is slow), but eventually will time out. To + eliminate the waits (and therefore risk possible protocol + mismatches -- or worse -- between Telnet client and server), tell + C-Kermit to SET TELNET WAIT OFF (or include the /NOWAIT switch with + the TELNET command). + +The Rlogin Client + + In multiuser operating systems such as UNIX and VMS, TCP/IP Rlogin + connections are available only to privileged users, since "login" is a + privileged socket. Assuming you are allowed to use it in the first + place, it is likely to behave differently depending on what type of + host you are rlogging in to, due to technical reasons having to do with + conflicting interpretations of RFC793 (Out-Of-Band Data) and Rlogin + (RFC1122)... "Specifically, the TCP urgent pointer in BSD points to the + byte after the urgent data byte, and an RFC-compliant TCP urgent + pointer points to the urgent data byte. As a result, if an application + sends urgent data from a BSD-compatible implementation to an + [54]RFC-1122 compatible implementation then the receiver will read the + wrong urgent data byte (it will read the byte located after the correct + byte in the data stream as the urgent data byte)." Rlogin requires the + use of OOB data while Telnet does not. Therefore, it is possible for + Telnet to work between all systems while BSD and System V TCP/IP + implementations are almost always a bad mix. + +The Telnet Client + + On a TCP/IP TELNET connection, you should normally have PARITY set to + NONE and (except in VMS C-Kermit) FLOW-CONTROL also set to NONE. If + file transfer does not work with these settings (for example, because + the remote TELNET server only gives a 7-bit data path), use SET PARITY + SPACE. Do not use SET PARITY MARK, EVEN, or ODD on a TELNET connection + -- it interferes with TELNET protocol. + + If echoing does not work right after connecting to a network host or + after dialing through a TCP/IP modem server, it probably means that the + TELNET server on the far end of the connection is executing the TELNET + protocol incorrectly. After initially connecting and discovering + incorrect echoing (characters are echoed twice, or not at all), escape + back, give the appropriate SET DUPLEX command (FULL or HALF), and then + CONNECT again. For a consistently misbehaving connection, you can + automate this process in a macro or TAKE file. + + TELNET sessions are treated just like serial communications sessions as + far as "terminal bytesize" and "command bytesize" are concerned. If you + need to view and/or enter 8-bit characters during a TELNET session, you + must tell C-Kermit to SET TERMINAL BYTESIZE 8, SET COMMAND BYTESIZE 8, + and SET PARITY NONE. + + If you SET TELNET DEBUG ON prior to making a connection, protocol + negotiations will be displayed on your screen. You can also capture + them in the debug log (along with everything else) and then extract + them easily, since all Telnet negotiations lines begin with (uppercase) + "TELNET". + +5. MODEMS AND DIALING + + [ [55]Top ] [ [56]Contents ] [ [57]Next ] [ [58]Previous ] + + External modems are recommended because: + + * They don't need any special drivers. + * They are less likely to interfere with normal operation of your + computer. + * You can use the lights and speaker to troubleshoot dialing. + * You can share them among all types of computers. + * You can easily turn them off and on when power-cycling seems + warranted. + * They are more likely to have manuals. + + Modems can be used by C-Kermit only when they are visible as or through + a regular serial port device. Certain modems can not be used in this + normal way on many kinds of computers: Winmodems, RPI modems, + Controllerless modems, the IBM Mwave, etc; all of these require special + drivers that perform some, most, or all of the modem's functions in + software. Such drivers are generally NOT available in UNIX or other + non-Windows (or non-OS/2, in the case of the Mwave) platforms. + + In order to dial a modem, C-Kermit must know its repertoire of commands + and responses. Each modem make and model is likely to have a different + repertoire. Since Kermit has no way of knowhing which kind of modem + will be dialed, normally you have to tell it with a SET MODEM TYPE + command, e.g.: + + set modem type usrobotics + set line /dev/cua0 + set speed 57600 + dial 7654321 + + In the early days, there was a wide variety of modems and command + languages. Nowadays, almost every modem uses the Hayes AT command set + (but with some differences in the details) and its startup + configuration includes error correction, data compression, and hardware + (RTS/CTS) flow control. As long as C-Kermit is capable of hardware flow + control (as it is on many, but not all, the platforms where it runs, + since some operating systems don't support it), the modem can be dailed + immediately, without lengthy configuration dialogs, and in fact this is + what SET MODEM TYPE GENERIC-HIGH-SPEED does. In C-Kermit 8.0, + GENERIC-HIGH-SPEED has become the default modem type, so now it is + usually possible to SET LINE, SET SPEED, and DIAL without having to + identify your modem. If this doesn't work, of course, then you might + have to fall back to the tradiational method: Give a SET MODEM TYPE for + a specific modem first, then SET LINE, SET SPEED, and DIAL. + + An important change in C-Kermit 6.0 is that when you give a SET MODEM + TYPE command to tell Kermit what kind of modem you have, Kermit also + sets a number of other modem-related parameters automatically from its + internal modem database. Thus, the order in which you give + modem-related commands is significant, whereas in prior releases they + could be given in any order. + + In particular, MODEM SPEED-MATCHING is set according to whether the + modem is known to be capable of speed buffering. SET MODEM TYPE + HAYES-2400 automatically turns SPEED-MATCHING ON, because when the + Hayes 2400 reports a particular speed in its CONNECT message, that + means its interface speed has changed to that speed, and C-Kermit's + must change accordingly if it is to continue communicating. This might + cause some confusion if you use "set modem type hayes" for dialing a + more advanced type of modem. + + The new default for flow control is "auto", meaning "do the right thing + for each type of connection". So (for example) if your version of + C-Kermit supports SET FLOW RTS/CTS and your modem also supports + RTS/CTS, then Kermit automatically sets its flow control to RTS/CTS and + set modem's flow control to RTS/CTS too before attempting to use the + modem. + + For these reasons, don't assume that "set modem type hayes" should be + used for all modems that uses the Hayes AT command set. "set modem type + hayes" really does mean Hayes 1200 or 2400, which in turn means no + hardware flow control, and no speed buffering. This choice will rarely + work with a modern high-speed modem. + +6. DIALING HINTS AND TIPS + + [ [59]Top ] [ [60]Contents ] [ [61]Next ] [ [62]Previous ] + + If you have a high-speed, error-correcting, data-compressing, + speed-buffering modem, you should fix the modem's interface speed as + high as possible, preferably (at least) four times higher than its + maximum connection (modulation) speed to allow compression to work at + full advantage. In this type of setup, you must also have an effective + means of flow control enabled between C-Kermit and the modem, + preferably hardware (RTS/CTS) flow control. On platforms that do not + support hardware flow control, it is usually possible to select + software flow control (Xon/Xoff), and C-Kermit will do its best to set + the modem for local Xon/Xoff flow control too (but then, of course, + Ctrl-S and Ctrl-Q characters can not be transmitted on the connection). + + If you are having trouble dialing your modem, SET DIAL DISPLAY ON to + watch the dialing interactions between C-Kermit and your modem. Consult + Chapters 3-4 of [63]Using C-Kermit (2nd Ed) for modem-dialing + troubleshooting instructions. The following sections offer some + addtional hints and tips. + +6.1. Syntax + + If you want to dial a number that starts with #, you'll need to quote + the "#" character (as \# or \{35}), since it is also a comment + introducer: + + C-Kermit>dial #98765421-1-212-5551212 ; Looks like a comment + ?You must specify a number to dial + C-Kermit>dial \#98765421-1-212-5551212 ; Works OK + C-Kermit>dial =#98765421-1-212-5551212 ; This works too + + When using a dialing directory, remember what happens if a name is not + found: + + C-Kermit>dial xyzcorp + Lookup: "xyzcorp" - not found - dialing as given + + This normally does no harm, but some modems might behave strangely when + given dial strings that contain certain letters. For example, a certain + German modem treats any dial string that contains the letter "s" as a + command to fetch a number from its internal list, and replies OK to the + ATD command, which is normally not a valid response except for partial + dialing. To avoid this situation, use: + + lookup xyzcorp + if success dial + +6.2. The Carrier Signal + + Remember: In many C-Kermit implementations (depending on the underlying + operating system -- mostly Windows, OS/2, and System-V-based UNIX + versions, and in C-Kermit 7.0, also VMS), you can't CONNECT to a modem + and type the modem's dialing command (like "ATDT7654321") manually, + unless you first tell C-Kermit to: + + SET CARRIER-WATCH OFF + + This is because (in these implementations), the CONNECT command + requires the modem's Carrier Detect (CD) signal to be on, but the CD + signal doesn't come on until after dialing is complete. This + requirement is what allows C-Kermit to pop back to its prompt + automatically when the connection is hung up. See the description of + SET CARRIER-WATCH in "Using C-Kermit". + + Similarly, if your dialed connection drops when CARRIER-WATCH is set to + AUTO or ON, you can't CONNECT back to the (now disconnected) screen to + see what might have happened unless you first SET CARRIER-WATCH OFF. + But sometimes not even SET CARRIER-WATCH OFF will help in this + situation: certain platforms (for example Unixware 2.1), once carrier + drops, won't let the application do i/o with the device any more. In + that case, if you want to use the device again, you have to CLOSE it + and OPEN it again. Or you can have Kermit do this for you automatically + by telling it to SET CLOSE-ON-DISCONNECT ON. + +6.3. Dialing and Flow Control + + Don't SET FLOW RTS/CTS if your modem is turned off, or if it is not + presenting the CTS signal. Otherwise, the serial device driver can get + stuck waiting for this signal to appear. + + Most modern modems support RTS/CTS (if they support any hardware flow + control at all), but some computers use different RS-232 circuits for + the same purposes, e.g. DTR and CD, or DTR and CTS. In such cases, you + might be able to make your computer work with your modem by + appropriately cross-wiring the circuits in the cable connector, for + example the computer's DTR to the modem's RTS, and modem's CD to the + computer's CTS. HOWEVER, C-Kermit does not know you have done this. So + if you have (say) SET FLOW DTR/CD, C-Kermit will make no attempt to + tell the modem to use RTS/CTS. You probably did this yourself when you + configured the modem. + +6.4. The Dial Timeout + + If it takes your call longer to be completed than the timeout interval + that C-Kermit calculates, you can use the SET DIAL TIMEOUT command to + override C-Kermit's value. But beware: the modem has its own timeout + for completing the call. If it is a Hayes-like modem, C-Kermit adjusts + the modem's value too by setting register S7. But the maximum value for + S7 might be smaller than the time you need! In that case, C-Kermit sets + S7 to 0, 255, or other (modem-specific) value to signify "no timeout". + If Kermit attempts to set register S7 to a value higher than your + modem's maximum, the modem will say "ERROR" and you will get a "Failure + to initialize modem" error. In that case, use SET DIAL TIMEOUT to + override C-Kermit's calculation of the timeout value with the highest + value that is legal for your modem, e.g. 60. + +6.5. Escape Sequence Guard Time + + A "TIES" (Time-Independent Escape Sequence) modem does not require any + guard time around its escape sequence. The following text: + + +++ATH0 + + if sent through a TIES modem, for example because you were uploading + this file through it, could pop the modem back into command mode and + make it hang up the connection. Later versions of the Telebit T1600 and + T3000 (version LA3.01E firmware and later), and all WorldBlazers, use + TIES. + + Although the probability of "+++" appearing in a Kermit packet is + markedly lower than with most other protocols (see the [64]File + Transfer section below), it can still happen under certain + circumstances. It can also happen when using C-Kermit's TRANSMIT + command. If you are using a Telebit TIES modem, you can change the + modem's escape sequence to an otherwise little-used control character + such as Ctrl-_ (Control-Underscore): + + AT S2=31 + + A sequence of three consecutive Ctrl-_ characters will not appear in a + Kermit packet unless you go to extraordinary lengths to defeat more + than a few of Kermit's built-in safety mechanisms. And if you do this, + then you should also turn off the modem's escape-sequence recognition + altogether: + + AT S48=0 S2=255 + + But when escape sequence recognition is turned off, "modem hangup" + (+++ATH0) will not work, so you should also SET MODEM + HANGUP RS232-SIGNAL (rather then MODEM-COMMAND). + +6.6. Adaptive Dialing + + Some modems have a feature called adaptive dialing. When they are told + to dial a number using Tone dialing, they check to make sure that + dialtone has gone away after dialing the first digit. If it has not, + the modem assumes the phone line does not accept Tone dialing and so + switches to Pulse. When dialing out from a PBX, there is almost always + a secondary dialtone. Typically you take the phone off-hook, get the + PBX dialtone, dial "9" to get an outside line, and then get the phone + company's dialtone. In a situation like this, you need to tell the + modem to expect the secondary dialtone. On Hayes and compatible modems, + this is done by putting a "W" in the dial string at the appropriate + place. For example, to dial 9 for an outside line, and then 7654321, + use ATDT9W7654321: + + SET PBX-OUTSIDE-PREFIX 9W + + (replace "9" with whatever your PBX's outside-line prefix is). + +6.7. The Busy Signal + + Some phone companies are eliminating the busy signal. Instead, they + issue a voice message such as "press 1 to automatically redial until + the number answers, or...". Obviously this is a disaster for modem + calls. If your service has this feature, there's nothing Kermit can do + about it. Your modem will respond with NO CARRIER (after a long time) + rather than BUSY (immediately), and Kermit will declare the call a + failure, rather than trying to redial the same number. + +6.8. Hanging Up + + There are two ways to hang up a modem: by turning off the serial port's + DTR signal (SET MODEM HANGUP-METHOD RS232-SIGNAL) or sending the modem + its escape sequence followed by its hangup command (SET MODEM + HANGUP-METHOD MODEM-COMMAND). If one doesn't work, try the other. If + the automatic hangup performed at the beginning of a DIAL command + causes trouble, then SET DIAL HANGUP OFF. + + The HANGUP command has no effect when C-Kermit is in remote mode. This + is on purpose. If C-Kermit could hang up its own controlling terminal, + this would (a) most likely leave behind zombie processes, and (b) pose + a security risk. + + If you DIAL a modem, disconnect, then SET HOST or TELNET, and then + HANGUP, Kermit sends the modem's hangup command, such as "+++ATHO". + There is no good way to avoid this, because this case can't reliably be + distinguished from the case in which the user does SET HOST + terminal-server, SET MODEM TYPE name, DIAL. In both cases we have a + valid modem type selected and we have a network connection. If you want + to DIAL and then later make a regular network connection, you will have + to SET MODEM TYPE NONE or SET DIAL HANGUP OFF to avoid this phenomenon. + +7. TERMINAL SERVERS + + [ [65]Top ] [ [66]Contents ] [ [67]Next ] [ [68]Previous ] + + Watch out for terminal server's escape character -- usually a control + character such as Ctrl-Circumflex (Ctrl-^). Don't unprefix it in + Kermit! + + Ciscos -- must often be told to "terminal download"... Cisco ASM models + don't have hardware flow control in both directions. + + Many terminal servers only give you a 7-bit connection, so if you can't + make it 8-bit, tell Kermit to "set parity space". + + The following story, regarding trouble transferring 8-bit files through + a reverse terminal server, was contributed by an Annex terminal server + user: + + Using C-Kermit on an HP 9000 712/80 running the HP-UX 10.0 operating + system. The HP was connected to a Xylogics Annex MICRO-ELS-UX R7.1 8 + port terminal server via ethernet. On the second port of the + terminal server is an AT&T Paradyne 3810 modem, which is connected + to a telephone line. There is a program which runs on the HP to + establish a Telnet connection between a serial line on the Annex and + a character special file on the HP (/dev file). This is an Annex + specific program called rtelnet (reverse telnet) and is provided + with the terminal server software. The rtelnet utility runs on top + of the pseudo-terminal facility provided by UNIX. It creates + host-originiated connections to devices attached ot Annex serial + ports. There are several command line arguments to be specified with + this program: the IP address of the terminal server, the number of + the port to attach to, and the name of the pseudo-device to create. + In addition to these there are options to tell rtelnet how to + operate on the connect: -b requests negotiation for Telnet binary + mode, -d turns on socket-leve debugging, -f enables "connect on the + fly" mode, -r removes the device-name if it already exists, etc. The + most important of these to be specified when using 8 data bits and + no parity, as we found out, was the -t option. This creates a + transparent TCP connection to the terminal server. Again, what we + assumed to be happening was that the rtelnet program encountered a + character sequence special to itself and then "eating" those kermit + packets. I think this is all of the information I can give you on + the configuration, short of the values associated with the port on + the terminal server. + + How to DIAL from a TCP/IP reverse terminal server (modem server): + + 1. (only if necessary) SET TELNET ECHO REMOTE + 2. SET HOST terminal-server-ip-name-or-address [ port ] + 3. SET MODEM TYPE modem-type + 4. (only if necessary) SET DIAL HANGUP OFF + 5. (for troubleshooting) SET DIAL DISPLAY ON + 6. DIAL phone-number + + The order is important: SET HOST before SET MODEM TYPE. Since this is a + Telnet connection, serial-port related commands such as SET SPEED, SET + STOP-BITS, HANGUP (when MODEM HANGUP-METHOD is RS232), etc, have no + effect. However, in C-Kermit 8.0, if the modem server supports + [69]RFC-2217 Telnet Com-Port Control protocol, these commands do indeed + take effect at the server's serial port. + +8. TERMINAL EMULATION + + [ [70]Top ] [ [71]Contents ] [ [72]Next ] [ [73]Previous ] + + Except for the Windows, OS/2, and Macintosh versions, C-Kermit does not + emulate any kind of terminal. Rather, it acts as a "semitransparent + pipe", passing the characters you type during a CONNECT session to the + remote host, and sending the characters received from the remote host + to your screen. Whatever is controlling your keyboard and screen + provides the specific terminal emulation: a real terminal, a PC running + a terminal emulator, etc, or (in the case of a self-contained + workstation) your console driver, a terminal window, xterm, etc. + + Kermit is semitrantsparent rather than fully transparent in the + following ways: + + * During a TELNET ("set host") session, C-Kermit itself executes the + TELNET protocol and performs TELNET negotiations. (But it does not + perform TN3270 protocol or any other type of 3270 terminal + emulation.) + * If you have changed your keyboard mapping using SET KEY, C-Kermit + replaces the characters you type with the characters or strings + they are mapped to. + * If you SET your TERMINAL CHARACTER-SET to anything but TRANSPARENT, + C-Kermit translates your keystrokes (after applying any SET KEY + definitions) before transmitting them, and translates received + characters before showing them on your screen. + * If your remote and/or local TERMINAL CHARACTER-SET is an ISO 646 + 7-bit national character set, such as German, French, Italian, + Swedish, etc, or Short KOI used for Cyrillic, C-Kermit's CONNECT + command automatically skips over ANSI escape sequences to avoid + translating their characters. Only ANSI/ISO standard + (VT100/200/300-like) 7-bit escape sequence formats are supported + for this purpose, no proprietary schemes like H-P, Televideo, + Tektronix, etc. + * If your version of C-Kermit includes SET TERMINAL APC command, then + C-Kermit's CONNECT command will handle APC escape sequences if + TERMINAL APC is not set to OFF (which is the default). + + You can make C-Kermit fully transparent by starting it with the -0 + (dash zero) command-line option. + + If you are running C-Kermit under a console driver, or in a terminal + window, that emulates the VT100, and use C-Kermit to log in to a VMS + system, the console driver or terminal window (not Kermit) is supposed + to reply to the "what are you?" query (ESC Z) from the VAX. If it + doesn't, and you can't make it do so, then you can (a) live with the + "unknown terminal" problem; (b) tell VMS to SET TERMINAL/DEVICE=VT100; + (c) program a key using SET KEY to send the appropriate sequence and + then punch the key at the right time; or (d) use the VMSLOGIN macro + that is defined in CKERMIT.INI to do this for you automatically. + + SET SESSION-LOG { TEXT, BINARY }, which is effective in UNIX and AOS/VS + but not other C-Kermit versions, removes CR, DEL, NUL, XON, and XOFF + characters (Using C-Kermit neglects to mention that XON and XOFF are + removed). The TEXT-mode setting is ineffective during SCRIPT command + execution, as well as on X.25 connections. + +9. KEY MAPPING + + [ [74]Top ] [ [75]Contents ] [ [76]Next ] [ [77]Previous ] + + Except in the terminal-emulating versions, C-Kermit's key mapping + facilities are limited to normal "ASCII" keys, and cannot be used with + function keys, arrow keys, arcane key combinations, etc. Since C-Kermit + runs on such a wide variety of hardware platforms (including, for + example, more than 360 different UNIX platforms), it is not possible + for C-Kermit to support every conceivable keyboard under every release + of every UNIX (or VMS, or ...) product on every different kind of + computer possibly under all manner of different console drivers, even + if it had the means to do so. + + In technical terms, C-Kermit uses the read() function to read + keystrokes, and read() returns a single byte (value 0 through 255). + C-Kermit's SET KEY function applies to these single-byte codes. + "Extended function" keys, such as F-keys, arrow keys, etc, usually + return either a 2-byte "scan code" or else a character string (such as + an escape sequence like " O p"). In both cases, C-Kermit has no + way to tell the difference between such multibyte key values, and the + corresponding series of single-byte key values. This could only be done + by accessing the keyboard at a much lower level in a highly + platform-dependent manner, probably requiring tens of thousands of + lines of code to support even a sampling of the most popular + workstation / OS combinations. + + However, most workstation console drivers (terminal emulation windows, + etc) include their own key-mapping facility. For example in AIX, the + AIXterm program (in whose window you would run C-Kermit) allows + rebinding of the F1-F12 keys to arbitrary strings. The same is true of + Xterm and DECterm windows, etc. Consult the technical documentation for + your workstation or emulator. See sample Xterm (Xmodmap) mappings in + the [78]Unix C-Kermit Hints and Tips document. + + The SET KEY command (except in Kermit 95) does not allow a key + definition to be (or contain) the NUL (\0) character. + +10. FILE TRANSFER + + [ [79]Top ] [ [80]Contents ] [ [81]Next ] [ [82]Previous ] + + C-Kermit 7.0 is the first release of C-Kermit to use fast (rather than + robust and therefore slow) protocol defaults: long packets, sliding + windows, control-character unprefixing, and streaming where possible. + This makes most transfers (partner willing) dramatically faster "out of + the box" but might break some combinations that worked before. If + transfers with C-Kermit 7.0 or later fail where transfers worked with + earlier C-Kermit versions, try the following (one at a time, in this + order): + + 1. SET PREFIXING ALL: Disables control-character unprefixing. + 2. SET STREAMING OFF: Disables streaming. + 3. CAUTIOUS: Selects medium but cautious protocol settings. + 4. ROBUST: this command reverts to the most conservative protocol + settings. + + Execution of multiple file transfers by C-Kermit from a command file + when in remote mode might exhibit long delays between each transfer. To + avoid this, just include the command "SET DELAY 0" in your command file + before any of the file-transfer commands. + + File transfer failures can occur for all sorts of reasons, most of them + listed in Chapter 10 of [83]Using C-Kermit. The following sections + touch on some that aren't. + + The [84]C-Kermit 7.0 Release Notes document SEND /COMMAND as taking an + argument, but it doesn't. Instead of SEND /COMMAND:{some command}, use: + +SEND /COMMAND [ other switches such as /AS-NAME: ] command [ arguments... ] + +10.1. Laptops + + Watch out for laptops and their assorted power-saver features; for + example, a built-in modem's "auto timeout delay" hanging up the + connection in the middle of a file transfer. Most modems, even if they + have this feature, do not have it enabled by default. But if you + experience otherwise inexplicable disconnections in the midst of your + Kermit sessions, check the modem manual for such things as "idle + timeout", "auto timeout", etc, and add the command to disable this + feature to Kermit's init string for this modem. + +10.2. NFS + + If uploading a large file to an NFS-mounted disk fails (or is painfully + slow), try uploading it to a local disk (e.g. /tmp on Unix) and then + copying to the NFS disk later. + +10.3. Modems + + If you are dialing out and find that downloads work but uploads don't, + try again with a lower serial-port speed. Case in point: dialing out on + a certain PC from Linux at 115200 bps using a USR Courier 56K + "V.Everything" external modem and RTS/CTS flow control. Downloads + worked flawlessly, uploads stopped dead after the first few packets + were sent. The modem lights showed constant retraining (ARQ light + blinks slowly), and the CTS light was off 95% of the time, allowing + nothing to get through. Reducing the serial port speed to 57600 bps + made the problems go away. Evidently the PC in question has a very fast + serial port, since dialing the same modem with a different PC at 115200 + bps works without incident. + +10.4. TCP/IP Connections + + If you have trouble transferring files over a TCP/IP connection, tell + Kermit to SET PARITY SPACE and try again. If that doesn't work, also + try a shorter packet length or smaller window size (to compensate for + certain well-known broken Telnet servers), and/or SET RELIABLE OFF. + +10.5. Multihop Connections + + If you have a multihop connection, with the interior nodes in CONNECT + mode (Kermit, Telnet, Rlogin, or any other), you can expect (a) file + transfer to be slower, and (b) the connection to be less transparent + (to control characters, perhaps to the 8th bit) than a more direct + connection. C-Kermit 7.0 and later have a "-0" (dash-zero) command-line + option to make it 100% transparent in cases where it is to be used in + the middle. + +10.6. Recovery + + The recovery feature (RESEND command) that was added in version 5A(190) + works only for binary-mode transfers. In order for this feature to be + useful at all, the default for SET FILE INCOMPLETE was changed from + DISCARD to KEEP. Otherwise an interrupted transfer would leave no + partial file behind unless you had remembered to change the default. + But now you have to pay closer attention to Kermit's messages to know + whether a transfer succeeded or failed -- previously, if it failed, the + file would not show up on the receiving end at all; in 5A(190) and + later, you'll get a partial file which could easily be mistaken for the + complete file unless you change the default back to DISCARD or read the + screen messages, or keep a transaction log. + +10.7. Filename Collisions + + SET FILE COLLISION BACKUP is the default. This means: + + * If you send the same file lots of times, there will be many backup + files. There is no automatic mechanism within Kermit to delete + them, no notion of a "version retention count", etc, but you can + use the PURGE command to clean them up. + * If a file arrives that has the same name as a directory, the file + transfer fails because Kermit will not rename a directory. Send the + file with another name, or use SET FILE COLLISION RENAME. + * If the directory lacks write permission, the file transfer fails + even if you have write access to the file that is being backed up; + in that case, switch to SET FILE COLLISION OVERWRITE or APPEND, or + send to a different directory. + + SET FILE COLLISION UPDATE depends on the date/time stamp in the + attribute packet. However, this is recorded in local time, not + Universal Time (GMT), and there is no indication of time zone. The time + is expressed to the precision of 1 second, but some file systems do not + record with this precision -- for example, MS-DOS records the file + date/time only to the nearest 2 seconds. This might cause update + operations to send more files than necessary. + + (This paragraph does NOT apply to UNIX, where, as of C-Kermit 7.0, + C-Kermit pipes incoming mail and print material directly the mail or + print program): When C-Kermit is receiving files from another Kermit + program that has been given the MAIL or REMOTE PRINT command, C-Kermit + follows the current filename collision action. This can be + disconcerting if the action was (for example) BACKUP, because the + existing file will be renamed, and the new file will be mailed (or + printed) and then deleted. Kermit cannot temporarily change to RENAME + because the file collision action occurs when the filename packet is + received, and the PRINT or MAIL disposition only comes later, in the + Attribute packet. + + Watch out for SET FILE COLLISION RENAME, especially when used in + conjunction with recovery. Recall that this option (which is NOT the + default) renames the incoming file if a file already exists with the + same name (the default is to rename the previously existing file, and + store the incoming file with its own name). It is strongly recommended + that you do not use SET FILE COLLISION RENAME if you ever intend to use + the recovery feature: + + * When the file is first received by C-Kermit, its name is changed if + another file already has the same name. When you RESEND the same + file after a failure, C-Kermit will probably try to append the + re-sent portion to the wrong file. + * Assuming that you get RESEND to work with FILE COLLISION RENAME, + C-Kermit, when receiving the remainder of the file during a RESEND + operation, will report back the wrong name. Nothing can be done + about this because the name is reported back before the receiving + Kermit program finds out that it is a recovery operation. + + Also watch out for DISABLE DELETE, since this implicitly sets FILE + COLLISION to RENAME. And note tht DELETE is DISABLEd automatically any + time you Kermit is in local mode (i.e. it makes a connection). Also + note that for purposes of DISABLE and ENABLE, "set host *" connections + do not count as local mode even though, strictly speaking, they are. + +10.8. DOS Pathnames + + When referring to foreign MS-DOS, Windows, Atari ST, OS/2, or other + file specifications that contain backslash characters in a C-Kermit + command, you might have to double each backslash, for example: + + C-Kermit>get c:\\directory\\foo.txt + + This is because backslash is used in C-Kermit commands for introducing + special character codes, variables, functions, etc. + +10.9. Cancellation + + If attempting to cancel local-mode file reception at a very early stage + (i.e. before data packets are exchanged) with X or Z does not work, use + E or Ctrl-C instead, or wait until the first data packets are sent. + + If you cancel a transfer that is underway using X or Z, and a lot of + window slots are in use, it might take a while for the cancellation to + take effect, especially if you do this on the receiving end; that's + because a lot of packets might already be on their way to you. In that + case, just be patient and let Kermit "drain" them. + + If C-Kermit is sending a file, remote-mode packet-mode breakout (three + consecutive Ctrl-C's by default) is not effective until after C-Kermit + sends its first packet. If C-Kermit is receiving a file or is in server + mode, it is effective right away. In the former case, the SET DELAY + value determines the earliest time at which you can break out of packet + mode. + +10.10. Partner Peculiarities + + When one or both partners is on an SCO operating system such as OSR5, + you might issue the command: + +mapchan -n + + to disable character-set conversion by the terminal driver. Similarly + for AIX: + +setmaps -t NOMAP + + When using C-Kermit to transfer files with the HP48SX calculator, you + must SET FLOW NONE. The HP48SX does not support flow control, and + evidently also becomes confused if you attempt to use it. You might + also need to use SET SEND PAUSE 100 (or other number). For greater + detail about transferring files the the HP-48, see: + + [85]http://www.columbia.edu/kermit/hp48.html + + Some communication programs have errors in their implementation of + Kermit attribute packets. If you get an error message from your + communication program like "Attribute error", tell C-Kermit to SET + ATTRIBUTES OFF. Better yet, switch to a real Kermit program. + + Some communication software claims to implement Kermit sliding windows, + but does so incorrectly. If sliding window transfers fail, set + C-Kermit's window size to the smallest one that works, for example, SET + WINDOW 1. + + For lots more detail about how to cope with defective Kermit partners, + see: + + * [86]Coping with Faulty Kermit Implementations (C-Kermit 7.0 and + later). + * [87]Coping with Broken Kermit Partners (C-Kermit 8.0 and later). + + The UNIX version of C-Kermit discards carriage returns when receiving + files in text mode. Thus, "bare" carriage returns (sometimes used to + achieve overstriking) are lost. + +11. SCRIPT PROGRAMMING + + [ [88]Top ] [ [89]Contents ] [ [90]Previous ] + +11.1. Comments Versus the SCRIPT Command + + Remember that ";" and "#" introduce comments when (a) they are the + first character on the line, or (b) they are preceded by at least one + blank or tab within a line. Thus constructions like: + + INPUT 5 ; + SCRIPT ~0 #--#--# + + must be coded using backslash notation to keep the data from being + ignored: + + INPUT 5 \59 ; 59 is the decimal ASCII code for ";" + SCRIPT ~0 \35--#--# ; 43 is the decimal ASCII code for "#" + + or, more simply: + + INPUT 5 \; ; Just quote the semicolon + SCRIPT ~0 \#--#--# ; Just quote the "#" + +11.2. Alphabetic Case and the INPUT Command + + INPUT and MINPUT caseless string comparisons do not work for non-ASCII + (international) characters. Workaround: SET INPUT CASE OBSERVE. Even + then, the "lexically less than" and "lexically greater than" operations + (IF LLT, IF LGT) probably won't work as expected. The same is true for + the case-conversion functions \Flower() and \Fupper(). C-Kermit does + not know the collating sequence for different character sets and + languages. (On the other hand, it might work depending on such items as + how Kermit was linked, whether your operating supports "locales", etc) + +11.3. NUL (0) Characters in C-Kermit Commands + + You can't include a NUL character (\0) in C-Kermit command text without + terminating the character string in which it appears. For example: + + echo In these brackets [\0] is a NUL + + will echo "In these brackets [". This applies to ECHO, INPUT, OUTPUT, + and all other commands (but you can represent NUL by "\N" in an OUTPUT + string). This is because C-language strings are terminated internally + by the NUL character, and it allows all of C-Kermit's string comparison + and manipulation functions to work in the normal "C" way. + + To illustrate: + + INPUT 5 \0 + + is equivalent to: + + INPUT 5 + + and: + + INPUT 5 ABC\0DEF + + is equivalent to: + + INPUT 5 ABC + + INPUT operations discard and ignore NUL characters that arrive from the + communication device, meaning that they do not figure into matching + operations (e.g. AB matches AB); they are not deposited in the + INPUT buffer (\v(input)); and they are not counted in \v(incount), with + two exceptions: + + 1. An arriving NUL character restarts the INPUT SILENCE timer. + 2. An arriving NUL character terminates the INPUT command with the + SUCCESS condition if the INPUT command was given an empty search + string. In this case \v(incount) is set to 1. + + Also, the \v(inchar) variable is null (completely empty) if the last + INPUT character was NUL. That is, there is no way to tell only by + looking at \v(inchar) the difference between a NUL that was INPUT and + no INPUT at all. If the INPUT command succeeded but \v(inchar) is + empty, then a NUL character was input. Also, \v(incount) will be set to + 1. + + Here's a sample script fragment to read characters, possibly including + NUL, from the communication connection and write them to a file: + + while true { + input 1 ; read one byte + if fail break ; timed out or connection closed + fwrite /char \%c \v(inchar) ; record the byte + } + + This works because when \v(inchar) is NUL, that's equivalent to FWRITE + /CHAR having no text argument at all, in which case it writes a NUL + character. + + \v(incount) and \v(inchar) are NOT affected by the CLEAR command. + +11.4. \ffiles() and \fnextfile() Peculiarities + + The following script program: + + for \%i 1 \ffiles(oofa.*) 1 { + send \fnextfile() + } + + did not work as expected in C-Kermit 6.0 and earlier but does work in + C-Kermit 7.0 and later. + +11.5. Commands That Have Only Local Effect + + Certain settings are local to each command level, meaning that + subordinate command levels (macros or command files) can change them + without affecting their values at higher command levels. When a new + command level is invoked, the value is inherited from the previous + level. These settings are: + + CASE + COUNT and \v(count) + INPUT CASE + INPUT TIMEOUT + MACRO ERROR + QUIET + TAKE ERROR + + This arrangement allows CASE, TIMEOUT, and ERROR settings, which are + used to control automatic exit from a command file or macro upon error, + to be automatically restored when the command file or macro exits. + + The COUNT variable follows this rule too, which permits nested SET + COUNT / IF COUNT loops, as in this example in which the inner loop + counts down from the current COUNT value of the outer loop (try it): + + DEFINE INNER WHILE COUNT { WRITE SCREEN { Inner:}, SHOW COUNT } + SET COUNT 5 + WHILE COUNT { WRITE SCREEN Outer:, SHOW COUNT, DO INNER } + + Keep in mind that an inferior command level cannot manipulate the COUNT + value held by a higher level. For example: + + DEFINE OOFA SHOW COUNT, IF COUNT GOTO LOOP + SET COUNT 5 + :LOOP + OOFA + ECHO Done + + results in an infinite loop; the COUNT value remains at 5 because it is + never decremented at the same level at which it was set. + +11.6. Literal Braces in Function Calls + + Since braces are used in function calls to indicate grouping, there is + no way to pass literal braces to the function itself. Solution: Define + a variable containing the string that has braces. Example: + + define \%a ab{cd + echo \fsubstring(\%a) + ab{cd + + If the string is to start with a leading brace and end with a closing + brace, then double braces must appear around the string (which itself + is enclosed in braces): + + define \%a {{{foo}}} + echo \fsubstring(\%a) + {foo} + + This also works for any other kind of string: + + define \%a {{ab{cd}} + echo \fsubstring(\%a) + ab{cd + +11.7. Defining Variables on the C-Kermit Command Line + + To define variables on the C-Kermit command line, use the -C + command-line option with one or more DEFINE or ASSIGN commands. Note + that the C-Kermit command line must cope with the quoting rules of your + shell. Examples: + + kermit -C "define \\%a foo, define phonenumber 7654321" + + In this case we follow UNIX quoting rules by doubling the backslash. + Once C-Kermit starts, the \%a and \m(phonenumber) variables are defined + as indicated and can be used in the normal way. + + In DOS or Windows or OS/2 the command would be: + + kermit -C "define \%%a foo, define phonenumber 7654321" + + Here we need to double the percent sign rather than the backslash + because of DOS shell quoting rules. + +11.8. Per-Character Echo Check with the OUTPUT Command + + Sometimes the OUTPUT command must be used to send commands or data to a + device in "echoplex" mode, meaning that characters must be sent one at + a time, and the next character can not be sent until the echo from the + previous one has been received. For example, a certain PBX might have + this characteristic. Let's say a Kermit script is used to program the + PBX. If characters are sent too fast, they can be lost. It would seem + that the command: + + SET OUTPUT PACING milliseconds + + could be used to take care of this, but the pacing interval is constant + and must be set large enough to allow even the slowest echo to finish. + If the script is large (an actual example is 14,000 lines long), this + can cause it to take hours longer than it needs to. + + Here is a macro you can use to OUTPUT a string in an Echoplex + environment: + + define XOUTPUT { + local \%c \%i + set output pacing 0 + for \%i 1 \flen(\%*) 1 { + asg \%c \fsubstr(\%*,\%i,1) + output \%c + input 2 \%c + } + } + + C-Kermit 7.0 or later is required. + + It sends one character at a time and then waits up to 2 seconds for the + character to be echoed back, but continues to the next character as + soon as the echo appears, so no time is wasted. You can add an IF FAIL + clause after the INPUT in case you want to do something special about + failure to detect an echo within the timeout period. Obviously you can + also change the 2-second limit, and adjust the script in any other + desired way. + +11.9. Scripted File Transfer + + Sometimes a user complains that when she makes a connection by hand, + logs in, and transfers a file, there are no problems, but when she + scripts the the exact same sequence, the file transfer always fails + after a few packets. Here's a scenario where this can happen: + + 1. Upon logging in to the remote computer, it sends a "What Are You?" + escape sequence. + 2. When you log in interactively, your terminal emulator sends the + response. This is invisible to you; you don't know it's happening. + 3. When you script the login, and begin a file transfer immediately + upon logging in, the host still sends the "What Are You?" sequence. + Kermit's INPUT ECHO setting is ON by default, so the escape + sequence passes through to the terminal, and the terminal sends its + response. But by this time Kermit has already started the file + transfer. + 4. By default, the local Kermit program examines the keyboard for + interruption characters between every packet. The "What Are You" + response is sitting in the keyboard buffer. Eventually Kermit will + read a character such as "c" that is a valid interruption + character, and the file transfer stops with "User cancelled". + + The right way to handle this situation is to have your look for the + "What Are You?" sequence and send the response itself, as described in + Using C-Kermit, pp.429-431. Or you can work around it by telling the + local Kermit to "set input echo off" and/or "set transfer interruption + off". + +11.10. Hexadecimal arithmetic... + + C-Kermit can do both integer and floating-point arithmetic, in both + ordinary algebraic notation and in Lisp S-Expression notation. All + arithmetic operators and functions operate only on decimal numbers. It + is possible, however, to write scripts that operate on hexadecimal + numbers. This is done by converting them to decimal prior to any + arithmetic operations, and then converting them back to hexadecimal for + display. Example: + +; EVALUATE is a command that evaluates an arithmetic expression. +; See HELP EVALUATE for details. This is just for demonstration. +; Arithmetic expressions can be used in any context where a number +; can be used. Also, the special notation: +; +; .\%a ::= expression +; +; evaluations the expression and assigns the result to the variable. +; +.\%a := fffe ; Set variable to hex value +set eval old ; See HELP EVAL +eval \fhex2n(\%a) ; Show value of variable +eval \fhex2n(\%a) + 1 ; Show value of expression +eval \fhex2n(\%a) + 2 ; Show value of expression +.\%x ::= \fhex2n(\%a) + 1 ; Assign value of expression to variable +echo \fn2hex(\%x) ; Display variable's value in hex +.\%x ::= \fhex2n(\%a) + 2 : Ditto +echo \fn2hex(\%x) +.\%x ::= \fhex2n(\%a) | \fhex2n(ffff) ; Similarly for logical OR +echo \fn2hex(\%x) +.\%x ::= \fhex2n(\%a) & \fhex2n(ffff) ; and logical AND +echo \fn2hex(\%x) + + By the way, you might be tempted to use Kermit's \xnn notation to plug + hex numbers into arithmetic expressions but this doesn't work. That + notation is stricly for bytes (hex representation of character values), + not for numbers. + +11.11. Other... + + Escape sequences (or any strings that contain control characters) can't + be used as labels, GOTO targets, or SWITCH cases. + + [ [91]Top ] [ [92]Contents ] [ [93]C-Kermit Home ] [ [94]C-Kermit 8.0 + Overview ] [ [95]Kermit Home ] + __________________________________________________________________ + + C-Kermit 8.0 Unix Hints and Tips / [96]The Kermit Project / + [97]kermit@columbia.edu / 30 June 2011 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ckcbwr.html + 12. http://www.columbia.edu/kermit/ckubwr.html + 13. http://www.columbia.edu/kermit/k95.html + 14. http://www.columbia.edu/kermit/ckermit.html + 15. http://www.columbia.edu/kermit/ckututor.html + 16. http://www.columbia.edu/kermit/ckcbwr.html#x0 + 17. http://www.columbia.edu/kermit/ckcbwr.html#x1 + 18. http://www.columbia.edu/kermit/ckcbwr.html#x2 + 19. http://www.columbia.edu/kermit/ckcbwr.html#x3 + 20. http://www.columbia.edu/kermit/ckcbwr.html#x4 + 21. http://www.columbia.edu/kermit/ckcbwr.html#x5 + 22. http://www.columbia.edu/kermit/ckcbwr.html#x6 + 23. http://www.columbia.edu/kermit/ckcbwr.html#x7 + 24. http://www.columbia.edu/kermit/ckcbwr.html#x8 + 25. http://www.columbia.edu/kermit/ckcbwr.html#x9 + 26. http://www.columbia.edu/kermit/ckcbwr.html#x10 + 27. http://www.columbia.edu/kermit/ckcbwr.html#x11 + 28. http://www.columbia.edu/kermit/ckcbwr.html#top + 29. http://www.columbia.edu/kermit/ckcbwr.html#contents + 30. http://www.columbia.edu/kermit/ckcbwr.html#x2 + 31. http://www.columbia.edu/kermit/ckcbwr.html#top + 32. http://www.columbia.edu/kermit/ckcbwr.html#contents + 33. http://www.columbia.edu/kermit/ckcbwr.html#x2 + 34. http://www.columbia.edu/kermit/ck60manual.html + 35. http://www.columbia.edu/kermit/ckermit2.html + 36. http://www.columbia.edu/kermit/ck60manual.html + 37. http://www.columbia.edu/kermit/ckermit80.html#x5 + 38. http://www.columbia.edu/kermit/ckermit80.html + 39. http://www.columbia.edu/kermit/ckermit80.html#x2.2 + 40. http://www.columbia.edu/kermit/ckermit80.html#x8.7.2 + 41. http://www.columbia.edu/kermit/ckermit80.html#x9 + 42. http://www.columbia.edu/kermit/ckcbwr.html#top + 43. http://www.columbia.edu/kermit/ckcbwr.html#contents + 44. http://www.columbia.edu/kermit/ckcbwr.html#x3 + 45. http://www.columbia.edu/kermit/ckcbwr.html#x1 + 46. http://www.columbia.edu/kermit/ckcbwr.html#top + 47. http://www.columbia.edu/kermit/ckcbwr.html#contents + 48. http://www.columbia.edu/kermit/ckcbwr.html#x4 + 49. http://www.columbia.edu/kermit/ckcbwr.html#x2 + 50. http://www.columbia.edu/kermit/ckcbwr.html#top + 51. http://www.columbia.edu/kermit/ckcbwr.html#contents + 52. http://www.columbia.edu/kermit/ckcbwr.html#x5 + 53. http://www.columbia.edu/kermit/ckcbwr.html#x3 + 54. ftp://ftp.isi.edu/in-notes/rfc1122.txt + 55. http://www.columbia.edu/kermit/ckcbwr.html#top + 56. http://www.columbia.edu/kermit/ckcbwr.html#contents + 57. http://www.columbia.edu/kermit/ckcbwr.html#x6 + 58. http://www.columbia.edu/kermit/ckcbwr.html#x4 + 59. http://www.columbia.edu/kermit/ckcbwr.html#top + 60. http://www.columbia.edu/kermit/ckcbwr.html#contents + 61. http://www.columbia.edu/kermit/ckcbwr.html#x7 + 62. http://www.columbia.edu/kermit/ckcbwr.html#x5 + 63. http://www.columbia.edu/kermit/ck60manual.html + 64. http://www.columbia.edu/kermit/ckcbwr.html#x10 + 65. http://www.columbia.edu/kermit/ckcbwr.html#top + 66. http://www.columbia.edu/kermit/ckcbwr.html#contents + 67. http://www.columbia.edu/kermit/ckcbwr.html#x8 + 68. http://www.columbia.edu/kermit/ckcbwr.html#x6 + 69. ftp://ftp.isi.edu/in-notes/rfc2217.txt + 70. http://www.columbia.edu/kermit/ckcbwr.html#top + 71. http://www.columbia.edu/kermit/ckcbwr.html#contents + 72. http://www.columbia.edu/kermit/ckcbwr.html#x9 + 73. http://www.columbia.edu/kermit/ckcbwr.html#x7 + 74. http://www.columbia.edu/kermit/ckcbwr.html#top + 75. http://www.columbia.edu/kermit/ckcbwr.html#contents + 76. http://www.columbia.edu/kermit/ckcbwr.html#x10 + 77. http://www.columbia.edu/kermit/ckcbwr.html#x8 + 78. http://www.columbia.edu/kermit/ckubwr.html + 79. http://www.columbia.edu/kermit/ckcbwr.html#top + 80. http://www.columbia.edu/kermit/ckcbwr.html#contents + 81. http://www.columbia.edu/kermit/ckcbwr.html#x11 + 82. http://www.columbia.edu/kermit/ckcbwr.html#x9 + 83. http://www.columbia.edu/kermit/ck60manual.html + 84. http://www.columbia.edu/kermit/ckermi70.htm + 85. http://www.columbia.edu/kermit/hp48.html + 86. http://www.columbia.edu/kermit/ckermit70.html#x4.22 + 87. http://www.columbia.edu/kermit/ckermit80.html#x15 + 88. http://www.columbia.edu/kermit/ckcbwr.html#top + 89. http://www.columbia.edu/kermit/ckcbwr.html#contents + 90. http://www.columbia.edu/kermit/ckcbwr.html#x10 + 91. http://www.columbia.edu/kermit/ckcbwr.html#top + 92. http://www.columbia.edu/kermit/ckcbwr.html#contents + 93. http://www.columbia.edu/kermit/ckermit.html + 94. http://www.columbia.edu/kermit/ck80.html + 95. http://www.columbia.edu/kermit/index.html + 96. http://www.columbia.edu/kermit/index.html + 97. mailto:kermit@columbia.edu diff --git a/ckccfg.txt b/ckccfg.txt new file mode 100644 index 0000000..22edac8 --- /dev/null +++ b/ckccfg.txt @@ -0,0 +1,1738 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +C-Kermit Configuration Options + + As of: C-Kermit 9.0.300, 30 June 2011 + This page last updated: Tue Jun 28 08:48:49 2011 (New York USA Time) + + IF YOU ARE READING A PLAIN-TEXT version of this document, note that + this file is a plain-text dump of a Web page. You can visit the + original (and possibly more up-to-date) Web page here: + + [11]http://www.columbia.edu/kermit/ckccfg.html + + [ [12]C-Kermit Home ] [ [13]Kermit Home ] + + CONTENTS + + 1. [14]FILE TRANSFER + 2. [15]SERIAL COMMUNICATION SPEEDS + 3. [16]FULLSCREEN FILE TRANSFER DISPLAY + 4. [17]CHARACTER SETS + 5. [18]APC EXECUTION + 6. [19]PROGRAM SIZE + 7. [20]MODEM DIALING + 8. [21]NETWORK SUPPORT + 9. [22]EXCEPTION HANDLING + 10. [23]SECURITY FEATURES + 11. [24]ENABLING SELECT() + 12. [25]I/O REDIRECTION + 13. [26]FLOATING-POINT NUMBERS, TIMERS, AND ARITHMETIC + 14. [27]SPECIAL CONFIGURATIONS + I. [28]SUMMARY OF COMPILE-TIME OPTIONS + + OVERVIEW + + This document describes configuration options for C-Kermit (5A and + later). The major topics covered include program size (and how to + reduce it), how to include or exclude particular features, notes on + serial-port, modem, and network support, and a list of C-Kermit's + compile-time options. + + For details about your particular operating system, also see the + system-specific installation instructions file, such as the + [29]C-Kermit Installation Instructions for Unix. + + [ [30]C-Kermit Home ] [ [31]Kermit Home ] + + 1. FILE TRANSFER + + [ [32]Top ] [ [33]Contents ] [ [34]Next ] [ [35]Previous ] + + Prior to version 7.0, C-Kermit was always built with the most + conservative Kermit file-transfer protocol defaults on every platform: + no control-character prefixing, 94-byte packets, and a window size of + 1. + + Starting in version 7.0, fast settings are the default. To override + these at compile time, include: + + -DNOFAST + + in the C compiler CFLAGS. Even with the fast defaults, C-Kermit + automatically drops down to whatever window and packet sizes requested + by the other Kermit, if these are smaller, when sending files (except + for control-character unprefixing, which is not negotiated, and which + is now set to CAUTIOUS rather than NONE at startup). C-Kermit's + settings prevail when it is receiving. + + [ [36]C-Kermit Home ] [ [37]Kermit Home ] + + 2. SERIAL COMMUNICATION SPEEDS + + [ [38]Top ] [ [39]Contents ] [ [40]Next ] [ [41]Previous ] + + As of 6 September 1997, a new simplified mechanism for obtaining the + list of legal serial interface speeds is in place: + + * If the symbol TTSPDLIST is defined, the system-dependent routine + ttspdlist() is called at program initialization to obtain the list. + * This symbol should be defined only for C-Kermit implementations + that have implemented the ttspdlist() function, typically in the + ck?tio.c module. See [42]ckutio.c for an example. + * TTSPDLIST is automatically defined in [43]ckcdeb.h for UNIX. Add + the appropriate #ifdefs for other platforms when the corresponding + ttspdlist() functions are filled in. + * If TTSPDLIST is (or normally would be) defined, the old code + (described below) can still be selected by defining NOTTSPDLIST. + + The ttspdlist() function can obtain the speeds in any way that works. + For example, based simply on #ifdef Bnnnn..#endif (in UNIX). Although + it might be better to actually check each speed against the currently + selected hardware interface before allowing it in the array, there is + usually no passive and/or reliable and safe way to do this, and so it's + better to let some speeds into the array that might not work, than it + is to erroneously exclude others. Speeds that don't work are caught + when the SET SPEED command is actually given. + + Note that this scheme does not necessarily rule out split speed + operation, but effectively it does in C-Kermit as presently constituted + since there are no commands to set input and output speed separately + (except the special case "set speed 75/1200"). + + Note that some platforms, notably AIX 4.2 and 4.3, implement high + serial speeds transparently to the application, e.g. by mapping 50 bps + to 57600 bps, and so on. + + That's the whole deal. When TTSPDLIST is not defined, the following + applies: + + Speeds are defined in two places: the SET SPEED keyword list in the + command parser (as of this writing, in the [44]ckuus3.c source file), + and in the system- dependent communications i/o module, ck?tio.c, + functions ttsspd() (set speed) and ttgspd() (get speed). The following + speeds are assumed to be available in all versions: + + 0, 110, 300, 600, 1200, 2400, 4800, 9600 + + If one or more of these speeds is not supported by your system, you'll + need to change the source code (this has never happened so far). Other + speeds that are not common to all systems have Kermit-specific symbols: + + Symbol Symbol + Speed (bps) to enable to disable + 50 BPS_50 NOB_50 + 75 BPS_75 NOB_75 + 75/1200 BPS_7512 NOB_7512 + 134.5 BPS_134 NOB_134 + 150 BPS_150 NOB_150 + 200 BPS_200 NOB_200 + 1800 BPS_1800 NOB_1800 + 3600 BPS_3600 NOB_3600 + 7200 BPS_7200 NOB_7200 + 14400 BPS_14K NOB_14K + 19200 BPS_19K NOB_19K + 28800 BPS_28K NOB_28K + 38400 BPS_38K NOB_38K + 57600 BPS_57K NOB_57K + 76800 BPS_76K NOB_76K + 115200 BPS_115K NOB_155K + 230400 BPS_230K NOB_230K + 460800 BPS_460K NOB_460K + 921600 BPS_921K NOB_921K + + The [45]ckcdeb.h header file contains default speed configurations for + the many systems that C-Kermit supports. You can override these + defaults by (a) editing ckcdeb.h, or (b) defining the appropriate + enabling and/or disabling symbols on the CC command line, for example: + + -DBPS_14400 -DNOB_115200 + + or the "make" command line, e.g.: + + make blah "KFLAGS=-DBPS_14400 -DNOB_115200" + + Note: some speeds have no symbols defined for them, because they have + never been needed: 12.5bps, 45.5bps, 20000bps, etc. These can easily be + added if required (but they will work only if the OS supports them). + + IMPORTANT: Adding one of these flags at compile time does not + necessarily mean that you will be able to use that speed. A particular + speed is usable only if your underlying operating system supports it. + In particular, it needs to be defined in the appropriate system header + file (e.g. in UNIX, cd to /usr/include and grep for B9600 in *.h and + sys/*.h to find the header file that contains the definitions for the + supported speeds), and supported by the serial device driver, and of + course by the physical device itself. + + ALSO IMPORTANT: The list of available speeds is independent of how they + are set. The many UNIXes, for example, offer a wide variety of APIs + that are BSD-based, SYSV-based, POSIX-based, and purely made up. See + the ttsspd(), ttgspd(), and ttspdlist() routines in [46]ckutio.c for + illustrations. + + The latest entries in this horserace are the tcgetspeed() and + ttsetspeed() routines found in UnixWare 7. Unlike other methods, they + accept the entire range of integers (longs really) as speed values, + rather than certain codes, and return an error if the number is not, in + fact, a legal speed for the device/driver in question. In this case, + there is no way to build a list of legal speeds at compile time, since + no Bnnnn symbols are defined (except for "depracated, legacy" + interfaces like ioctl()) and so the legal speed list must be enumerated + in the code -- see ttspdlist() in [47]ckutio.c. + + [ [48]C-Kermit Home ] [ [49]Kermit Home ] + + 3. FULLSCREEN FILE TRANSFER DISPLAY + + [ [50]Top ] [ [51]Contents ] [ [52]Next ] [ [53]Previous ] + + New to edit 180 is support for an MS-DOS-Kermit-like local-mode full + screen file transfer display, accomplished using the curses library, or + something equivalent (for example, the Screen Manager on DEC VMS). To + enable this feature, include the following in your CFLAGS: + + -DCK_CURSES + + and then change your build procedure (if necessary) to include the + necessary libraries. For example, in Unix these are usually "curses" or + "ncurses" (and more recenlty, "ncursesw" and "slang"), perhaps also + "termcap", "termlib", or "tinfo": + + "LIBS= -lcurses -ltermcap" + "LIBS= -lcurses -ltermlib" + "LIBS= -lncurses" + "LIBS= -ltermlib" + "LIBS= -ltinfo" + + "man curses" for further information, and search through the Unix + [54]makefile for "CK_CURSES" to see many examples, and also see the + relevant sections of the [55]Unix C-Kermit Installation Instructions, + particularly Sections [56]4 and [57]9.2. + + There might still be a complication. Some implementations of curses + reserve the right to alter the buffering on the output file without + restoring it afterwards, which can leave Kermit's command processing in + a mess when the prompt comes back after a fullscreen file transfer + display. The typical symptom is that characters you type at the prompt + after a local-mode file transfer (i.e. after seeing the curses + file-transfer display) do not echo until you press the Return (Enter) + key. If this happens to you, try adding + + -DCK_NEWTERM + + to your makefile target (see comments in screenc() in [58]ckuusx.c for + an explanation). + + If that doesn't fix the problem, then use a bigger hammer and replace + -DCK_NEWTERM with: + + -DNONOSETBUF + + which tells Kermit to force stdout to be unbuffered so CBREAK mode can + work. + + In SCO Xenix and SCO UNIX, there are two separate curses libraries, one + based on termcap and the other based on terminfo. The default library, + usually terminfo, is established when the development system is + installed. To manually select terminfo (at compile time): + + compile -DM_TERMINFO and link -ltinfo + + and to manually select termcap: + + compile -DM_TERMCAP and link -ltcap -ltermlib + + looks at M_TERMINFO and M_TERMCAP to decide which header + files to use. /usr/lib/libcurses.a is a link to either libtinfo.a or + libtcap.a. The C-Kermit compilation options must agree with the version + of the curses library that is actually installed. + + NOTE: If you are doing an ANSI-C compilation and you get compile time + warnings like the following: + + Warning: function not declared in ckuusx.c: wmove, printw, wclrtoeol, + wclear, wrefresh, endwin, etc... + + it means that your file does not contain prototypes for + these functions. The warnings should be harmless. + + New to edit 190 is the ability to refresh a messed-up full-screen + display, e.g. after receiving a broadcast message. This depends on the + curses package including the wrefresh() and clearok() functions and the + curscr variable. If your version has these, or has code to simulate + them, then add: + + -DCK_WREFRESH + + The curses and termcap libraries add considerable size to the program + image (e.g. about 20K on a SUN-4, 40K on a 386). On some small systems, + such as the AT&T 6300 PLUS, curses can push Kermit over the edge... + even though it compiles, loads, and runs correctly, its increased size + apparently makes it swap constantly, slowing it down to a crawl, even + when the curses display is not in use. Some new makefile targets have + been added to take care of this (e.g. sys3upcshcc), but similar tricks + might be necessary in other cases too. + + On the curses file-transfer display, just below the "thermometer", is a + running display of the transfer rate, as a flat quotient of file + characters per elapsed seconds so far. You can change this to an + average that gives greater weight to recent history (0.25 * + instantaneous cps + 0.75 * historical cps) by adding -DCPS_WEIGHTED to + your CFLAGS (sorry folks, this one is not worth a SET command). You can + choose a second type of weighted average in which the weighting smooths + out progressively as the transfer progresses by adding -DCPS_VINCE to + -DCPS_WEIGHTED. + + An alternative to curses is also available at compile time, but should + be selected if your version of Kermit is to be run in local mode only + in an ANSI terminal environment, for example on a desktop workstation + that has an ANSI console driver. To select this option in place of + curses, define the symbol MYCURSES: + + -DMYCURSES + + instead of CK_CURSES. The MYCURSES option uses built-in ANSI (VT100) + escape sequences, and depends upon your terminal or console driver to + interpret them correctly. + + In some C-Kermit builds, we replace printf() via #define printf... + However, this can cause conflicts with the [n]curses header files. + Various hacks are required to get around this -- see [59]ckutio.c, + [60]ckufio.c, [61]ckuusx.c, [62]ckucmd.c, etc. + + [ [63]C-Kermit Home ] [ [64]Kermit Home ] + + 4. CHARACTER SETS + + [ [65]Top ] [ [66]Contents ] [ [67]Next ] [ [68]Previous ] + + Since version 5A, C-Kermit has included support for conversion of + character sets for Western European languages (i.e. languages that + originated in Western Europe, but are now also spoken in the Western + Hemisphere and other parts of the world), via ISO 8859-1 Latin Alphabet + 1, for Eastern European languages (ISO Latin-2), Hebrew (and Yiddish), + Greek, and Cyrillic-alphabet languages (ISO Latin/Cyrillic). Many file + (local) character sets are supported: ISO 646 7-bit national sets, IBM + code pages, Apple, DEC, DG, NeXT, etc. + + To build Kermit with no character-set translation at all, include + -DNOCSETS in the CFLAGS. To build with no Latin-2, add -DNOLATIN2. To + build with no Cyrillic, add -DNOCYRIL. To omit Hebrew, add -DNOHEBREW. + If -DNOCSETS is *not* included, you'll always get LATIN1. To build with + no KANJI include -DNOKANJI. There is presently no way to include + Latin-2, Cyrillic, Hebrew, or Kanji without also including Latin-1. + + [69]Unicode support was added in C-Kermit 7.0, and it adds a fair + amount of tables and code (and this is only a "Level 1" implementation + -- a higher level would also require building in the entire Unicode + database). On a PC with RH 5.2 Linux, building C-Kermit 7.0, we get the + following sizes: + + NOCSETS NOUNICODE NOKANJI Before After + [ ] [ ] [ ] 1329014 (Full) + [ ] [ ] [ X ] 1325686 (Unicode but no Kanji) + [ ] [ X ] [ ] 1158837 (All charsets except Unicode) + [ X ] [ x ] [ x ] 1090845 (NOCSETS implies the other two) + + Note, by the way, that NOKANJI without NOUNICODE only removes the + non-Unicode Kanji sets (Shift-JIS, EUC-JP, JIS-7, etc). Kanji is still + representable in UCS-2 and UTF-8. + + [ [70]C-Kermit Home ] [ [71]Kermit Home ] + + 5. APC EXECUTION + + [ [72]Top ] [ [73]Contents ] [ [74]Next ] [ [75]Previous ] + + The Kermit CONNECT and INPUT commands are coded to execute Application + Program Command escape sequences from the host: + + _\ + + where is a C-Kermit command, or a list of C-Kermit commands + separated by commas, up to about 1K in length. + + To date, this feature has been included in the OS/2, Windows, VMS, + OS-9, and Unix versions, for which the symbol: + + CK_APC + + is defined automatically in [76]ckuusr.h. For OS/2, APC is enabled at + runtime by default, for UNIX it is disabled. It is controlled by the + SET TERMINAL APC command. Configuring APC capability into a version + that gets it by default (because CK_APC is defined in [77]ckuusr.h) can + be overridden by including: + + -DNOAPC + + on the CC command line. + + C-Kermit's autodownload feature depends on the APC feature, so + deconfiguring APC also disables autodownload (it doesn't use APC escape + sequences, but uses the APC switching mechanism internally). + + [ [78]C-Kermit Home ] [ [79]Kermit Home ] + + 6. PROGRAM SIZE + + [ [80]Top ] [ [81]Contents ] [ [82]Next ] [ [83]Previous ] + + SECTION CONTENTS + + 6.1. [84]Feature Selection + 6.2. [85]Changing Buffer Sizes + 6.3. [86]Other Size-Related Items + 6.4. [87]Space/Time Tradeoffs + + (Also see [88]Section 4) + + Each release of C-Kermit is larger than the last. On some computers + (usually old ones) the size of the program prevents it from being + successfully linked and loaded. On some others (also usually old ones), + it occupies so much memory that it is constantly swapping or paging. In + such cases, you can reduce C-Kermit's size in various ways, outlined in + this section. The following options can cut down on the program's size + at compile time by removing features or changing the size of storage + areas. + + If you are reading this section because all you want is a small, fast, + quick-to-load Kermit file-transfer application for the remote end of + your connection, and the remote end is Unix based, take a look at + G-Kermit: + + [89]http://www.columbia.edu/kermit/gkermit.html + + 6.1. Feature Selection + + Features can be added or removed by defining symbols on the CC (C + compiler) command line. "-D" is the normal CC directive to define a + symbol so, for example, "-DNODEBUG" defines the symbol NODEBUG. Some C + compilers might use different syntax, e.g. "-d NODEBUG" or + "/DEFINE=NODEBUG". For C compilers that do not accept command-line + definitions, you can put the corresponding #define statements in the + file ckcsym.h, for example: + + #define NODEBUG + + The following table shows the savings achieved when building C-Kermit + 8.0 (Beta.04) with selected feature-deselection switches on an + Intel-based PC with Red Hat Linux 7.0 and gcc 2.96. The sizes are for + non-security builds. The fully configured non-security build is 2127408 + bytes. + + Option Size Savings Effect + NOICP 545330 74.4% No Interactive Command Parser (command-line only) + NOLOCAL 1539994 27.6% No making connections. + NOXFER 1551108 27.1% No file transfer. + IKSDONLY 1566608 26.4% Internet Kermit Server only. + NOCSETS 1750097 17.7% No character-set conversion. + NOSPL 1800293 15.4% No Script Programming Language. + NONET 1808575 15.0% No making network connections. + NOUNICODE 1834426 13.8% No Unicode character-set conversion. + NOHELP 1837877 13.6% No built-in help text. + NODEBUG 1891669 11.1% No debug log. + NOFRILLS 1918966 9.8% No "frills". + NOFTP 1972496 7.3% No FTP client. + NODIAL 1984488 6.7% No automatic modem dialing. + NOPUSH 2070184 2.7% No shell access, running external programs, etc. + NOIKSD 2074129 2.5% No Internet Kermit Server capability. + NOHTTP 2082610 2.1% No HTTP client. + NOFLOAT 2091332 1.7% No floating-point arithmetic. + NOCHANNELIO 2095978 1.5% No FOPEN/FREAD/FWRITE/FCLOSE, etc. + MINIDIAL 2098035 1.4% No built-in support for many kinds of modems. + NOSERVER 2098987 1.3% No server mode. + NOSEXP 2105898 1.0% No S-Expressions. + NOPTY 2117743 0.5% No pseudoterminal support. + NORLOGIN 2121089 0.3% No RLOGIN connections. + NOOLDMODEMS 2124038 0.2% No built-in support for old kinds of modems. + NOSSH 2125696 0.1% No SSH command. + + And here are a few combinations + + Options Size Savings Effect + NODEBUG NOICP NOCSETS NOLOCAL 281641 86.7% No debug log, parser, + character sets, or making connections. + NOICP NOCSETS NOLOCAL 376468 82.3% No parser, character sets, or making + connections. + NOICP NOCSETS NONET 427510 79.9% No parser, character sets, or network + connections. + NOSPL NOCSETS 1423784 33.1% No script language, or character sets. + + -DNOFRILLS removes various command synonyms; the following top-level + commands: CLEAR, DELETE, DISABLE, ENABLE, GETOK, MAIL, RENAME, TYPE, + WHO; and the following REMOTE commands: KERMIT, LOGIN, LOGOUT, PRINT, + TYPE, WHO. + + 6.2. Changing Buffer Sizes + + Most modern computers have so much memory that (a) there is no need to + scrimp and save, and (b) C-Kermit, even when fully configured, is + relatively small by today's standards. + + Two major factors affect Kermit's size: feature selection and buffer + sizes. Buffer sizes affect such things as the maximum length for a + Kermit packet, the maximum length for a command, for a macro, for the + name of a macro, etc. Big buffer sizes are used when the following + symbol is defined: + + BIGBUFOK + + as it is by default for most modern platforms (Linux, AIX 4 and 5, + HP-UX 10 and 11, Solaris, etc) in [90]ckuusr.h. If your build does not + get big buffers automatically (SHOW FEATURES tells you), you can + include them by rebuilding with BIGBUFOK defined; e.g. in Unix: + + make xxxx KFLAGS=-DBIGBUFOK + + where xxxx is the makefile target. On the other hand, if you want to + build without big buffers when they normally would be selected, use: + + make xxxx KFLAGS=-DNOBIGBUF + + There are options to control Kermit's packet buffer allocations. The + following symbols are defined in [91]ckcker.h in such a way that you + can override them by redefining them in CFLAGS: + + -DMAXSP=xxxx - Maximum send-packet length. + -DMAXRP=xxxx - Maximum receive-packet length. + -DSBSIZ=xxxx - Total allocation for send-packet buffers. + -DRBSIZ=xxxx - Total allocation for receive-packet buffers. + + The defaults depend on the platform. + + Using dynamic allocation (-DDYNAMIC) reduces storage requirements for + the executable program on disk, and allows more and bigger packets at + runtime. This has proven safe over the years, and now most builds (e.g. + all Unix, VMS, Windows, and OS/2 ones) use dynamic memory allocation by + default. If it causes trouble, however, then omit the -DDYNAMIC option + from CFLAGS, or add -DNODYNAMIC. + + 6.3. Other Size-Related Items + + To make Kermit compile and load successfully, you might have to change + your build procedure to: + + a. Request a larger ("large" or "huge") compilation / code-generation + model. This is needed for 16-bit PC-based UNIX versions (most or + all of which fail to build C-Kermit 7.0 and later anyway). This is + typically done with a -M and/or -F switch (see your cc manual or + man page for details). + b. Some development systems support overlays. If the program is too + big to be built as is, check your loader manual ("man ld") to see + if an overlay feature is available. See the 2.10/2.11 BSD example + in the UNIX makefile. (Actually, as of version 7.0, C-Kermit is too + big to build, period, even with overlays, on 2.xx BSD). + c. Similarly, some small and/or segment-based architectures support + "code mapping", which is similar to overlays (PDP11-based VENIX + 1.0, circa 1984, was an example). See the linker documentation on + the affected platform. + + It is also possible to reduce the size of the executable program file + in several other ways: + + a. Include the -O (optimize) compiler switch if it isn't already + included in your "make" entry (and if it works!). If your compiler + supports higher levels of optimization (e.g. -O2 or higher number, + -Onolimit (HP-UX), etc), try them; the greater the level of + optimization, the longer the compilation and more likely the + compiler will run out of memory. The the latter eventuality, some + compilers also provide command-line options to allocate more memory + for the optimizer, like "-Olimit number" in Ultrix. + b. If your platofrm supports shared libraries, change the make entry + to take advantage of this feature. The way to do this is, of + course, platform dependent; see the NeXT makefile target for an + example. some platforms (like Solaris) do it automatically and give + you no choice. But watch out: executables linked with shared + libraries are less portable than statically linked executables. + c. Strip the program image after building ("man strip" for further + info), or add -s to the LNKFLAGS (UNIX only). This strips the + program of its symbol table and relocation information. + d. Move character strings into a separate file. See the 2.11 BSD + target for an example. + + 6.4. Space/Time Tradeoffs + + There are more than 6000 debug() statements in the program. If you want + to save both space (program size) and time (program execution time), + include -DNODEBUG in the compilation. If you want to include debugging + for tracking down problems, omit -DNODEBUG from the make entry. But + when you include debugging, you have two choices for how it's done. One + definition defines debug() to be a function call; this is cheap in + space but expensive in execution. The other defines debug as "if + (deblog)" and then the function call, to omit the function call + overhead when the debug log is not active. But this adds a lot of space + to the program. Both methods work, take your choice; IFDEBUG is + preferred if memory is not a constraint but the computer is likely to + be slow. The first method is the default, i.e. if nothing is done to + the CFLAGS or in [92]ckcdeb.h (but in some cases, e.g. VMS, it is). To + select the second method, include -DIFDEBUG in the compilation (and + don't include -DNODEBUG). + + [ [93]C-Kermit Home ] [ [94]Kermit Home ] + + 7. MODEM DIALING + + [ [95]Top ] [ [96]Contents ] [ [97]Next ] [ [98]Previous ] + + -DNODIAL removes automatic modem dialing completely, including the + entire [99]ckudia.c module, plus all commands that refer to dialing in + the various ckuus*.c modules. + + -DMINIDIAL leaves the DIAL and related commands (SET/SHOW MODEM, + SET/SHOW DIAL) intact, but removes support for all types of modems + except CCITT, Hayes, Unknown, User-defined, Generic-high-speed, and + None (= Direct). The MINIDIAL option cuts the size of the dial module + approximately in half. Use this option if you have only Hayes or CCITT + modems and don't want to carry the baggage for the other types. + + A compromise between full dialer support and MINIDIAL is obtained by + removing support for "old" modems -- all the strange non-Hayes + compatible 1200 and 2400 bps modems that C-Kermit has been carrying + around since 1985 or so. To remove support for these modems, add + -DNOOLDMODEMS to CFLAGS at compilation time. + + Finally, if you keep support for old modems, you will notice that their + names appear on the "set modem ?" menu. That's because their names are, + by default, "visible". But the list is confusing to the younger + generation, who have only heard of modems from the V.32bis-and-later + era. If you want to be able to use old modems, but don't want their + names cluttering up menus, add this to CFLAGS: + + -DM_OLD=1 + + [ [100]C-Kermit Home ] [ [101]Kermit Home ] + + 8. NETWORK SUPPORT + + [ [102]Top ] [ [103]Contents ] [ [104]Next ] [ [105]Previous ] + + SECTION CONTENTS + + 8.1. [106]TCP/IP + 8.2. [107]X.25 + 8.3. [108]Other Networks + + C-Kermit supports not only serial-port and modem connections, but also + TCP/IP and X.25 network connections. Some versions support other + network types too like DECnet, LAT, NETBIOS, etc. If you define the + following symbol: + + NONET + + then all network support is compiled away. + + 8.1. TCP/IP + + SUBSECTION CONTENTS + + 8.1.1. [109]Firewalls + 8.1.2. [110]Compilation and Linking Problems + 8.1.3. [111]Enabling Host Address Lists + 8.1.4. [112]Enabling Telnet NAWS + 8.1.5. [113]Enabling Incoming TCP/IP Connections + 8.1.6. [114]Disabling SET TCP Options + + C-Kermit's TCP/IP features require the Berkeley sockets library or + equivalent, generally available on any Unix system, as well as in + Windows 9x/NT, OS/2, VMS, AOS/VS, VOS, etc. The TCP/IP support includes + built-in TELNET, FTP, and HTTP protocol. To select TCP/IP support, + include -DTCPSOCKET in your makefile target's CFLAGS, or (in VMS) the + appropriate variant (e.g. -DWOLLONGONG, -DMULTINET, -DEXCELAN, + -DWINTCP, etc). + + The VMS and/or early Unix third-party TCP/IP products are often + incompatible with each other, and sometimes with different versions of + themselves. For example, Wollongong reportedly put header files in + different directories for different UNIX versions: + + * in.h can be in either /usr/include/sys or /user/include/netinet. + * telnet.h can be in either /usr/include/arpa or + /user/include/netinet. + * inet.h can be in either /usr/include/arpa or /user/include/sys. + + In cases like this, use the -I cc command-line option when possible; + otherwise it's better to make links in the file system than it is to + hack up the C-Kermit source code. Suppose, for example, Kermit is + looking for telnet.h in /usr/include/arpa, but on your computer it is + in /usr/include/netinet. Do this (as root, or get the system + administrator to do it): + + cd /usr/include/arpa + ln /usr/include/netinet/telnet.h telnet.h + + ("man ln" for details about links.) + + The network support for TCP/IP and X.25 is in the source files + [115]ckcnet.h, [116]ckctel.c, [117]ckctel.c, [118]ckctel.h, + [119]ckcftp.c, with miscellaneous SHOW commands, etc, in the various + ckuus*.c modules, plus code in the ck*con.c or ckucns.c (CONNECT + command) and several other modules to detect TELNET negotiations, etc. + + Within the TCPSOCKET code, some socket-level controls are included if + TCPSOCKET is defined in the C-Kermit CFLAGS and SOL_SOCKET is defined + in in the system's TCP-related header files, such as . + These are: + + SET TCP KEEPALIVE + SET TCP LINGER + SET TCP RECVBUF + SET TCP SENDBUF + + In addition, if TCP_NODELAY is defined, the following command is also + enabled: + + SET TCP NODELAY (Nagle algorithm) + + See the [120]C-Kermit user documentation for descriptions of these + commands. + + 8.1.1. Firewalls + + There exist various types of firewalls, set up to separate users of an + internal TCP/IP network ("Intranet") from the great wide Internet, but + then to let selected users or services get through after all. + + One firewall method is called SOCKS, in which a proxy server allows + users inside a firewall to access the outside world, based on a + permission list generally stored in a file. SOCKS is enabled in one of + two ways. First, the standard sockets library is modified to handle the + firewall, and then all the client applications are relinked (if + necessary, i.e. if the libraries are not dynamically loaded) with the + modified sockets library. The APIs are all the same, so the + applications do not need to be recoded or recompiled. + + In the other method, the applications must be modified to call + replacement routines, such as Raccept() instead of accept(), Rbind() + instead of bind(), etc, and then linked with a separate SOCKS library. + This second method is accomplished (for SOCKS4) in C-Kermit by + including -DCK_SOCKS in your CFLAGS, and also adding: + + -lsocks + + to LIBS, or replacing -lsockets with -lsocks (depending on whether the + socks library also includes all the sockets entry points). + + For SOCKS5, use -DCK_SOCKS5. + + Explicit firewall support can, in general, not be a standard feature or + a feature that is selected at runtime, because the SOCKS library tends + to be different at each site -- local modifications abound. + + The ideal situation occurs when firewalls are supported by the first + method, using dynamically linked sockets-replacement libraries; in this + case, all your TCP/IP client applications negotiate the firewall + transparently. + + 8.1.2. Compilation and Linking Problems + + If you get a compilation error in [121]ckcnet.c, with a complaint like + "incompatible types in assignment", it probably has something to do + with the data type your system uses for the inet_addr() function, which + is declared (usually) in . Kermit uses "unsigned long" + unless the symbol INADDRX is defined, in which case "struct inaddr" is + used instead. Try adding -DINADDRX to CFLAGS in your make entry, and if + that fixes the problem, please send a report to kermit@columbia.edu. + + Compilation errors might also have to do with the data type used for + getsockopt() and setsockopt() option-length field. This is normally an + int, but sometimes it's a short, a long, or an unsigned any of those, + or a size_t. To fix the compilation problem, add -DSOCKOPT_T=xxx to the + CFLAGS in your makefile target, where xxx is the appropriate type (use + "man getsockopt" or grep through your system/network header files to + find the needed type). + + 8.1.3. Enabling Host Address Lists + + When you give Kermit an IP host name, it calls the socket routine + gethostbyname() to resolve it. gethostbyname() returns a hostent + struct, which might or might not not include a list of addresses; if it + does, then if the first one fails, Kermit can try the second one, and + so on. However, this will only work if the symbol "h_addr" is a macro + defined as "h_addr_list[0]", usually in netdb.h. If it is, then you can + activate this feature by defining the following symbol in CFLAGS: + + HADDRLIST + + 8.1.4. Enabling Telnet NAWS + + The Telnet Negotiation About Window Size (NAWS) option requires the + ability to find out the terminal screen's dimensions. E.g. in Unix, we + need something like ioctl(0, TIOCGWINSZ, ...). If your version of + Kermit was built with NAWS capability, SHOW VERSIONS includes CK_NAWS + among the compiler options. If it doesn't, you can add it by defining + CK_NAWS at compile time. Then, if the compiler or linker complain about + undefined or missing symbols, or there is no complaint but SHOW + TERMINAL fails to show reasonable "Rows =, Columns =" values, then take + a look at (or write) the appropriate ttgwsiz() routine. On the other + hand, if CK_NAWS is defined by default for your system (in + [122]ckcnet.h), but causes trouble, you can override this definition by + including the -DNONAWS switch on your CC command line, thus disabling + the NAWS feature. + + This appears to be needed at least on the AT&T 3B2, where in + [123]ckutio.c, the routine ttgwsiz() finds that the TIOCGWINSZ symbol + is defined but lacks definitions for the corresponding winsize struct + and its members ws_col and ws_row. + + The UNIX version of C-Kermit also traps SIGWINCH, so it can send a NAWS + to the Telnet server any time the local console terminal window size + changes, e.g. when you stretch it with a mouse. The SIGWINCH-trapping + code is enabled if SIGWINCH is defined (i.e. in signal.h). If this code + should cause problems, you can disable it without disabling the NAWS + feature altogether, by defining NOSIGWINCH at compile time. + + 8.1.5. Enabling Incoming TCP/IP Connections + + This feature lets you "set host * port" and wait for an incoming + connection on the given port. This feature is enabled automatically at + compile if TCPSOCKET is defined and SELECT is also defined. But watch + out, simply defining SELECT on the cc command line does not guarantee + successful compilation or linking (see [124]Section 11). + + If you want to disable incoming TCP/IP connections, then build C-Kermit + with: + + -DNOLISTEN + + 8.1.6. Disabling SET TCP Options + + The main reason for this is because of header file / prototype + conflicts at compile time regardting get- / setsockopt(). If you can't + fix them (without breaking other builds), add the following in CFLAGS: + + -DNOTCPOPTS + + 8.2. X.25 + + X.25 support requires (a) a Sun, (b) the SunLink product (libraries and + header files), and (c) an X.25 connection into your Sun. Similarly (in + C-Kermit 7.0 or later) Stratus VOS and IBM AIX. + + In UNIX, special makefile targets sunos4x25 and sunos41x25 (for SUNOS + 4.0 and 4.1, respectively), or aix41x25, are provided to build in this + feature, but they only work if conditions (a)-(c) are met. To request + this feature, include -DSUNX25 (or -DIBMX25) in CFLAGS. + + SUNX25 (or -DIBMX25) and TCPSOCKET can be freely mixed and matched, and + selected by the user at runtime with the SET NETWORK TYPE command or + SET HOST switches. + + 8.3. Other Networks + + Support for other networking methods -- NETBIOS, LAT, Named Pipes, etc + -- is included in ck*net.h and ck*net.c for implementations (such as + Windows or OS/2) where these methods are supported. + + Provision is made in the organization of the modules, header files, + commands, etc, for addition of new network types such as DECnet, X.25 + for other systems (HP-UX, VMS, etc), and so on. Send email to + [125]kermit@columbia.edu if you are willing and able to work on such a + project. + + [ [126]C-Kermit Home ] [ [127]Kermit Home ] + + 9. EXCEPTION HANDLING + + [ [128]Top ] [ [129]Contents ] [ [130]Next ] [ [131]Previous ] + + The C language setjmp/longjmp mechanism is used for handling + exceptions. The jump buffer is of type jmp_buf, which almost everywhere + is typedef'd as an array, in which case you should have no trouble + compiling the exception-handling code. However, if you are building + C-Kermit in/for an environment where jmp_buf is something other than an + array (e.g. a struct), then you'll have to define the following symbol: + + JBNOTARRAY + + [ [132]C-Kermit Home ] [ [133]Kermit Home ] + + 10. SECURITY FEATURES + + [ [134]Top ] [ [135]Contents ] [ [136]Next ] [ [137]Previous ] + + Security, in the sense of secure authentication and strong encryption, + can be built into versionf of C-Kermit for which the appropriate + libraries and header files are available (Kerberos IV, Kerberos V, + OpenSSL, SRP), as explained in great detail in the Kermit Security + Reference + . The following symbols govern C-Kermit's security features at build + time: + + NO_AUTHENTICATION + Means do not configure any TELNET AUTHENTICATION support. It + implies NO_ENCRYPTION and undefines any of the auth and encrypt + types. It does not undefine CK_SSL even though builds with + CK_SSL cannot succeed without CK_AUTHENTICATION. (This will be + supported in a future release. It will be needed to allow + C-Kermit to be built only as an FTP client.) + + NO_KERBEROS + Means do not compile in any KERBEROS support when + CK_AUTHENTICATION has been defined. + + NO_SRP + Do not compile in any SRP support when CK_AUTHENTICATION has + been defined. + + NO_SSL + Do not compile in any SSL/TLS support + + NO_ENCRYPTION + Do not compile in any Telnet encryption support. It does not + affect the use of SSL/TLS + + NOSSH + Do not compile in any SSH support whether internal or external + + CK_AUTHENTICATION + Telnet AUTHENTICATION support. (Also, required if SSL/TLS + support is desired.) On most platforms this does not autodefine + any authentication mechanisms such as Kerberos V, Kerberos IV, + SRP, ... Those need to be defined separately. + + CK_KERBEROS + Defined automatically when KRB4, KRB5, or KRB524 are defined. + Implies that some version of Kerberos is in use. + + KRB4 + Should be defined when Kerberos IV support is desired. + + KRB5 + Should be defined when Kerberos V support is desired. + + KRB524 + Should be defined if both Kerberos V and Kerberos IV are used + and the Kerberos IV support is provided by the MIT Kerberos IV + compatibility library in the current Kerberos 5 distribution. + + KRB5_U2U + Should be defined if KRB5 is defined and Kerberos 5 User to User + mode is desired. + + HEIMDAL + Should be defined if Kerberos V support is provided by HEIMDAL. + Support for this option is not complete in C-Kermit 8.0. Anyone + interested in working on this should contact kermit-support. + + CK_SRP + Should be defined if SRP support is desired. + + CK_ENCRYPTION + Should be defined if TELNET ENCRYPTION option support is + desired. This option does not define any particular encryption + types. That should be done by defining CK_DES or CK_CAST. + + CK_DES + Should be defined if either DES or 3DES Telnet Encryption option + support is desired. + + LIBDES + If CK_DES is defined and DES support is being provided by either + Eric Young's libdes.a or OpenSSL 0.9.6x or earlier, this option + must be defined. If it is not defined, it will be assumed that + DES support is provided by the MIT Kerberos IV libraries. + + CK_CAST + Should be defined if CAST Telnet Encryption option support is + desired + + CK_SSL + Should be defined if SSL/TLS support (OpenSSL) is desired. + + SSL_KRB5 + If KRB5 is defined, and OpenSSL is built to support the Kerberos + 5 ciphers, then you should define SSL_KRB5 + + NOSSLKRB5 + If you are using OpenSSL 0.9.7 or higher and do not wish to + build with support for Kerberos 5 TLS ciphers, this option must + be defined. + + ZLIB + If you are using OpenSSL 0.9.6 or higher and it has been + compiled with support for ZLIB compression, this option should + be defined to enable Kermit to properly enable the use of + compression. + + SSHCMD + Defined for C-Kermit to enable the use of external SSH clients + from the Kermit command language + + SSHBUILTIN + Defined for Kermit implementations that have integrated SSH + support. Currently only Windows. + + ANYSSH + Defined if either SSHCMD or SSHBUILTIN are defined. + + CK_SNDLOC + Telnet Send Location support. + + NOSNDLOC + Do not include Telnet Send Location support. + + CK_XDISPLOC + Telnet X-Display Location support. Determines if the X-Display + location information is sent to the Telnet server either via + Telnet XDISPLOC or NEW-ENV options. + + NOXDISPLOC + Do not include Telnet X-Display Location support. + + CK_FORWARD_X + Telnet Forward X Windows Session Data option. Used to protect + the privacy and integrity of X Windows Sessions when secure + telnet sessions are in use. + + NOFORWARDX + Do not include Telnet Forward X Windows Session Data option. + + Besides the strong forms of security listed above, C-Kermit also + embodies various internal security features, including: + + NOPUSH + Compiling with the NOPUSH symbol defined removes all the "shell + escape" features from the program, including the PUSH, RUN, and + SPAWN commands, the "!" and "@" command prefixes, OPEN !READ, + OPEN !WRITE, job control (including the SUSPEND command), the + REDIRECT command, shell/DCL escape from CONNECT mode, as well as + the server's execution of REMOTE HOST commands (and, of course, + the ENABLE HOST command). Add NODISPO to also prevent acceptance + of incoming MAIL or REMOTE PRINT files. For UNIX, also be sure + to read [138]Section 11 of the [139]Unix C-Kermit Installation + Instructions. about set[ug]id configuration. Additional + restrictions can be enforced when in server mode; read about the + DISABLE command in the user manual. + + NOCCTRAP + Compiling with NOCCTRAP prevents the trapping of SIGINT by + Kermit. Thus if the user generates a SIGINT signal (e.g. by + typing the system's interrupt character), Kermit will exit + immediately, rather than returning to its prompt. + + NOPUSH and NOCCTRAP together allow Kermit to be run from restricted + shells, preventing access to system functions. + + [ [140]C-Kermit Home ] [ [141]Kermit Home ] + + 11. ENABLING SELECT() + + [ [142]Top ] [ [143]Contents ] [ [144]Next ] [ [145]Previous ] + + Kermit works best if it can do nonblocking reads, nondestructive input + buffer checking, and millisecond sleeps. All of these functions can be + accomplished by the select() function, which, unfortunately, is not + universally available. Furthermore, select() is required if incoming + TCP/IP connections are to be supported. + + select() was introduced with Berkeley UNIX, rejected by AT&T for System + V, but is gradually creeping in to all UNIX versions (and other + operating systems too) by virtue of its presence in the sockets + library, which is needed for TCP/IP. AT&T SVID for System V R4 includes + select(), but that does not mean that all SVR4 implementations have it. + + Furthermore, even when select() is available, it might work only on + socket file descriptors, but not on others like serial ports, pipes, + etc. For example, in AOS/VS and BeOS, it works only with file + descriptors that were created by socket() and opened by connect() or + accept(). + + Other alternatives include poll() and rdchk(). Only one of these three + functions should be included. The following symbols govern this: + + SELECT Use select() (BSD, or systems with sockets libraries) + CK_POLL Use poll() (System V) + RDCHK Use rdchk() (SCO XENIX and UNIX) + + If your system supports the select() function, but your version of + C-Kermit does not, try adding: + + -DSELECT + + to the CFLAGS, and removing -DRDCHK or -DCK_POLL if it is there. If you + get compilation errors, some adjustments to ck*tio.c and/or ck*net.c + might be needed; search for SELECT (uppercase) in these files (note + that there are several variations on the calling conventions for + select()). + + Various macros and data types need to be defined in order to use + select(). Usually these are picked up from or . + But on some systems, they are in . In that case, add the + following: + + -DSELECT_H + + to the CFLAGS to tell C-Kermit to #include . A good + indication that you need to do this would be if you get compile-time + complaints about "fd_set" or "FD_SET" not being declared or defined. + + In UNIX, the use of select() vs fork() in the CONNECT command is + independent of the above considerations, and is governed by choosing a + particular makefile target. + + As of C-Kermit 7.0, select() is also the preferred control mechanism + for the CONNECT command. Unfortunately, the structures used by the + original UNIX CONNECT command, based on fork(), and those used by + select(), are so different, it was not practical to implement them both + in one module. So the select()-based CONNECT command module for UNIX is + [146]ckucns.c, and the fork-based one remains [147]ckucon.c. To choose + the fork-based one, which is more portable (but slower and more + fragile), use "wermit" as the make target. To choose the select-based + one, use "xermit". Only do this if you can verify that the CONNECT + command works on serial connections and PIPE connections as well as TCP + connections. + + The select()-based Unix CONNECT module, ckucns.c, must be used if + encryption is to be done, since the fork() version (ckucon.c) loses + its ability to share vital state information between the two forks. + Also note that the select() version is superior in many other ways + too. For example, it recovers better from exterior killing, forced + disconnections, etc, plus it goes faster. + + SHOW VERSIONS tells whether the CONNECT module uses fork() or select(). + + C-Kermit 8.0 adds learned script capability, which depends on select(). + All the "wermit" based targets (as opposed to "xermit") had NOLEARN + added to them. Whenever changing a target over from wermit to xermit, + also remember to remove NOLEARN. + + [ [148]C-Kermit Home ] [ [149]Kermit Home ] + + 12. I/O REDIRECTION + + [ [150]Top ] [ [151]Contents ] [ [152]Next ] [ [153]Previous ] + + The REDIRECT command allows a local program to be run with its i/o + redirected over the communications connection. Your version of C-Kermit + has a REDIRECT command if it was built with the following CFLAG: + + -DCK_REDIR + + This, in turn, is possible only if the underlying API is there. In the + case of UNIX this is just the wait() system call, so all UNIX versions + get this feature as of 6.0.192 (earlier versions needed a + header file defining the symbols WIFEXITED and WEXITSTATUS). + + As of version 7.0, file transfer can be done using pipes and filters. + To enable this feature, #define PIPESEND (and fill in the code). To + disable on systems where it is normally enabled, define NOPIPESEND. + This feature is, of course, also disabled by building with NOPUSH (or + giving the "nopush" command at runtime). + + C-Kermit 7.0 also adds the PIPE and SET HOST /COMMAND commands, which + provide another form of redirection. This feature is selected with + -DNETCMD. CK_RDIR must also be defined, since the same mechanisms are + used internally. + + [ [154]C-Kermit Home ] [ [155]Kermit Home ] + + 13. FLOATING-POINT NUMBERS, TIMERS, AND ARITHMETIC + + [ [156]Top ] [ [157]Contents ] [ [158]Next ] [ [159]Previous ] + + Floating-point support was added in C-Kermit 7.0. + + Floating-point numbers are enabled internally, at least for use in + high-precision file-transfer timers and statistics, unless the + following symbol is defined at compile time: + + -DNOFLOAT + + This might be necessary on old PCs that do not have built-in + floating-point hardware. + + When NOFLOAT is not defined, the following symbol tells which + floating-point type to use: + + -DCKFLOAT=xxxx + + The value is either "double" (normal for 32- and 16-bit architectures) + or "float" (normal for 64-bit architectures). + + C-Kermit can be configured to use high-precision file-transfer timers + for more accurate statistics. This feature is enabled with: + + -DGFTIMER + + and disabled with: + + -DNOGFTIMER + + If you try to build with -DGFTIMER but you get compilation errors, + either fix them (and send email to kermit@columbia.edu telling what you + did), or else give up and use -DNOGFTIMER (or -DNOFLOAT) instead. Hint: + depending on your machine architecture, you might have better luck + using double than float as the data type for floating-point numbers, or + vice versa. Look in [160]ckcdeb.h for the CKFLOAT definition. + + Floating-point arithmetic is also supported in the script programming + language. First via the \fpp...() functions, such as \fppadd(), which + adds two floating-point numbers, second in S-Expressions. Addition, + subtraction, multiplication, and division are always available. But + other functions such as logs, raising to powers, sines and cosines, + etc, require the C Math library. To include user-level floating-point + math you must put: + + -DFNFLOAT + + and in Unix you must link with the Math library: + + LIBS=".... -lm" + + In K95 and VMS, FNFLOAT is defined automatically if CKFLOAT is defined. + In Unix, however, FNFLOAT must be added to each makefile target + individually, because of the special linking instructions that must + also be added to each target. + + Note: S-Expressions require FNFLOAT. + + [ [161]C-Kermit Home ] [ [162]Kermit Home ] + + 14. SPECIAL CONFIGURATIONS + + [ [163]Top ] [ [164]Contents ] [ [165]Previous ] + + As of C-Kermit 7.0, if you build C-Kermit normally, but with -DNOICP + (No Interactive Command Parser), you get a program capable of making + serial connections (but not dialing) and network connections (if + TCPSOCKET or other network option included), and can also transfer + files using Kermit protocol, but only via autodownload/upload. + Furthermore, if you call the executable "telnet", it will act like + Telnet -- using the command-line options. However, in this case there + is nothing to escape back to, so if you type Ctrl-\c, it just prints a + message to this effect. + + You can also build C-Kermit with -DNOXFER, meaning omit all the + file-transfer features. This leaves you with a scriptable + communications program that is considerably smaller than the full + C-Kermit. + + [ [166]C-Kermit Home ] [ [167]Kermit Home ] + + APPENDIX I: SUMMARY OF COMPILE-TIME OPTIONS + + [ [168]Top ] [ [169]Contents ] + + These are the symbols that can be specified on the cc command line, + listed alphabetically. Others are used internally, including those + taken from header files, those defined by the compiler itself, and + those inferred from the ones given below. Kermit's SHOW VERSIONS + command attempts to display most of these. See [170]ckcdeb.h and + [171]ckcnet.h for inference rules. For example SVR3 implies ATTSV, + MULTINET implies TCPSOCKET, and so on. + + Here is the complete list of the Kermit-specific compile-time switches: + + ACUCNTRL Select BSD 4.3-style acucntrl() bidirectional tty control. + aegis Build for Apollo Aegis (predefined on Apollo systems). + AIX370 Build for IBM AIX/370 for IBM mainframes. + AIXESA Build for IBM AIX/ESA for IBM mainframes. + AIXPS2 Build for IBM AIX 3.0 for PS/2 series (never formally released). + AIXRS Build for IBM AIX 3.x on RS/6000. + AIX41 Build for IBM AIX 4.x on RS/6000. + AMIGA Build for Commodore Amiga with Intuition OS. + ATT6300 Build for AT&T 6300 PLUS. + ATT7300 Build for AT&T 7300 UNIX PC (3B1). + ATTSV Build for AT&T System III or V UNIX. + AUX Build for Apple A/UX for the Macintosh. + BIGBUFOK OK to use big buffers - "memory is not a problem" + BPS_xxxx Enable SET SPEED xxxx + BSD29 Build for BSD 2.9 or 2.10. + BSD4 Build for BSD 4.2. + BSD41 Build for BSD 4.1. + BSD43 Build for BSD 4.3. + BSD44 Build for BSD 4.4. + C70 Build for BBN C/70. + CIE Build for CIE Systems 680/20. + CKCONINTB4CB Work around prompt-disappears after escape back from + CONNECT. + CKLEARN Build with support for learned scripts. + CKLOGDIAL Enable connection log. + CKMAXPATH Maximum length for a fully qualified filename. + CKREGEX (misnomer) Include [...] or {xxx,xxx,xxx} matching in + ckmatch(). + CKSYSLOG Enable syslogging. + CK_ANSIC Enable ANSI C constructs - prototypes, etc. + CK_ANSILIBS Use header files for ANSI C libraries. + CK_APC Enable APC execution by CONNECT module. + CK_CURSES Enable fullscreen file transfer display. + CK_DSYSINI Use system-wide init file, with name supplied by Kermit. + CK_DTRCD DTR/CD flow control is available. + CK_FAST Build with fast Kermit protocol defaults. + CK_FORK_SIG UNIX only: signal() number for CONNECT module forks. + CK_IFRO IF REMOTE command is available (and can run in remote mode). + CK_INI_A System-wide init file takes precedence over user's. + CK_INI_B User's init file takes precedence over the system-wide one. + CK_LABELED Include support for SET FILE TYPE LABELED. + CK_LBRK This version can send Long BREAK. + CK_LINGER Add code to turn of TCP socket "linger" parameter. + CK_MKDIR This version has a zmkdir() command to create directories. + CK_NAWS Include TELNET Negotiate About Window Size support. + CK_NEWTERM Use newterm() rather than initscr() to initialize curses. + CK_PAM Include PAM authentication (might also require -lpam). + CK_PCT_BAR Fullscreen file transfer display should include + "thermometer". + CK_POLL System-V or POSIX based UNIX has poll() function. + CK_POSIX_SIG Use POSIX signal handing: sigjmp_buf, sigsetjmp, + siglongjmp. + CK_READ0 read(fd,&x,0) can be used to test TCP/IP connections. + CK_REDIR Enable the REDIRECT command. + CK_RESEND Include the RESEND command (needs zfseek() + append). + CK_RTSCTS RTS/CTS flow control is available. + CK_SHADOW Include support for shadow passwords (e.g. for IKSD + authentication). + CK_SOCKBUF Enable TCP socket-buffer-size-increasing code. + CK_SOCKS UNIX only: Build with socks library rather than regular + sockets + CK_SOCKS5 UNIX only: Build with socks 5 lib rather than regular sockets + CK_SPEED Enable control-character unprefixing. + CK_SYSINI="xxxxx" Quoted string to be used as system-wide init file + name. + CK_TIMERS Build with support for dynamically calculated packet + timeouts. + CK_TMPDIR This version of Kermit has an isdir() function. + CK_TTYFD Defined on systems where the communications connection file + descriptor (ttyfd) can be passed to other processes as a command-line + argument via \v(ttyfd). + CK_URL Parse URLs as well as hostnames, etc. + CK_XONXOFF Xon/Xoff flow control available. + CK_XYZ Include support for XYZMODEM protocols. + CK_WREFRESH Curses package includes wrefresh(),clearok() for screen + refresh. + CKFLOAT=type Floating-point data type, "double" or "float". + CKTYP_H=xxx Force include of xxx as file. + CLSOPN When hanging up a tty device, also close and reopen it. + CMDDEP Maximum recursion depth for self-referential user-defined fn's. + COHERENT Build for Mark Williams Coherent UNIX + CONGSPD Define if this version has congspd() routine in ck?tio.c + datageneral Build for Data General AOS/VS or AOS/VS II + DCLPOPEN popen() is available but needs to be declared + DEC_TCPIP Build with support for DEC TCP/IP (UCX) for (Open)VMS + DGUX430 Build for DG/UX 4.30 + DGUX540 Build for DG/UX 5.40 + DEFPAR=x Default parity, 0, 'e', 'o', 'm', or 's'. + DFTTY=xxx Default communications device name. + DIRENT UNIX directory structure to be taken from . + DIRPWDRP Prompt for password in REMOTE CWD command. + DTILDE Include UNIX ~ notation for username/home-directory + DYNAMIC Allocate file transfer packet buffers dynamically with malloc. + ENCORE Build for Encore Multimax computers. + EXCELAN Build with excelan TCP/IP. + FNFLOAT Include floating-point math functions (logs, sin, cos, exp, + etc) + FT18 Build for Fortune For:Pro 1.8. + FT21 Build for Fortune For:Pro 2.1. + GEMDOS Build for Atari ST GEMDOS. + GFTIMER Use high-precision floating-point file-transfer timers. + GID_T=xxx Group IDs are of type xxx (usually int, short, or gid_t). + HADDRLIST If gethostbyname() hostent struct contains a list of + addresses. + HDBUUCP Build with support for Honey DanBer UUCP. + HPUX Build for Hewlett Packard HP-UX. + HPUX9 Build for Hewlett Packard HP-UX 9.x. + HPUX10 Build for Hewlett Packard HP-UX 10.x. + HWPARITY Define if this version can SET PARITY HARDWARE { EVEN, ODD...} + I386IX Build for Interactive System V R3. + IFDEBUG Add IF stmts "if (deblog)" before "debug()" calls. + INADDRX TCP/IP inet_addr() type is struct inaddr, not unsigned long. + INTERLAN Build with support for Racal/Interlan TCP/IP. + ISDIRBUG System defs of S_ISDIR and S_ISREG have bug, define ourselves. + ISIII Build for Interactive System III. + IX370 Build for IBM IX/370. + KANJI Build with Kanji character-set translation support. + LCKDIR UUCP lock directory is /usr/spool/uucp/LCK/. + LFDEVNO UUCP lockfile name uses device numbers, as in SVR4. + LINUXFSSTND For Linux, use FSSTND UUCP lockfile conventions (default). + LOCK_DIR=xxx UUCP lock directory is xxx (quoted string). + LOCKF Use lockf() (in addition to lockfiles) on serial lines + LONGFN BSD long filenames supported using and opendir(). + LYNXOS Build for Lynx OS 2.2 or later (POSIX-based). + MAC Build for Apple Macintosh with Mac OS. + MATCHDOT Make wildcards match filenames that start with period (.) + MAXRP=number Maximum receive-packet length. + MAXSP=number Maximum send-packet length. + MDEBUG Malloc-debugging requested. + MINIDIAL Minimum modem dialer support: CCITT, Hayes, Unkown, and None. + MINIX Build for MINIX. + MIPS Build for MIPS workstation. + MULTINET Build with support for TGV MultiNet TCP/IP (VAX/VMS). + M_UNIX Defined by SCO. + NAP The nap() is available (conflicts with SELECT and USLEEP) + NAPHACK The nap() call is available but only as syscall(3112,...) + NDIR BSD long filenames supported using and opendir(). + NDGPWNAM Don't declare getpwnam(). + NDSYSERRLIST Don't declare sys_errlist[]. + NEEDSELECTDEFS select() is avaible but we need to define FD_blah + ourselves. + NETCMD Build with support for SET HOST /COMMAND and PIPE commands. + NEXT Build for NeXT Mach 1.x or 2.x or 3.0, 3.1, or 3.2. + NEXT33 Build for NeXT Mach 3.3. + NOANSI Disable ANSI C function prototyping. + NOAPC Do not include CK_APC code. + NOARROWKEYS Exclude code to parse ANSI arrow-key sequences. + NOB_xxxx Disable SET SPEED xxxx + NOBIGBUF Override BIGBUFOK when it is the default + NOBRKC Don't try to refer to t_brkc or t_eof tchars structure members. + NOCKFQHOSTNAME Exclude code to get fully qualified hostname in case it + causes core dumps. + NOCCTRAP Disable Control-C (SIGINT) trapping. + NOCKSPEED Disable control-prefix removal feature (SET CONTROL). + NOCKTIMERS Build without support for dynamic timers. + NOCKXYZ Overrides CK_XYZ. + NOCKREGEX Do not include [...] or {xxx,xxx,xxx} matching in ckmatch(). + NOCMDL Build with no command-line option processing. + NOCOTFMC No Close(Open()) To Force Mode Change (UNIX version). + NOCSETS Build with no support for character set translation. + NOCYRIL Build with no support for Cyrillic character set translation. + NOCYRILLIC Ditto. + NODEBUG Build with no debug logging capability. + NODIAL Build with no DIAL or SET DIAL commands. + NODISPO Build to always refuse incoming MAIL or REMOTE PRINT files. + DNODISPLAY Build with no file-transfer display. + NOESCSEQ Build with no support for ANSI escape sequence recognition. + NOFAST Do not make FAST Kermit protocol settings the default. + NOFDZERO Do not use file descriptor 0 for remote-mode file transfer. + NOFILEH Do not #include . + NOFLOAT Don't include any floating-point data types or operations. + NOFRILLS Build with "no frills" (this should be phased out...) + NOFTRUNCATE Include this on UNIXes that don't have ftruncate(). + NOGETUSERSHELL Include this on UNIXes that don't have getusershell(). + NOGFTIMER Don't use high-precision floating-point file-transfer timers. + NOHEBREW Build with no support for Hebrew character sets. + NOHELP Build with no built-in help. + NOIKSD Build with IKSD support excluded. + NOINITGROUPS Include this on UNIXes that don't have initgroups(). + NOICP Build with no interactive command parser. + NOJC Build with no support for job control (suspend). + NOKANJI Build with no support for Japanese Kanji character sets. + NOKVERBS Build with no support for keyboard verbs (\Kverbs). + NOLATIN2 Build with no ISO Latin-2 character-set translation support. + NOLEARN Build with no support for learned scripts. + NOLINKBITS Use of S_ISLNK and _IFLNK untrustworthy; use readlink() + instead. + NOLOCAL Build without any local-mode features: No Making Connections. + NOLOGDIAL Disable connection log. + NOLOGIN Build without IKSD (network login) support. + NOLSTAT Not OK to use lstat(). + NOMDMHUP Build without "modem-specific hangup" (e.g. ATH0) feature. + NOMHHOST Exclude the multihomed-host TCP/IP code (if compilcation + errors) + NOMINPUT Build without MINPUT command. + NOMSEND Build with no MSEND command. + NONAWS Do not include TELNET Negotiate About Window Size support. + NONET Do not include any network support. + NONOSETBUF (See NOSETBUF) + NOPARSEN Build without automatic parity detection. + NOPIPESEND Disable file transfer using pipes and filters. + NOPOLL Override CK_POLL definition. + NOPOPEN The popen() library call is not available. + NOPURGE Build with no PURGE command. + NOPUSH Build with no escapes to operating system. + NOREALPATH In UNIX, realpath() function is not available. + NORECALL Disable the command-recall feature. + NOREDIRECT Disable REDIRECT command. + NORENAME Don't use rename() system call, use link()/unlink() (UNIX). + NORESEND Build with no RESEND command. + NORETRY Build with no command-retry feature. + NOSCRIPT Build with no SCRIPT command. + NOSELECT Don't try to use select(). + NOSERVER Build with no SERVER mode and no server-related commands. + NOSETBUF Don't make console writes unbuffered. + NONOSETBUF DO make console writes unbuffered. + NOSETREU setreuid() and/or setregid() not available. + NOSHOW Build with no SHOW command (not recommended!). + NOSIGWINCH Disable SIGWINCH signal trapping. + NOSPL Build with no script programming language. + NOSTAT Don't call stat() from mainline code. + NOSYMLINK Include this for UNIXes that don't have readlink(). + NOSYSIOCTLH Do not #include . + NOSYSTIMEH Co not include . + NOSYSLOG Disable syslogging code. + NOTCPOPTS Build with no SET TCP options or underlying support. + NOTLOG Build with no support for transaction logging. + NOTM_ISDST Struct tm has no tm_isdst member. + NOUNICODE Build with no support for Unicode character-set translation. + NOURL Don't parse URLs + NOUUCP Build with no UUCP lockfile support (dangerous!). + NOWARN Make EXIT WARNING be OFF by default (otherwise it's ON). + NOWREFRESH Override built-in definition of CK_WREFRESH (q.v.). + NOXFER Build with no Kermit or other file-transfer protocols. + NOXMIT Build with no TRANSMIT command. + NOXPRINT Disables transparent print code. + OLDMSG Use old "entering server mode" message (see [172]ckcmai.c). + OLINUXHISPEED Build in old Linux hi-serial-speed code (for Linux <= + 1.0). + OPENBSD Build for OpenBSD. + OS2 Build for OS/2. + OSF Build for OSF/1. + OSFPC Build for OSF/1 on a PC. + OSF32 Digital UNIX 3.2 or later. + OSF40 Build for Digital UNIX 4.0. + OSF50 Build for Digital UNIX 5.0. + OSK Build for OS-9. + OXOS Build for Olivetti X/OS 2.3. + PCIX Build for PC/IX + PID_T=xxx Type for pids is xxx (normally int or pid_t). + POSIX Build for POSIX: use POSIX header files, functions, etc. + _POSIX_SOURCE Disable non-POSIX features. + PROVX1 Build for Venix 1.0 on DEC Professional 3xx. + PTX Build for Dynix/PTX + PWID_T=xxx getpwid() type is xxx. + RBSIZ=xxx Define overall size of receive-packet buffer (with DYNAMIC). + RDCHK rdchk() system call is available. + RENAME rename() system call is available (UNIX). + RTAIX Build for AIX 2.2.1 on IBM RT PC. + RTU Build for Masscomp / Concurrent RTU. + SAVEDUID BSD or other non-AT&T UNIX has saved-setuid feature. + SBSIZ=xxx Define overall size of send-packet buffer (use with DYNAMIC). + SDIRENT Directory structure specified in . + SELECT select() function available (conflicts with RDCHK and CK_POLL) + SELECT_H Include for select()-releated definitions. + SETEUID BSD 4.4-style seteXid() functions available. + SIG_V Type for signal() is void. Used to override normal assumption. + SIG_I Type for signal() is int. Used to override normal assumption. + SOCKOPT_T Override default data type for get/setsockopt() option + length. + SOLARIS Build for Solaris. + SOLARIS25 Build for Solaris 2.5 or later. + SONYNEWS Build for Sony NEWS-OS. + STERMIOX is available. + STRATUS Build for Stratus VOS. + STRATUSX25 Include Stratus VOS X.25 support. + SUN4S5 Build for SUNOS 4.x in the System V R3 environment. + SUNOS4 Build for SUNOS 4.0 in the BSD environment. + SUNOS41 Build for SUNOS 4.1 in the BSD environment. + SUNX25 Build with support for SunLink X.25. + SVR3 Build for AT&T System V Release 3. + SVR3JC Allow job control support on System V Release 3 UNIX versions. + SVR4 Build for AT&T System V Release 4. + SW_ACC_ID UNIX only -- swap real & effective ids around access() calls. + sxaE50 Build for PFU Compact A Series SX/A TISP. + SYSLOGLEVEL=n Force syslogging at given level. + SYSTIMEH Include . + SYSUTIMEH Include for setting file dates (88OPEN) + TCPSOCKET Build with support for TCP/IP via Berkeley sockets library. + TERMIOX header file is available (mostly SVR4). + TNCODE Include TELNET-specific code. + TOWER1 Build for NCR Tower 1632 with OS 1.02. + TRS16 Build for Tandy 16/6000. + UID_T=xxx Type for uids is xxx (normally int or uid_t). + UNIX Must be defined for all UNIX versions. + UNIX351M AT&T UNIX 3.51m on the AT&T 7300 UNIX PC. + USE_ARROWKEYS Include code to parse ANSI arrow-key sequences. + USE_LSTAT OK to use lstat(). + USE_MEMCPY Define this if memcpy()/memset()/memmove() available. + USE_STRERROR Define this if strerror() is available. + USLEEP usleep() system call available (conflicts with NAP & SELECT). + UTEK Build for Tektronix workstations with UTEK OS. + UTIMEH Include for setting file dates (SVR4, POSIX) + UTS24 Build for Amdahl UTS 2.4. + V7 Build for Version 7 UNIX. + VMS Build for VAX/VMS. + VOID=xxx VOID type for functions (int or void). + VXVE Build for CDC VX/VE 5.2.1. + WAIT_T=xxx Type of argument passed to wait(). + WINTCP Build with Wollongong VAX/VMS TCP/IP (implies TCPSOCKET) + WOLLONGONG Build with Wollongong UNIX TCP/IP (implies TCPSOCKET) + XENIX Build for Xenix (SCO, Tandy, others). + XNDIR Support for BSD long filenames via . + XYZ_INTERNAL Support for XYZMODEM protocols is internal, not external. + ZFCDAT Define this if zfcdat() function is available in Kermit. + ZILOG Build for Zilog ZEUS. + ZJDATE Has zjdate() function that converts date to Julian format. + XPRINT Transparent print code included in CONNECT module. + + [ [173]Top ] [ [174]Contents ] [ [175]C-Kermit Home ] [ [176]Kermit + Home ] + __________________________________________________________________ + + + C-Kermit Configuration Options / [177]The Kermit Project / + [178]kermit@columbia.edu / 30 June 2011 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ckccfg.html + 12. http://www.columbia.edu/kermit/ckermit.html + 13. http://www.columbia.edu/kermit/index.html + 14. http://www.columbia.edu/kermit/ckccfg.html#x1 + 15. http://www.columbia.edu/kermit/ckccfg.html#x2 + 16. http://www.columbia.edu/kermit/ckccfg.html#x3 + 17. http://www.columbia.edu/kermit/ckccfg.html#x4 + 18. http://www.columbia.edu/kermit/ckccfg.html#x5 + 19. http://www.columbia.edu/kermit/ckccfg.html#x6 + 20. http://www.columbia.edu/kermit/ckccfg.html#x7 + 21. http://www.columbia.edu/kermit/ckccfg.html#x8 + 22. http://www.columbia.edu/kermit/ckccfg.html#x9 + 23. http://www.columbia.edu/kermit/ckccfg.html#x10 + 24. http://www.columbia.edu/kermit/ckccfg.html#x11 + 25. http://www.columbia.edu/kermit/ckccfg.html#x12 + 26. http://www.columbia.edu/kermit/ckccfg.html#x13 + 27. http://www.columbia.edu/kermit/ckccfg.html#x14 + 28. http://www.columbia.edu/kermit/ckccfg.html#xa1 + 29. http://www.columbia.edu/kermit/ckuins.html + 30. http://www.columbia.edu/kermit/ckermit.html + 31. http://www.columbia.edu/kermit/index.html + 32. http://www.columbia.edu/kermit/ckccfg.html#top + 33. http://www.columbia.edu/kermit/ckccfg.html#contents + 34. http://www.columbia.edu/kermit/ckccfg.html#x2 + 35. http://www.columbia.edu/kermit/ckccfg.html#x0 + 36. http://www.columbia.edu/kermit/ckermit.html + 37. http://www.columbia.edu/kermit/index.html + 38. http://www.columbia.edu/kermit/ckccfg.html#top + 39. http://www.columbia.edu/kermit/ckccfg.html#contents + 40. http://www.columbia.edu/kermit/ckccfg.html#x3 + 41. http://www.columbia.edu/kermit/ckccfg.html#x1 + 42. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 43. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 44. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus3.c + 45. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 46. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 47. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 48. http://www.columbia.edu/kermit/ckermit.html + 49. http://www.columbia.edu/kermit/index.html + 50. http://www.columbia.edu/kermit/ckccfg.html#top + 51. http://www.columbia.edu/kermit/ckccfg.html#contents + 52. http://www.columbia.edu/kermit/ckccfg.html#x4 + 53. http://www.columbia.edu/kermit/ckccfg.html#x2 + 54. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 55. http://www.columbia.edu/kermit/ckuins.html + 56. http://www.columbia.edu/kermit/ckuins.html#x4 + 57. http://www.columbia.edu/kermit/ckuins.html#x9.2 + 58. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c + 59. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 60. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 61. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c + 62. ftp://kermit.columbia.edu/kermit/c-kermit/ckucmd.c + 63. http://www.columbia.edu/kermit/ckermit.html + 64. http://www.columbia.edu/kermit/index.html + 65. http://www.columbia.edu/kermit/ckccfg.html#top + 66. http://www.columbia.edu/kermit/ckccfg.html#contents + 67. http://www.columbia.edu/kermit/ckccfg.html#x5 + 68. http://www.columbia.edu/kermit/ckccfg.html#x3 + 69. http://www.columbia.edu/kermit/unicode.html + 70. http://www.columbia.edu/kermit/ckermit.html + 71. http://www.columbia.edu/kermit/index.html + 72. http://www.columbia.edu/kermit/ckccfg.html#top + 73. http://www.columbia.edu/kermit/ckccfg.html#contents + 74. http://www.columbia.edu/kermit/ckccfg.html#x6 + 75. http://www.columbia.edu/kermit/ckccfg.html#x4 + 76. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.h + 77. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.h + 78. http://www.columbia.edu/kermit/ckermit.html + 79. http://www.columbia.edu/kermit/index.html + 80. http://www.columbia.edu/kermit/ckccfg.html#top + 81. http://www.columbia.edu/kermit/ckccfg.html#contents + 82. http://www.columbia.edu/kermit/ckccfg.html#x7 + 83. http://www.columbia.edu/kermit/ckccfg.html#x5 + 84. http://www.columbia.edu/kermit/ckccfg.html#x6.1 + 85. http://www.columbia.edu/kermit/ckccfg.html#x6.2 + 86. http://www.columbia.edu/kermit/ckccfg.html#x6.3 + 87. http://www.columbia.edu/kermit/ckccfg.html#x6.4 + 88. http://www.columbia.edu/kermit/ckccfg.html#x4 + 89. http://www.columbia.edu/kermit/gkermit.html + 90. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.h + 91. ftp://kermit.columbia.edu/kermit/c-kermit/ckcker.h + 92. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 93. http://www.columbia.edu/kermit/ckermit.html + 94. http://www.columbia.edu/kermit/index.html + 95. http://www.columbia.edu/kermit/ckccfg.html#top + 96. http://www.columbia.edu/kermit/ckccfg.html#contents + 97. http://www.columbia.edu/kermit/ckccfg.html#x8 + 98. http://www.columbia.edu/kermit/ckccfg.html#x6 + 99. ftp://kermit.columbia.edu/kermit/c-kermit/ckudia.c + 100. http://www.columbia.edu/kermit/ckermit.html + 101. http://www.columbia.edu/kermit/index.html + 102. http://www.columbia.edu/kermit/ckccfg.html#top + 103. http://www.columbia.edu/kermit/ckccfg.html#contents + 104. http://www.columbia.edu/kermit/ckccfg.html#x9 + 105. http://www.columbia.edu/kermit/ckccfg.html#x7 + 106. http://www.columbia.edu/kermit/ckccfg.html#x8.1 + 107. http://www.columbia.edu/kermit/ckccfg.html#x8.2 + 108. http://www.columbia.edu/kermit/ckccfg.html#x8.3 + 109. http://www.columbia.edu/kermit/ckccfg.html#x8.1.1 + 110. http://www.columbia.edu/kermit/ckccfg.html#x8.1.2 + 111. http://www.columbia.edu/kermit/ckccfg.html#x8.1.3 + 112. http://www.columbia.edu/kermit/ckccfg.html#x8.1.4 + 113. http://www.columbia.edu/kermit/ckccfg.html#x8.1.5 + 114. http://www.columbia.edu/kermit/ckccfg.html#x8.1.6 + 115. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h + 116. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.c + 117. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.c + 118. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.h + 119. ftp://kermit.columbia.edu/kermit/c-kermit/ckcftp.c + 120. http://www.columbia.edu/kermit/ckermit.html + 121. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.c + 122. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h + 123. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 124. http://www.columbia.edu/kermit/ckccfg.html#x11 + 125. mailto:kermit@columbia.edu + 126. http://www.columbia.edu/kermit/ckermit.html + 127. http://www.columbia.edu/kermit/index.html + 128. http://www.columbia.edu/kermit/ckccfg.html#top + 129. http://www.columbia.edu/kermit/ckccfg.html#contents + 130. http://www.columbia.edu/kermit/ckccfg.html#x10 + 131. http://www.columbia.edu/kermit/ckccfg.html#x8 + 132. http://www.columbia.edu/kermit/ckermit.html + 133. http://www.columbia.edu/kermit/index.html + 134. http://www.columbia.edu/kermit/ckccfg.html#top + 135. http://www.columbia.edu/kermit/ckccfg.html#contents + 136. http://www.columbia.edu/kermit/ckccfg.html#x11 + 137. http://www.columbia.edu/kermit/ckccfg.html#x9 + 138. http://www.columbia.edu/kermit/ckuins.html#x11 + 139. http://www.columbia.edu/kermit/ckuins.html + 140. http://www.columbia.edu/kermit/ckermit.html + 141. http://www.columbia.edu/kermit/index.html + 142. http://www.columbia.edu/kermit/ckccfg.html#top + 143. http://www.columbia.edu/kermit/ckccfg.html#contents + 144. http://www.columbia.edu/kermit/ckccfg.html#x12 + 145. http://www.columbia.edu/kermit/ckccfg.html#x10 + 146. ftp://kermit.columbia.edu/kermit/c-kermit/ckucns.c + 147. ftp://kermit.columbia.edu/kermit/c-kermit/ckucon.c + 148. http://www.columbia.edu/kermit/ckermit.html + 149. http://www.columbia.edu/kermit/index.html + 150. http://www.columbia.edu/kermit/ckccfg.html#top + 151. http://www.columbia.edu/kermit/ckccfg.html#contents + 152. http://www.columbia.edu/kermit/ckccfg.html#x13 + 153. http://www.columbia.edu/kermit/ckccfg.html#x11 + 154. http://www.columbia.edu/kermit/ckermit.html + 155. http://www.columbia.edu/kermit/index.html + 156. http://www.columbia.edu/kermit/ckccfg.html#top + 157. http://www.columbia.edu/kermit/ckccfg.html#contents + 158. http://www.columbia.edu/kermit/ckccfg.html#x14 + 159. http://www.columbia.edu/kermit/ckccfg.html#x12 + 160. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 161. http://www.columbia.edu/kermit/ckermit.html + 162. http://www.columbia.edu/kermit/index.html + 163. http://www.columbia.edu/kermit/ckccfg.html#top + 164. http://www.columbia.edu/kermit/ckccfg.html#contents + 165. http://www.columbia.edu/kermit/ckccfg.html#x13 + 166. http://www.columbia.edu/kermit/ckermit.html + 167. http://www.columbia.edu/kermit/index.html + 168. http://www.columbia.edu/kermit/ckccfg.html#top + 169. http://www.columbia.edu/kermit/ckccfg.html#contents + 170. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 171. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h + 172. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c + 173. http://www.columbia.edu/kermit/ckccfg.html#top + 174. http://www.columbia.edu/kermit/ckccfg.html#contents + 175. http://www.columbia.edu/kermit/ckermit.html + 176. http://www.columbia.edu/kermit/index.html + 177. http://www.columbia.edu/kermit/index.html + 178. mailto:kermit@columbia.edu diff --git a/ckclib.c b/ckclib.c index ac6f62d..51b9f06 100644 --- a/ckclib.c +++ b/ckclib.c @@ -1,4 +1,4 @@ -char * cklibv = "C-Kermit library, 9.0.049, 30 Dec 2010"; +char * cklibv = "C-Kermit library, 9.0.052, 29 Jun 2011"; #define CKCLIB_C @@ -8,7 +8,7 @@ char * cklibv = "C-Kermit library, 9.0.049, 30 Dec 2010"; Author: Frank da Cruz , Columbia University Academic Information Systems, New York City. - Copyright (C) 1999, 2010, + Copyright (C) 1999, 2011, 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. @@ -54,6 +54,7 @@ char * cklibv = "C-Kermit library, 9.0.049, 30 Dec 2010"; chknum() - Checks if string is a (possibly signed) integer. rdigits() - Checks if string is composed only of decimal digits. isfloat() - Checks if string is a valid floating-point number. + ckround() - Rounds a floating-point number to desired precision. parnam() - Returns parity name string. hhmmss() - Converts seconds to hh:mm:ss string. lset() - Write fixed-length field left-adjusted into a record. @@ -2051,6 +2052,122 @@ isfloat(s,flag) char *s; int flag; { floatval = f; /* Set result */ return(d ? 2 : 1); /* Succeed */ } + +/* + c k r o u n d -- Rounds a floating point number or an integer. + + fpnum: + Floating-point number to round. + places: + Positive...To how many decimal places. + Zero.......Round to integer. + Negative...-1 = nearest ten, -2 = nearest 100, -3 = nearest thousand, etc. + obuf + Output buffer for string result if desired. + obuflen + Length of output buffer. + Returns: + Result as CKFLOAT (which is not going to be as exact as the string result) + And the exact result in the string output buffer, if one was specified. +*/ +CKFLOAT +#ifdef CK_ANSIC +ckround(CKFLOAT fpnum, int places, char *obuf, int obuflen) +#else +ckround(fpnum,places,obuf,obuflen) + CKFLOAT fpnum; int places, obuflen; char *obuf; +#endif /* CK_ANSIC */ +/* ckround */ { + char *s, *s2, *d; + int i, p, len, x, n, digits; + int carry = 0; + int minus = 0; + char buf[200]; + char * number; + CKFLOAT value; + extern int fp_digits; + + sprintf(buf,"%200.100f",fpnum); /* Make string version to work with */ + number = (char *) buf; /* Make pointer to it */ + + p = places; /* Precision */ + d = (char *)0; /* Pointer to decimal or string end */ + + s = number; /* Fix number... */ + while (*s == ' ' || *s == '\011') s++; /* Strip leading whitespace */ + if (*s == '+') s++; /* Skip leading plus sign*/ + number = s; /* Start of number */ + if (*s == '-') { minus++; number++; s++; } /* Remember if negative */ + + s = number; /* Don't allow false precision */ + n = 0; + while (*s && *s != '.') s++, n++; /* Find decimal */ + + if (p + n > fp_digits) /* Too many digits */ + p = fp_digits - n; /* Don't ask for bogus precision */ + if (p < 0) p = 0; /* But don't ask for less than zero */ + if (n > fp_digits) /* Integer part has too many digits */ + *s = 0; /* but we can't truncate it */ + else /* Magnitude is OK */ + number[fp_digits+1] = 0; /* Truncate fractional part. */ + + len = (int)strlen(number); /* Length of non-bogus number */ + d = s; /* Pointer to decimal point */ + if (p > 0) { /* Rounding the fractional part */ + if (n + p < len) { /* If it's not already shorter */ + if (*s == '.') s++; /* Skip past decimal */ + s += p; /* Go to desired spot */ + if (*s > '4' && *s <= '9') /* Check value of digit */ + carry = 1; + *s = 0; /* And end the string */ + s--; /* Point to last digit */ + } + } else if (p == 0) { /* Rounding to integer */ + if (*s == '.') { + *s = 0; /* erase the decimal point */ + if (*(s+1)) { /* and there is a factional part */ + if (*(s+1) > '4' && *(s+1) <= '9') /* Check for carry */ + carry = 1; + } + s--; /* Point to last digit */ + } + } else { /* Rounding the integer part */ + if (s + p > number) { /* as in "the nearest hundred" */ + s += p; /* Go left to desired digit */ + *d = 0; /* Discard fraction */ + carry = 0; + if (*s > '4') /* Check first digit of fraction */ + carry = 1; /* and set carry flag */ + s2 = s; + while (s2 < d) /* Fill in the rest with zeros */ + *s2++ = '0'; + s--; /* Point to last digit */ + } + } + if (carry) { /* Handle carry, if any */ + while (s >= number) { + if (*s == '.') { /* Skip backwards over decimal */ + s--; + continue; + } + *s += 1; /* Add 1 to current digit */ + carry = 0; + if (*s <= '9') /* If result is 9 or less */ + break; /* we're done */ + *s = '0'; /* Otherwise put 0 */ + carry = 1; /* carry the 1 */ + s--; /* and back up to next digit */ + } + } +#ifdef __alpha + sscanf(number,"%f",&value); /* Convert back to floating point */ +#else + sscanf(number,"%lf",&value); /* Convert back to floating point */ +#endif + if (obuf) strncpy(obuf,number,obuflen); /* Set string result */ + return(value); /* Return floating-point result */ +} + #endif /* CKFLOAT */ /* Sorting routines... */ diff --git a/ckcmai.c b/ckcmai.c index 26b773a..6c31421 100644 --- a/ckcmai.c +++ b/ckcmai.c @@ -1,6 +1,6 @@ -#define EDITDATE "21 Jun 2011" /* Last edit date dd mmm yyyy */ -#define EDITNDATE "20110621" /* Keep them in sync */ -/* Tue Jun 21 11:32:48 2011 */ +#define EDITDATE "30 Jun 2011" /* Last edit date dd mmm yyyy */ +#define EDITNDATE "20110630" /* Keep them in sync */ +/* Tue Jun 28 16:54:15 2011 */ /* ckcmai.c - Main program for C-Kermit plus some miscellaneous functions */ @@ -40,8 +40,8 @@ char * ck_cryear = "2011"; /* C-Kermit copyright year */ #ifndef BETATEST #ifndef OS2 /* UNIX, VMS, etc... (i.e. C-Kermit) */ -char *ck_s_test = "Beta"; /* "Dev","Alpha","Beta","RC", or "" */ -char *ck_s_tver = "02"; /* Test version number or "" */ +char *ck_s_test = ""; /* "Dev","Alpha","Beta","RC", or "" */ +char *ck_s_tver = ""; /* Test version number or "" */ #else /* OS2 */ char *ck_s_test = ""; /* (i.e. K95) */ char *ck_s_tver = ""; @@ -64,11 +64,22 @@ char *ck_s_date = EDITDATE; /* See top */ char *buildid = EDITNDATE; /* See top */ #ifdef UNIX -static char sccsid[] = "@(#)C-Kermit 9.0.299"; +static char sccsid[] = "@(#)C-Kermit 9.0.300"; #endif /* UNIX */ -char *ck_s_ver = "9.0.299"; /* C-Kermit version string */ -long ck_l_ver = 900299L; /* C-Kermit version number */ +/* + The C-Kermit Version number is major.minor.edit (integers). + Major version always goes up. + Minor version is historical, hasn't been used since C-Kermit 7.1. + Edit is sequential, always goes up, but there can be gaps. + For example there might be many edits between releases. + If the major goes to 10, some version-number-based feature tests + could fail. It might be better to use the minor version field + for future releases. +*/ + +char *ck_s_ver = "9.0.300"; /* C-Kermit version string */ +long ck_l_ver = 900300L; /* C-Kermit version number */ #ifdef OS2 char *ck_s_xver = "3.0.0"; /* Product-specific version string */ diff --git a/ckcplm.txt b/ckcplm.txt new file mode 100644 index 0000000..9829987 --- /dev/null +++ b/ckcplm.txt @@ -0,0 +1,3046 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +C-Kermit Program Logic Manual + + Frank da Cruz + [11]The Kermit Project + [12]Columbia University + + As of: C-Kermit 9.0.300, 30 June 2011 + Last update: Tue Jun 28 08:59:18 2011 + + IF YOU ARE READING A PLAIN-TEXT version of this document, note that + this file is a plain-text dump of a Web page. You can visit the + original (and possibly more up-to-date) Web page here: + + [13]http://www.columbia.edu/kermit/ckcplm.html + + [ [14]C-Kermit Home ] [ [15]Kermit Home ] + +CONTENTS + + 1. [16]INTRODUCTION + 2. [17]FILES + 3. [18]SOURCE CODE PORTABILITY AND STYLE + 4. [19]MODULES + 4.A. [20]Group A: Library Routines + 4.B. [21]Group B: Kermit File Transfer + 4.C. [22]Group C: Character-Set Conversion + 4.D. [23]Group D: User Interface + 4.E. [24]Group E: Platform-Dependent I/O + 4.F. [25]Group F: Network Support + 4.G. [26]Group G: Formatted Screen Support + 4.H. [27]Group H: Pseudoterminal Support + 4.I. [28]Group I: Security + I. [29]APPENDIX I: FILE PERMISSIONS + +1. INTRODUCTION + + The Kermit Protocol is specified in the book Kermit, A File Transfer + Protocol by Frank da Cruz, Digital Press / Butterworth Heinemann, + Newton, MA, USA (1987), 379 pages, ISBN 0-932376-88-6. It is assumed + the reader is familiar with the Kermit protocol specification. + + This file describes the relationship among the modules and functions of + C-Kermit 5A and later, and other programming considerations. C-Kermit + is designed to be portable to any kind of computer that has a C + compiler. The source code is broken into many files that are grouped + according to their function, as shown in the [30]Contents. + + C-Kermit has seen constant development since 1985. Throughout its + history, there has been a neverending tug-of-war among: + + a. Functionality: adding new features, fixing bugs, improving + performance. + b. Adding support for new platforms. + c. "Buzzword 1.0 compliance". + + The latter category is the most frustrating, since it generally + involves massive changes just to keep the software doing what it did + before in some new setting: e.g. the K&R-to-ANSIC conversion (which had + to be done, of course, without breaking K&R); Y2K (not a big deal in + our case); the many and varied UNIX and other API "standards"; IPv6. + + [ [31]Contents ] [ [32]C-Kermit ] [ [33]Kermit Home ] + +2. FILES + + C-Kermit source files begin with the two letters "ck", for example + ckutio.c. Filenames are kept short (6.3) for maximum portability and + (obviously I hope) do not contain spaces or more than one period. The + third character in the name denotes something about the function group + and the expected level of portability: + + a General descriptive material and documentation (text) + b BOO file encoders and decoders (obsolete) + c All platforms with C compilers (*) + d Data General AOS/VS + e Reserved for "ckermit" files, like ckermit.ini, ckermit2.txt + f (reserved) + g (reserved) + h (reserved) + i Commodore Amiga (Intuition) + j (unused) + k (unused) + l Stratus VOS + m Macintosh with Mac OS 1-9 + n Microsoft Windows NT/2000/XP + o OS/2 and/or Microsoft Windows 9x/ME/NT/2000/XP + p Plan 9 from Bell Labs + q (reserved) + r DEC PDP-11 with RSTS/E (never used, open for reassigment) + s Atari ST GEMDOS (last supported in version 5A(189)) + t DEC PDP-11 with RT-11 (never used, open for reassigment) + u Unix-based operating systems (*) + v VMS and OpenVMS + w Wart (Lex-like preprocessor, platform independent) + x (reserved) + y (reserved) + z (reserved) + 0-3 (reserved) + 4 IBM AS/400 + 5-8 (reserved) + 9 Microware OS-9 + _ Encryption modules + + (*) In fact there is little distinction between the ckc*.* and cku*.* + categories. It would make more sense for all cku*.* modules to be + ckc*.* ones, except ckufio.c, ckutio.c, ckucon.c, ckucns.c, and + ckupty.c, which truly are specific to Unix. The rest (ckuus*.c, + ckucmd.c, etc) are quite portable. + + One hint before proceeding: functions are scattered all over the ckc*.c + and cku*.c modules, where function size has begun to take precedence + over the desirability of grouping related functions together, the aim + being to keep any particular module from growing disproportionately + large. The easiest way (in UNIX) to find out in what source file a + given function is defined is like this (where the desired function is + foo()...): + + grep ^foo\( ck*.c + + This works because the coding convention has been to make function + names always start on the left margin with their contents indented, for + example: + +static char * +foo(x,y) int x, y; { + ... +} + + Also note the style for bracket placement. This allows bracket-matching + text editors (such as EMACS) to help you make sure you know which + opening bracket a closing bracket matches, particularly when the + opening bracket is above the visible screen, and it also makes it easy + to find the end of a function (search for '}' on the left margin). + + Of course EMACS tags work nicely with this format too: + + $ cd kermit-source-directory + $ etags ck[cu]*.c + $ emacs + Esc-X Visit-Tags-Table + + (but remember that the source file for ckcpro.c is [34]ckcpro.w!) + + Also: + + * Tabs should be set every 8 spaces, as on a VT100. + * All lines must no more than 79 characters wide after tab expansion. + * Note the distinction between physical tabs (ASCII 9) and the + indentation conventions, which are: 4 for block contents, 2 for + most other stuff (obviously this is not a portability issue, just + style). + + [ [35]Contents ] [ [36]C-Kermit ] [ [37]Kermit Home ] + +3. SOURCE CODE PORTABILITY AND STYLE + + C-Kermit was designed in 1985 as a platform-independent replacement for + the earlier Unix Kermit. c-Kermit's design was expected to promote + portability, and judging from the number of platforms to which it has + been adapted since then, the model is effective, if not ideal + (obviously if we had it all to do over, we'd change a few things). To + answer the oft-repeated question: "Why are there so many #ifdefs?", + it's because: + + * Many of them are related to feature selection and program size, and + so need to be there anyway. + * Those that treat compiler, library, platform, header-file, and + similar differences have built up over time as hundreds of people + all over the world adapted C-Kermit to their particular + environments and sent back their changes. There might be more + politically-correct ways to achieve portability, but this one is + natural and proven. The basic idea is to introduce changes that can + be selected by defining a symbol, which, if not defined, leaves the + program exactly as it was before the changes. + * Although it might be possible to "clean up" the "#ifdef mess", + nobody has access to all the hundreds of platforms served by the + #ifdefs to check the results. + + And to answer the second-most-oft-repeated question: "Why don't you + just use GNU autoconfig / automake / autowhatever instead of + hard-coding all those #ifdefs?" Answers: + + * The GNU tools are not available on all the platforms where C-Kermit + must be built and I wouldn't necessarily trust them if they were. + * Each platform is a moving target, so the tools themselves would + need to updated before Kermit could be updated. + * It would only add another layer of complexity to an already complex + process. + * Conversion at this point would not be practical unless there was a + way to test the results on all the hundreds of platforms where + C-Kermit is supposed to build. + + When writing code for the system-indendent C-Kermit modules, please + stick to the following coding conventions to ensure portability to the + widest possible variety of C preprocessors, compilers, and linkers, as + well as certain network and/or email transports. The same holds true + for many of the "system dependent" modules too; particularly the Unix + ones, since they must be buildable by a wide variety of compilers and + linkers, new and old. + + This list does not purport to be comprehensive, and although some items + on it might seem far-fetched, they would not be listed unless I had + encountered them somewhere, some time. I wish I had kept better records + so I could cite specific platforms and compilers. + + * Try to keep variable and function names unique within 6 characters, + especially if they are used across modules, since 6 is the maximum + for some old linkers (actually, this goes back to TOPS-10 and -20 + and other old DEC OS's where C-Kermit never ran anyway; a more + realistic maximum is probably somewhere between 8 and 16). We know + for certain that VAX C has a 31-character max because it complains + -- others might not complain, but just silently truncate, thus + folding two or more routines/variables into one. + * Keep preprocessor symbols unique within 8 characters; that's the + max for some preprocessors (sorry, I can't give a specific example, + but in 1988 or thereabouts, I had to change character-set symbols + like TC_LATIN1 and TC_LATIN2 to TC_1LATIN and TC_2LATIN because the + digits were being truncated and ignored on a platform where I + actually had to build C-Kermit 5A; unfortunately I didn't note + which platform -- maybe some early Ultrix version?) + * Don't create preprocessor symbols, or variable or function names, + that start with underscore (_). These are usually reserved for + internal use by the compiler and header files. + * Don't put #include directives inside functions or { blocks }. + * Don't use the #if or #elif preprocessor constructions, only use + #ifdef, #ifndef, #define, #undef, and #endif. + * Put tokens after #endif in comment brackets, e.g. #endif /* FOO */. + * Don't indent preprocessor statements - # must always be first char + on line. + * Don't put whitespace after # in preprocessor statements. + * Don't use #pragma, even within #ifdefs -- it makes some + preprocessors give up. + * Same goes for #module, #if, etc - #ifdefs do NOT protect them. + * Don't use logical operators in preprocessor constructions. + * Avoid #ifdefs inside argument list to function calls (I can't + remember why this one is here, but probably needn't be; we do this + all the time). + * Always cast strlen() in expressions to int: + if ((int)strlen(foo) < x)... + * Any variable whose value might exceed 16383 should be declared as + long, or if that is not possible, then as unsigned. + * Avoid typedefs; they might be portable but they are very confusing + and there's no way to test for their presence or absence at compile + time. Use preprocessor symbols instead if possible; at least you + can test their definitions. + * Unsigned long is not portable; use a preprocessor symbol (Kermit + uses ULONG for this). + * Long long is not portable. If you really need it, be creative. + * Similarly 1234LL is not portable, nor almost any other constant + modifier other than L. + * Unsigned char is not portable, use CHAR (a preprocessor symbol + defined in the Kermit header files) and always take precautions + against character signage (more about this [38]below). + * Don't use initializers with automatic arrays or structs: it's not + portable. + * Don't use big automatic arrays or structs in functions that might + be called recursively; some platforms have fixed-size stacks (e.g. + Windows 9x: 256K) and recursive functions crash with stack + overflow. Even when there is not a compiler limitation, this causes + memory to be consumed without bound, and can end up filling swap + space. + * Don't assume that struct assignment performs a copy, or that it + even exists. + * Don't use sizeof to get the size of an array; someone might come + along later and and change it from static to malloc'd. Always use a + symbol to refer to the array's size. + * Don't put prototypes for static functions into header files that + are used by modules that don't contain that function; the link step + can fail with unresolved references (e.g. on AOS/VS). + * Avoid the construction *++p (the order of evaluation varies; it + shouldn't but at least one compiler had a bug that made me include + this item). + * Don't use triple assignments, like a = b = c = 0; (or quadruple, + etc). Some compilers generate bad code for these, or crash, etc + (some version of DEC C as I recall). + * Some compilers don't allow structure members to have the same names + as other identifiers. Try to give structure members unique names. + * Don't assume anything about order of evaluation in boolean + expressions, or that they will stop early if a required condition + is not true, e.g.: + if (i > 0 && p[i-1] == blah) + + can still dump core if i == 0 (hopefully this is not true of any + modern compiler, but I would not have said this if it did not + actually happen somewhere). + * Don't have a switch() statement with no cases (e.g. because of + #ifdefs); this is a fatal error in some compilers. + * Don't put lots of code in a switch case; move it out to a separate + function; some compilers run out of memory when presented with a + huge switch() statement -- it's not the number of cases that + matters; it's the overall amount of code. + * Some compilers might also limit the number of switch() cases, e.g. + to 254. + * Don't put anything between "switch() {" and "case:" -- switch + blocks are not like other blocks. + * Don't jump into or out of switches. + * Don't make character-string constants longer than about 250 bytes. + Longer strings should be broken up into arrays of strings. + * Don't write into character-string constants (obviously). Even when + you know you are not writing past the end; the compiler or linker + might have put them into read-only and/or shared memory, and/or + coalesced multiple equal constants so if you change one you change + them all. + * Don't depend on '\r' being carriage return. + * Don't depend on '\n' being linefeed or for that matter any SINGLE + character. + * Don't depend on '\r' and '\n' being different (e.g. as separate + switch() cases). + * In other words, don't use \n or \r to stand for specific + characters; use \012 and \015 instead. + * Don't code for "buzzword 1.0 compliance", unless "buzzword" is K&R + and "1.0" is the first edition. + * Don't use or depend on anything_t (size_t, pid_t, etc), except + time_t, without #ifdef protection (time_t is the only one I've + found that is accepted everywhere). This is a tough one because the + same function might require (say) a size_t arg on one platform, + whereas size_t is unheard of on another; or worse, it might require + a totally different data type, like int or long or some other + typedef'd thing. It has often proved necessary to define a symbol + to stand for the type of a particular argument to a particular + library or system function to get around this problem. + * Don't use or depend on internationalization ("i18n") features, + wchar_t, locales, etc, in portable code; they are not portable. + Anyway, locales are not the right model for Kermit's + multi-character-set support. Kermit does all character-set + conversion itself and does not use any external libraries or + functions. + * In particular, don't use any library functions that deal with wide + characters or Unicode in any form. These are not only nonportable, + but a constantly shifting target (e.g. the ones in glibc). + * Don't make any assumption about signal handler type. It can be + void, int, long, or anything else. Always declare signal handlers + as SIGTYP (see definition in ckcdeb.h and augment it if necessary) + and always use SIGRETURN at exit points from signal handlers. + * Signals should always be re-armed to be used again (this barely + scratches the surface -- the differences between BSD/V7 and System + V and POSIX signal handling are numerous, and some platforms do not + even support signals, alarms, or longjmps correctly or at all -- + avoid all of this if you can). + * On the other hand, don't assume that signals are disarmed after + being raised. In some platforms you have to re-arm them, in others + they stay armed. + * Don't call malloc() and friends from a signal handler; don't do + anything but setting integer global variables in a signal handler. + * malloc() does not initialize allocated memory -- it never said it + did. Don't expect it to be all 0's. + * Did You Know: malloc() can succeed and the program can still dump + core later when it attempts to use the malloc'd memory? (This + happens when allocation is deferred until use and swap space is + full.) + * memset(), memmove(), and memcpy() are not portable, don't use them + without protecting them in ifdefs (we have USE_MEMCPY for this). + bzero()/bcopy() too, except we're guaranteed to have + bzero()/bcopy() when using the sockets library (not really). See + examples in the source. + * Don't assume that strncpy() stops on the first null byte -- most + versions always copy the number of bytes given in arg 3, padding + out with 0's and overwriting whatever was there before. Use + C-Kermit ckstrncpy() if you want predictable non-padding behavior, + guaranteed NUL-termination, and a useful return code. + * DID YOU KNOW.. that some versions of inet_blah() routines return IP + addresses in network byte order, while others return them local + machine byte order? So passing them to ntohs() or whatever is not + always the right thing to do. + * Don't use ANSI-format function declarations without #ifdef + CK_ANSIC, and always provide an #else for the non-ANSI case. + * Use the Kermit _PROTOTYP() macro for declaring function prototypes; + it works in both the ANSI and non-ANSI cases. + * Don't depend on any other ANSI preprocessor features like "pasting" + -- they are often missing or nonoperational. + * Don't assume any C++ syntax or semantics. + * Don't use // as a comment introducer. C is not C++. + * Don't declare a string as "char foo[]" in one module and "extern + char * foo" in another, or vice-versa: this causes core dumps. + * With compiler makers falling all over themselves trying to outdo + each other in ANSI strictness, it has become increasingly necessary + to cast EVERYTHING. This is increasingly true for char vs unsigned + char. We need to use unsigned chars if we want to deal with 8-bit + character sets, but most character- and string-oriented APIs want + (signed) char arguments, so explicit casts are necessary. It would + be nice if every compiler had a -funsigned-char option (as gcc + does), but they don't. + * a[x], where x is an unsigned char, can produce a wild memory + reference if x, when promoted to an int, becomes negative. Cast it + to (unsigned), even though it ALREADY IS unsigned. + * Be careful how you declare functions that have char or long + arguments; for ANSI compilers you MUST use ANSI declarations to + avoid promotion problems, but you can't use ANSI declarations with + non-ANSI compilers. Thus declarations of such functions must be + hideously entwined in #ifdefs. Example: latter: + int /* Put character in server command buffer */ + #ifdef CK_ANSIC + putsrv(char c) + #else + putsrv(c) char c; + #endif /* CK_ANSIC */ + /* putsrv */ { + *srvptr++ = c; + *srvptr = '\0'; /* Make sure buffer is null-terminated */ + return(0); + } + + * Be careful how you return characters from functions that return int + values -- "getc-like functions" -- in the ANSI world. Unless you + explicitly cast the return value to (unsigned), it is likely to be + "promoted" to an int and have its sign extended. + * At least one compiler (the one on DEC OSF/1 1.3) treats "/*" and + "*/" within string constants as comment begin and end. No amount of + #ifdefs will get around this one. You simply can't put these + sequences in a string constant, e.g. "/usr/local/doc/*.*". + * Avoid putting multiple macro references on a single line, e.g.: + putchar(BS); putchar(SP); putchar(BS) + + This overflows the CPP output buffer of more than a few C preprocessors + (this happened, for example, with SunOS 4.1 cc, which evidently has a + 1K macro expansion buffer). + + C-Kermit needs constant adjustment to new OS and compiler releases. + Every new OS release shuffles header files or their contents, or + prototypes, or data types, or levels of ANSI strictness, etc. Every + time you make an adjustment to remove a new compilation error, BE VERY + CAREFUL to #ifdef it on a symbol unique to the new configuration so + that the previous configuration (and all other configurations on all + other platforms) remain as before. + + Assume nothing. Don't assume header files are where they are supposed + to be, that they contain what you think they contain, that they define + specific symbols to have certain values -- or define them at all! Don't + assume system header files protect themselves against multiple + inclusion. Don't assume that particular system or library calls are + available, or that the arguments are what you think they are -- order, + data type, passed by reference vs value, etc. Be conservative when + attempting to write portable code. Avoid all advanced features. + + If you see something that does not make sense, don't assume it's a + mistake -- it might be there for a reason, and changing it or removing + is likely to cause compilation, linking, or runtime failures sometime, + somewhere. Some huge percentage of the code, especially in the + platform-dependent modules, is workarounds for compiler, linker, or API + bugs. + + But finally... feel free to violate any or all of these rules in + platform-specific modules for environments in which the rules are + certain not to apply. For example, in VMS-specific code, it is OK to + use #if, because VAX C, DEC C, and VMS GCC all support it. + + [ [39]Contents ] [ [40]C-Kermit ] [ [41]Kermit Home ] + +3.1. Memory Leaks + + The C language and standard C library are notoriously inadequate and + unsafe. Strings are arrays of characters, usually referenced through + pointers. There is no native string datatype. Buffers are fixed size, + and C provides no runtime bounds checking, thus allowing overwriting of + other data or even program code. With the popularization of the + Internet, the "buffer exploit" has become a preferred method for + hackers to hijack privileged programs; long data strings are fed to a + program in hopes that it uses unsafe C library calls such as strcpy() + or sprintf() to copy strings into automatic arrays, thus overwriting + the call stack, and therefore the routine's return address. When such a + hole is discovered, a "string" can be constructed that contains machine + code to hijack the program's privileges and penetrate the system. + + This problem is partially addressed by the strn...() routines, which + should always be used in preference to their str...() equivalents + (except when the copy operation has already been prechecked, or there + is a good reason for not using them, e.g. the sometimes undesirable + side effect of strncpy() zeroing the remainder of the buffer). The most + gaping whole, however, is sprintf(), which performs no length checking + on its destination buffer, and is not easy to replace. Although + snprintf() routines are starting to appear, they are not yet + widespread, and certainly not universal, nor are they especially + portable, or even full-featured. + + For these reasons, we have started to build up our own little library + of C Library replacements, ckclib.[ch]. These are safe and highly + portable primitives for memory management and string manipulation, such + as: + + ckstrncpy() + Like strncpy but returns a useful value, doesn't zero buffer. + + ckitoa() + Opposite of atoi() + + ckltoa() + Opposite of atol() + + ckctoa() + Returns character as string + + ckmakmsg() + Used with ck?to?() as a safe sprintf() replacement for up to 4 + items + + ckmakxmsg() + Like ckmakmsg() but accepts up to 12 items + + More about library functions in [42]Section 4.A. + + [ [43]Contents ] [ [44]C-Kermit ] [ [45]Kermit Home ] + +3.2. The "char" vs "unsigned char" Dilemma + + This is one of the most aggravating and vexing characteristics of the C + language. By design, chars (and char *'s) are SIGNED. But in the modern + era, however, we need to process characters that can have (or include) + 8-bit values, as in the ISO Latin-1, IBM CP 850, or UTF-8 character + sets, so this data must be treated as unsigned. But some C compilers + (such as those based on the Bell UNIX V7 compiler) do not support + "unsigned char" as a data type. Therefore we have the macro or typedef + CHAR, which we use when we need chars to be unsigned, but which, + unfortunately, resolves itself to "char" on those compilers that don't + support "unsigned char". AND SO... We have to do a lot of fiddling at + runtime to avoid sign extension and so forth. + + Some modern compilers (e.g. IBM, DEC, Microsoft) have options that say + "make all chars be unsigned" (e.g. GCC "-funsigned-char") and we use + them when they are available. Other compilers don't have this option, + and at the same time, are becoming increasingly strict about type + mismatches, and spew out torrents of warnings when we use a CHAR where + a char is expected, or vice versa. We fix these one by one using casts, + and the code becomes increasingly ugly. But there remains a serious + problem, namely that certain library and kernel functions have + arguments that are declared as signed chars (or pointers to them), + whereas our character data is unsigned. Fine, we can can use casts here + too -- but who knows what happens inside these routines. + + [ [46]Contents ] [ [47]C-Kermit ] [ [48]Kermit Home ] + +4. MODULES + + When C-Kermit is on the far end of a connection, it is said to be in + remote mode. When C-Kermit has made a connection to another computer, + it is in local mode. (If C-Kermit is "in the middle" of a multihop + connection, it is still in local mode.) + + On another axis, C-Kermit can be in any of several major states: + + Command State + Reading and writing from the job's controlling terminal or + "console". In this mode, all i/o is handled by the Group E + conxxx() (console i/o) routines. + + Protocol State + Reading and writing from the communicatons device. In this mode, + all i/o is handled by the Group E ttxxx() (terminal i/o) + routines. + + Terminal State + Reading from the keyboard with conxxx() routines and writing to + the communications device with ttxxx() routines AND vice-versa. + + When in local mode, the console and communications device are distinct. + During file transfer, Kermit may put up a file-transfer display on the + console and sample the console for interruption signals. + + When in remote mode, the console and communications device are the + same, and therefore there can be no file-transfer display on the + console or interruptions from it (except for "in-band" interruptions + such as ^C^C^C). + + [ [49]Contents ] [ [50]C-Kermit ] [ [51]Kermit Home ] + +4.A. Group A: Library Functions + + Library functions, strictly portable, can be used by all modules on all + platforms: [52]ckclib.h, [53]ckclib.c. + + (To be filled in... For now, see [54]Section 3.1 and the comments in + ckclib.c.) + + [ [55]Contents ] [ [56]C-Kermit ] [ [57]Kermit Home ] + +4.B. Group B: Kermit File Transfer + + The Kermit protocol kernel. These files, whose names start with "ckc + are supposed to be totally portable C, and are expected to compile + correctly on any platform with any C compiler. "Portable" does not mean + the same as as "ANSI" -- these modules must compile on 10- and 20-year + old computers, with C preprocessors, compilers, and/or linkers that + have all sorts of restrictions. The Group B modules do not include any + header files other than those that come with Kermit itself. They do not + contain any library calls except from the standard C library (e.g. + printf()). They most certainly do not contain any system calls. Files: + + [58]ckcsym.h + For use by C compilers that don't allow -D on the command line. + + [59]ckcasc.h + ASCII character symbol definitions. + + [60]ckcsig.h + System-independent signal-handling definitions and prototypes. + + [61]ckcdeb.h + Originally, debugging definitions. Now this file also contains + all definitions and prototypes that are shared by all modules in + all groups. + + [62]ckcker.h + Kermit protocol symbol definitions. + + [63]ckcxla.h + Character-set-related symbol definitions (see next section). + + [64]ckcmai.c + The main program. This module contains the declarations of all + the protocol-related global variables that are shared among the + other modules. + + [65]ckcpro.w + The protocol module itself, written in "wart", a lex-like + preprocessor that is distributed with Kermit under the name + CKWART.C. + + [66]ckcfns.c, [67]ckcfn2.c, [68]ckcfn3.c + The protocol support functions used by the protocol module. + + [69]Group B modules may call upon functions from [70]Group E, but not + from [71]Group D modules (with the single exception that the main + program invokes the user interface, which is in Group D). (This last + assertion is really only a conjecture.) + + [ [72]Contents ] [ [73]C-Kermit ] [ [74]Kermit Home ] + +4.C. Group C: Character-Set Conversion + + Character set translation tables and functions. Used by the [75]Group + B, protocol modules, but may be specific to different computers. (So + far, all character character sets supported by C-Kermit are supported + in [76]ckuxla.c and [77]ckuxla.h, including Macintosh and IBM character + sets). These modules should be completely portable, and not rely on any + kind of system or library services. + + [78]ckcxla.h + Character-set definitions usable by all versions of C-Kermit. + + ck?xla.h + Character-set definitions for computer "?", e.g. [79]ckuxla.h + for UNIX, [80]ckmxla.h for Macintosh. + + [81]ck?xla + Character-set translation tables and functions for computer "?", + For example, CKUXLA.C for UNIX, CKMXLA.C for Macintosh. So far, + these are the only two such modules. The UNIX module is used for + all versions of C-Kermit except the Macintosh version. + + [82]ckcuni.h + Unicode definitions + + [83]ckcuni.c + Unicode module + + Here's how to add a new file character set in the original (non-Unicode + modules). Assuming it is based on the Roman (Latin) alphabet. Let's + call it "Barbarian". First, in ck?xla.h, add a definition for FC_BARBA + (8 chars maximum length) and increase MAXFCSETS by 1. Then, in + ck?xla.c: + + * Add a barbarian entry into the fcsinfo array. + * Add a "barbarian" entry to file character set keyword table, + fcstab. + * Add a "barbarian" entry to terminal character set keyword table, + ttcstab. + * Add a translation table from Latin-1 to barbarian: yl1ba[]. + * Add a translation table from barbarian to Latin-1: ybal1[]. + * Add a translation function from Barbarian to ASCII: xbaas(). + * Add a translation function from Barbarian to Latin-1: xbal1(). + * Add a translation function from Latin-1 to Barbarian: xl1ba(). + * etc etc for each transfer character set... + * Add translation function pointers to the xls and xlr tables. + + Other translations involving Barbarian (e.g. from Barbarian to + Latin-Cyrillic) are performed through these tables and functions. See + ckuxla.h and ckuxla.c for extensive examples. + + To add a new Transfer Character Set, e.g. Latin Alphabet 9 (for the + Euro symbol), again in the "old" character-set modules: + + In ckcxla.h: + + + Add a TC_xxxx definition and increase MAXTCSETS accordingly. + + In ck?xla.h (since any transfer charset is also a file charset): + + + Add an FC_xxxx definition and increase MAXFCSETS accordingly. + + In ck?xla.c: + + + Add a tcsinfo[] entry. + + Make a tcstab[] keyword table entry. + + Make an fcsinfo[] table entry. + + Make an fcstab[] keyword table entry. + + Make a tcstab[] keyword table entry. + + If necessary, make a langinfo[] table entry. + + Make entries in the function pointer arrays. + + Provide any needed functions. + + As of C-Kermit 7.0, character sets are also handled in parallel by the + new (and very large) Unicode module, ckcuni.[ch]. Eventually we should + phase out the old way, described just above, and operate entirely in + (and through) Unicode. The advantages are many. The disadvantages are + size and performance. To add a character to the Unicode modules: + + In ckcuni.h: + + + (To be filled in...) + + In ckcuni.c: + + + (To be filled in...) + + [ [84]Contents ] [ [85]C-Kermit ] [ [86]Kermit Home ] + +4.D. Group D: User Interface + + This is the code that communicates with the user, gets her commands, + informs her of the results. It may be command-line oriented, + interactive prompting dialog, menus and arrow keys, windows and mice, + speech recognition, telepathy, etc. The one provided is command-and + prompt, with the ability to read commands from various sources: the + console keyboard, a file, or a macro definition. The user interface has + three major functions: + + 1. Sets the parameters for the file transfer and then starts it. This + is done by setting certain (many) global variables, such as the + protocol machine start state, the file specification, file type, + communication parameters, packet length, window size, character + set, etc. + 2. Displays messages on the user's screen during the file transfer, + using the screen() function, which is called by the group-1 + modules. + 3. Executes any commands directly that do not require Kermit protocol, + such as the CONNECT command, local file management commands, + parameter-setting commands, FTP client commands, etc. + + If you plan to imbed the [87]Group B, files into a program with a + different user interface, your interface must supply an appropriate + screen() function, plus a couple related ones like chkint() and + intmsg() for handling keyboard (or mouse, etc) interruptions during + file transfer. The best way to find out about this is to link all the + C-Kermit modules together except the ckuu*.o and ckucon.o modules, and + see which missing symbols turn up. + + C-Kermit's character-oriented user interface (as opposed to the + Macintosh version's graphical user interface) consists of the following + modules. C-Kermit can be built with an interactive command parser, a + command-line-option-only parser, a graphical user interface, or any + combination, and it can even be built with no user interface at all (in + which case it runs as a remote-mode Kermit server). + + [88]ckucmd.h + [89]ckucmd.c + The command parsing primitives used by the interactive command + parser to parse keywords, numbers, filenames, etc, and to give + help, complete fields, supply defaults, allow abbreviations and + editing, etc. This package is totally independent of Kermit, but + does depend on the [90]Group E functions. + + [91]ckuusr.h + Definitions of symbols used in Kermit's commands. + + ckuus*.c + Kermit's interactive command parser, including the script + programming language: [92]ckuusr.c (includes top-level keyword + tables); [93]ckuus2.c (HELP command text); [94]ckuus3.c (most of + the SET command); [95]ckuus4.c (includes variables and + functions); ckuus[567].c (miscellaneous); + + [96]ckuusy.c + The command-line-option parser. + + [97]ckuusx.c + User interface functions common to both the interactive and + command-line parsers. + + [98]ckuver.h + Version heralds for different implementations. + + [99]ckuscr.c + The (old, uucp-like) SCRIPT command + + [100]ckudia.c + The DIAL command. Includes specific knowledge of many types of + modems. + + Note that none of the above files is actually Unix-specific. Over time + they have proven to be portable among all platforms where C-Kermit is + built: Unix, VMS, AOS/VS, Amiga, OS-9, VOS, etc etc. Thus the third + letter should more properly be "c", but changing it would be too + confusing. + + ck?con.c, ckucns.c + The CONNECT command. Terminal connection, and in some cases + (Macintosh, Windows) also terminal emulation. NOTE: As of + C-Kermit 7.0, there are two different CONNECT modules for UNIX: + [101]ckucon.c -- the traditional, portable, fork()-based version + -- and [102]ckucns.c, a new version that uses select() rather + than forks so it can handle encryption. ckucns.c is the + preferred version for Unix; ckucon.c is not likely to keep pace + with it in terms of upgrades, etc. However, since select() is + not portable to every platform, ckucon.c will be kept + indefinitely for those platforms that can't use ckucns.c. NOTE: + SunLink X.25 support is available only in ckucon.c. + + ck_*.*, ckuat*.* + Modules having to do with authentication and encryption. Since + the relaxation of USA export laws, they are included with the + general source-code distribution. Secure C-Kermit binaries can + be built using special targets in the standard makefile. + However, secure prebuilt binaries may not be distributed. + + For other implementations, the files may, and probably do, have + different names. For example, the Macintosh graphical user interface + filenames start with "ckm". Kermit 95 uses the ckucmd and ckuus* + modules, but has its own CONNECT command modules. And so on. + + Here is a brief description of C-Kermit's "user interface interface", + from ckuusr.c. It is nowhere near complete; in particular, hundreds of + global variables are shared among the many modules. These should, some + day, be collected into classes or structures that can be passed around + as needed; not only for purity's sake, but also to allow for multiple + simultaneous communication sessions and or user interfaces. Our list of + things to do is endless, and reorganizing the source is almost always + at the bottom. + + The ckuus*.c modules (like many of the ckc*.c modules) depend on the + existence of C library features like fopen, fgets, feof, (f)printf, + argv/argc, etc. Other functions that are likely to vary among operating + systems -- like setting terminal modes or interrupts -- are invoked via + calls to functions that are defined in the [103]Group E + platform-dependent modules, ck?[ft]io.c. The command line parser + processes any arguments found on the command line, as passed to main() + via argv/argc. The interactive parser uses the facilities of the cmd + package (developed for this program, but, in theory, usable by any + program). Any command parser may be substituted for this one. The only + requirements for the Kermit command parser are these: + + 1. Set parameters via global variables like duplex, speed, ttname, + etc. See [104]ckcmai.c for the declarations and descriptions of + these variables. + 2. If a command can be executed without the use of Kermit protocol, + then execute the command directly and set the sstate (start state) + variable to 0. Examples include SET commands, local directory + listings, the CONNECT command. + 3. If a command requires the Kermit protocol, set the following + variables: + sstate string data + 'x' (enter server mode) (none) + 'r' (send a 'get' command) cmarg, cmarg2 + 'v' (enter receive mode) cmarg2 + 'g' (send a generic command) cmarg + 's' (send files) nfils, cmarg & cmarg2 OR cmlist + 'c' (send a remote host command) cmarg + + + cmlist is an array of pointers to strings. + cmarg, cmarg2 are pointers to strings. + nfils is an integer (hmmm, probably should be an unsigned long). + + cmarg can be: + A filename string (possibly wild), or: + a pointer to a prefabricated generic command string, or: + a pointer to a host command string. + + cmarg2 is: + The name to send a single file under, or: + the name under which to store an incoming file; must not + be wild. + If it's the name for receiving, a null value means to + store the file under the name it arrives with. + + cmlist is: + A list of nonwild filenames, such as passed via argv. + + nfils is an integer, interpreted as follows: + -1: filespec (possibly wild) in cmarg, must be expanded + internally. + 0: send from stdin (standard input). + >0: number of files to send, from cmlist. + + The screen() function is used to update the screen during file + transfer. The tlog() function writes to a transaction log (if TLOG is + defined). The debug() function writes to a debugging log (if DEBUG is + defined). The intmsg() and chkint() functions provide the user i/o for + interrupting file transfers. + + [ [105]Contents ] [ [106]C-Kermit ] [ [107]Kermit Home ] + +4.E. Group E: Platform-Dependent I/O + + Platform-dependent function definitions. All the Kermit modules, + including the command package, call upon these functions, which are + designed to provide system-independent primitives for controlling and + manipulating devices and files. For Unix, these functions are defined + in the files [108]ckufio.c (files), [109]ckutio.c (communications), and + [110]ckusig.c (signal handling). + + For VMS, the files are [111]ckvfio.c, ckvtio.c, and [112]ckusig.c (VMS + can use the same signal handling routines as Unix). It doesn't really + matter what the files are called, except for Kermit distribution + purposes (grouping related files together alphabetically), only that + each function is provided with the name indicated, observes the same + calling and return conventions, and has the same type. + + The Group E modules contain both functions and global variables that + are accessed by modules in the other groups. These are now described. + + (By the way, I got this list by linking all the C-Kermit modules + together except ckutio and ckufio. These are the symbols that ld + reported as undefined. But that was a long time ago, probably circa + Version 6.) + +4.E.1. Global Variables + + char *DELCMD; + Pointer to string containing command for deleting files. + Example: char *DELCMD = "rm -f "; (UNIX) + Example: char *DELCMD = "delete "; (VMS) + Note trailing space. Filename is concatenated to end of this + string. NOTE: DELCMD is used only in versions that do not + provide their own built-in DELETE command. + + char *DIRCMD; + Pointer to string containing command for listing files when a + filespec is given. + Example: char *DIRCMD = "/bin/ls -l "; (UNIX) + Example: char *DIRCMD = "directory "; (VMS) + Note trailing space. Filename is concatenated to end of this + string. NOTE: DIRCMD is used only in versions that do not + provide their own built-in DIRECTORY command. + + char *DIRCM2; + Pointer to string containing command for listing files when a + filespec is not given. (currently not used, handled in another + way.) + Example: char *DIRCMD2 = "/bin/ls -ld *"; + NOTE: DIRCMD2 is used only in versions that do not provide their + own built-in DIRECTORY command. + + char *PWDCMD; + Pointer to string containing command to display current + directory. + Example: char *PWDCMD = "pwd "; + NOTE: PWDCMD is used only in versions that do not provide their + own built-in PWD command. + + char *SPACMD; + Pointer to command to display free disk space in current + device/directory. + Example: char *SPACMD = "df ."; + NOTE: SPACMD is used only in versions that do not provide their + own built-in SPACE command. + + char *SPACM2; + Pointer to command to display free disk space in another + device/directory. + Example: char *SPACM2 = "df "; + Note trailing space. Device or directory name is added to this + string. NOTE: SPACMD2 is used only in versions that do not + provide their own built-in SPACE command. + + char *TYPCMD; + Pointer to command for displaying the contents of a file. + Example: char *TYPCMD = "cat "; + Note trailing space. Device or directory name is added to this + string. NOTE: TYPCMD is used only in versions that do not + provide their own built-in TYPE command. + + char *WHOCMD; + Pointer to command for displaying logged-in users. + Example: char *WHOCMD = "who "; + Note trailing space. Specific user name may be added to this + string. + + int backgrd = 0; + Flag for whether program is running in foreground (0) or + background (nonzero). Background operation implies that screen + output should not be done and that all errors should be fatal. + + int ckxech; + Flag for who is to echo console typein: + 1: The program (system is not echoing). + 0: The OS, front end, terminal, etc (not this program). + + char *ckxsys; + Pointer to string that names the computer and operating system. + Example: char *ckxsys = " NeXT Mach 1.0"; + Tells what computer system ckxv applies to. In UNIX Kermit, this + variable is also used to print the program herald, and in the + SHOW VERSION command. + + char *ckxv; + Pointer to version/edit info of ck?tio.c module. + Example: char *ckxv = "UNIX Communications Support, 6.0.169, 6 + Sep 96"; + Used by SHOW VERSION command. + + char *ckzsys; + Like ckxsys, but briefer. + Example: char *ckzsys = " 4.3 BSD"; + Tells what platform ckzv applies to. Used by the SHOW VERSION + command. + + char *ckzv; + Pointer to version/edit info of ck?fio.c module. + Example: char *ckzv = "UNIX File support, 6.0.113, 6 Sep 96"; + Used by SHOW VERSION command. + + int dfflow; + Default flow control. 0 = none, 1 = Xon/Xoff, ... (see FLO_xxx + symbols in ckcdeb.h) + Set by Group E module. Used by [113]ckcmai.c to initialize flow + control variable. + + int dfloc; + Default location. 0 = remote, 1 = local. Set by Group E module. + Used by ckcmai.c to initialize local variable. Used in various + places in the user interface. + + int dfprty; + Default parity. 0 = none, 'e' = even, 'o' = odd, 'm' = mark, 's' + = space. Set by Group E module. Used by ckcmai.c to initialize + parity variable. + + char *dftty; + Default communication device. Set by Group E module. Used in + many places. This variable should be initialized the the symbol + CTTNAM, which is defined in ckcdeb.h, e.g. as "/dev/tty" for + UNIX, "TT:" for VMS, etc. Example: char *dftty = CTTNAM; + + char *mtchs[]; + Array of string pointers to filenames that matched the most + recent wildcard match, i.e. the most recent call to zxpand(). + Used (at least) by command parsing package for partial filename + completion. + + int tilde_expand; + Flag for whether to attempt to expand leading tildes in + directory names (used in UNIX only, and then only when the + symbol DTILDE is defined. + + int ttnproto; + The protocol being used to communicate over a network device. + Values are defined in ckcnet.h. Example: NP_TELNET is network + protocol "telnet". + + int maxnam; + The maximum length for a filename, exclusive of any device or + directory information, in the format of the host operating + system. + + int maxpath; + The maximum length for a fully specified filename, including + device designator, directory name, network node name, etc, in + the format of the host operating system, and including all + punctuation. + + int ttyfd; + File descriptor of the communication device. -1 if there is no + open or usable connection, including when C-Kermit is in remote + mode. Since this is not implemented everywhere, references to it + are in #ifdef CK_TTYFD..#endif. + + [ [114]Contents ] [ [115]C-Kermit ] [ [116]Kermit Home ] + +4.E.2. Functions + + These are divided into three categories: file-related functions (B.1), + communication functions (B.2), and miscellaneous functions (B.3). + +4.E.2.1. File-Related Functions + + In most implementations, these are collected together into a module + called ck?fio.c, where ? = "u" ([117]ckutio.c for Unix), "v" + ([118]ckvtio.c for VMS), [119]etc. To be totally platform-independent, + C-Kermit maintains its own file numbers, and provides the functions + described in this section to deal with the files associated with them. + The file numbers are referred to symbolically, and are defined as + follows in ckcker.h: + + #define ZCTERM 0 /* Console terminal */ + #define ZSTDIO 1 /* Standard input/output */ + #define ZIFILE 2 /* Current input file for SEND command */ + #define ZOFILE 3 /* Current output file for RECEIVE command */ + #define ZDFILE 4 /* Current debugging log file */ + #define ZTFILE 5 /* Current transaction log file */ + #define ZPFILE 6 /* Current packet log file */ + #define ZSFILE 7 /* Current session log file */ + #define ZSYSFN 8 /* Input from a system function (pipe) */ + #define ZRFILE 9 /* Local file for READ command */ (NEW) + #define ZWFILE 10 /* Local file for WRITE command */ (NEW) + #define ZMFILE 11 /* Auxilliary file for internal use */ (NEW) + #define ZNFILS 12 /* How many defined file numbers */ + + In the descriptions below, fn refers to a filename, and n refers to one + of these file numbers. Functions are of type int unless otherwise + noted, and are listed mostly alphabetically. + + int + chkfn(n) int n; + Checks the file number n. Returns: + -1: File number n is out of range + 0: n is in range, but file is not open + 1: n in range and file is open + + int + iswild(filspec) char *filespec; + Checks if the file specification is "wild", i.e. contains + metacharacters or other notations intended to match multiple + filenames. Returns: + 0: not wild + 1: wild. + + int + isdir(string) char *string; + Checks if the string is the name of an existing directory. The + idea is to check whether the string can be "cd'd" to, so in some + cases (e.g. DOS) it might also indicate any file structured + device, such as a disk drive (like A:). Other nonzero returns + indicate system-dependent information; e.g. in VMS + isdir("[.FOO]") returns 1 but isdir("FOO.DIR;1") returns 2 to + indicate the directory-file name is in a format that needs + conversion before it can be combined with a filename. Returns: + 0: not a directory (including any kind of error) + 1: it is an existing directory + + char * + zfcdat(name) char *name; + Returns modification (preferably, otherwise creation) date/time + of file whose name is given in the argument string. Return value + is a pointer to a string of the form yyyymmdd hh:mm:ss, for + example 19931231 23:59:59, which represents the local time (no + timezone or daylight savings time finagling required). Returns + the null string ("") on failure. The text pointed to by the + string pointer might be in a static buffer, and so should be + copied to a safe place by the caller before any subsequent calls + to this function. + + struct zfnfp * + zfnqfp(fn, buflen, buf) char * fn; int buflen; char * buf; + Given the filename fn, the corresponding fully qualified, + absolute filename is placed into the buffer buf, whose length is + buflen. On failure returns a NULL pointer. On success returns a + pointer to a struct zfnfp containing pointers to the full + pathname and to just the filename, and an int giving the length + of the full pathname. All references to this function in + mainline code must be protected by #ifdef ZFNQFP..#endif, + because it is not present in all of the ck*fio.c modules. So if + you implement this function in a version that did not have it + before, be sure to add #define ZFNQFP in the appropriate spot in + ckcdeb.h or in the build-procedure CFLAGS. + + int + zcmpfn(s1,s2) char * s2, * s2; + Compares two filenames to see if they refer to the same. + Internally, the arguments can be converted to fully qualified + pathnames, e.g. with zfnqfp(), realpath(), or somesuch. In Unix + or other systems where symbolic links exist, the link should be + resolved before making the comparison or looking at the inodes. + Returns: + 0: Files are not identical. + 1: Files are identical. + + int + zfseek(pos) long pos; + Positions the input pointer on the current input file to the + given position. The pos argument is 0-based, the offset + (distance in bytes) from beginning of the file. Needed for + RESEND, PSEND, and other recovery operations. This function is + not necessarily possible on all systems, e.g. record-oriented + systems. It should only be used on binary files (i.e. files we + are sending in binary mode) and stream-oriented file systems. + Returns: + -1: on failure. + 0: On success. + + int + zchdir(dirnam) char *dirnam; + Changes current or default directory to the one given in dirnam. + Returns: + 0: On failure. + 1: on success. + + long + zchki(fn) char *fn; + Check to see if file with name fn is a regular, readable, + existing file, suitable for Kermit to send -- not a directory, + not a symbolic link, etc. Returns: + -3: if file exists but is not accessible (e.g. read-protected); + -2: if file exists but is not of a readable type (e.g. a + directory); + -1: on error (e.g. file does not exist, or fn is garbage); + >=0: (length of file) if file exists and is readable. + Also see isdir(), zgetfs(). + + int + zchkpid(pid) unsigned long pid; + Returns: + 1: If the given process ID (e.g. pid in UNIX) is valid and + active + 0: otherwise. + + long + zgetfs(fn) char *fn; + Gets the size of the given file, regardless of accessibility. + Used for directory listings. Unlike zchki(), should return the + size of any kind of file, even a directory. zgetfs() also should + serve as a mini "get file info" function that can be used until + we design a better one, by also setting some global variables: + int zgfs_link = 1/0 = file is (not) a symbolic link. + int zgfs_dir = 1/0 = file is (not) a directory. + char linkname[] = if zgfs_link != 0, name of file link points + to. + Returns: + -1: on error (e.g. file does not exist, or fn is garbage); + >=0: (length of file) if file exists and is readable. + + int + zchko(fn) char *fn; + Checks to see if a file of the given name can be created. + Returns: + -1: if file cannot be created, or on any kind of error. + 0: if file can be created. + + int + zchkspa(fn,len) char *f; long len; + Checks to see if there is sufficient space to store the file + named fn, which is len bytes long. If you can't write a function + to do this, then just make a dummy that always returns 1; higher + level code will recover from disk-full errors. The receiving + Kermit uses this function to refuse an incoming file based on + its size, via the attribute mechanism. Returns: + -1: on error. + 0: if there is not enough space. + 1: if there is enough space. + + int + zchin(n,c) int n; int *c; + Gets a character from file number n, return it in c (call with + &c). Returns: + -1: on failure, including EOF. + 0: on success with character in c. + + int + zchout(n,c) int n; char c; + Writes the character c to file number n. Returns: + -1: on error. + 0: on success. + + int + zclose(n) int n; + Closes file number n. Returns: + -1: on error. + 1: on success. + + int + zdelet(fn) char *name; + Attempts to delete (remove, erase) the named file. Returns: + -1: on error. + 1: if file was deleted successfully. + + char * + zgperm(char * f) + Returns a pointer to the system-dependent numeric + permissions/protection string for file f, or NULL upon failure. + Used if CK_PERMS is defined. + + char * + ziperm(char * f) + Returns a pointer to the system-dependent symbolic + permissions/protection string for file f, or NULL upon failure. + Used if CK_PERMS is defined. Example: In UNIX zgperm(f) might + return "100770", but ziperm() might return "-rwxrwx---". In VMS, + zgperm() would return a hexadecimal string, but ziperm() would + return something like "(RWED,RWED,RE,)". + + char * + zgtdir() + Returns a pointer to the name of the current directory, folder, + etc, or a NULL pointer if the current directory cannot be + determined. If possible, the directory specification should be + (a) fully specified, e.g. as a complete pathname, and (b) be + suitable for appending a filename. Thus, for example, Unix + directory names should end with '/'. VMS directory names should + look like DEV:[NAME] (rather than, say, NAME.DIR;1). + + char * + zhome() + Returns a pointer to a string containing the user's home + directory, or NULL upon error. Should be formatted like zgtdir() + (q.v.). + + int + zinfill() + Fill buffer from input file. This function is used by the macro + zminchar(), which is defined in ckcker.h. zminchar() manages its + own buffer, and calls zinfill() to fill it whenever it becomes + empty. It is used only for sending files, and reads characters + only from file number ZIFILE. zinfill() returns -1 upon end of + file, -2 upon fatal error, and -3 upon timeout (e.g. when + reading from a pipe); otherwise it returns the first character + from the buffer it just read. + + int + zkself() + Kills the current job, session, process, etc, logs out, + disappears. Used by the Kermit server when it receives a BYE + command. On failure, returns -1. On success, does not return at + all! This function should not be called until all other steps + have been taken to close files, etc. + + VOID + zstrip(fn,&fn2) char *fn1, **fn2; + Strips device and directory, etc, from file specification fn, + leaving only the filename (including "extension" or "filetype" + -- the part after the dot). For example DUA0:[PROGRAMS]OOFA.C;3 + becomes OOFA.C, or /usr/fdc/oofa.c becomes oofa.c. Returns a + pointer to result in fn2. + + int + zsetperm(char * file, unsigned int code) + Set permissions of file to given system-dependent code. 0: On + failure. + 1: on success. + + int + zsetroot(char * dir) + Sets the root for the user's file access, like Unix chroot(), + but does not require privilege. In Unix, this must be + implemented entirely by Kermit's own file access routines. + Returns: + 1: Success + -1: Invalid argument + -2: + -3: Internal error + -4: Access to given directory denied + -5: New root not within old root + + int + zinroot(char * file) + If no root is set (zsetroot()), returns 1. + Otherwise, if given file is in the root, returns 1. + Otherwise, returns 0. + + VOID + zltor(fn,fn2) char *fn1, *fn2; + Local-To-Remote filename translation. OBSOLETE: replaced by + nzltor() (q.v.). Translates the local filename fn into a format + suitable for transmission to an arbitrary type of computer, and + copies the result into the buffer pointed to by fn2. Translation + may involve (a) stripping the device and/or directory/path name, + (b) converting lowercase to uppercase, (c) removing spaces and + strange characters, or converting them to some innocuous + alphabetic character like X, (d) discarding or converting extra + periods (there should not be more than one). Does its best. + Returns no value. name2 is a pointer to a buffer, furnished by + the caller, into which zltor() writes the resulting name. No + length checking is done. + + #ifdef NZLTOR + VOID + nzltor(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int + convert,pathnames,max; + Replaces zltor(). This new version handles pathnames and checks + length. fn1 and fn2 are as in zltor(). This version is called + unconditionally for each file, rather than only when filename + conversion is enabled. Pathnames can have the following values: + + PATH_OFF: Pathname, if any, is to be stripped + PATH_REL: The relative pathname is to be included + PATH_ABS: The full pathname is to be included + + After handling pathnames, conversion is done to the result as in + the zltor() description if convert != 0; if relative or absolute + pathnames are included, they are converted to UNIX format, i.e. + with slash (/) as the directory separator. The max parameter + specifies the maximum size of fn2. If convert > 0, the regular + conversions are done; if convert < 0, minimal conversions are + done (we skip uppercasing the letters, we allow more than one + period, etc; this can be used when we know our partner is UNIX + or similar). + + #endif /* NZLTOR */ + + int + nzxpand(fn,flags) char *fn; int flags; + Replaces zxpand(), which is obsolete as of C-Kermit 7.0. + Call with: + fn = Pointer to filename or pattern. + flags = option bits: + flags & ZX_FILONLY Match regular files + flags & ZX_DIRONLY Match directories + flags & ZX_RECURSE Descend through directory tree + flags & ZX_MATCHDOT Match "dot files" + flags & ZX_NOBACKUP Don't match "backup files" + flags & ZX_NOLINKS Don't follow symlinks. + + Returns the number of files that match fn, with data structures + set up so the first file (if any) will be returned by the next + znext() call. If ZX_FILONLY and ZX_DIRONLY are both set, or + neither one is set, files and directories are matched. Notes: + + 1. It is essential that the number returned by nzxpand() reflect + the actual number of filenames that will be returned by + znext() calls. In other words: + for (n = nzxpand(string,flags); n > 0; n--) { + znext(buf); + printf("%s\n", buf); + } + + should print all the file names; no more, no less. + 2. In UNIX, DOS, OS-9, etc, where directories contain entries for + themselves (.) and the superior directory (..), these should + NOT be included in the list under any circumstances, including + when ZX_MATCHDOT is set. + 3. Additional option bits might be added in the future, e.g. for + sorting (sort by date/name/size, reverse/ascending, etc). + Currently this is done only in higher level code (through a + hack in which the nzxpand() exports its filename array, which + is not portable because not all OS's can use this mechanism). + + int + zmail(addr,fn) char *addr, fn; + Send the local, existing file fn as e-mail to the address addr. + Returns: + 0: on success + 2: if mail delivered but temp file can't be deleted + -2: if mail can't be delivered + + int + zmkdir(path) char *path; + The path can be a file specification that might contain + directory information, in which the filename is expected to be + included, or an unambiguous directory specification (e.g. in + UNIX it must end with "/"). This routine attempts to create any + directories in the given path that don't already exist. Returns + 0 or greater success: no directories needed creation, or else + all directories that needed creation were created successfully; + the return code is the number of directories that were created. + Returns -1 on failure to create any of the needed directories. + + int + zrmdir(path) char *path; + Attempts to remove the given directory. Returns 0 on success, -1 + on failure. The detailed semantics are open -- should it fail if + the directory contains any files or subdirectories, etc. It is + probably best for this routine to behave in whatever manner is + customary on the underlying platform; e.g. in UNIX, VMS, DOS, + etc, where directories can not be removed unless they are empty. + + VOID + znewn(fn,s) char *fn, **s; + Transforms the name fn into a filename that is guaranteed to be + unique. If the file fn does not exist, then the new name is the + same as fn; Otherwise, it's different. this function does its + best, returns no value. New name is created in caller's space. + Call like this: znewn(old,&new);. The second parameter is a + pointer to the new name. This pointer is set by znewn() to point + to a static string in its own space, so be sure to the result to + a safe place before calling this function again. + + int + znext(fn) char *fn; + Copies the next file name from a file list created by zxpand() + into the string pointed to by fn (see zxpand). If no more files, + then the null string is placed there. Returns 0 if there are no + more filenames, with 0th element the array pointed to by fn set + to NUL. If there is a filename, it is stored in the array + pointed to by fn and a positive number is returned. NOTE: This + is a change from earlier definitions of this function + (pre-1999), which returned the number of files remaining; thus 0 + was the return value when returning the final file. However, no + mainline code ever depended on the return value, so this change + should be safe. + + int + zopeni(n,fn) int n; char *fn; + Opens the file named fn for input as file number n. Returns: + 0: on failure. + 1: on success. + + int + zopeno(n,fn,zz,fcb) int n; char *name; struct zattr *zz; struct + filinfo *fcb; + Attempts to open the named file for output as file number n. zz + is a Kermit file attribute structure as defined in ckcdeb.h, + containing various information about the file, including its + size, creation date, and so forth. This function should attempt + to honor as many of these as possible. fcb is a "file control + block" in the traditional sense, defined in ckcdeb.h, containing + information relevant to complicated file systems like VMS (RMS), + IBM MVS, etc, like blocksize, record length, organization, + record format, carriage control, etc. Returns: + 0: on failure. + 1: on success. + + int + zoutdump() + Dumps a file output buffer. Used with the macro zmchout() + defined in ckcker.h. Used only with file number ZOFILE, i.e. the + file that is being received by Kermit during file transfer. + Returns: + -1: on failure. + 0: on success. + + int + zprint(p,fn) char *p, *f; + Prints the file with name fn on a local printer, with options p. + Returns: + 0: on success + 3: if file sent to printer but can't be deleted + -3: if file can't be printed + + int + zrename(fn,fn2) char *fn, *fn2; + Changes the name of file fn to fn2. If fn2 is the name of an + existing directory, or a file-structured device, then file fn is + moved to that directory or device, keeping its original name. If + fn2 lacks a directory separator when passed to this function, an + appropriate one is supplied. Returns: + -1: on failure. + 0: on success. + + int + zcopy(source,dest) char * source, * dest; + Copies the source file to the destination. One file only. No + wildcards. The destination string may be a filename or a + directory name. Returns: + 0: on success. + <0: on failure: + -2: source file is not a regular file. + -3: source file not found. + -4: permission denied. + -5: source and destination are the same file. + -6: i/o error. + -1: other error. + + char * + zlocaltime(char *) + Call with: "yyyymmdd hh:mm:ss" GMT/UTC date-time. Returns + pointer to local date-time string "yyyymmdd hh:mm:ss" on + success, NULL on failure. + + VOID + zrtol(fn,fn2) char *fn, *fn2; + Remote-To-Local filename translation. OBSOLETE: replaced by + nzrtol(). Translates a "standard" filename to a local filename. + For example, in Unix this function might convert an + all-uppercase name to lowercase, but leave lower- or mix-case + names alone. Does its best, returns no value. New name is in + string pointed to by fn2. No length checking is done. + + #ifdef NZLTOR + int + nzrtol(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int + convert,pathnames,max; + Replaces zrtol. Like zrtol but handles pathnames and checks + length. See nzltor for detailed description of parameters. + + #endif /* NZLTOR */ + + int + zsattr(xx) struct zattr *xx; + Fills in a Kermit file attribute structure for the file which is + to be sent, namely the currently open ZIFILE. Note that this is + not a very good design, but we're stuck with it. Callers must + ensure that zsattr() is called only on real files, not on pipes, + internally generated file-like objects such as server REMOTE + command responses, etc. Returns: + -1: on failure. + 0: on success with the structure filled in. + If any string member is null, it should be ignored by the + caller. + If any numeric member is -1, it should be ignored by the caller. + + int + zshcmd(s) char *s; + s contains to pointer to a command to be executed by the host + computer's shell, command parser, or operating system. If the + system allows the user to choose from a variety of command + processors (shells), then this function should employ the user's + preferred shell. If possible, the user's job (environment, + process, etc) should be set up to catch keyboard interruption + signals to allow the user to halt the system command and return + to Kermit. The command must run in ordinary, unprivileged user + mode. If possible, this function should return -1 on failure to + start the command, or else it should return 1 if the command + succeeded and 0 if it failed. + + int + pexitstatus + zshcmd() and zsyscmd() should set this to the command's actual + exit status code if possible. + + int + zsyscmd(s) char *s; + s contains to pointer to a command to be executed by the host + computer's shell, command parser, or operating system. If the + system allows the user to choose from a variety of command + processors (shells), then this function should employ the system + standard shell (e.g. /bin/sh for Unix), so that the results will + always be the same for everybody. If possible, the user's job + (environment, process, etc) should be set up to catch keyboard + interruption signals to allow the user to halt the system + command and return to Kermit. The command must run in ordinary, + unprivileged user mode. If possible, this function should return + -1 on failure to start the command, or else it should return 1 + if the command succeeded and 0 if it failed. + + VOID + z_exec(s,args) char * s; char * args[]; + This one executes the command s (which is searched for using the + system's normal searching mechanism, such as PATH in UNIX), with + the given argument vector, which follows the conventions of UNIX + argv[]: the name of the command pointed to by element 0, the + first arg by element 1, and so on. A null args[] pointer + indicates the end of the arugment list. All open files must + remain open so the exec'd process can use them. Returns only if + unsuccessful. + + int + zsinl(n,s,x) int n, x; char *s; + Reads a line from file number n. Writes the line into the + address s provided by the caller. Writing terminates when + newline is read, but with newline discarded. Writing also + terminates upon EOF or if length x is exhausted. Returns: + -1: on EOF or error. + 0: on success. + + int + zsout(n,s) int n; char *s; + Writes the string s out to file number n. Returns: + -1: on failure. + 0: on success. + + int + zsoutl(n,s) int n; char *s; + Writes the string s out to file number n and adds a line + (record) terminator (boundary) appropriate for the system and + the file format. Returns: + -1: on failure. + 0: on success. + + int + zsoutx(n,s,x) int n, x; char *s; + Writes exactly x characters from string s to file number n. If s + has fewer than x characters, then the entire string s is + written. Returns: + -1: on failure. + >= 0: on success, the number of characters actually written. + + int + zstime(fn,yy,x) char *fn; struct zattr *yy; int x; + Sets the creation date (and other attributes) of an existing + file, or compares a file's creation date with a given date. Call + with: + + fn: pointer to name of existing file. + yy: Pointer to a Kermit file attribute structure in which yy->date.val + is a date of the form yyyymmdd hh:mm:ss, e.g. 19900208 13:00:00, which + is to be used for setting or comparing the file date. Other attributes + in the struct can also be set, such as the protection/permission (See + [120]Appendix I), when it makes sense (e.g. "yy->lprotect.val" can be + set if the remote system ID matches the local one). + x: A function code: 0 means to set the file's creation date as given. + 1 means compare the date from the yy struct with the file's date. + + Returns: + -1: on any kind of error. + 0: if x is 0 and the file date was set successfully. + 0: if x is 1 and date from attribute structure > file creation + date. + 1: if x is 1 and date from attribute structure <= file + creation date. + + VOID + zstrip(name,name2) char *name, **name2; + Strips pathname from filename "name". Constructs the resulting + string in a static buffer in its own space and returns a pointer + to it in name2. Also strips device name, file version numbers, + and other "non-name" material. + + int + zxcmd(n,s) char *s; + Runs a system command so its output can be accessed as if it + were file n. The command is run in ordinary, unprivileged user + mode. + If n is ZSTDIO or ZCTERM, returns -1. + If n is ZIFILE or ZRFILE, then Kermit reads from the command, + otherwise Kermit writes to the command. + Returns 0 on error, 1 on success. + + int + zxpand(fn) char *fn; + OBSOLETE: Replaced by nzxpand(), q.v. + + #ifdef ZXREWIND + int + zxrewind() + Returns the number of files returned by the most recent + nzxpand() call, and resets the list to the beginning so the next + znext() call returns the first file. Returns -1 if zxpand has + not yet been called. If this function is available, ZXREWIND + should be defined; otherwise it should not be referenced. + + #endif /* ZXREWIND */ + + int + xsystem(cmd) char *cmd; + Executes the system command without redirecting any of its i/o, + similar (well, identical) to system() in Unix. But before + passing the command to the system, xsystem() ensures that all + privileges are turned off, so that the system command executes + in ordinary unprivileged user mode. If possible, xsystem() + returns the return code of the command that was executed. + +4.E.2.2. IKSD Variables and Functions + + These must be implemented in any C-Kermit version that is to be + installed as an Internet Kermit Service Daemon (IKSD). IKSD is expected + to be started by the Internet Daemon (e.g. inetd) with its standard i/o + redirected to the incoming connection. + + int ckxanon; + Nonzero if anonymous logins allowed. + + extern int inserver; + Nonzero if started in IKSD mode. + + extern int isguest; + Nonzero if IKSD and user logged in anonymously. + + extern char * homdir; + Pointer to user's home directory. + + extern char * anonroot; + Pointer to file-system root for anonymous users. + + Existing functions must make "if (inserver && isguest)" checks for + actions that would not be legal for guests: zdelete(), zrmdir(), + zprint(), zmail(), etc. + + int + zvuser(name) char * name; + Verifies that user "name" exists and is allowed to log in. If + the name is "ftp" or "anonymous" and ckxanon != 0, a guest login + is set up. Returns 0 if user not allowed to log in, nonzero if + user may log in. + + int + zvpass(string) char * string; + Verifies password of the user from the most recent zvuser() + call. Returns nonzero if password is valid for user, 0 if it + isn't. Makes any appropriate system log entries (IKSD logins, + failed login attempts, etc). If password is valid, logs the user + in as herself (if real user), or sets up restricted anonymous + access if user is guest (e.g. changes file-system root to + anonroot and sets isguest = 1). + + VOID + zsyslog() + Begins any desired system logging of an IKSD session. + + VOID + zvlogout() + Terminates an IKSD session. In most cases this is simply a + wrapper for exit() or doexit(), with some system logging added. + +4.E.2.3. Privilege Functions + + These functions are used by C-Kermit to adapt itself to operating + systems where the program can be made to run in a "privileged" mode, + e.g. setuid or setgid in Unix. C-Kermit should NOT read and write files + or start subprocesses as a privileged program. This would present a + serious threat to system security. The security package has been + installed to prevent such security breaches by turning off the + program's special privileges at all times except when they are needed. + + In UNIX, the only need Kermit has for privileged status is access to + the UUCP lockfile directory, in order to read, create, and destroy + lockfiles, and to open communication devices that are normally + protected against the user (see the [121]Unix C-Kermit Installation + Instructions for discussion). Therefore, privileges should only be + enabled for these operations and disabled at all other times. This + relieves the programmer of the responsibility of putting expensive and + unreliable access checks around every file access and subprocess + creation. + + Strictly speaking, these functions are not required in all C-Kermit + implementations, because their use (so far, at least) is internal to + the Group E modules. However, they should be included in all C-Kermit + implementations for operating systems that support the notion of a + privileged program (UNIX, RSTS/E, what others?). + + int + priv_ini() + Determine whether the program is running in privileged status. + If so, turn off the privileges, in such a way that they can be + turned on again when needed. Called from sysinit() at program + startup time. Returns: + 0 on success + nonzero on failure, in which case the program should halt + immediately. + + int + priv_on() + If the program is not privileged, this function does nothing. If + the program is privileged, this function returns it to + privileged status. priv_ini() must have been called first. + Returns: + 0 on success + nonzero on failure + + int + priv_off() + Turns privileges off (if they are on) in such a way that they + can be turned back on again. Returns: + 0 on success + nonzero on failure + + int + priv_can() + Turns privileges off in such a way that they cannot be turned + back on. Returns: + 0 on success + nonzero on failure + + int + priv_chk() + Attempts to turns privileges off in such a way that they can be + turned on again later. Then checks to make sure that they were + really turned off. If they were not really turned off, then they + are cancelled permanently. Returns: + 0 on success + nonzero on failure + +4.E.2.4. Console-Related Functions + + These relate to the program's "console", or controlling terminal, i.e. + the terminal that the user is logged in on and types commands at, or on + a PC or workstation, the actual keyboard and screen. + + int + conbin(esc) char esc; + Puts the console into "binary" mode, so that Kermit's command + parser can control echoing and other treatment of characters + that the user types. esc is the character that will be used to + get Kermit's attention during packet mode; puts this in a global + place. Sets the ckxech variable. Returns: + -1: on error. + 0: on success. + + int + concb(esc) char esc; + Put console in "cbreak" (single-character wakeup) mode. That is, + ensure that each console character is available to the program + immediately when the user types it. Otherwise just like + conbin(). Returns: + -1: on error. + 0: on success. + + int + conchk() + Returns a number, 0 or greater, the number of characters waiting + to be read from the console, i.e. the number of characters that + the user has typed that have not been read yet by Kermit. + + long + congspd(); + Returns the speed ("baud rate") of the controlling terminal, if + known, otherwise -1L. + + int + congks(timo) int timo; + Get Keyboard Scancode. Reads a keyboard scan code from the + physical console keyboard. If the timo parameter is greater than + zero, then times out and returns -2 if no character appears + within the given number of seconds. Upon any other kind of + error, returns -1. Upon success returns a scan code, which may + be any positive integer. For situations where scan codes cannot + be read (for example, when an ASCII terminal is used as the + job's controlling terminal), this function is identical to + coninc(), i.e. it returns an 8-bit character value. congks() is + for use with workstations whose keyboards have Alternate, + Command, Option, and similar modifier keys, and Function keys + that generate codes greater than 255. + + int + congm() + Console get modes. Gets the current console terminal modes and + saves them so that conres() can restore them later. Returns 1 if + it got the modes OK, 0 if it did nothing (e.g. because Kermit is + not connected with any terminal), -1 on error. + + int + coninc(timo) int timo; + Console Input Character. Reads a character from the console. If + the timo parameter is greater than zero, then coninc() times out + and returns -2 if no character appears within the given number + of seconds. Upon any other kind of error, returns -1. Upon + success, returns the character itself, with a value in the range + 0-255 decimal. + + VOID + conint(f,s) SIGTYP (*f)(), (*s)(); + Sets the console to generate an interrupt if the user types a + keyboard interrupt character, and to transfer control the + signal-handling function f. For systems with job control, s is + the address of the function that suspends the job. Sets the + global variable "backgrd" to zero if Kermit is running in the + foreground, and to nonzero if Kermit is running in the + background. See ckcdeb.h for the definition of SIGTYP. No return + value. + + VOID + connoi() + Console no interrupts. Disable keyboard interrupts on the + console. No return value. + + int + conoc(c) char c; + Writes character c to the console terminal. Returns: + 0 on failure, 1 on success. + + int + conol(s) char *s; + Writes string s to the console. Returns -1 on error, 0 or + greater on success. + + int + conola(s) char *s[]; { + Writes an array of strings to the console. Returns -1 on error, + 0 or greater on success. + + int + conoll(s) char *s; + Writes string s to the console, followed by the necessary line + termination characters to put the console cursor at the + beginning of the next line. Returns -1 on error, 0 or greater on + success. + + int + conres() + Restores the console terminal to the modes obtained by congm(). + Returns: -1 on error, 0 on success. + + int + conxo(x,s) int x; char *s; + Write x characters from string s to the console. Returns 0 or + greater on success, -1 on error. + + char * + conkbg(); + Returns a pointer to the designator of the console keyboard + type. For example, on a PC, this function would return "88", + "101", etc. Upon failure, returns a pointer to the empty string. + +4.E.2.5. Communications Functions + + The communication device is the device used for terminal emulation and + file transfer. It may or may not be the same device as the console, and + it may or may not be a terminal (serial-port) device; it could also be + a network connection. For brevity, the communication device is referred + to here as the "tty". When the communication device is the same as the + console device, Kermit is said to be in remote mode. When the two + devices are different, Kermit is in local mode. + + int + ttchk() + Returns the number of characters that have arrived at the + communication device but have not yet been read by ttinc(), + ttinl(), and friends. If communication input is buffered (and it + should be), this is the sum of the number of unread characters + in Kermit's buffer PLUS the number of unread characters in the + operating system's internal buffer. The call must be + nondestructive and nonblocking, and as inexpensive as possible. + Returns: + 0: or greater on success, + 0: in case of internal error, + -1: or less when it determines the connection has been broken, + or there is no connection. + + That is, a negative return from ttchk() should reliably indicate + that there is no usable connection. Furthermore, ttchk() should + be callable at any time to see if the connection is open. When + the connection is open, every effort must be made to ensure that + ttchk returns an accurate number of characters waiting to be + read, rather than just 0 (no characters) or 1 (1 or more + characters), as would be the case when we use select(). This + aspect of ttchk's operation is critical to successful operation + of sliding windows and streaming, but "nondestructive buffer + peeking" is an obscure operating system feature, and so when it + is not available, we have to do it ourselves by managing our own + internal buffer at a level below ttinc(), ttinl(), etc, as in + the UNIX version (non-FIONREAD case). + + An external global variable, clsondisc, if nonzero, means that + if a serial connection drops (carrier on-to-off transition + detected by ttchk()), the device should be closed and released + automatically. + + int + ttclos() + Closes the communication device (tty or network). If there were + any kind of exclusive access locks connected with the tty, these + are released. If the tty has a modem connection, it is hung up. + For true tty devices, the original tty device modes are + restored. Returns: + -1: on failure. + 0: on success. + + int + ttflui() + Flush communications input buffer. If any characters have + arrived but have not yet been read, discard these characters. If + communications input is buffered by Kermit (and it should be), + this function flushes Kermit's buffer as well as the operating + system's internal input buffer. Returns: + -1: on failure. + 0: on success. + + int + ttfluo() + Flush tty output buffer. If any characters have been written but + not actually transmitted (e.g. because the system has been + flow-controlled), remove them from the system's output buffer. + (Note, this function is not actually used, but it is recommended + that all C-Kermit programmers add it for future use, even if it + is only a dummy function that returns 0 always.) + + int + ttgmdm() + Looks for the modem signals CTS, DSR, and CTS, and returns those + that are on in as its return value, in a bit mask as described + for ttwmdm, in which a bit is on (1) or off (0) according to + whether the corresponding signal is on (asserted) or off (not + asserted). Return values: + -3: Not implemented + -2: if the line does not have modem control + -1: on error + >=0: on success, with bit mask containing the modem signals. + + long + ttgspd() + Returns the current tty speed in BITS (not CHARACTERS) per + second, or -1 if it is not known or if the tty is really a + network, or upon any kind of error. On success, the speed + returned is the actual number of bits per second, like 1200, + 9600, 19200, etc. + + int + ttgwsiz() + Get terminal window size. Returns -1 on error, 0 if the window + size can't be obtained, 1 if the window size has been + successfully obtained. Upon success, the external global + variables tt_rows and tt_cols are set to the number of screen + rows and number of screen columns, respectively. As this + function is not implemented in all ck*tio.c modules, calls to it + must be wrapped in #ifdef CK_TTGWSIZ..#endif. NOTE: This + function must be available to use the TELNET NAWS feature + (Negotiate About Window Size) as well as Rlogin. + + int + tthang() + Hang up the current tty device. For real tty devices, turn off + DTR for about 1/3-1/2 second (or other length of time, depending + on the system). If the tty is really a network connection, close + it. Returns: + -1: on failure. + 0: if it does not even try to hang up. + 1: if it believes it hung up successfully. + + VOID + ttimoff() + Turns off all pending timer interrupts. + + int + ttinc(timo) int timo; (function is old, return codes are new) + Reads one character from the communication device. If timo is + greater than zero, wait the given number of seconds and then + time out if no character arrives, otherwise wait forever for a + character. Returns: + -3: internal error (e.g. tty modes set wrong) + -2: communications disconnect + -1: timeout or other error + >=0: the character that was read. + It is HIGHLY RECOMMENDED that ttinc() be internally buffered so + that calls to it are relatively inexpensive. If it is possible + to to implement ttinc() as a macro, all the better, for example + something like: + + #define ttinc(t) ( (--txbufn >= 0) ? txbuf[ttbufp++] : txbufr(t) ) + + (see description of txbufr() below) + + int + ttinl(dest,max,timo,eol,start,turn) int max,timo,turn; CHAR + *dest, eol, start; + ttinl() is Kermit's packet reader. Reads a packet from the + communications device, or up to max characters, whichever occurs + first. A line is a string of characters starting with the start + character up to and including the character given in eol or + until the length is exhausted, or, if turn != 0, until the line + turnaround character (turn) is read. If turn is 0, ttinl() + *should* use the packet length field to detect the end, to allow + for the possibility that the eol character appears unprefixed in + the packet data. (The turnaround character is for half-duplex + linemode connections.) + + If timo is greater than zero, ttinl() times out if the eol + character is not encountered within the given number of seconds + and returns -1. + + The characters that were input are copied into "dest" with their + parity bits stripped if parity is not none. The first character + copied into dest should be the start character, and the last + should be the final character of the packet (the last block + check character). ttinl() should also absorb and discard the eol + and turn characters, and any other characters that are waiting + to be read, up until the next start character, so that + subsequent calls to ttchk() will not succeed simply because + there are some terminators still sitting in the buffer that + ttinl() didn't read. This operation, if performed, MUST NOT + BLOCK (so if it can't be performed in a guaranteed nonblocking + way, don't do it). + + On success, ttinl() returns the number of characters read. + Optionally, ttinl() can sense the parity of incoming packets. If + it does this, then it should set the global variable ttprty + accordingly. ttinl() should be coded to be as efficient as + possible, since it is at the "inner loop" of packet reception. + ttinl() returns: + -1: Timeout or other possibly correctable error. + -2: Interrupted from keyboard. + -3: Uncorrectable i/o error -- connection lost, configuration + problem, etc. + >=0: on success, the number of characters that were actually + read and placed in the dest buffer, not counting the trailing + null. + + int + ttoc(c) char c; + Outputs the character c to the communication line. If the + operation fails to complete within two seconds, this function + returns -1. Otherwise it returns the number of characters + actually written to the tty (0 or 1). This function should only + be used for interactive, character-mode operations, like + terminal connection, script execution, dialer i/o, where the + overhead of the signals and alarms does not create a bottleneck. + (THIS DESCRIPTION NEEDS IMPROVEMENT -- If the operation fails + within a "certain amount of time"... which might be dependent on + the communication method, speed, etc. In particular, + flow-control deadlocks must be accounted for and broken out of + to prevent the program from hanging indefinitely, etc.) + + int + ttol(s,n) int n; char *s; + Kermit's packet writer. Writes the n characters of the string + pointed to to by s. NOTE: It is ttol's responsibility to write + ALL of the characters, not just some of them. Returns: + -1: on a possibly correctable error (so it can be retried). + -3: on a fatal error, e.g. connection lost. + >=0: on success, the actual number of characters written (the + specific number is not actually used for anything). + + int + ttopen(ttname,lcl,modem,timo) char *ttname; int *lcl, modem, + timo; + Opens a tty device, if it is not already open. ttopen must check + to make sure the SAME device is not already open; if it is, + ttopen returns successfully without doing anything. If a + DIFFERENT device is currently open, ttopen() must call ttclos() + to close it before opening the new one. + + Parameters: + + ttname: + character string - device name or network host name. + + lcl: + If called with lcl < 0, sets value of lcl as + follows: + 0: the terminal named by ttname is the job's + controlling terminal. + 1: the terminal named by ttname is not the job's + controlling terminal. + If the device is already open, or if the requested + device can't be opened, then lcl remains (and is + returned as) -1. + + modem: + Less than zero: this is the negative of the network + type, and ttname is a network host name. Network + types (from [122]ckcnet.h: + + NET_TCPB 1 TCP/IP Berkeley (socket) (implemented in [123]ckutio.c) + NET_TCPA 2 TCP/IP AT&T (streams) (not yet implemented) + NET_DEC 3 DECnet (not yet implemented) + + Zero or greater: ttname is a terminal device name. + Zero means a direct connection (don't use modem + signals). Positive means use modem signals depending + on the current setting of ttcarr (see ttscarr()). + + timo: + > 0: number of seconds to wait for open() to return + before timing out. + <=0: no timer, wait forever (e.g. for incoming + call). + For real tty devices, ttopen() attempts to gain + exclusive access to the tty device, for example in + UNIX by creating a "lockfile" (in other operating + systems, like VMS, exclusive access probably + requires no special action). + + Side effects: + Copies its arguments and the tty file descriptor to global + variables that are available to the other tty-related + functions, with the lcl value altered as described above. + Gets all parameters and settings associated with the line + and puts them in a global area, so that they can be + restored by ttres(), e.g. when the device is closed. + + Returns: + 0: on success + -5: if device is in use + -4: if access to device is denied + -3: if access to lock mechanism denied + -2: upon timeout waiting for device to open + -1: on other error + + int + ttpkt(speed,flow,parity) long speed; int flow, parity; + Puts the currently open tty device into the appropriate modes + for transmitting and receiving Kermit packets. + + Arguments: + + speed: + if speed > -1, and the device is a true tty device, + and Kermit is in local mode, ttpkt also sets the + speed. + + flow: + if in the range 0-3, ttpkt selects the corresponding + type of flow control. Currently 0 is defined as no + flow control, 1 is Xon/Xoff, and no other types are + defined. If (and this is a horrible hack, but it + goes back many years and will be hard to eradicate) + flow is 4, then the appropriate tty modes are set + for modem dialing, a special case in which we talk + to a modem-controlled line without requiring + carrier. If flow is 5, then we require carrier. + + parity: + This is simply copied into a global variable so that + other functions (like ttinl, ttinc, etc) can use it. + + Side effects: + Copies its arguments to global variables, flushes the + terminal device input buffer. + + Returns: + -1: on error. + 0: on success. + + int + ttsetflow(int) + Enables the given type of flow control on the open serial + communications device immediately. Arguments are the FLO_xxx + values from ckcdeb.h, except FLO_DIAL, FLO_DIAX, or FLO_AUTO, + which are not actual flow-control types. Returns 0 on success, + -1 on failure. + + #ifdef TTSPDLIST + long * + ttspdlist() + Returns a pointer to an array of longs, or NULL on failure. On + success, element 0 of the array contains number, n, indicating + how many follow. Elements 1-n are serial speeds, expressed in + bits per second, that are legal on this platform. The user + interface may use this list to construct a menu, keyword table, + etc. + + #endif /* TTSPDLIST */ + + int + ttres() + Restores the tty device to the modes and settings that were in + effect at the time it was opened (see ttopen). Returns: + -1: on error. + 0: on success. + + int + ttruncmd(string) char * string; + Runs the given command on the local system, but redirects its + input and output to the communication (SET LINE, SET PORT, or + SET HOST) device. Returns: + 0: on failure. + 1: on success. + + int + ttscarr(carrier) int carrier; + Copies its argument to a variable that is global to the other + tty-related functions, and then returns it. The values for + carrier are defined in ckcdeb.h: CAR_ON, CAR_OFF, CAR_AUTO. + ttopen(), ttpkt(), and ttvt() use this variable when deciding + how to open the tty device and what modes to select. The + meanings are these: + + CAR_OFF: Ignore carrier at all times. + CAR_ON: Require carrier at all times, except when dialing. This means, + for example, that ttopen() could hang forever waiting for carrier if it + is not present. + CAR_AUTO: If the modem type is zero (i.e. the connection is direct), + this is the same as CAR_OFF. If the modem type is positive, then heed + carrier during CONNECT (ttvt mode), but ignore it at other times + (packet mode, during SET LINE, etc). Compatible with pre-5A versions of + C-Kermit. This should be the default carrier mode. + + Kermit's DIAL command ignores the carrier setting, but ttopen(), + ttvt(), and ttpkt() all honor the carrier option in effect at + the time they are called. None of this applies to remote mode + (the tty device is the job's controlling terminal) or to network + host connections (modem type is negative). + + int + ttsndb() + Sends a BREAK signal on the tty device. On a real tty device, + send a real BREAK lasting approximately 275 milliseconds. If + this is not possible, simulate a BREAK by (for example) dropping + down some very low baud rate, like 50, and sending a bunch of + null characters. On a network connection, do the appropriate + network protocol for BREAK. Returns: + -1: on error. + 0: on success. + + int + ttsndlb() + Like ttsndb(), but sends a "Long BREAK" (approx 1.5 seconds). + For network connections, it is identical to ttsndb(). Currently, + this function is used only if CK_LBRK is defined (as it is for + UNIX and VMS). + + int + ttsspd(cps) int cps; + For serial devices only, set the device transmission speed to + (note carefully) TEN TIMES the argument. The argument is in + characters per second, but transmission speeds are in bits per + second. cps are used rather than bps because high speeds like + 38400 are not expressible in a 16-bit int but longs cannot be + used because keyword-table values are ints and not longs. If the + argument is 7, then the bps is 75, not 70. If the argument is + 888, this is a special code for 75/1200 split-speed operation + (75 bps out, 1200 bps in). Returns: + -1: on error, meaning the requested speed is not valid or + available. + >=0: on success (don't try to use this value for anything). + + int + ttvt(speed,flow) long speed; int flow; + Puts the currently open tty device into the appropriate modes + for terminal emulation. The arguments are interpreted as in + ttpkt(). Side effects: ttvt() stores its arguments in global + variables, and sets a flag that it has been called so that + subsequent calls can be ignored so long as the arguments are the + same as in the last effective call. Other functions, such as + ttopen(), ttclose(), ttres(), ttvt(), etc, that change the tty + device in any way must unset this flag. In UNIX Kermit, this + flag is called tvtflg. + + int + ttwmdm(mdmsig,timo) int mdmsig, timo; + Waits up to timo seconds for all of the given modem signals to + appear. mdmsig is a bit mask, in which a bit is on (1) or off + (0) according to whether the corresponding signal is to be + waited for. These symbols are defined in ckcdeb.h: + BM_CTS (bit 0) means wait for Clear To Send + BM_DSR (bit 1) means wait for Data Set Ready + BM_DCD (bit 2) means wait for Carrier Detect + Returns: + -3: Not implemented. + -2: This line does not have modem control. + -1: Timeout: time limit exceeded before all signals were + detected. + 1: Success. + + int + ttxin(n,buf) int n; CHAR *buf; + Reads x characters from the tty device into the specified buf, + stripping parity if parity is not none. This call waits forever, + there is no timeout. This function is designed to be called only + when you know that at least x characters are waiting to be read + (as determined, for example, by ttchk()). This function should + use the same buffer as ttinc(). + + int + txbufr(timo) int timo; + Reads characters into the internal communications input buffer. + timo is a timeout interval, in seconds. 0 means no timeout, wait + forever. Called by ttinc() (and possibly ttxin() and ttinl()) + when the communications input buffer is empty. The buffer should + be called ttxbuf[], its length is defined by the symbol TXBUFL. + The global variable txbufn is the number of characters available + to be read from ttxbuf[], and txbufp is the index of the next + character to be read. Should not be called if txbufn > 0, in + which case the buffer does not need refilling. This routine + returns: + -2: Communications disconnect + -1: Timeout + >=0: A character (0 - 255) On success, the first character that + was read, with the variables txbufn and txbufp set appropriately + for any remaining characters. + NOTE: Currently this routine is used internally only by the UNIX + and VMS versions. The aim is to make it available to all + versions so there is one single coherent and efficient way of + reading from the communications device or network. + +4.E.2.6. Miscellaneous system-dependent functions + + VOID + ztime(s) char **s; + Returns a pointer, s, to the current date-and-time string in s. + This string must be in the fixed-field format associated with + the C runtime asctime() function, like: "Sun Sep 16 13:23:45 + 1973\n" so that callers of this function can extract the + different fields. The pointer value is filled in by ztime, and + the data it points to is not safe, so should be copied to a safe + place before use. ztime() has no return value. As a side effect, + this routine can also fill in the following two external + variables (which must be defined in the system-dependendent + modules for each platform): + long ztusec: Fraction of seconds of clock time, microseconds. + long ztmsec: Fraction of seconds of clock time, milliseconds. + If these variables are not set by zstime(), they remain at their + initial value of -1L. + + int + gtimer() + Returns the current value of the elapsed time counter in seconds + (see rtimer), or 0 on any kind of error. + + #ifdef GFTIMER + CKFLOAT + gftimer() + Returns the current value of the elapsed time counter in + seconds, as a floating point number, capable of representing not + only whole seconds, but also the fractional part, to the + millisecond or microsecond level, whatever precision is + available. Requires a function to get times at subsecond + precision, as well as floating-point support. That's why it's + #ifdef'd. + + #endif /* GFTIMER */ + + int + msleep(m) int m; + Sleeps (pauses, does nothing) for m milliseconds (a millisecond + is one thousandth of a second). Returns: + -1: on failure. + 0: on success. + + VOID + rtimer() + Sets the elapsed time counter to zero. If you want to time how + long an operation takes, call rtimer() when it starts and gtimer + when it ends. rtimer() has no return value. + + #ifdef GFTIMER + VOID + rftimer() + Sets the elapsed time counter to zero. If you want to time how + long an operation takes, call rftimer() when it starts and + gftimer when it ends. rftimer() has no return value. Note: + rftimer() is to be used with gftimer() and rtimer() is to be + used with gtimer(). See the rftimer() description. + + #endif /* GFTIMER */ + + int + sysinit() + Does whatever needs doing upon program start. In particular, if + the program is running in any kind of privileged mode, turns off + the privileges (see priv_ini()). Returns: + -1: on error. + 0: on success. + + int + syscleanup() + Does whatever needs doing upon program exit. Returns: + -1: on error. + 0: on success. + + int + psuspend() + Suspends the Kermit process, puts it in the background so it can + be continued ("foregrounded") later. Returns: + -1: if this function is not supported. + 0: on success. + + [ [124]Contents ] [ [125]C-Kermit ] [ [126]Kermit Home ] + +4.F. Group F: Network Support + + As of version 5A, C-Kermit includes support for several networks. + Originally, this was just worked into the ttopen(), ttclos(), ttinc(), + ttinl(), and similar routines in [127]ckutio.c. But this made it + impossible to share this code with non-UNIX versions, like VMS, AOS/VS, + OS/2, etc. So as of edit 168, network code has been separated out into + its own module and header file, ckcnet.c and ckcnet.h: + + [128]ckcnet.h: Network-related symbol definitions. + [129]ckcnet.c: Network i/o (TCP/IP, X.25, etc), shared by most + platforms. + [130]cklnet.c: Network i/o (TCP/IP, X.25, etc) specific to Stratus + VOS. + + The routines and variables in these modules fall into two categories: + + 1. Support for specific network packages like SunLink X.25 and TGV + MultiNet, and: + 2. support for specific network virtual terminal protocols like CCITT + X.3 and TCP/IP Telnet. + + Category (1) functions are analogs to the tt*() functions, and have + names like netopen, netclos, nettinc, etc. Group A-D modules do not + (and must not) know anything about these functions -- they continue to + call the old Group E functions (ttopen, ttinc, etc). Category (2) + functions are protocol specific and have names prefixed by a protocol + identifier, like tn for telnet x25 for X.25. + + ckcnet.h contains prototypes for all these functions, as well as symbol + definitions for network types, protocols, and network- and protocol- + specific symbols, as well as #includes for the header files necessary + for each network and protocol. + + The following functions are to be provided for networks that do not use + normal system i/o (open, read, write, close): + + int + netopen() + To be called from within ttopen() when a network connection is + requested. Calling conventions and purpose same as Group E + ttopen(). + + int + netclos() + To be called from within ttclos() when a network connection is + being closed. Calling conventions and purpose same as Group E + ttclos(). + + int + nettchk() + To be called from within ttchk(). Calling conventions and + purpose same as Group E ttchk(). + + int + netflui() + To be called from within ttflui(). Calling conventions and + purpose same as Group E ttflui(). + + int + netbreak() + To send a network break (attention) signal. Calling conventions + and purpose same as Group E ttsndbrk(). + + int + netinc() + To get a character from the network. Calling conventions same as + Group E ttsndbrk(). + + int + nettoc() + Send a "character" (byte) to the network. Calling conventions + same as Group E ttoc(). + + int + nettol() + Send a "line" (sequence of bytes) to the network. Calling + conventions same as Group E ttol(). + + Conceivably, some systems support network connections simply by letting + you open a device of a certain name and letting you do i/o to it. + Others (like the Berkeley sockets TCP/IP library on UNIX) require you + to open the connection in a special way, but then do normal i/o (read, + write). In such a case, you would use netopen(), but you would not use + nettinc, nettoc, etc. + + VMS TCP/IP products have their own set of functions for all network + operations, so in that case the full range of netxxx() functions is + used. + + The technique is to put a test in each corresponding ttxxx() function + to see if a network connection is active (or is being requested), test + for which kind of network it is, and if necessary route the call to the + corresponding netxxx() function. The netxxx() function must also + contain code to test for the network type, which is available via the + global variable ttnet. + + [ [131]Contents ] [ [132]C-Kermit ] [ [133]Kermit Home ] + +4.F.1. Telnet Protocol + + (This section needs a great deal of updating...) + + As of edit 195, Telnet protocol is split out into its own files, since + it can be implemented in remote mode, which does not have a network + connection: + + [134]ckctel.h: Telnet protocol symbol definitions. + [135]ckctel.c: Telnet protocol. + + The Telnet protocol is supported by the following variables and + routines: + + int tn_init + Nonzero if telnet protocol initialized, zero otherwise. + + int + tn_init() + Initialize the telnet protocol (send initial options). + + int + tn_sopt() + Send a telnet option. + + int + tn_doop() + Receive and act on a telnet option from the remote. + + int + tn_sttyp() + Send terminal type using telnet protocol. + +4.F.2. FTP Protocol + + (To be filled in...) + +4.F.3. HTTP Protocol + + (To be filled in...) + +4.F.4. X.25 Networks + + These routines were written SunLink X.25 and have since been adapted to + at least on one other: IBM AIXLink/X.25. + + int + x25diag() + Reads and prints X.25 diagnostics + + int + x25oobh() + X.25 out of band signal handler + + int + x25intr() + Sends X.25 interrupt packet + + int + x25reset() + Resets X.25 virtual circuit + + int + x25clear() + Clear X.25 virtual circuit + + int + x25stat() + X.25 status + + int + setqbit() + Sets X.25 Q-bit + + int + resetqbit() + Resets X.25 Q-bit + + int + x25xin() + Reads n characters from X.25 circuit. + + int + x25inl() + Read a Kermit packet from X.25 circuit. + + [ [136]Contents ] [ [137]C-Kermit ] [ [138]Kermit Home ] + +4.F.5. Adding New Network Types + + Example: Adding support for IBM X.25 and Hewlett Packard X.25. First, + add new network type symbols for each one. There are already some + network types defined for other X.25 packages: + + NET_SX25 is the network-type ID for SunLink X.25. + NET_VX25 is the network-type ID for VOS X.25. + + So first you should new symbols for the new network types, giving them + the next numbers in the sequence, e.g.: + +#define NET_HX25 11 /* Hewlett-Packard X.25 */ +#define NET_IX25 12 /* IBM X.25 */ + + This is in ckcnet.h. + + Then we need symbols to say that we are actually compiling in the code + for these platforms. These would be defined on the cc command line: + + -DIBMX25 (for IBM) + -DHPX25 (for HP) + + So we can build C-Kermit versions for AIX and HP-UX both with and + without X.25 support (since not all AIX and IBM systems have the needed + libraries, and so an executable that was linked with them might no + load). + + Then in ckcnet.h: + +#ifdef IBMX25 +#define ANYX25 +#endif /* IBMX25 */ + +#ifdef HPX25 +#define ANYX25 +#endif /* HPX25 */ + + And then use ANYX25 for code that is common to all of them, and IBMX25 + or HPX25 for code specific to IBM or HP. + + It might also happen that some code can be shared between two or more + of these, but not the others. Suppose, for example, that you write code + that applies to both IBM and HP, but not Sun or VOS X.25. Then you add + the following definition to ckcnet.h: + +#ifndef HPORIBMX25 +#ifdef HPX25 +#define HPORIBMX25 +#else +#ifdef IBMX25 +#define HPORIBMX25 +#endif /* IBMX25 */ +#endif /* HPX25 */ +#endif /* HPORIBMX25 */ + + You can NOT use constructions like "#if defined (HPX25 || IBMX25)"; + they are not portable. + + [ [139]Contents ] [ [140]C-Kermit ] [ [141]Kermit Home ] + +4.G. Group G: Formatted Screen Support + + So far, this is used only for the fullscreen local-mode file transfer + display. In the future, it might be extended to other uses. The + fullscreen display code is in and around the routine screenc() in + [142]ckuusx.c. + + In the UNIX version, we use the curses library, plus one call from the + termcap library. In other versions (OS/2, VMS, etc) we insert dummy + routines that have the same names as curses routines. So far, there are + two methods for simulating curses routines: + + 1. In VMS, we use the Screen Management Library (SMG), and insert + stubs to convert curses calls into SMG calls. + 2. In OS/2, we use the MYCURSES code, in which the stub routines + actually emit the appropriate escape sequences themselves. + + Here are the stub routines: + + int + tgetent(char *buf, char *term) + Arguments are ignored. Returns 1 if the user has a supported + terminal type, 0 otherwise. Sets a global variable (for example, + "isvt52" or "isdasher") to indicate the terminal type. + + VOID + move(int row, int col) + Sends the escape sequence to position the cursor at the + indicated row and column. The numbers are 0-based, e.g. the home + position is 0,0. + + int + clear() + Sends the escape sequence to clear the screen. + + int + clrtoeol() + Sends the escape sequence to clear from the current cursor + position to the end of the line. + + In the MYCURSES case, code must be added to each of the last three + routines to emit the appropriate escape sequences for a new terminal + type. + + clearok(curscr), wrefresh() + In real curses, these two calls are required to refresh the + screen, for example after it was fractured by a broadcast + message. These are useful only if the underlying screen + management service keeps a copy of the entire screen, as curses + and SMG do. C-Kermit does not do this itself. + + [ [143]Contents ] [ [144]C-Kermit ] [ [145]Kermit Home ] + +4.H. Group H: Pseudoterminal Support + + (To be filled in...) + +4.I. Group I: Security + + (To be filled in...) + + [ [146]Contents ] [ [147]C-Kermit ] [ [148]Kermit Home ] + +APPENDIX I. FILE PERMISSIONS + +I.1. Format of System-Dependent File Permissions in A-Packets + + The format of this field (the "," attribute) is interpreted according + to the System ID ("." Attribute). + + For UNIX (System ID = U1), it's the familiar 3-digit octal number, the + low-order 9 bits of the filemode: Owner, Group, World, e.g. 660 = + read/write access for owner and group, none for world, recorded as a + 3-digit octal string. High-order UNIX permission bits are not + transmitted. + + For VMS (System ID = D7), it's a 4-digit hex string, representing the + 16-bit file protection WGOS fields (World,Group,Owner,System), in that + order (which is the reverse of how they're shown in a directory + listing); in each field, Bit 0 = Read, 1 = Write, 2 = Execute, 3 = + Delete. A bit value of 0 means permission is granted, 1 means + permission is denied. Sample: + + r-01-00-^A/!FWERMIT.EXE'" + s-01-00-^AE!Y/amd/watsun/w/fdc/new/wermit.exe.DV + r-02-01-^A]"A."D7""B8#119980101 18:14:05!#8531&872960,$A20B-!7(#512@ #.Y + s-02-01-^A%"Y.5! + + A VMS directory listing shows the file's protection as (E,RWED,RED,RE) + which really means (S=E,O=RWED,G=RED,W=RE), which is reverse order from + the internal storage, so (RE,RED,RWED,E). Now translate each letter to + its corresponding bit: + + RE=0101, RED=1101, RWED=1111, E=0010 + + Now reverse the bits: + + RE=1010, RED=0010, RWED=0000, E=1101 + + This gives the 16-bit quantity: + + 1010001000001101 + + This is the internal representation of the VMS file permission; in hex: + + A20B + + as shown in the sample packet above. + + The VMS format probably would also apply to RSX or any other FILES-11 + system. + +I.2. Handling of Generic Protection + + To be used when the two systems are different (and/or do not recognize + or understand each other's local protection codes). + + First of all, the book is wrong. This should not be the World + protection, but the Owner protection. The other fields should be set + according to system defaults (e.g. UNIX umask, VMS default protection, + etc), except that no non-Owner field should give more permissions than + the Owner field. + + [ [149]Top ] [ [150]Contents ] [ [151]C-Kermit Home ] [ [152]Kermit + Home ] + __________________________________________________________________ + + + C-Kermit Program Logic Manual / [153]The Kermit Project / + [154]kermit@columbia.edu / 30 June 2011 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/ckfaq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ + 12. http://www.columbia.edu/ + 13. http://www.columbia.edu/kermit/ckcplm.html + 14. http://www.columbia.edu/kermit/ckermit.html + 15. http://www.columbia.edu/kermit/index.html + 16. http://www.columbia.edu/kermit/ckcplm.html#x1 + 17. http://www.columbia.edu/kermit/ckcplm.html#x2 + 18. http://www.columbia.edu/kermit/ckcplm.html#x3 + 19. http://www.columbia.edu/kermit/ckcplm.html#x4 + 20. http://www.columbia.edu/kermit/ckcplm.html#x4.A + 21. http://www.columbia.edu/kermit/ckcplm.html#x4.B + 22. http://www.columbia.edu/kermit/ckcplm.html#x4.C + 23. http://www.columbia.edu/kermit/ckcplm.html#x4.D + 24. http://www.columbia.edu/kermit/ckcplm.html#x4.E + 25. http://www.columbia.edu/kermit/ckcplm.html#x4.F + 26. http://www.columbia.edu/kermit/ckcplm.html#x4.G + 27. http://www.columbia.edu/kermit/ckcplm.html#x4.H + 28. http://www.columbia.edu/kermit/ckcplm.html#x4.I + 29. http://www.columbia.edu/kermit/ckcplm.html#xa1 + 30. http://www.columbia.edu/kermit/ckcplm.html#contents + 31. http://www.columbia.edu/kermit/ckcplm.html#contents + 32. http://www.columbia.edu/kermit/ckermit.html + 33. http://www.columbia.edu/kermit/index.html + 34. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w + 35. http://www.columbia.edu/kermit/ckcplm.html#contents + 36. http://www.columbia.edu/kermit/ckermit.html + 37. http://www.columbia.edu/kermit/index.html + 38. http://www.columbia.edu/kermit/ckcplm.html#x3.2 + 39. http://www.columbia.edu/kermit/ckcplm.html#contents + 40. http://www.columbia.edu/kermit/ckermit.html + 41. http://www.columbia.edu/kermit/index.html + 42. http://www.columbia.edu/kermit/ckcplm.html#x4.A + 43. http://www.columbia.edu/kermit/ckcplm.html#contents + 44. http://www.columbia.edu/kermit/ckermit.html + 45. http://www.columbia.edu/kermit/index.html + 46. http://www.columbia.edu/kermit/ckcplm.html#contents + 47. http://www.columbia.edu/kermit/ckermit.html + 48. http://www.columbia.edu/kermit/index.html + 49. http://www.columbia.edu/kermit/ckcplm.html#contents + 50. http://www.columbia.edu/kermit/ckermit.html + 51. http://www.columbia.edu/kermit/index.html + 52. ftp://kermit.columbia.edu/kermit/c-kermit/ckclib.h + 53. ftp://kermit.columbia.edu/kermit/c-kermit/ckclib.c + 54. http://www.columbia.edu/kermit/ckcplm.html#x3.1 + 55. http://www.columbia.edu/kermit/ckcplm.html#contents + 56. http://www.columbia.edu/kermit/ckermit.html + 57. http://www.columbia.edu/kermit/index.html + 58. ftp://kermit.columbia.edu/kermit/c-kermit/ckcsym.h + 59. ftp://kermit.columbia.edu/kermit/c-kermit/ckcasc.h + 60. ftp://kermit.columbia.edu/kermit/c-kermit/ckcsig.h + 61. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 62. ftp://kermit.columbia.edu/kermit/c-kermit/ckcker.h + 63. ftp://kermit.columbia.edu/kermit/c-kermit/ckcxla.h + 64. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c + 65. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w + 66. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfns.c + 67. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfn2.c + 68. ftp://kermit.columbia.edu/kermit/c-kermit/ckcfn3.c + 69. http://www.columbia.edu/kermit/ckcplm.html#x4.B + 70. http://www.columbia.edu/kermit/ckcplm.html#x4.E + 71. http://www.columbia.edu/kermit/ckcplm.html#x4.D + 72. http://www.columbia.edu/kermit/ckcplm.html#contents + 73. http://www.columbia.edu/kermit/ckermit.html + 74. http://www.columbia.edu/kermit/index.html + 75. http://www.columbia.edu/kermit/ckcplm.html#x4.B + 76. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.c + 77. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.h + 78. ftp://kermit.columbia.edu/kermit/c-kermit/ckcxla.h + 79. ftp://kermit.columbia.edu/kermit/c-kermit/ckuxla.h + 80. ftp://kermit.columbia.edu/kermit/c-kermit/ckmxla.h + 81. ftp://kermit.columbia.edu/kermit/c-kermit/ck?xla + 82. ftp://kermit.columbia.edu/kermit/c-kermit/ckcuni.h + 83. ftp://kermit.columbia.edu/kermit/c-kermit/ckcuni.c + 84. http://www.columbia.edu/kermit/ckcplm.html#contents + 85. http://www.columbia.edu/kermit/ckermit.html + 86. http://www.columbia.edu/kermit/index.html + 87. http://www.columbia.edu/kermit/ckcplm.html#x4.B + 88. ftp://kermit.columbia.edu/kermit/c-kermit/ckucmd.h + 89. ftp://kermit.columbia.edu/kermit/c-kermit/ckucmd.c + 90. http://www.columbia.edu/kermit/ckcplm.html#x4.E + 91. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.h + 92. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusr.c + 93. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus2.c + 94. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus3.c + 95. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus4.c + 96. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusy.c + 97. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c + 98. ftp://kermit.columbia.edu/kermit/c-kermit/ckuver.h + 99. ftp://kermit.columbia.edu/kermit/c-kermit/ckuscr.c + 100. ftp://kermit.columbia.edu/kermit/c-kermit/ckudia.c + 101. ftp://kermit.columbia.edu/kermit/c-kermit/ckucon.c + 102. ftp://kermit.columbia.edu/kermit/c-kermit/ckucns.c + 103. http://www.columbia.edu/kermit/ckcplm.html#x4.E + 104. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c + 105. http://www.columbia.edu/kermit/ckcplm.html#contents + 106. http://www.columbia.edu/kermit/ckermit.html + 107. http://www.columbia.edu/kermit/index.html + 108. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 109. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 110. ftp://kermit.columbia.edu/kermit/c-kermit/ckusig.c + 111. ftp://kermit.columbia.edu/kermit/c-kermit/ckvfio.c + 112. ftp://kermit.columbia.edu/kermit/c-kermit/ckusig.c + 113. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c + 114. http://www.columbia.edu/kermit/ckcplm.html#contents + 115. http://www.columbia.edu/kermit/ckermit.html + 116. http://www.columbia.edu/kermit/index.html + 117. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 118. ftp://kermit.columbia.edu/kermit/c-kermit/ckvtio.c + 119. http://www.columbia.edu/kermit/ckcplm.html#x2 + 120. http://www.columbia.edu/kermit/ckcplm.html#xa1 + 121. http://www.columbia.edu/kermit/ckuins.html + 122. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h + 123. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 124. http://www.columbia.edu/kermit/ckcplm.html#contents + 125. http://www.columbia.edu/kermit/ckermit.html + 126. http://www.columbia.edu/kermit/index.html + 127. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 128. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.h + 129. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.c + 130. ftp://kermit.columbia.edu/kermit/c-kermit/cklnet.c + 131. http://www.columbia.edu/kermit/ckcplm.html#contents + 132. http://www.columbia.edu/kermit/ckermit.html + 133. http://www.columbia.edu/kermit/index.html + 134. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.h + 135. ftp://kermit.columbia.edu/kermit/c-kermit/ckctel.c + 136. http://www.columbia.edu/kermit/ckcplm.html#contents + 137. http://www.columbia.edu/kermit/ckermit.html + 138. http://www.columbia.edu/kermit/index.html + 139. http://www.columbia.edu/kermit/ckcplm.html#contents + 140. http://www.columbia.edu/kermit/ckermit.html + 141. http://www.columbia.edu/kermit/index.html + 142. ftp://kermit.columbia.edu/kermit/c-kermit/ckuusx.c + 143. http://www.columbia.edu/kermit/ckcplm.html#contents + 144. http://www.columbia.edu/kermit/ckermit.html + 145. http://www.columbia.edu/kermit/index.html + 146. http://www.columbia.edu/kermit/ckcplm.html#contents + 147. http://www.columbia.edu/kermit/ckermit.html + 148. http://www.columbia.edu/kermit/index.html + 149. http://www.columbia.edu/kermit/ckcplm.html#top + 150. http://www.columbia.edu/kermit/ckcplm.html#contents + 151. http://www.columbia.edu/kermit/ckermit.html + 152. http://www.columbia.edu/kermit/index.html + 153. http://www.columbia.edu/kermit/index.html + 154. mailto:kermit@columbia.edu diff --git a/ckermit.ini b/ckermit.ini new file mode 100644 index 0000000..b30f389 --- /dev/null +++ b/ckermit.ini @@ -0,0 +1,8 @@ +COMMENT - Standard C-Kermit initialization file +; +echo +echo The very long standard initialization file that was distributed +echo with C-Kermit 6, 7, and 8 is no longer recommended as "standard", +echo since its features were little used. It is still available in +echo the C-Kermit distribution as ockermit.ini. +echo diff --git a/ckermit70.txt b/ckermit70.txt new file mode 100644 index 0000000..4661a51 --- /dev/null +++ b/ckermit70.txt @@ -0,0 +1,17661 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +Supplement to [11]Using C-Kermit , 2nd Edition + +For C-Kermit 7.0 + +As of C-Kermit version: 7.0.196 +This file created: 8 February 2000 +This file last updated: +Mon Sep 13 08:52:41 2010 + + +Authors: Frank da Cruz and Christine M. Gianone +Address: The Kermit Project + Columbia University + 612 West 115th Street + New York NY 10025-7799 + USA +Fax: +1 (212) 662-6442 +E-Mail: [12]kermit-support@columbia.edu +Web: [13]http://www.columbia.edu/kermit/ +Or: [14]http://www.kermit-project.org/ +Or: [15]http://www.columbia.nyc.ny.us/kermit/ + +NOTICES + + This document: + Copyright © 1997, 2000, Frank da Cruz and Christine M. Gianone. + All rights reserved. + + Kermit 95: + Copyright © 1995, 2000, Trustees of Columbia University in the + City of New York. All rights reserved. + + C-Kermit: + Copyright © 1985, 2000, + Trustees of Columbia University in the City of New York. All + rights reserved. See the C-Kermit [16]COPYING.TXT file or the + copyright text in the [17]ckcmai.c module for disclaimer and + permissions. + + When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or SSL + protocol are included: + Portions Copyright © 1990, Massachusetts Institute of + Technology. + Portions Copyright © 1991, 1993 Regents of the University of + California. + Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T. + Portions Copyright © 1997, Stanford University. + Portions Copyright © 1995-1997, Eric Young . + + For the full text of the third-party copyright notices, see + [18]Appendix V. + +WHAT IS IN THIS FILE + + This file lists changes made to C-Kermit since the second edition of + the book [19]Using C-Kermit was published and C-Kermit 6.0 was released + in November 1996. Use this file as a supplement to the second edition + of Using C-Kermit until the third edition is published some time in + 2000. If the "most recent update" shown above is long ago, contact + Columbia University to see if there is a newer release. + + For further information, also see the [20]CKCBWR.TXT ("C-Kermit + beware") file for hints, tips, tricks, restrictions, frequently asked + questions, etc, plus the system-specific "beware file", e.g. + [21]CKUBWR.TXT for UNIX, [22]CKVBWR.TXT for VMS, etc, and also any + system-specific update files such as KERMIT95.HTM for Kermit 95 (in the + DOCS\MANUAL\ subdirectory of your K95 directory). + + This Web-based copy of the C-Kermit 7.0 update notes supersedes the + plain-text CKERMIT2.TXT file. All changes after 19 January 2000 + appear only here in the Web version. If you need an up-to-date + plain-text copy, use your Web browser to save this page as plain + text. + +ABOUT FILENAMES + + In this document, filenames are generally shown in uppercase, but on + file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS, + lowercase names are used: [23]ckubwr.txt, [24]ckermit70.txt, etc. + +ADDITIONAL FILES + + Several other files accompany this new Kermit release: + + SECURITY.TXT + Discussion of Kermit's new authentication and encryption + features: + + + [25]Plain-text version + + [26]HTML (hypertext) version + + IKSD.TXT + How to install and manage an Internet Kermit Service Daemon. + + + [27]Plain-text version + + [28]HTML (hypertext) version + + Also see [29]cuiksd.htm for instructions for use. + + TELNET.TXT + A thorough presentation of Kermit's new advanced Telnet features + and controls. + + + [30]Plain-text version + + [31]HTML (hypertext) version + +THE NEW C-KERMIT LICENSE + + The C-Kermit license was rewritten for version 7.0 to grant automatic + permission to packagers of free operating-system distributions to + include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD, + NetBSD, etc. The new license is in the [32]COPYING.TXT file, and is + also displayed by C-Kermit itself when you give the VERSION or + COPYRIGHT command. The new C-Kermit license does not apply to + [33]Kermit 95. + +ACKNOWLEDGMENTS + + Thanks to Jeff Altman, who joined the Kermit Project in 1995, for much + of what you see in C-Kermit 7.0, especially in the networking and + security areas, and his key role in designing and implementing the + Internet Kermit Service Daemon. And special thanks to Lucas Hart for + lots of help with the VMS version; to Peter Eichhorn for continuous + testing on the full range of HP-UX versions and for a consolidated set + of HP-UX makefile targets; and to Colin Allen, Mark Allen, Roger Allen, + Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson Beebe, + Gerry Belanger, Jeff Bernsten, Mark Berryman, John Bigg, Volker + Borchert, Jonathan Boswell, Tim Boyer, Frederick Bruckman, Kenneth + Cochran, Jared Crapo, Bill Delaney, Igor Sobrado Delgado, Clarence + Dold, Joe Doupnik, John Dunlap, Max Evarts, Patrick French, Carl + Friedberg, Carl Friend, Hirofumi Fujii, Andrew Gabriel, Gabe Garza, + Boyd Gerber, David Gerber, George Gilmer, Hunter Goatley, DJ Hagberg, + Kevin Handy, Andy Harper, Randolph Herber, Sven Holström, Michal + Jaegermann, Graham Jenkins, Dick Jones, Terry Kennedy, Robert D Keys, + Nick Kisseberth, Igor Kovalenko, David Lane, Adam Laurie, Jeff + Liebermann, Eric Lonvick, Hoi Wan Louis, Arthur Marsh, Gregorie Martin, + Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup, Daniel + Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Steve Rance, + Stephen Riehm, Nigel Roles, Larry Rosenman, Jay S Rouman, David + Sanderson, John Santos, Michael Schmitz, Steven Schultz, Bob Shair, + Richard Shuford, Fred Smith, Michael Sokolov, Jim Spath, Peter Szell, + Ted T'so, Brian Tillman, Linus Torvalds, Patrick Volkerding, Martin + Vorländer, Steve Walton, Ken Weaverling, John Weekley, Martin Whitaker, + Jim Whitby, Matt Willman, Joellen Windsor, Farrell Woods, and many + others for binaries, hosting, reviews, suggestions, advice, bug + reports, and all the rest over the 3+ year C-Kermit 7.0 development + cycle. Thanks to Russ Nelson and the board of the Open Software + Initiative ([34]http://www.opensource.org) for their cooperation in + developing the new C-Kermit license and to the proprietors of those + free UNIX distributions that have incorporated C-Kermit 7.0 for their + cooperation and support, especially FreeBSD's Jörg Wunsch. + +NOTE TO KERMIT 95 USERS + + Kermit 95 and C-Kermit share the same command and scripting language, + the same Kermit file-transfer protocol implementation, and much else + besides. + + Like the book [35]Using C-Kermit, this file concentrates on the aspects + of C-Kermit that are common to all versions: UNIX, VMS, Windows, OS/2, + VOS, AOS/VS, etc. Please refer to your Kermit 95 documentation for + information that is specific to Kermit 95. + + C-Kermit 7.0 corresponds to Kermit 95 1.1.19. + +C-KERMIT VERSIONS AND VERSION NUMBERS + + "C-Kermit" refers to all the many programs that are compiled in whole + or in part from common C-language source code, comprising: + + * A Kermit file transfer protocol module + * A command parser and script execution module + * A modem-dialing module + * A network support module + * A character-set translation module. + + and several others. These "system-independent" modules are combined + with system-dependent modules for each platform to provide the required + input/output functions, and also in some cases overlaid with an + alternative user interface, such as Macintosh Kermit's point-and-click + interface, and in some cases also a terminal emulator, as Kermit 95. + + The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then + (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and + so on, with the specific edit number in parentheses, for example + 4E(072) or 5A(188). This scheme was used through 5A(191), but now we + have gone back to the traditional numbering scheme with decimal points: + major.minor.edit; for example 7.0.196. Internal version numbers (the + \v(version) variable), however, are compatible in C-Kermit 5A upwards. + + Meanwhile, C-Kermit derivatives for some platforms (Windows, Macintosh) + might go through several releases while C-Kermit itself remains the + same. These versions have their own platform-specific version numbers, + such as Kermit 95 1.1.1, 1.1.2, and so on. + + C-Kermit Version History: + + 1.0 1981-1982 Command-line only, 4.2 BSD UNIX only + 2.0 (*) (who remembers...) + 3.0 May 1984 Command-line only, supports several platforms + 4.0-4.1 Feb-Apr 1985 (*) First interactive and modular version + 4C(050) May 1985 + 4D(060) April 1986 + 4E(066) August 1987 Long packets + 4E(068) January 1988 + 4E(072) January 1989 + 4F(095) August 1989 (*) Attribute packets + 5A(188) November 1992 Scripting, TCP/IP, sliding windows (1) + 5A(189) September 1993 Control-char unprefixing + 5A(190) October 1994 Recovery + 5A(191) April 1995 OS/2 only + 6.0.192 September 1996 Intelligent dialing, autodownload, lots more (2) + 6.1.193 1997-98 (*) Development only + 6.1.194 June 1998 K95 only - switches, directory recursion, more + 7.0.195 August 1999 IKSD + more (CU only as K95 1.1.18-CU) + 7.0.196 1 January 2000 Unicode, lots more + + (*) Never formally released (4.0 was a total rewrite) + (1) Using C-Kermit, 1st Edition + (2) Using C-Kermit, 2nd Edition + +CONTENTS + + I. [36]C-KERMIT DOCUMENTATION + + II. [37]NEW FEATURES + + (0) [38]INCOMPATIBILITIES WITH PREVIOUS RELEASES + (1) [39]PROGRAM AND FILE MANAGEMENT AND COMMANDS + 1.0. [40]Bug fixes + 1.1. [41]Command Continuation + 1.2. [42]Editor Interface + 1.3. [43]Web Browser and FTP Interface + 1.4. [44]Command Editing + 1.5. [45]Command Switches + 1.5.1. [46]General Switch Syntax + 1.5.2. [47]Order and Effect of Switches + 1.5.3. [48]Distinguishing Switches from Other Fields + 1.5.4. [49]Standard File Selection Switches + 1.5.5. [50]Setting Preferences for Different Commands + 1.6. [51]Dates and Times + 1.7. [52]Partial Completion of Keywords + 1.8. [53]Command Recall + 1.9. [54]EXIT Messages + 1.10. [55]Managing Keyboard Interruptions + 1.11. [56]Taming the Wild Backslash -- Part Deux + 1.11.1. [57]Background + 1.11.2. [58]Kermit's Quoting Rules + 1.11.3. [59]Passing DOS Filenames from Kermit to Shell Commands + 1.11.4. [60]Using Variables to Hold DOS Filenames + 1.11.5. [61]Passing DOS Filenames as Parameters to Macros + 1.11.6. [62]Passing DOS File Names from Macro Parameters to the D +OS Shell + 1.11.7. [63]Passing DOS Filenames to Kermit from the Shell + 1.12. [64]Debugging + 1.13. [65]Logs + 1.14. [66]Automatic File-Transfer Packet Recognition at the Command Pro +mpt + 1.15. [67]The TYPE Command + 1.16. [68]The RESET Command + 1.17. [69]The COPY and RENAME Commands + 1.18. [70]The MANUAL Command + 1.19. [71]String and Filename Matching Patterns + 1.20. [72]Multiple Commands on One Line + 1.21. [73]What Do I Have? + 1.22. [74]Generalized File Input and Output + 1.22.1. [75]Why Another I/O System? + 1.22.2. [76]The FILE Command + 1.22.3. [77]FILE Command Examples + 1.22.4. [78]Channel Numbers + 1.22.5. [79]FILE Command Error Codes + 1.22.6. [80]File I/O Variables + 1.22.7. [81]File I/O Functions + 1.22.8. [82]File I/O Function Examples + 1.23. [83]The EXEC Command + 1.24. [84]Getting Keyword Lists with '?' + (2) [85]MAKING AND USING CONNECTIONS + 2.0. [86]SET LINE and SET HOST Command Switches + 2.1. [87]Dialing + 2.1.1. [88]The Dial Result Message + 2.1.2. [89]Long-Distance Dialing Changes + 2.1.3. [90]Forcing Long-Distance Dialing + 2.1.4. [91]Exchange-Specific Dialing Decisions + 2.1.5. [92]Cautions about Cheapest-First Dialing + 2.1.6. [93]Blind Dialing (Dialing with No Dialtone) + 2.1.7. [94]Trimming the Dialing Dialog + 2.1.8. [95]Controlling the Dialing Speed + 2.1.9. [96]Pretesting Phone Number Conversions + 2.1.10. [97]Greater Control over Partial Dialing + 2.1.11. [98]New DIAL-related Variables and Functions + 2.1.12. [99]Increased Flexibility of PBX Dialing + 2.1.13. [100]The DIAL macro - Last-Minute Phone Number Conversions + 2.1.14. [101]Automatic Tone/Pulse Dialing Selection + 2.1.15. [102]Dial-Modifier Variables + 2.1.16. [103]Giving Multiple Numbers to the DIAL Command + 2.2. [104]Modems + 2.2.1. [105]New Modem Types + 2.2.2. [106]New Modem Controls + 2.3. [107]TELNET and RLOGIN + 2.3.0. [108]Bug Fixes + 2.3.1. [109]Telnet Binary Mode Bug Adjustments + 2.3.2. [110]VMS UCX Telnet Port Bug Adjustment + 2.3.3. [111]Telnet New Environment Option + 2.3.4. [112]Telnet Location Option + 2.3.5. [113]Connecting to Raw TCP Sockets + 2.3.6. [114]Incoming TCP Connections + 2.4. [115]The EIGHTBIT Command + 2.5. [116]The Services Directory + 2.6. [117]Closing Connections + 2.7. [118]Using C-Kermit with External Communication Programs + 2.7.0. [119]C-Kermit over tn3270 and tn5250 + 2.7.1. [120]C-Kermit over Telnet + 2.7.2. [121]C-Kermit over Rlogin + 2.7.3. [122]C-Kermit over Serial Communication Programs + 2.7.4. [123]C-Kermit over Secure Network Clients + 2.7.4.1. [124]SSH + 2.7.4.2. [125]SSL + 2.7.4.3. [126]SRP + 2.7.4.4. [127]SOCKS + 2.7.4.5. [128]Kerberos and SRP + 2.8. [129]Scripting Local Programs + 2.9. [130]X.25 Networking + 2.9.1. [131]IBM AIXLink/X.25 Network Provider Interface for AIX + 2.9.2. [132]HP-UX X.25 + 2.10. [133]Additional Serial Port Controls + 2.11. [134]Getting Access to the Dialout Device + 2.12. [135]The Connection Log + 2.13. [136]Automatic Connection-Specific Flow Control Selection + 2.14. [137]Trapping Connection Establishment and Loss + 2.15. [138]Contacting Web Servers with the HTTP Command + (3) [139]TERMINAL CONNECTION + 3.1. [140]CONNECT Command Switches + 3.2. [141]Triggers + 3.3. [142]Transparent Printing + 3.4. [143]Binary and Text Session Logs + (4) [144]FILE TRANSFER AND MANAGEMENT + 4.0. [145]Bug Fixes, Minor Changes, and Clarifications + 4.1. [146]File-Transfer Filename Templates + 4.1.1. [147]Templates in the As-Name + 4.1.2. [148]Templates on the Command Line + 4.1.3. [149]Post-Transfer Renaming + 4.2. [150]File-Transfer Pipes and Filters + 4.2.1. [151]Introduction + 4.2.1.1. [152]Terminology + 4.2.1.2. [153]Notation + 4.2.1.3. [154]Security + 4.2.2. [155]Commands for Transferring from and to Pipes + 4.2.2.1. [156]Sending from a Command + 4.2.2.2. [157]Receiving to a Command + 4.2.3. [158]Using File-Transfer Filters + 4.2.3.1. [159]The SEND Filter + 4.2.3.2. [160]The RECEIVE Filter + 4.2.4. [161]Implicit Use of Pipes + 4.2.5. [162]Success and Failure of Piped Commands + 4.2.6. [163]Cautions about Using Pipes to Transfer Directory Trees + 4.2.7. [164]Pipes and Encryption + 4.2.8. [165]Commands and Functions Related to Pipes + 4.2.8.1. [166]The OPEN !READ and OPEN !WRITE Commands + 4.2.8.2. [167]The REDIRECT Command + 4.2.8.3. [168]Receiving Mail and Print Jobs + 4.2.8.4. [169]Pipe-Related Functions + 4.3. [170]Automatic Per-File Text/Binary Mode Switching + 4.3.1. [171]Exceptions + 4.3.2. [172]Overview + 4.3.3. [173]Commands + 4.3.4. [174]Examples + 4.4. [175]File Permissions + 4.4.1. [176]When ATTRIBUTES PROTECTION is OFF + 4.4.1.1. [177]Unix + 4.4.1.2. [178]VMS + 4.4.2. [179]When ATTRIBUTES PROTECTION is ON + 4.4.2.1. [180]System-Specific Permissions + 4.4.2.1.1. [181]UNIX + 4.4.2.1.2. [182]VMS + 4.4.2.2. [183]System-Independent Permissions + 4.5. [184]File Management Commands + 4.5.1. [185]The DIRECTORY Command + 4.5.2. [186]The CD and BACK Commands + 4.5.2.1. [187]Parsing Improvements + 4.5.2.2. [188]The CDPATH + 4.5.3. [189]Creating and Removing Directories + 4.5.4. [190]The DELETE and PURGE Commands + 4.6. [191]Starting the Remote Kermit Server Automatically + 4.7. [192]File-Transfer Command Switches + 4.7.1. [193]SEND Command Switches + 4.7.2. [194]GET Command Switches + 4.7.3. [195]RECEIVE Command Switches + 4.8. [196]Minor Kermit Protocol Improvements + 4.8.1. [197]Multiple Attribute Packets + 4.8.2. [198]Very Short Packets + 4.9. [199]Wildcard / File Group Expansion + 4.9.1. [200]In UNIX C-Kermit + 4.9.2. [201]In Kermit 95 + 4.9.3. [202]In VMS, AOS/VS, OS-9, VOS, etc. + 4.10. [203]Additional Pathname Controls + 4.11. [204]Recursive SEND and GET: Transferring Directory Trees + 4.11.1. [205]Command-Line Options + 4.11.2. [206]The SEND /RECURSIVE Command + 4.11.3. [207]The GET /RECURSIVE Command + 4.11.4. [208]New and Changed File Functions + 4.11.5. [209]Moving Directory Trees Between Like Systems + 4.11.6. [210]Moving Directory Trees Between Unlike Systems + 4.12. [211]Where Did My File Go? + 4.13. [212]File Output Buffer Control + 4.14. [213]Improved Responsiveness + 4.15. [214]Doubling and Ignoring Characters for Transparency + 4.16. [215]New File-Transfer Display Formats + 4.17. [216]New Transaction Log Formats + 4.17.1. [217]The BRIEF Format + 4.17.2. [218]The FTP Format + 4.18. [219]Unprefixing NUL + 4.19. [220]Clear-Channel Protocol + 4.20. [221]Streaming Protocol + 4.20.1. [222]Commands for Streaming + 4.20.2. [223]Examples of Streaming + 4.20.2.1. [224]Streaming on Socket-to-Socket Connections + 4.20.2.2. [225]Streaming on Telnet Connections + 4.20.2.3. [226]Streaming with Limited Packet Length + 4.20.2.4. [227]Streaming on Dialup Connections + 4.20.2.5. [228]Streaming on X.25 Connections + 4.20.3. [229]Streaming - Preliminary Conclusions + 4.21. [230]The TRANSMIT Command + 4.22. [231]Coping with Faulty Kermit Implementations + 4.22.1. [232]Failure to Accept Modern Negotiation Strings + 4.22.2. [233]Failure to Negotiate 8th-bit Prefixing + 4.22.3. [234]Corrupt Files + 4.22.4. [235]Spurious Cancellations + 4.22.5. [236]Spurious Refusals + 4.22.6. [237]Failures during the Data Transfer Phase + 4.22.7. [238]Fractured Filenames + 4.22.8. [239]Bad File Dates + 4.23. [240]File Transfer Recovery + 4.24. [241]FILE COLLISION UPDATE Clarification + 4.25. [242]Autodownload Improvements + (5) [243]CLIENT/SERVER + 5.0. [244]Hints + 5.1. [245]New Command-Line Options + 5.2. [246]New Client Commands + 5.3. [247]New Server Capabilities + 5.3.1. [248]Creating and Removing Directories + 5.3.2. [249]Directory Listings + 5.4. [250]Syntax for Remote Filenames with Embedded Spaces + 5.5. [251]Automatic Orientation Messages upon Directory Change + 5.6. [252]New Server Controls + 5.7. [253]Timeouts during REMOTE HOST Command Execution + (6) [254]INTERNATIONAL CHARACTER SETS + 6.0. [255]ISO 8859-15 Latin Alphabet 9 + 6.1. [256]The HP-Roman8 Character Set + 6.2. [257]Greek Character Sets + 6.3. [258]Additional Latin-2 Character Sets + 6.4. [259]Additional Cyrillic Character Sets + 6.5. [260]Automatic Character-Set Switching + 6.6. [261]Unicode + 6.6.1. [262]Overview of Unicode + 6.6.2. [263]UCS Byte Order + 6.6.2. [264]UCS Transformation Formats + 6.6.3. [265]Conformance Levels + 6.6.4. [266]Relationship of Unicode with Kermit's Other Character Sets + 6.6.5. [267]Kermit's Unicode Features + 6.6.5.1. [268]File Transfer + 6.6.5.2. [269]The TRANSLATE Command + 6.6.5.3. [270]Terminal Connection + 6.6.5.4. [271]The TRANSMIT Command + 6.6.5.5. [272]Summary of Kermit Unicode Commands + 6.7. [273]Client/Server Character-Set Switching + (7) [274]SCRIPT PROGRAMMING + 7.0. [275]Bug Fixes + 7.1. [276]The INPUT Command + 7.1.1. [277]INPUT Timeouts + 7.1.2. [278]New INPUT Controls + 7.1.3. [279]INPUT with Pattern Matching + 7.1.4. [280]The INPUT Match Result + 7.2. [281]New or Improved Built-In Variables + 7.3. [282]New or Improved Built-In Functions + 7.4. [283]New IF Conditions + 7.5. [284]Using More than Ten Macro Arguments + 7.6. [285]Clarification of Function Call Syntax + 7.7. [286]Autodownload during INPUT Command Execution + 7.8. [287]Built-in Help for Functions. + 7.9. [288]Variable Assignments + 7.9.1. [289]Assignment Operators + 7.9.2. [290]New Assignment Commands + 7.10. [291]Arrays + 7.10.1. [292]Array Initializers + 7.10.2. [293]Turning a String into an Array of Words + 7.10.3. [294]Arrays of Filenames + 7.10.4. [295]Automatic Arrays + 7.10.5. [296]Sorting Arrays + 7.10.6. [297]Displaying Arrays + 7.10.7. [298]Other Array Operations + 7.10.8. [299]Hints for Using Arrays + 7.10.9. [300]Do-It-Yourself Arrays + 7.10.10. [301]Associative Arrays + 7.11. [302]OUTPUT Command Improvements + 7.12. [303]Function and Variable Diagnostics + 7.13. [304]Return Value of Macros + 7.14. [305]The ASSERT, FAIL, and SUCCEED Commands. + 7.15. [306]Using Alarms + 7.16. [307]Passing Arguments to Command Files + 7.17. [308]Dialogs with Timed Responses + 7.18. [309]Increased Flexibility of SWITCH Case Labels + 7.19. "[310]Kerbang" Scripts + 7.20. [311]IF and XIF Statement Syntax + 7.20.1. [312]The IF/XIF Distinction + 7.20.2. [313]Boolean Expressions (The IF/WHILE Condition) + 7.21. [314]Screen Formatting and Cursor Control + 7.22. [315]Evaluating Arithmetic Expressions + 7.23. [316]Floating-Point Arithmetic + 7.24. [317]Tracing Script Execution + 7.25. [318]Compact Substring Notation + 7.26. [319]New WAIT Command Options + 7.26.1. [320]Waiting for Modem Signals + 7.26.2. [321]Waiting for File Events + 7.27. [322]Relaxed FOR and SWITCH Syntax + (8) [323]USING OTHER FILE TRANSFER PROTOCOLS + (9) [324]COMMAND-LINE OPTIONS + 9.0. [325]Extended-Format Command-Line Options + 9.1. [326]Command Line Personalities + 9.2. [327]Built-in Help for Command Line Options + 9.3. [328]New Command-Line Options + (10) [329]C-KERMIT AND G-KERMIT + +III. [330]APPENDICES + +III.1. [331]Character Set Tables +III.1.1. [332]The Hewlett Packard Roman8 Character Set +III.1.2. [333]Greek Character Sets +III.1.2.1. [334]The ISO 8859-7 Latin / Greek Alphabet +III.1.2.2. [335]The ELOT 927 Character Set +III.1.2.3. [336]PC Code Page 869 +III.2. [337]Updated Country Codes + +IV. [338]ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition. +V. [339]ADDITIONAL COPYRIGHT NOTICES + +I. C-KERMIT DOCUMENTATION + + The user manual for C-Kermit is: + + Frank da Cruz and Christine M. Gianone, [340]Using C-Kermit, Second + Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997, + 622 pages, ISBN 1-55558-164-1. + + [341]CLICK HERE for reviews. + + The present document is a supplement to Using C-Kermit 2nd Ed, not a + replacement for it. + + US single-copy price: $52.95; quantity discounts available. Available + in bookstores or directly from Columbia University: + + The Kermit Project + Columbia University + 612 West 115th Street + New York NY 10025-7799 + USA + Telephone: +1 (212) 854-3703 + Fax: +1 (212) 662-6442 + + Domestic and overseas orders accepted. Price: US $44.95 (US, Canada, + and Mexico). Shipping: $4.00 within the USA; $15.00 to all other + countries. Orders may be paid by MasterCard or Visa, or prepaid by + check in US dollars. Add $65 bank fee for checks not drawn on a US + bank. Do not include sales tax. Inquire about quantity discounts. + + You can also order by phone from the publisher, Digital Press / + [342]Butterworth-Heinemann, with MasterCard, Visa, or American Express: + + +1 800 366-2665 (Woburn, Massachusetts office for USA & Canada) + +44 1865 314627 (Oxford, England distribution centre for UK & Europe) + +61 03 9245 7111 (Melbourne, Vic, office for Australia & NZ) + +65 356-1968 (Singapore office for Asia) + +27 (31) 2683111 (Durban office for South Africa) + + A [343]German-language edition of the First Edition is also available: + + Frank da Cruz and Christine M. Gianone, C-Kermit - Einführung und + Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN + 3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00. Verlag + Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover. + Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29. + + The [344]Kermit file transfer protocol is specified in: + + Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press, + Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy + price: $39.95. Availability as above. + + News and articles about Kermit software and protocol are published + periodically in the journal, [345]Kermit News. Subscriptions are free; + contact Columbia University at the address above. + + Online news about Kermit is published in the + [346]comp.protocols.kermit.announce and [347]comp.protocols.kermit.misc + newsgroups. + +II. NEW FEATURES + + Support for the Bell Labs Plan 9 operating system was added to version + 6.0 too late to be mentioned in the book (although it does appear on + the cover). + + Specific changes and additions are grouped together by major topic, + roughly corresponding to the chapters of [348]Using C-Kermit. + +0. INCOMPATIBILITIES WITH PREVIOUS RELEASES + + 1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This + includes "unprefixing" of certain control characters. Because of + this, file transfers that worked with previous releases might not + work in the new release (but it is more likely that they will work, + and much faster). If a transfer fails, you'll get a + context-sensitive hint suggesting possible causes and cures. + Usually SET PREFIXING ALL does the trick. + 2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore + the previous behavior, put SET FILE TYPE TEXT in your C-Kermit + initialization file. + 3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit + 7.0 now switches between text and binary mode automatically on a + per-file basis according to various criteria, including (a) which + kind of platform is on the other end of the connection (if known), + (b) the version of Kermit on the other end, and (c) the file's name + (see [349]Section 4, especially [350]4.3). To disable this + automatic switching and restore the earlier behavior, put SET + TRANSFER MODE MANUAL in your C-Kermit initialization file. To + disable automatic switching for a particular transfer, include a + /TEXT or /BINARY switch with your SEND or GET command. + 4. The RESEND and REGET commands automatically switch to binary mode; + previously if RESEND or REGET were attempted when FILE TYPE was + TEXT, these commands would fail immediately, with a message telling + you they work only when the FILE TYPE is BINARY. Now they simply do + this for you. See [351]Section 4.23 for additional (important) + information. + 5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and + 138) in case rlogin, ssh, or cu are "in the middle", since + otherwise ~ might appear in Kermit packets, and this would + cause rlogin, ssh, or cu to disconnect, suspend, escape back, or + otherwise wreck the file transfer. Xon and Xoff are now always + prefixed too, even when Xon/Xoff flow control is not in effect, + since unprefixing them has proven dangerous on TCP/IP connections. + 6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built + into C-Kermit itself rather than implemented by running an external + command or program. The built-in command might not behave the way + the platform-specific external one did, but many options are + available for customization. Of course the underlying + platform-specific command can still be accessed with "!", "@", or + "RUN" wherever the installation does not forbid. In UNIX, the "ls" + command can be accessed directly as "ls" in C-Kermit. See + [352]Section 4.5.1 for details. + 7. SEND ? prints a list of switches rather than a list of filenames. + If you want to see a list of filenames, use a (system-dependent) + construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND + []? (VMS), etc. See [353]Sections 1.5 and [354]4.7.1. + 8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous + versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and + }, with dash used inside []'s to denote ranges and comma used + inside {} to separate list elements. If you need to include any of + these characters literally in a filename, precede each one with + backslash (\). See [355]Section 4.9. + 9. SET QUIET { ON, OFF } is now on the command stack, just like SET + INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458 + of [356]Using C-Kermit, 2nd Edition. This allows any macro or + command file to SET QUIET ON or OFF without worrying about saving + and restoring the global QUIET value. For example, this lets you + write a script that tries SET LINE on lots of devices until it + finds one free without spewing out loads of error messages, and + also without disturbing the global QUIET setting, whatever it was. + 10. Because of the new "." operator (which introduces assignments), + macros whose names begin with "." can not be invoked "by name". + However, they still can be invoked with DO. + 11. The syntax of the EVALUATE command has changed. See [357]Section + 7.9.2. To restore the previous syntax, use SET EVALUATE OLD. + 12. The \v(directory) variable now includes the trailing directory + separator; in previous releases it did not. This is to allow + constructions such as: + cd \v(dir)data.tmp + + to work across platforms that might have different directory + notation, such as UNIX, Windows, and VMS. + 13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and + sticky. In C-Kermit 7.0, there is an array of default flow-control + values for each kind of connection, that are applied automatically + at SET LINE/PORT/HOST time. Thus a SET FLOW command given before + SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can + be guaranteed to have the desired effect only if given after the + SET LINE/PORT/HOST command. + 14. Character-set translation works differently in the TRANSMIT command + when (a) the file character-set is not the same as the local end of + the terminal character-set, or (b) when the terminal character-set + is TRANSPARENT. + +1. PROGRAM AND FILE MANAGEMENT AND COMMANDS + +1.0. Bug Fixes + + The following patches were issued to correct bugs in C-Kermit 6.0. + These are described in detail in the 6.0 PATCHES file. All of these + fixes have been incorporated in C-Kermit 6.1 (never released except as + K95 1.1.16-17) and 7.0. + + 0001 All UNIX C-Kermit mishandles timestamps on files before 1970 + 0002 Solaris 2.5++ Compilation error on Solaris 2.5 with Pro C + 0003 All VMS CKERMIT.INI Fix for VMS + 0004 VMS/VAX/UCX 2.0 C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0 + 0005 All C-Kermit Might Send Packets Outside Window + 0006 All MOVE from SEND-LIST does not delete original files + 0007 Solaris 2.5++ Higher serial speeds on Solaris 2.5 + 0008 All C-Kermit application file name can't contain spaces + 0009 AT&T 7300 UNIXPC setuid and hardware flow-control problems + 0010 Linux on Alpha Patch to make ckutio.c compile on Linux/Alpha + 0011 OS-9/68000 2.4 Patch to make ck9con.c compile on OS-9/68000 2.4 + 0012 MW Coherent 4.2 Patches for successful build on Coherent 4.2 + 0013 SINIX-Y 5.43 "delay" variable conflicts with + 0014 VMS/VAX/CMU-IP Subject: Patches for VAX/VMS 5.x + CMU-IP + 0015 All XECHO doesn't flush its output + 0016 VMS CD and other directory operations might not work + 0017 Linux 1.2.x++ Use standard POSIX interface for high serial speeds + 0018 UNIX SET WILDCARD-EXPANSION SHELL dumps core + 0019 All Hayes V.34 modem init string problem + 0020 All READ command does not fail if file not open + 0021 All Problems with long function arguments + 0022 All Certain \function()s can misbehave + 0023 All X MOD 0 crashes program + 0024 All Internal bulletproofing for lower() function + 0025 OpenBSD Real OpenBSD support for C-Kermit 6.0 + 0026 All Incorrect checks for macro/command-file nesting depth + 0027 All ANSWER doesn't automatically CONNECT + 0028 All Overzealous EXIT warning + 0029 All OUTPUT doesn't echo when DUPLEX is HALF + 0030 All Minor problems with REMOTE DIRECTORY/DELETE/etc + 0031 All CHECK command broken + 0032 All Problem with SET TRANSMIT ECHO + 0033 UNIX, VMS, etc HELP SET SERVER says too much + 0034 All READ and !READ too picky about line terminators + 0035 All END from inside SWITCH doesn't work + 0036 All Problem telnetting to multihomed hosts + 0037 All Redirection failures in REMOTE xxx > file + + REDIRECT was missing in many UNIX C-Kermit implementations; in version + 7.0, it should be available in all of them. + +1.1. Command Continuation + + Comments that start with ";" or "#" can no longer be continued. In: + + ; this is a comment - + echo blah + + the ECHO command will execute, rather than being taken as a + continuation of the preceding comment line. This allows easy + "commenting out" of commands from macro definitions. + + However, the text of the COMMENT command can still be continued onto + subsequent lines: + + comment this is a comment - + echo blah + + As of version 6.0, backslash is no longer a valid continuation + character. Only hyphen should be used for command continuation. This is + to make it possible to issue commands like "cd a:\" on DOS-like + systems. + + As of version 7.0: + + * You can quote a final dash to prevent it from being a continuation + character: + echo foo\- + + This prints "foo-". The command is not continued. + * You can enter commands such as: + echo foo - ; this is a comment + + interactively and they are properly treated as continued commands. + Previously this worked only in command files. + +1.2. Editor Interface + + SET EDITOR name [ options ] + Lets you specify a text-editing program. The name can be a fully + specified pathname like /usr/local/bin/emacs19/emacs, or it can + be the name of any program in your PATH, e.g. "set editor + emacs". In VMS, it must be a DCL command like "edit", + "edit/tpu", "emacs", etc. If an environment variable EDITOR is + defined when Kermit starts, its value is the default editor. You + can also specify options to be included on the editor command + line. Returns to Kermit when the editor exits. + + EDIT [ filename ] + If the EDIT command is given without a filename, then if a + previous filename had been given to an EDIT command, it is used; + if not, the editor is started without a file. If a filename is + given, the editor is started on that file, and the filename is + remembered for subsequent EDIT commands. + + SHOW EDITOR + Displays the full pathname of your text editor, if any, along + with any command line options, and the file most recently edited + (and therefore the default filename for your next EDIT command). + + Related variables: \v(editor), \v(editopts), \v(editfile). + +1.3. Web Browser and FTP Interface + + C-Kermit includes an FTP command, which simply runs the FTP program; + C-Kermit does not include any built-in support for Internet File + Transfer Protocol, nor any method for interacting directly with an FTP + server. In version 7.0, however, C-Kermit lets you specify your FTP + client: + + SET FTP-CLIENT [ name [ options ] ] + The name is the name of the FTP executable. In UNIX, Windows, or + OS/2, it can be the filename of any executable program in your + PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere (or + if you do not have a PATH definition), it must be the fully + specified pathname of the FTP program. If the name contains any + spaces, enclose it braces. Include any options after the + filename; these depend the particular ftp client. + + The Web browser interface is covered in the following subsections. + +1.3.1. Invoking your Browser from C-Kermit + + BROWSE [ url ] + Starts your preferred Web browser on the URL, if one is given, + otherwise on the most recently given URL, if any. Returns to + Kermit when the browser exits. + + SET BROWSER [ name [ options ] ] + Use this command to specify the name of your Web browser + program, for example: "set browser lynx". The name must be in + your PATH, or else it must be a fully specified filename; in VMS + it must be a DCL command. + + SHOW BROWSER + Displays the current browser, options, and most recent URL. + + Related variables: \v(browser), \v(browsopts), \v(browsurl). + + Also see [358]Section 2.15: Contacting Web Servers with the HTTP + Command. + +1.3.2. Invoking C-Kermit from your Browser + + The method for doing this depends, of course, on your browser. Here are + some examples: + + Netscape on UNIX (X-based) + In the Options->Applications section, set your Telnet + application to: + + xterm -e /usr/local/bin/kermit/kermit -J %h %p + + (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual + pathname). -J is C-Kermit's command-line option to "be like + Telnet"; %h and %p are Netscape placeholders for hostname and + port. + + Lynx on UNIX + As far as we know, this can be done only at compile time. Add + the following line to the Lynx userdefs.h file before building + the Lynx binary: + + #define TELNET_COMMAND "/opt/bin/kermit -J" + + And then add lines like the following to the Lynx.cfg file: + + DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE + DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE + + UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE + UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE + UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE + UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE + + But none of the above is necessary if you make C-Kermit your default + Telnet client, which you can do by making a symlink called 'telnet' to + the C-Kermit 7.0 binary. See [359]Section 9.1 for details. + +1.4. Command Editing + + Ctrl-W ("Word delete") was changed in 7.0 to delete back to the + previous non-alphanumeric, rather than all the way back to the previous + space. + +1.5. Command Switches + + As of version 7.0, C-Kermit's command parser supports a new type of + field, called a "switch". This is an optional command modifier. + +1.5.1. General Switch Syntax + + A switch is a keyword beginning with a slash (/). If it takes a value, + then the value is appended to it (with no intervening spaces), + separated by a colon (:) or equal sign (=). Depending on the switch, + the value may be a number, a keyword, a filename, a date/time, etc. + Examples: + + send oofa.txt ; No switches + send /binary oofa.zip ; A switch without a value + send /protocol:zmodem oofa.zip ; A switch with a value (:) + send /protocol=zmodem oofa.zip ; A switch with a value (=) + send /text /delete /as-name:x.x oofa.txt ; Several switches + + Like other command fields, switches are separated from other fields, + and from each other, by whitespace, as shown in the examples just + above. You can not put them together like so: + + send/text/delete/as-name:x.x oofa.txt + + (as you might do in VMS or DOS, or as we might once have done in + TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity + between "/" as switch introducer versus "/" as UNIX directory + separator; e.g. in: + + send /delete/as-name:foo/text oofa.txt + + Does "foo/text" mean the filename is "foo" and the transfer is to be in + text mode, or does it mean the filename is "foo/text"? Therefore we + require whitespace between switches to resolve the ambiguity. (That's + only one of several possible ambiguities -- it is also conceivable that + a file called "text" exists in the path "/delete/as-name:foo/"). + + In general, if a switch can take a value, but you omit it, then either + a reasonable default value is supplied, or an error message is printed: + + send /print:-Plaserwriter oofa.txt ; Value included = print options + send /print oofa.txt ; Value omitted, OK + send /mail:kermit@columbia.edu oofa.txt ; Value included = address + send /mail oofa.txt ; Not OK - address required + ?Address required + + Context-sensitive help (?) and completion (Esc or Tab) are available in + the normal manner: + + C-Kermit> send /pr? Switch, one of the following: + /print /protocol + C-Kermit> send /protocol:? File-transfer protocol, + one of the following: + kermit xmodem ymodem ymodem-g zmodem + C-Kermit> send /protocol:kermit + + If a switch takes a value and you use completion on it, a colon (:) is + printed at the end of its name to indicate this. If it does not take a + value, a space is printed. + + Also, if you type ? in a switch field, switches that take values are + shown with a trailing colon; those that don't take values are shown + without one. + +1.5.2. Order and Effect of Switches + + The order of switches should not matter, except that they are evaluated + from left to right, so if you give two switches with opposite effects, + the rightmost one is used: + + send /text /binary oofa.zip ; Sends oofa.zip in binary mode. + + Like other command fields, switches have no effect whatsoever until the + command is entered (by pressing the Return or Enter key). Even then, + switches affect only the command with which they are included; they do + not have global effect or side effects. + +1.5.3. Distinguishing Switches from Other Fields + + All switches are optional. A command that uses switches lets you give + any number of them, including none at all. Example: + + send /binary oofa.zip + send /bin /delete oofa.zip + send /bin /as-name:mupeen.zip oofa.zip + send oofa.zip + + But how does Kermit know when the first "non-switch" is given? It has + been told to look for both a switch and for something else, the data + type of the next field (filename, number, etc). In most cases, this + works well. But conflicts are not impossible. Suppose, for example, in + UNIX there was a file named "text" in the top-level directory. The + command to send it would be: + + send /text + + But C-Kermit would think this was the "/text" switch. To resolve the + conflict, use braces: + + send {/text} + + or other circumlocutions such as "send //text", "send /./text", etc. + + The opposite problem can occur if you give an illegal switch that + happens to match a directory name. For example: + + send /f oofa.txt + + There is no "/f" switch (there are several switches that begin with + "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in + the root directory; then this command would be interpreted as: + + Send all the files in the "/f" directory, giving each one an as-name + of "oofa.txt". + + This could be a mistake, or it could be exactly what you intended; + C-Kermit has no way of telling the difference. To avoid situations like + this, spell switches out in full until you are comfortable enough with + them to know the minimum abbreviation for each one. Hint: use ? and + completion while typing switches to obtain the necessary feedback. + +1.5.4. Standard File Selection Switches + + The following switches are used on different file-oriented commands + (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of + files that match the given specification. + + /AFTER:date-time + Select only those files having a date-time later than the one + given. See [360]Section 1.6 for date-time formats. Synonym: + /SINCE. + + /NOT-AFTER:date-time + Select only those files having a date-time not later than (i.e. + earlier or equal to) the one given. Synonym: /NOT-SINCE. + + /BEFORE:date-time + Select only those files having a date-time earlier than the one + given. + + /NOT-BEFORE:date-time + Select only those files having a date-time not earlier than + (i.e. later or equal to) the one given. + + /DOTFILES + UNIX and OS-9 only: The filespec is allowed to match files whose + names start with (dot) period. Normally these files are not + shown. + + /NODOTFILES + (UNIX and OS-9 only) Don't show files whose names start with dot + (period). This is the opposite of /DOTFILES, and is the default. + Note that when a directory name starts with a period, the + directory and (in recursive operations) all its subdirectories + are skipped. + + /LARGER-THAN:number + Only select files larger than the given number of bytes. + + /SMALLER-THAN:number + Only select files smaller than the given number of bytes. + + /EXCEPT:pattern + Specifies that any files whose names match the pattern, which + can be a regular filename, or may contain "*" and/or "?" + metacharacters (wildcards), are not to be selected. Example: + + send /except:*.log *.* + + sends all files in the current directory except those with a + filetype of ".log". Another: + + send /except:*.~*~ *.* + + sends all files except the ones that look like Kermit or EMACS + backup files (such as "oofa.txt.~17~") (of course you can also + use the /NOBACKUP switch for this). + + The pattern matcher is the same one used by IF MATCH string + pattern ([361]Section 7.4), so you can test your patterns using + IF MATCH. If you need to match a literal * or ? (etc), precede + it by a backslash (\). If the pattern contains any spaces, it + must be enclosed in braces: + + send /except:{Foo bar} *.* + + The pattern can also be a list of up to 8 patterns. In this + case, the entire pattern must be enclosed in braces, and each + sub-pattern must also be enclosed in braces; this eliminates the + need for designating a separator character, which is likely to + also be a legal filename character on some platform or other, + and therefore a source of confusion. You may include spaces + between the subpatterns but they are not necessary. The + following two commands are equivalent: + + send /except:{{ck*.o} {ck*.c}} ck*.? + send /except:{{ck*.o}{ck*.c}} ck*.? + + If a pattern is to include a literal brace character, precede it + with "\". Also note the apparent conflict of this list format + and the string-list format described in [362]Section 4.9.1. In + case you want to include a wildcard string-list with braces on + its outer ends as an /EXCEPT: argument, do it like this: + + send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c + +1.5.5. Setting Preferences for Different Commands + + Certain oft-used commands offer lots of switches because different + people have different requirements or preferences. For example, some + people want to be able to delete files without having to watch a list + of the deleted files scroll past, while others want to be prompted for + permission to delete each file. Different people prefer different + directory-listing styles. And so on. Such commands can be tailored with + the SET OPTIONS command: + + SET OPTIONS command [ switch [ switch [ ... ] ] ] + Sets each switch as the default for the given command, replacing + the "factory default". Of course you can also override any + defaults established by the SET OPTIONS command by including the + relevant switches in the affected command any time you issue it. + + SHOW OPTIONS + Lists the commands that allows option-setting, and the options + currently in effect, if any, for each. Switches that have + synonyms are shown under their primary name; for example. /LOG + and /VERBOSE are shown as /LIST. + + Commands for which options may be set include DIRECTORY, DELETE, PURGE, + and TYPE. Examples: + + SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE + SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES + SET OPTIONS TYPE /PAGE + + Not necessarily all of a command's switches can be set as options. For + example, file selection switches, since these would normally be + different for each command. + + Put the desired SET OPTIONS commands in your C-Kermit customization + file for each command whose default switches you want to change every + time you run C-Kermit. + +1.6. Dates and Times + + Some commands and switches take date-time values, such as: + + send /after:{8-Feb-2000 10:28:01} + + Various date-time formats are acceptable. The rules for the date are: + + * The year must have 4 digits. + * If the year comes first, the second field is the month. + * The day, month, and year may be separated by spaces, /, -, or + underscore. + * The month may be numeric (1 = January) or spelled out or + abbreviated in English. + + If the date-time string contains any spaces, it must be enclosed in + braces. Examples of legal dates: + + Interpretation: + 2000-Feb-8 8 February 2000 + {2000 Feb 8} 8 February 2000 + 2000/Feb/8 8 February 2000 + 2000_Feb_8 8 February 2000 + 2000-2-8 8 February 2000 + 2000-02-08 8 February 2000 + 8-Feb-2000 8 February 2000 + 08-Feb-2000 8 February 2000 + 12/25/2000 25 December 2000 + 25/12/2000 25 December 2000 + + The last two examples show that when the year comes last, and the month + is given numerically, the order of the day and month doesn't matter as + long as the day is 13 or greater (mm/dd/yyyy is commonly used in the + USA, whereas dd/mm/yyyy is the norm in Europe). However: + + 08/02/2000 Is ambiguous and therefore not accepted. + + If a date is given, the time is optional and defaults to 00:00:00. If + the time is given with a date, it must follow the date, separated by + space, /, -, or underscore, and with hours, minutes, and seconds + separated by colon (:). Example: + + 2000-Feb-8 10:28:01 Represents 8 February 2000, 10:28:01am + + If a date is not given, the current date is used and a time is + required. + + Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed + by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon. + Examples of times that are acceptable: + + Interpretation: + 3:23:56 3:23:56am + 3:23:56am 3:23:56am + 3:23:56pm 3:23:56pm = 15:23:56 + 15:23:56 3:23:56pm = 15:23:56 + 3:23pm 3:23:00pm = 15:23:00 + 3:23PM 3:23:00pm = 15:23:00 + 3pm 3:00:00pm = 15:00:00 + + Examples of legal date-times: + + send /after:{8 Feb 2000 10:28:01} + send /after:8_Feb_2000_10:28:01 + send /after:8-Feb-2000/10:28:01 + send /after:2000/02/08/10:28:01 + send /after:2000/02/08_10:28:01 + send /after:2000/02/08_10:28:01am + send /after:2000/02/08_10:28:01pm + send /after:2000/02/08_10:28pm + send /after:2000/02/08_10pm + send /after:10:00:00pm + send /after:10:00pm + send /after:10pm + send /after:22 + + Finally, there is a special all-numeric format you can use: + + yyyymmdd hh:mm:ss + + For example: + + 20000208 10:28:01 + + This is Kermit's standard date-time format (based on ISO 8601), and is + accepted (among other formats) by any command or switch that requires a + date-time, and is output by any function whose result is a calendar + date-time. + + There are no optional parts to this format and it must be exactly 17 + characters long, punctuated as shown (except you can substitute + underscore for space in contexts where a single "word" is required). + The time is in 24-hour format (23:00:00 is 11:00pm). This is the format + returned by \fdate(filename), so you can also use constructions like + this: + + send /after:\fdate(oofa.txt) + + which means "all files newer than oofa.txt". + + Besides explicit dates, you can also use the any of the following + shortcuts: + + TODAY + Stands for the current date at 00:00:00. + + TODAY 12:34:56 + Stands for the current date at the given time. + + YESTERDAY + Stands for yesterday's date at 00:00:00. A time may also be + given. + + TOMORROW + Stands for tomorrow's date at 00:00:00. A time may also be + given. + + + number { DAYS, WEEKS, MONTHS, YEARS } [ time ] + Is replaced by the future date indicated, relative to the + current date. If the time is omitted, 00:00:00 is used. + Examples: +3days, +2weeks, +1year, +37months. + + - number { DAYS, WEEKS, MONTHS, YEARS } [ time ] + + Is replaced by the past date indicated, relative to the current + date. If the time is omitted, 00:00:00 is used. + + The time can be separated from the date shortcut by any of the same + separators that are allowed for explicit date-times: space, hyphen, + slash, period, or underscore. In switches and other space-delimited + fields, use non-spaces to separate date/time fields, or enclose the + date-time in braces, e.g.: + + purge /before:-4days_12:00:00 + purge /before:{- 4 days 12:00:00} + + Of course you can also use variables: + + define \%n 43 + purge /before:-\%ndays_12:00:00 + + Shortcut names can be abbreviated to any length that still + distinguishes them from any other name that can appear in the same + context, e.g. "TOD" for today, "Y" for yesterday. Also, the special + abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS". + + (To see how to specify dates relative to a specific date, rather than + the current one, see the [363]\fmjd() function description below.) + + You can check date formats with the DATE command. DATE by itself prints + the current date and time in standard format: yyyymmdd hh:mm:ss. DATE + followed by a date and/or time (including shortcuts) converts it to + standard format if it can understand it, otherwise it prints an error + message. + + The following variables and functions deal with dates and times; any + function argument designated as "date-time" can be in any of the + formats described above. + + \v(day) + The first three letters of the English word for the current day + of the week, e.g. "Wed". + + \fday(date-time) + The first three letters of the English word for day of the week + of the given date. If a time is included, it is ignored. + Example: \fday(8 Feb 1988) = "Mon". + + \v(nday) + The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 = + Saturday. + + \fnday(date-time) + The numeric day of the week for the given date. If a time is + included, it is ignored. Example: \fnday(8 Feb 1988) = "1". + + \v(date) + The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this + example, a leading zero is supplied for day-of-month less than + 10). + + \v(ndate) + The current date in numeric format: yyyymmdd, e.g. "20000208". + + \v(time) + The current time as hh:mm:ss, e.g. "15:27:14". + + \ftime(time) + The given free-format date and/or time (e.g. "3pm") returns the + time (without the date) converted to hh:mm:ss 24-hour format, + e.g. "15:00:00" (the date, if given, is ignored). + + \v(ntime) + The current time as seconds since midnight, e.g. "55634". + + \v(tftime) + The elapsed time of the most recent file-transfer operation in + seconds. + + \v(intime) + The elapsed time for the most recent INPUT command to complete, + in milliseconds. + + \fntime(time) + The given free-format date and/or time is converted to seconds + since midnight (the date, if given, is ignored). This function + replaces \ftod2secs(), which is now a synonym for \fntime(). + Unlike \ftod2secs(), \fntime() allows a date to be included, and + it allows the time to be in free format (like 3pm), and it + allows the amount of time to be more than 24 hours. E.g. + \fntime(48:00:00) = 172800. Example of use: + + set alarm \fntime(48:00:00) ; set alarm 48 hours from now. + + \fn2time(seconds) + The given number of seconds is converted to hh:mm:ss format. + + \fdate(filename) + Returns the modification date-time of the given file in standard + format: yyyymmdd hh:mm:ss. + + \fcvtdate(date-time) + Converts a free-format date and/or time to Kermit standard + format: yyyymmdd hh:mm:ss. If no argument is given, returns the + current date-time in standard format. If a date is given but no + time, the converted date is returned without a time. If a time + is given with no date, the current date is supplied. Examples: + + \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17 + \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm). + \fcvtd(4 Jul 2000) = 20000704 + \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm). + + \fdayofyear(date-time) + \fdoy(date-time) + Converts a free-format date and/or time to yyyyddd, where ddd is + the 3-digit day of the year, and 1 January is Day 1. If a time + is included with the date, it is returned in standard format. If + a date is included but no time, the date is returned without a + time. If a time is given with no date, the time is converted and + the current date is supplied. If no argument is given, the + current date-time is returned. Synonym: \fdoy(). Examples: + + \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17 + \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm). + \fdoy(4 Jul 2000) = 2000185 + \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm). + + Note: The yyyyddd day-of-year format is often erroneously referred to + as a Julian date. However, a true Julian date is a simple counting + number, the number of days since a certain fixed day in the past. + [364]See \fmjd() below. + + \fdoy2date(date-time) + Converts a date or date-time in day-of-year format to a standard + format date. A yyyyddd-format date must be supplied; time is + optional. The given date is converted to yyyymmdd format. If a + time is given, it is converted to 24-hour format. Examples: + + \fdoy2date(2000185) = 20000704 + \fdoy2(2000185 3pm) = 20000704 15:00:00 + + \fmjd(date-time) + Converts free-format date and/or time to a Modified Julian Date + (MJD), the number of days since 17 Nov 1858 00:00:00. If a time + is given, it is ignored. Examples: + + \fmjd(4 Jul 2000) = 50998 + \fmjd(17 Nov 1858) = 0 + \fmjd(16 Nov 1858) = -1 + + \fmjd2date(mjd) + Converts an MJD (integer) to standard date format, yyyymmdd: + + \fmjd2(50998) = 4 Jul 1998 + \fmjd2(0) = 17 Nov 1858 + \fmjd2(-1) = 16 Nov 1858 + \fmjd2(-365) = 17 Nov 1857 + + MJDs are normal integers and, unlike DOYs, may be added, subtracted, + etc, with each other or with other integers, to obtain meaningful + results. For example, to find out the date 212 days ago: + + echo \fmjd2date(\fmjd()-212) + + Constructions such as this can be used in any command where a date-time + is required, e.g.: + + send /after:\fmjd2date(\fmjd()-212) + + to send all files that are not older than 212 days (this is equivalent + to "send /after:-212days"). + + MJDs also have other regularities not exhibited by other date formats. + For example, \fmodulus(\fmjd(any-date),7) gives the day of the week for + any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier to + use \fnday() for this purpose, and it gives the more conventional + result of 0=Sun, 1=Mon, ..., 6=Sat). + + Note that if MJDs are to be compared, they must be compared numerically + (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT), whereas DOYs must + be compared lexically if they include a time (which contains ":" + characters); however, if DOYs do not include a time, they may also be + compared numerically. + + In any case, lexical comparison of DOYs always produces the appropriate + result, as does numeric comparison of MJDs. + + The same comments apply to sorting. Also note that DOYs are fixed + length, but MJDs can vary in length. However, all MJDs between 3 April + 1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits + long on 31 Aug 2132, and 7 digits long on 13 Oct 4596). + +1.7. Partial Completion of Keywords + + Partial completion of keywords was added in C-Kermit 7.0. In prior + versions, if completion was attempted (by pressing the Esc or Tab key) + on a string that matched different keywords, you'd just get a beep. Now + Kermit completes up to the first character where the possibly matching + keywords differ and then beeps. For example: + + C-Kermit> send /n + + which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the dash: + + C-Kermit> send /not- + + Partial completion works for filenames too (as it has for some years). + +1.8. Command Recall + + C-Kermit has had a command history buffer for some time, which could be + scrolled interactively using control characters or (in Kermit 95 only) + arrow keys. Version 7.0 adds a REDO command that allows the most recent + command matching a given pattern to be re-executed: + + { REDO, RR, ^ } [ pattern ] + Search the command history list for the most recent command that + matches the given pattern, and if one is found, execute it + again. + + The pattern can be a simple string (like "send"), in which case the + last SEND command is re-executed. Or it can contain wildcard characters + "*" and/or "?", which match any string and any single character, + respectively (note that "?" must be preceded by backslash to override + its normal function of giving help), and in most C-Kermit versions may + also include [] character lists and {} string lists (see [365]Section + 4.9). + + The match works by appending "*" to the end of the given pattern (if + you didn't put one there yourself). Thus "redo *oofa" becomes "redo + *oofa*" and therefore matches the most recent command that contains + "oofa" anywhere within the command. If you want to inhibit the + application of the trailing "*", e.g. to force matching a string at the + end of a command, enclose the pattern in braces: + + redo {*oofa} + + matches the most recent command that ends with "oofa". + + REDO commands themselves are not entered into the command history list. + If no pattern is given, the previous (non-REDO) command is re-executed. + The REDOne command is reinserted at the end of the command history + buffer, so the command scrollback character (Ctrl-P, Ctrl-B, or + Uparrow) can retrieve it. + + Examples: + + C-Kermit> echo foo + foo + C-Kermit> show alarm + (no alarm set) + C-Kermit> echo blah + blah + C-Kermit> redo ; Most recent command + blah + C-Kermit> redo s ; Most recent command starting with "s" + (no alarm set) + C-Kermit> redo echo f ; Most recent command starting with "echo f" + foo + C-Kermit> redo *foo ; Most recent command that has "foo" in it + foo + C-Kermit> ; Scroll back + C-Kermit> echo foo ; The REDOne command is there + C-Kermit> redo {*foo} ; Most recent command that ends with "foo" + foo + C-Kermit> + + Since REDO, REDIAL, and REDIRECT all start the same way, and RED is the + designated non-unique abbreviation for REDIAL, REDO must be spelled out + in full. For convenience, RR is included as an invisible easy-to-type + synonym for REDO. You can also use the "^" character for this: + + C-Kermit> ^ ; Most recent command + C-Kermit> ^ s ; Most recent command starting with "s" + C-Kermit> ^s ; Ditto (space not required after "^"). + C-Kermit> ^*foo ; Most recent command that has "foo" in it. + C-Kermit> ^{*foo} ; Most recent command ends with "foo". + + Unlike the manual command-history-scrolling keys, the REDO command can + be used in a script, but it's not recommended (since the command to be + REDOne might not be found, so if the REDO command fails, you can't tell + whether it was because REDO failed to find the requested command, or + because the command was found but it failed). + +1.9. EXIT Messages + + The EXIT and QUIT commands now accept an optional message to be + printed. This makes the syntax of EXIT and QUIT just like END and STOP: + + { EXIT, QUIT, END, STOP } [ status-code [ message ] ] + + where status-code is a number (0 indicating success, nonzero indicating + failure). This is handy in scripts that are never supposed to enter + interactive mode: + + dial 7654321 + if fail exit 1 Can't make connection - try again later. + + Previously this could only be done in two steps: + + dial 7654321 + xif fail { echo Can't make connection - try again later, exit 1 } + + A status code must be included in order to specify a message. In the + case of EXIT and QUIT, the default status code is contained in the + variable \v(exitstatus), and is set automatically by various events + (file transfer failures, etc; it can also be set explicitly with the + SET EXIT STATUS command). If you want to give an EXIT or QUIT command + with a message, but without changing the exit status from what it + normally would have been, use the \v(exitstatus) variable, e.g.: + + exit \v(existatus) Goodbye from \v(cmdfile). + + The EXIT status is returned to the system shell or whatever other + process invoked C-Kermit, e.g. in UNIX: + + C-Kermit> exit 97 bye bye + bye bye + $ echo $? + 97 + $ + +1.10. Managing Keyboard Interruptions + + When C-Kermit is in command or file-transfer mode (as opposed to + CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the + ability to disarm the Ctrl-C interrupt: + + SET COMMAND INTERRUPT { ON, OFF } + COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be + used to interrupt a command or a file transfer in progress. Use + OFF to disable these interruptions, and use it with great + caution for obvious reasons. + + SET TRANSFER INTERRUPT { ON, OFF } + This can be used to disable keyboard interruption of file + transfer when C-Kermit is in local mode, or to re-enable it + after it has been disabled. This applies to the X, Z, E, and + similar keys as well as to the system interrupt character, + usually Ctrl-C. This is distinct from SET TRANSFER CANCELLATION, + which tells whether packet mode can be exited by sending a + special sequence of characters. + + Several other commands can be interrupted by pressing any key while + they are active. Version 7.0 adds the ability to disable this form of + interruption also: + + SET INPUT CANCELLATION { ON, OFF } + Whether an INPUT command in progress can be interrupted by + pressing a key. Normally ON. Setting INPUT CANCELLATION OFF + makes INPUT commands uninterruptible except by Ctrl-C (unless + COMMAND INTERRUPTION is also OFF). + + SET SLEEP CANCELLATION { ON, OFF } + Whether a SLEEP, PAUSE, or WAIT command in progress can be + interrupted by pressing a key. Normally ON. Setting SLEEP + CANCELLATION OFF makes these commands uninterruptible except by + Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET + PAUSE CANCELLATION, SET WAIT CANCELLATION. + + So to make certain a script is not interruptible by the user, include + these commands: + + SET TRANSFER INTERRUPT OFF + SET SLEEP CANCELLATION OFF + SET INPUT CANCELLATION OFF + SET COMMAND INTERRUPTION OFF + + Make sure to turn them back on afterwards if interruption is to be + re-enabled. + + When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the + keyboard, the new variable \v(kbchar) contains a copy of the (first) + character that was typed and caused the interruption, provided it was + not the command interrupt character (usually Ctrl-C). If these commands + complete successfully or time out without a keyboard interruption, the + \v(kbchar) variable is empty. + + The \v(kbchar) variable (like any other variable) can be tested with: + + if defined \v(kbchar) command + + The command is executed if the variable is not empty. + + The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0, + etc). + +1.11. Taming The Wild Backslash -- Part Deux + + [366]Using C-Kermit, 2nd Edition, contains a brief section, "Taming the + Wild Backslash", on page 48, which subsequent experience has shown to + be inadequate for Kermit users intent on writing scripts that deal with + Windows, DOS, and OS/2 filenames, in which backslash (\) is used as the + directory separator. This section fills in the blanks. + +1.11.1. Background + + The Kermit command language shares a certain unavoidable but annoying + characteristic with most other command languages that are capable of + string replacement, namely the necessity to "quote" certain characters + when you want them to be taken literally. This is a consequence of the + facts that: + + 1. One or more characters must be set aside to denote replacement, + rather than acting as literal text. + 2. We have only 96 printable characters to work with in ASCII, which + is still the only universally portable character set. + 3. There is no single printable character that is unused everywhere. + 4. Variables are not restricted to certain contexts, as they are in + formal programming languages like C and Fortran, but can appear + anywhere at all within a command, and therefore require special + syntax. + + Thus there can be conflicts. To illustrate, the standard UNIX shell + uses dollar sign ($) to introduce variables. So the shell command: + + echo $TERM + + displays the value of the TERM variable, e.g. vt320. But suppose you + want to display a real dollar sign: + + echo The price is $10.20 + + This causes the shell to evaluate the variable "$1", which might or + might not exist, and substitute its value, e.g.: + + The price is 0.20 + + (in this case the $1 variable had no value.) This is probably not what + you wanted. To force the dollar sign to be taken literally, you must + apply a "quoting rule", such as "precede a character by backslash (\) + to force the shell to take the character literally": + + echo The price is \$10.20 + The price is $10.20 + + But now suppose you want the backslash AND the dollar sign to be taken + literally: + + echo The price is \\$10.20 + + This doesn't work, since the first backslash quotes the second one, + thereby leaving the dollar sign unquoted again: + + The price is \0.20 + + Quoting the dollar sign requires addition of a third backslash: + + echo The price is \\\$10.20 + The price is \$10.20 + + The first backslash quotes the second one, and the third backslash + quotes the dollar sign. + + Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS + CLI, etc etc -- has similar rules. UNIX shell rules are probably the + most complicated, since many printable characters -- not just one -- + are special there: dollar sign, single quote, double quote, backslash, + asterisk, accent grave, number sign, ampersand, question mark, + parentheses, brackets, braces, etc -- practically every + non-alphanumeric character needs some form of quoting if it is to be + taken literally. And to add to the confusion, the UNIX shell offers + many forms of quoting, and many alternative UNIX shells are available, + each using slightly different syntax. + +1.11.2. Kermit's Quoting Rules + + Kermit's basic quoting rules are simple by comparison (there are, of + course, additional syntax requirements for macro definitions, command + blocks, function calls, etc, but they are not relevant here). + + The following characters are special in Kermit commands: + + Backslash (\) + Introduces a variable, or the numeric representation of a + special character, or a function, or other item for + substitution. If the backslash is followed by a digit or by any + of the following characters: + + x, o, d, m, s, f, v, $, %, &, :, { + + this indicates a special substitution item; otherwise the + following character is to be taken literally (exceptions: \ at + end of line is taken literally; \n, \b, and \n are special items + in the OUTPUT command only). + + Semicolon (;) + (Only when at the beginning of a line or preceded by at least + one space or tab) Introduces a comment. + + Number sign (#) + (Only when at the beginning of a line or preceded by at least + one space or tab) Just like semicolon; introduces a comment. + + Question mark (?) + (Only at the command prompt - not in command files or macros) + Requests context-sensitive help. + + To force Kermit to take any of these characters literally, simply + precede it by a backslash (\). + + Sounds easy! And it is, except when backslash also has a special + meaning to the underlying operating system, as it does in DOS, Windows, + and OS/2, where it serves as the directory separator in filenames such + as: + + D:\K95\KEYMAPS\READ.ME + + Using our rule, we would need to refer to this file in Kermit commands + as follows: + + D:\\K95\\KEYMAPS\\READ.ME + + But this would not be obvious to new users of Kermit software on DOS, + Windows, or OS/2, and it would be annoying to seasoned ones. Thus + MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the + more natural notation, as in: + + send d:\k95\keymaps\read.me + + The reason this is tricky is that we also need to allow for variables + and other expressions introduced by backslash in the same command. For + example, suppose \%a is a variable whose value is "oofa" (without the + quotes). What does the following command do? + + send d:\%a + + Does it send the file named "oofa" in the current directory of the D: + disk, or does it send a file named "%a" in the root directory of the D: + disk? This is the kind of trouble we get into when we attempt to bend + the rules in the interest of user friendliness. (The answer is: if the + variable \%a has definition that is the name of an existing file, that + file is sent; if a file d:\%a exists, it is sent; otherwise if both + conditions are true, the variable takes precedence, and the literal + filename can be forced by quoting: \\%a.) + + In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another + way by allowing you to use forward slash (/) rather than backslash (\) + as the directory separator: + + send d:/k95/keymaps/read.me + + This looks more natural to UNIX users, and in fact is perfectly + acceptable to the Windows 95/98/NT and OS/2 operating systems on the + API level. BUT (there is always a "but") the Microsoft shell, + COMMAND.COM, for Windows 95/98 and NT does not allow this notation, and + therefore it can not be used in any Kermit command -- such as RUN -- + that invokes the Windows command shell AND your command shell is + COMMAND.COM or any other shell that does not allow forward slash as + directory separator (some alternative shells do allow this). + + NOTE: There exists a wide variety of alternative shells from third + parties that do not have this restriction. If you are using a shell + that accepts forward slash as a directory separator, you can stop + reading right now -- UNLESS (there is always an "unless") you want + your scripts to be portable to systems that have other shells. Also + note that some Windows shells might actually REQUIRE forward slashes + (instead of backslashes) as directory separators; we do not treat + this situation below, but the treatment is obvious -- use slash + rather backslash as the directory separator. + +1.11.3. Passing DOS Filenames from Kermit to Shell Commands + + The following Kermit commands invoke the system command shell: + + RUN (and its synonyms ! and @) + REDIRECT + PIPE + + Each of these commands takes a shell command as an operand. These shell + commands are not, and can not be, parsed by Kermit since Kermit does + not know the syntax of shell commands, and so can't tell the difference + between a keyword, a filename, a variable, a switch, or other item. + Therefore the rules can not be bent since Kermit doesn't know where or + how to bend them. To illustrate (using the regular Windows shell): + + run c:\\windows\\command\\chkdsk.exe + + works OK, but: + + run c:/windows/command/chkdsk.exe + + is not accepted by COMMAND.COM. But: + + run c:\windows\command\chkdsk.exe + + results in Kermit applying its quoting rules before sending the text to + the shell. Since "w" and "c" are not in the list of backslash-item + codes, the backslash means "take the following character literally". + Thus, by the time this filename gets to the Windows shell, it has + become: + + c:windowscommandchkdsk.exe + + which is probably not what you wanted. (If "w" and "c" were in the + list, the results could be even stranger.) Even more confusing is the + case where a directory or filename starts with one or more digits: + + run c:\123\lotus.exe + + in which "\123" is the Kermit notation for ASCII character 123, which + happens to be left brace ({), resulting in "c:{lotus.exe". + + So when passing filenames to a Windows shell, always use double + backslashes as directory separators, to ensure that the shell gets + single backslashes: + + run c:\\windows\\command\\chkdsk.exe + run c:\\123\\lotus.exe + + Similar problems might occur with the built-in EDIT, BROWSE, and FTP + commands. These commands result in Kermit building a shell command + internally to invoke the associated helper program; the form of this + command might conflict with the form demanded by certain alternative + shells. + +1.11.4. Using Variables to Hold DOS Filenames + + Now to the next level. Suppose you want to write a script in which + filenames are parameters, and therefore are stored in variables. + Example: + + define \%f c:\windows\command\chkdsk.exe + ... + run \%f + + Obviously this won't work for the reasons just noted; the RUN command + requires directory separators be coded as double backslashes: + + define \%f c:\\windows\\command\\chkdsk.exe + ... + run \%f + + This will work; no surprises here. However, if you had used ASSIGN + rather than DEFINE, you might have been surprised after all; review + pages 348-349 of [367]Using C-Kermit (2nd Ed) for the difference + between DEFINE and ASSIGN. + + We have said that any Kermit 95 or MS-DOS Kermit command that parses + filenames itself -- SEND, for example -- does not require double + backslashes since it knows it is parsing a filename. So since the + following works: + + send c:\windows\command\chkdsk.exe + + Should the following also work? + + define \%f c:\windows\command\chkdsk.exe + ... + send \%f + + Answer: No. Why? Because \%f is evaluated "recursively", to allow for + the possibility that its definition contains further variable + references. This is true of all "backslash-percent-letter" (or -digit) + variables, and also for array references. So \%f becomes + c:\windows\command\chkdsk.exe, which becomes + c:windowscommandchkdsk.exe. + + The trick here is to use the "other" kind of variable, that is + evaluated only "one level deep" rather than recursively: + + define filename c:\windows\command\chkdsk.exe + ... + send \m(filename) + + Similarly if you want to prompt the user for a filename: + + ask filename { Please type a filename: } + Please type a filename: c:\windows\command\chkdsk.exe + send \m(filename) + +1.11.5. Passing DOS Filenames as Parameters to Macros + + Suppose you want to pass a DOS filename containing backslashes as a + parameter to a Kermit macro. This raises two issues: + + 1. Parameters to macros are "just text" and so are fully evaluated + before they are passed to the macro. + 2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are + the type of variable that is evaluated recursively. + + Thus a DOS filename is ruined once in the act of parsing the macro + invocation, and again when referring to it from within the macro. To + illustrate, suppose "test" is a macro. Then in the invocation: + + test c:\mydir\blah.txt + + "c:mydirblah.txt" is assigned to \%1. However, if we double the + backslashes: + + test c:\\mydir\\blah.txt + + "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1 + in the macro, it is evaluated recursively, resulting in + "c:mydirblah.txt". To illustrate: + + define test echo \%1 + test c:\mydir\blah.txt + c:mydirblah.txt + test c:\\mydir\\blah.txt + c:mydirblah.txt + test c:\\\\mydir\\\\blah.txt + c:\mydir\blah.txt + + Let's address each part of the problem separately. First, inside the + macro. You can use the \fcontents() function to force a + backslash-percent variable (such as a macro argument) to be evaluated + one level deep instead of recursively, for example: + + define test echo { The filename is "\fcontents(\%1)"} + + test c:\mydir\blah.txt ; We don't expect this to work + The filename is "c:mydirblah.txt" ; and it doesn't. + test c:\\mydir\\blah.txt ; But this does... + The filename is "c:\mydir\blah.txt" + + Thus if the filename arrives inside the macro with single backslashes, + the backslashes are preserved if you always refer to the parameter + through the \fcontents() function. + + Now how to ensure that backslashes are not stripped or misinterpreted + when passing a filename to a macro? This brings us back to what we + learned in earlier sections: + + 1. If it is a literal filename, either double the backslashes, or (if + the filename is to be used only within Kermit itself and not passed + to a DOS shell, or it is to be passed to an alternative shell that + accepts forward slash as a directory separator), use forward slash + instead of backslash as the directory separator. + 2. If it is a variable that contains a filename, make sure you use a + macro-style variable name, rather than a + backslash-percent-character name. + + Examples: + + define test echo \fcontents(\%1) + define filename c:\mydir\blah.txt + + test c:\\mydir\\blah.txt ; Literal filename with double backslashes + c:\mydir\blah.txt + + test c:/mydir/blah.txt ; Literal filename with forward slashes + c:/mydir/blah.txt + + test \m(filename) ; Variable + c:\mydir\blah.txt + + But what if you don't like these rules and you still want to pass a + literal filename containing single backslashes to a macro? This is + possible too, but a bit tricky: turn command quoting off before + invoking the macro, and then turn it back on inside the macro. Example: + + define test set command quoting on, echo \fcontents(\%1) + + set command quoting off + test c:\mydir\blah.txt + c:\mydir\blah.txt + + Upon return from the macro, command quoting is back on (since the macro + turned it on). + + Obviously this trick can not be used if the filename is stored in a + variable, since it prevents the variable from being evaluated. + +1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell + + Now suppose you need to pass a DOS filename to a macro, and the macro + needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN + command. This works too: + + define xrun run \fcontents(\%1) + xrun c:\\windows\\command\\chkdsk.exe + + (or you can use the SET COMMAND QUOTING OFF / ON technique described + above to avoid the double backslashes.) But.. + + xrun c:/windows/command/chkdsk.exe + + does not work if the Windows shell does not recognize "/" as a + directory separator. If there is a chance that a filename might be + passed to the macro in this form, the macro will need to convert it to + a form acceptable to the shell: + + define xrun run \freplace(\fcontents(\%1),/,\\) + + Here we replace all occurrences (if any) of "/" in the argument with + "\" prior to issuing the RUN command. Of course, in order to specify + "\" as a literal character in the \freplace() argument list, we have to + double it. + +1.11.7. Passing DOS Filenames to Kermit from the Shell + + As noted in the manual, the \&@[] array contains Kermit's command-line + arguments. Suppose one of these arguments, say \&@[3], is a DOS + filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and + K95 1.1.18 and later, command-line arguments after "=" or "--" are also + available in the top-level \%1..9 variables; see [368]Section 7.5.) + + Of course you can eliminate any problems by using forward slashes + rather than backslashes in the filename, but sometimes this is not + possible, as when the Kermit command line is being generated by another + program than can only generate "native" format DOS filenames. + + As noted in the manual, "\%x" variables and \&x[] arrays are always + evaluated "all the way" (recursively). If the contents of one of these + variables contains backslashes, this causes another level of + evaluation. + + There is another kind of variable, which is evaluated only "one level + deep". You can use this to prevent interpretation of the backslashes in + the filenames. Example: + + assign filename \fcontents(\&@[3]) ; Transfer contents + ... + send \m(filename) + + Or, more simply: + + send \fcontents(\&@[3]) + +1.12. Debugging + + The debug log is produced when you give a "log debug" command. This is + normally done at the request of the Kermit help desk, for forwarding to + the Kermit developers for analysis as a last resort in troubleshooting + problems. (Last resort because it can grow quite huge in a very short + time.) In cases where timing information is critical to understanding a + problem, you can tell C-Kermit to put a timestamp on each debug log + line by giving the command: + + SET DEBUG TIMESTAMP ON + + At any time before or after activating the debug log (SET DEBUG + TIMESTAMP OFF turns off timestamping). Timestamps can be turned off and + on as desired while logging. Obviously, they increase the size and + growth rate of the log significantly, and so should be used sparingly. + Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a + second (but is included only on platforms that include this feature). + +1.13. Logs + + In UNIX C-Kermit and in K-95, you can now direct any log to a pipe. + This not only lets you send your logs to places other than disk files, + but also lets you customize them to any desired degree. + + LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe } + ... + A "pipe" is the name of a command, preceded by a vertical bar. + If the pipe contains any spaces, it must be enclosed in braces. + + Here are some examples for UNIX (always remember the importance of + getting the UNIX shell quoting rules right): + + LOG TRANSACTIONS |lpr + This sends the transaction log to the default UNIX printer, + rather than to a file (use "lp" rather than "lpr" if necessary). + + LOG TRANSACTIONS {| myfilter > t.log} + For those who don't like the format of the transaction log, or + want to extract certain information from it; write your own + output filter. + + LOG SESSION {| lpr -Plaserwriter} + This sends the session log to a specific UNIX printer, rather + than to a file. Note the braces around the pipeline. These are + required because it contains spaces. + + LOG DEBUG {| tail -100 > debug.log} + This causes the debug log file to contain only the final 100 + lines. Suppose C-Kermit crashes under some unpredictable + circumstances, and you need a debug log to catch it in the act. + But the debug log can grow to huge proportions very quickly, + possibly filling up the disk. Piping the debug log through + "tail" results in keeping only the last 100 lines (or other + number of your choice). + + LOG DEBUG {| grep "^TELNET" > debug.log} + This one shows how to log only Telnet negotiations. Piping the + debug log through grep or egrep lets you log only specific + information, rather than everything. "man grep" for further + info. + + LOG DEBUG {| gzip -c > debug.log.gz} + Creates a full debug log, but compressed by gzip to save space. + + LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log} + This one writes the regular packet log, but translates the + Ctrl-A that starts each packet to the letter "X" and removes the + s-nn-nn- notation from the beginning of each line. Note the + double backslash (normal Kermit quoting rules). "man tr" and + "man cut" for further info. + + See [369]Section 2.12 for information about the new connection log. + +1.14. Automatic File-Transfer Packet Recognition at the Command Prompt + + Beginning in version 7.0, C-Kermit can recognize Kermit (and in some + cases also Zmodem) file-transfer packets while at its command prompt. + This is convenient (for example), if you escaped back from a remote + Kermit program and told the local Kermit program to send a file, but + forgot to tell the remote Kermit program to receive it (and the local + Kermit did not have the "send a Kermit receive command" feature + available). This feature is controlled by the following command: + + SET COMMAND AUTODOWNLOAD { ON, OFF } + When ON, which is the default, the command parser recognizes + Kermit packets when Kermit is in remote mode. An S packet makes + it go into receive mode, an I packet makes it go into server + mode. When OFF, packet recognition is disabled and the behavior + when a packet is received at the command prompt is as it was in + C-Kermit 6.1 and earlier (namely to print an error message). + + COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL + AUTODOWNLOAD, which is effective during CONNECT mode. + +1.15. The TYPE Command + + The TYPE command now accepts a selection of optional switches + ([370]Section 1.5), and also sets several variables. + + Syntax: TYPE [ switches... ] filename + + Variables: + + \v(ty_ln) + Line number of current line (during TYPE command; see /PREFIX) + + \v(ty_lc) + Line count of file most recently TYPEd. + + \v(ty_mc) + Match count of file most recently TYPEd (see /MATCH). + + Switches: + + /PAGE + If /PAGE is included, Kermit pauses at the end of each screenful + and issues a "more?" prompt. You may press the space bar to view + the next page (screenful), or press "q" or "n" to return to the + C-Kermit prompt. If this switch is given, it overrides the + COMMAND MORE-PROMPTING setting for this command only. If it is + not given, paging is according to COMMAND MORE-PROMPTING. + + /NOPAGE + Do not pause at the end of each screenful; show the whole file + (or all selected lines) at once. If this switch is given, it + overrides the COMMAND MORE-PROMPTING setting for this command + only. If it is not given, paging is according to COMMAND + MORE-PROMPTING. + + /HEAD[:n] + Only show the first n lines of the file (where n is a number). + If n is omitted, 10 is used. + + /TAIL[:n] + Only show the last n lines of the file (where n is a number). If + nis omitted, 10 is used. Note: /HEAD and /TAIL can't be + combined; if you give both switches, only the most recent one is + used. + + /MATCH:pattern + Only type lines from the file that match the given pattern (see + [371]Section 4.9.1 for pattern notation). UNIX users familiar + with grep should note a significant difference: there is no + implied "*" at the beginning and end of the pattern. Thus: + + TYPE /MATCH:foo Lists lines whose entire contents are "foo". + TYPE /MATCH:foo* Lists lines that start with "foo". + TYPE /MATCH:*foo Lists lines that end with "foo". + TYPE /MATCH:*foo* Lists lines that have "foo" anywhere in them. + + /HEAD and /TAIL apply after /MATCH, so "type /tail:20 /match:x*" + shows the last 20 lines in the file that start with "x". + + /PREFIX:string + Print the given string at the beginning of each line. The string + may be a constant, a variable, or a quoted variable. If it's an + unquoted variable, its value at the time the TYPE command was + given is used as a constant. If it is a quoted variable, it is + re-evaluated for each line; a useful variable for this context + is \v(ty_ln) (the line number of the current line being typed). + If the prefix is to include spaces, it must be enclosed in + braces. Examples: + + type /prefix:{oofa.txt: } /match:*thing* oofa.txt + Prints all lines in oofa.txt that contain "thing" with the + filename itself as the prefix (similar to UNIX grep). + + type /prefix:{\v(time). } oofa.txt + Prefixes each line of oofa.txt with the time at which the + TYPE command was given (one backslash) + + type /prefix:{\\v(time). } oofa.txt + Prefixes each line of oofa.txt with the time at which that + line is being typed (two backslashes). + + type /prefix:{\\v(ty_ln). } oofa.txt + Prefixes each line of oofa.txt with its line number. + + type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt + Same as the previous example, except the line number is + right-adjusted in a 4-column field. + + /WIDTH[:n] + Truncates each line at column n (which must be a number) prior + to printing it. This option can be used for long lines when you + don't want them to wrap. If nis omitted, your current screen + width is used. + + /COUNT + Counts lines and -- if /MATCH was included, matches -- but does + not print any lines from the file. The line and match count is + shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are + set accordingly. + + SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n } + Sets the paging default for TYPE commands, which can be + overridden in any particular TYPE command by including the + desired switch. + + If a TYPE command is given with no switch, and no SET OPTIONS TYPE + selection is in effect, paging is according to your COMMAND + MORE-PROMPTING setting (SHOW COMMAND). + +1.16. The RESET Command + + The RESET command, added in 7.0, closes all open files and logs, but + does not affect the open connection (if any). + +1.17. The COPY and RENAME Commands + + As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME + commands are built in and do not call the underlying platform's COPY or + RENAME command. This allows them to work in "NOPUSH" versions and other + circumstances where it can't access system commands, and it allows file + copying and renaming to be done portably in scripts. The + characteristics of the built-in COPY or RENAME include: + * It fails if the source file is a directory or is wild or lacks read + access. + * It fails if the source file is the destination file. + * It allows the destination file to be a directory, in which case the + source file is copied (or renamed) into it with the same name. + * It overwrites an existing destination file if its permission + allows. + * It sets the new file's permission according to umask but also + carries forward the source file's execute permission bits if the + destination file did not already exist. + * It fails if interrupted by Ctrl-C. + * Upon error, it prints an appropriate message. + * It returns standardized error codes that can be tested by IF + SUCCESS / FAIL. + + These commands now also accept the following switches: + + /LIST (/LOG, /VERBOSE) = Print "file1 => file2 (OK)" (or error message). + /NOLIST (/NOLOG, /QUIET) = Don't print anything (except error messages). + + /NOLIST is the default. + + The same built-in code is used by the UNIX C-Kermit server to execute + REMOTE COPY commands (except in this case no switches are available). + + The COPY command also accepts the following additional switches. When + any of these are given (and they can be used in any combination except + /SWAP and /APPEND), some of the checks listed above are relaxed, and + thus it might be possible to get into trouble in certain cases, e.g. + when the source and target files are the same file: + + /APPEND = Append source file to destination file. + /SWAP-BYTES = Swap bytes (see [372]Section 6.6.5). + /FROMB64 = Decode the source file from Base64 encoding. + /TOB64 = Encode the target file in Base64. + + Base64 is the encoding commonly used for enclosures in Internet email. + +1.18. The MANUAL Command + + The MANUAL command can be used to access the appropriate Kermit manual + or other manual. The general syntax is: + + MANUAL [ string ] + If the string is omitted, C-Kermit asks the underlying system to + access the C-Kermit manual using whatever method is appropriate + for the system. + + The specific action depends on the system. In UNIX, a "man" command is + issued; "kermit" is the default argument but other manual topics may be + specified. If the "man" command allows index or string searching, the + appropriate syntax may be included. + + In Kermit 95, the MANUAL command brings up the HTML online K95 manual. + + In VMS and elsewhere, "man" is simply translated to "help", with a + default argument of "kermit"; other and/or additional arguments may be + included according to the definition of the system's "help" command. + + Correct operation of the "man" command in C-Kermit depends on the + appropriate man page or help topic having been installed in the right + place with the right permissions and format. + +1.19. String and Filename Matching Patterns + + A pattern is a string that includes special notation for matching + classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports + patterns in several places: + + * Filenames ([373]Section 4.9) + * SWITCH case labels ([374]Section 7.18) + * The new IF MATCH statement ([375]Section 7.4) + * TYPE /MATCH ([376]Section 1.15) + * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ([377]Section 4.3) + * The \fsearch() and \farraylook() functions ([378]Sections 7.3 and + [379]7.10.7) + * The \fpattern() function used with [M,RE]INPUT ([380]Section 7.1) + + Patterns are also called wildcards, especially when used for filename + matching. C-Kermit's pattern syntax is explained in [381]Section 4.9.1, + and also by the HELP WILDCARDS command. + +1.20. Multiple Commands on One Line + + As of C-Kermit 7.0, commands can be grouped together on one line by + separating the commands with commas and enclosing the list in braces. + For example: + + C-Kermit> { echo One, echo Two, echo Three } + C-Kermit> do { echo One, echo Two, echo Three } + + Command lists can be nested: + + [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three } + + and the END command works as it does in macros: + + [ do ] { echo One, echo Two, if true end, echo Three } + + The "one line" stricture is, of course, pliant to line-continuation + conventions, namely that lines ending in hyphen (-) or left brace ({) + are to be continued. Thus the first example can also be rendered: + + [ do ] { + echo One + echo Two + echo Three + } + + (the "do" is optional). + +1.21. What Do I Have? + + C-Kermit can be built for hundreds of different platforms with + practically countless configuration options. Certain commands might not + be available in certain configurations, etc. Even on the same platform, + different builds are possible: "maximum functionality", "minimum size", + "maximum performance", and so on. You can find out a lot about the + configuration of your C-Kermit program with the SHOW FEATURES command. + Of course, a lot of what it says, especially in the bottom part, might + seem like gibberish, but can be deciphered with a Rosetta Stone (such + as the C-Kermit source or the [382]ckccfg.txt file). In any case, the + output from SHOW FEATURES might easily explain why some expected + feature is missing, or some buffer is smaller than expected. Here's a + sample of the bottom section for the SunOS version: + +C-Kermit 7.0.196, 1 Jan 2000 + +Major optional features included: + Network support (type SHOW NET for further info) + Telnet Kermit Option + Hardware flow control + External XYZMODEM protocol support + Latin-1 (West European) character-set translation + Latin-2 (East European) character-set translation + Cyrillic (Russian, Ukrainian, etc) character-set translation + Greek character-set translation + Hebrew character-set translation + Japanese character-set translation + Unicode character-set translation + Pseudoterminal control + REDIRECT command + RESEND command + Fullscreen file transfer display + Control-character unprefixing + Streaming + Autodownload + +Major optional features not included: + No Kerberos(TM) authentication + No SRP(TM) (Secure Remote Password) protocol + No Secure Sockets Layer (SSL) protocol + No Transport Layer Security (TLS) protocol + No encryption + No X Windows forwarding + +Host info: + Machine: sun4m + Model: (unknown) + OS: SunOS + OS Release: 4.1.3_U1 + OS Version: 4 + +Target: sunos41gsc +GCC version: 2.7.2 +Compiled Dec 31 1999 10:38:54, options: + __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK + BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT + CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS + CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC + CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH + CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC + FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB + IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32 + MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD + NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND + RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4 + SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX + UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46 + z_maxchan=46 ZXREWIND + + byte order: big endian + + sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8 + + floating-point: precision=16 rounding=1 + + Without going into detail about what all the notation means, notice a + couple things: + + * The Options section shows symbols ("macros") in effect during + compilation, together with their values (for those that have + values). The options are listed in alphabetical order to make any + particular option easier to find. + * MAXWLD is the maximum number of files that a wildcard can expand + to. + * Anything starting with "NO" is a feature (or something other than a + feature) that has been deliberately "compiled out", or omitted. + * Important items for script writers include: CMDBL=32763 (the size + of the command buffer and therefore the maximum length for a macro + or variable definition; CMDDEP=64 (the limit on recursion depth); + FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the + size of the INPUT command circular buffer); MAC_MAX=16384 (the + maximum number of macros), etc. + + See the [383]ckccfg.txt file for details. + +1.22. Generalized File Input and Output + + C-Kermit 7.0 adds a new generalized I/O system for stream files, + augmenting (and to some extent, overlapping with) the older OPEN, READ, + WRITE, and CLOSE commands. In the new file i/o system, which can be + used simultaneously with the old one, all commands are grouped together + under the new FILE keyword, and some related functions and variables + are added. + +1.22.1. Why Another I/O System? + + The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the + following restrictions: + + 1. Only one READ file and one WRITE file can be open at a time. + 2. The READ and WRITE commands are strictly line oriented. + 3. These commands can not be used with binary files. + 4. They do not support read/write access or random access. + 5. The syntax is a bit counterintuitive for programmers. + + The new file i/o system allows multiple files to be open at once, in + any desired combination of modes (read/write/append) supported by the + operating system, for line, block (record), or character i/o, for + sequential or random access, using consistent syntax and conventions. + + The new system, however, does not replace the old one, since the old + system still must be used for: + + 1. The session, packet, debug, transaction, and connection logs. + 2. Reading and writing commands rather than files. + 3. Existing scripts. + + The new system works only with regular files, not with commands or + pipes or mailboxes or pseudoterminals. No special provisions are made + in the FILE commands for handling devices or network connections, nor + for preventing you from trying to open them; if the underlying + operating system treats them like regular stream disk files, the FILE + commands (except, of course SEEK, REWIND, and COUNT) might work with + them. (In C programming terms, the FILE commands are, at present, + nothing more than a front end to fopen() / fread() / fwrite() / + fclose() and friends, which are a portable API to sequential files, but + this might change in the future for platforms like VMS and VOS that + have more complicated file systems.) + + Definitions: + + Channel + A number assigned to a file when it is opened, by which it must + be referred to in all input/output operations. + + Read/Write Pointer + The current position in an open file, expressed as the 0-based + byte count from the beginning. + +1.22.2. The FILE Command + + FILE keyword [ switches ] channel [ data ] + The keyword specifies the function: FILE OPEN, FILE READ, FILE + WRITE, FILE CLOSE, etc. For convenience (and for familiarity to + C programmers), the two-word FILE commands can be shortened to + the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on. + Switches are optional, and modify or amplify the requested file + function. + + As in C, Fortran, and other programming languages, open files are + referred to by "channels", integers such as 0, 1, 2, 3, and so on. A + channel number is assigned when you open a file. The number of + available channels depends on the underlying operating system, and can + be seen in the variable: + + \v(f_max) + + or by giving the FILE LIST (FLIST) command. Channels are discussed in + greater detail in [384]Section 1.22.4. + + FILE command errors can be caught with IF FAIL after the FILE command. + In addition, the \v(f_error) variable is set to the completion code of + the command: 0 if no error, or a negative number if there was an error. + The error codes are listed in [385]Section 1.22.5. + + The command to open a file is: + + FILE OPEN [ switches ] variable filename + Opens a file for the type of access specified by the switches, + or for read-only access if no switches are given. Upon success, + a channel number is assigned to this file and stored in the + given variable so you can refer to the open file in subsequent + i/o commands. If the file can not be opened, the FILE OPEN + command fails. Synonym: FOPEN. + + The FILE OPEN switches are: + + /READ + Open the file for read access. If no switches are given, /READ + is assumed. If the file does not exist or can't be opened for + read access, the FILE OPEN command fails. + + /WRITE + Allow writing. If a file of the same name already exists, it is + overwritten unless /READ or /APPEND is also included. If a file + of the given name does not exist, it is created. + + /APPEND + Equivalent to /WRITE, except that if the file exists, it is not + destroyed. The read/write pointer is set to the end of the file, + so unless you change it with FILE SEEK or REWIND (see below), + the first FILE WRITE command adds to the end of the file, + preserving what was there already. If /WRITE is also given, it + is ignored. + + /BINARY + Open the file in "binary" mode, rather than text mode. This + switch is meaningless (but still can be used) in UNIX. In VMS, + Windows, and OS/2, it inhibits end-of-line processing and + conversion, and so should be used for binary files and/or files + that are to be accessed in record or character mode rather than + line by line. + + The variable for the channel number can be any kind of variable: the + \%x kind, a macro name, or an array element. But it must be a variable, + not a number -- C-Kermit assigns the channel number; you can't tell it + what number to use. + + Example: + + FILE OPEN \%c oofa.txt ; Open oofa.txt for reading. + IF FAIL exit 1 Can't open oofa.txt ; Always check to see if it worked. + ECHO oofa.txt: channel = \%c + + If the file oofa.txt is opened successfully, a channel number is + assigned to the variable \%c. Here's another example using a macro name + for the channel number: + + FILE OPEN channel oofa.txt ; Open oofa.txt for reading. + IF SUCCESS ECHO oofa.txt: channel = \m(channel) + + Switches can be combined when it makes sense and the underlying + operating system allows it. For example, to open a file in binary mode + for reading and writing (sometimes called "update"): + + FILE OPEN /READ /WRITE /BINARY \%c budget.db + + Some combinations might be allowed, others not. For example /READ + /APPEND will usually not be allowed. /WRITE /APPEND is treated as + /APPEND. + + A major advantage of the new system over the older one is that you can + have multiple files open at once. Suppose, for example, that you want + to open all the files in a certain directory at once: + + .\%n := \ffiles(/usr/olga*,&f) ; Get file list into array. + if ( > \%n \v(f_max) ) { ; Make sure there aren't too many. + exit 1 {\v(dir): \%n = Too many files} + } + declare \&c[\%n] ; Make array for channel numbers. + for \%i 1 \%n 1 { ; Loop to open every file... + file open \&c[\%i] \&f[\%i] ; Try to open this one + if fail exit 1 Open error: \&f[\%i] ; Check for failure + } + + If this loop completes successfully, the \&c[] array will contain \%n + channel numbers of open files in elements 1 through \%n. + + Any file that you open with FILE OPEN stays open until Kermit exits, or + you close it explicitly. The command to close a file is: + + FILE CLOSE { ALL, channel } + If a channel number is given and the channel refers to an open + file, the file is closed and the channel is freed for reuse; if + the channel does not refer to an open file, an error message is + printed and the command fails. If ALL is specified instead of a + specific channel, all files opened with FILE OPEN are closed and + if all open files were closed successfully (even if no files + were open), the command succeeds; if any open file could not be + closed, the command fails; however, all open files that could be + closed are still closed. Synonym: FCLOSE. + + FILE CLOSE might fail because, for example, the disk filled up or a + quota was exceeded. Example: + + fopen /write \%c new.txt ; Open new.txt for writing. + if fail exit 1 ; Check for error. + fclose \%c ; Close the file we just opened. + + This creates a 0-length file called new.txt. + + Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a + new file, and therefore destroys any file with the same name that might + already exist (assuming you have permission to delete it). To avoid + overwriting existing files, simply check first: + + if exist new.txt exit 1 {Fatal - new.txt already exists} + fopen /write \%c new.txt + if fail ... + + The next two commands give information about open files: + + FILE STATUS channel + Tells the name of the file, if any, open on the given channel + and the switches it was opened with. The read/write pointer is + also shown; this is where the next read or write will occur; + "[EOF]" is shown if the current position in the open file is the + end -- i.e. the next read will fail if the file was opened in + /READ mode; the next write will add material to the end. The + current line number (0-based) is also shown if known. The FILE + STATUS command succeeds if the channel is open, and fails if + there is no open file on the given channel, or if the channel + number is invalid or out of range. Synonym: FSTATUS. + + FILE LIST + Lists the channel number and name of each open file, along with + its OPEN modes (R, W, A, B, RW, etc) and its current read/write + pointer or "[EOF]" if it is at the end. Also tells the number of + files currently opened with FILE OPEN, plus the maximum number + of open files allowed by the system and the maximum number + allowed for FILE OPEN. Synonym: FLIST. + + Next come the commands for reading and writing files: + + FILE READ [ switches ] channel [ variable ] + Reads data from the file on the given channel number into the + variable, if one was given; if no variable was given, the result + is printed on the screen. IMPORTANT: The variable should + normally be a macro name rather than a \%x or \&x[] variable if + you want backslash characters in the file to be taken literally + (see pp.408-412 of [386]Using C-Kermit for an explanation; you + can also read into a \%x or \&x[] variable, but then you must + remember to protect future references to by \fcontents() if you + don't want C-Kermit to process any backslashes it might + contain). The desired amount of data (according to the switches) + is read from the file at the current read/write pointer, and + upon completion the read/write position is updated to first byte + after the data that was read, no matter what switches were + given. Synonym: FREAD. + + FILE WRITE [ switches ] channel text + Writes the given text to the file on the given channel number. + The text, of course, can be literal text or a variable, or any + combination. If the text might contain leading or trailing + spaces, it must be enclosed in braces if you want to preserve + them. Synonym: FWRITE. + + Before proceeding, a caution about the NUL character. C-Kermit is so + named because it is a Kermit program written in the C language. In C, + character strings are represented as a sequence of non-NUL bytes + terminated by a NUL byte (a byte in which all bits are 0). Thus a C + string can not contain NUL bytes; it always ends with the first NUL + byte. C-Kermit variables are implemented as C strings and therefore + can't contain NUL bytes either, so the FILE READ and FILE WRITE + commands do not handle files or strings that contain NUL bytes, except + when the /CHARACTER switch is included with the FILE READ or WRITE + command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE + command; these switches are explained below. + + Also note that Kermit can not be used read or write binary numbers in + the machine's internal format (integer or floating-point); in general, + numbers can be processed only when represented as numeric or + floating-point strings. + + FILE READ switches are: + + /LINE + Specifies that a line of text is to be read. A line is defined + according to the underlying operating system's text-file format. + For example, in UNIX a line is a sequence of characters up to + and including a linefeed, or the end of the file, which ever + comes first. The line terminator (if any) is removed before + assigning the text to the variable. If no switches are included + with the FILE READ command, /LINE is assumed. Normally this + switch should not be used with files opened in /BINARY mode (but + nothing prevents it either). + + /SIZE:number + Specifies that the given number of bytes (characters) is to be + read. The actual number of bytes returned will be less if the + end of file is reached (or a NUL byte is encountered). For + example, if a file is 514 bytes long, FILE READ /SIZE:512 + returns 512 bytes the first time and 2 bytes the second time. + FILE READ /SIZE provides a kind of "record i/o" for files that + do not necessarily contain lines. The resulting block of + characters is assigned to the variable without any editing. + Synonym: /BLOCK. + + /CHARACTER + Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the + variable is empty, this indicates a NUL byte was read. Synonym: + BYTE. + + FILE WRITE switches are: + + /LINE + Specifies that an appropriate line terminator is to be added to + the end of the text. If no switches are included, /LINE is + assumed. + + /SIZE:number + Specifies that the given number of bytes (characters) is to be + written. If the given text is longer than the requested size, it + is truncated; if is shorter, it is padded according /LPAD and + /RPAD switches. Synonym: /BLOCK. + + /LPAD[:value] + If /SIZE was given, but the text is shorter than the requested + size, the text is padded on the left with sufficient copies of + the character whose ASCII value is given to write the given + length. If no value is specified, 32 (the code for Space) is + used. The value can also be 0 to write the indicated number of + NUL bytes. If /SIZE was not given, this switch is ignored. + + /RPAD[:value] + Like LPAD, but pads on the right. + + /CHARACTER + Specifies that one character should be written. If the text is + empty or not given, a NUL character is written; otherwise the + first character of text is given. Synonym: /BYTE. + + /STRING + Specifies that the text is to be written as-is, with no + terminator added. + + Here's an example in which we copy a text file line by line: + + file open /read \%c oofa.txt ; Open input file + if fail exit 1 Can't open input file ; Check that it's open + file open /write \%d new.txt ; Open output file + if fail exit 1 Can't open output file ; Check + while true { ; Loop to copy lines + file read /line \%c line ; Read a line + if fail break ; Assume failure = end of file + file write /line \%d {\m(line)} ; Write the line to output file + if fail exit 1 Write failure ; Failure here is fatal + } + file close \%c ; Close the two files + file close \%d + + Note that since /LINE is the default for both FILE READ and FILE WRITE, + it can be omitted as in the following example, where we also use the + short names for the FILE commands. + + fopen /read \%c oofa.txt ; Open input file + if fail exit 1 Can't open input file ; Check that it's open + fopen /write \%d new.txt ; Open output file + if fail exit 1 Can't open output file ; Check + while true { ; Loop to copy lines + fread \%c line ; Read a line + if fail break ; Assume failure = end of file + fwrite \%d {\m(line)} ; Write the line to output file + if fail exit 1 Write failure ; Failure here is fatal + } + fclose \%c ; Close the two files + fclose \%d + + Here's the same example using "record i/o" (the open and close + sequences are are omitted since they are the same as above). The result + is the same, but execution is much faster: + + while true { ; Loop to copy blocks + fread /size:512 \%c block ; Read a block into \%a + if fail break ; Assume failure = end of file + fwrite /string \%d {\m(block)} ; Write the block to output file + if fail exit 1 Write failure ; Failure here is fatal + } + + Although record i/o is faster, it should not be used in line-oriented + applications, since it returns arbitrary chunks of the file to your + script, rather than lines. In this example, FWRITE /STRING is used + rather than FWRITE /SIZE:512 to avoid the last output block being + padded beyond the original file's length. + + A file can also be copied character by character, but this is much + slower than line i/o and VERY much slower than block i/o: + + while true { ; Loop to copy blocks + fread /char \%c c ; Read a character into c + if fail break ; Assume failure = end of file + fwrite /char \%d {\m(c)} ; Write character to output file + if fail exit 1 Write failure ; Failure is fatal + } + + Although character i/o is slow, it is the only way to process files + that contain NUL characters (i.e. bytes composed of only zero bits). In + the example above, when "fread /char \%c c" returns a NUL, the c + variable is empty. But since the FREAD /CHAR command did not fail, we + know the result was really a NUL. FWRITE /CHAR, when given an empty + variable (or no variable at all) writes a NUL. Thus the loop above will + copy any file at all (very slowly). In non-copying applications, NULs + are detected like this: + + fread /char \%c c + if fail (do something) + if not def c (a NUL byte was read) + + Finally some advanced file operations: + + FILE FLUSH channel + For output files only: commits all previous writes to disk, in + case the computer was buffering them. Synonym: FFLUSH. + + FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel + By default, or if the /BYTES switch is given, counts the bytes + in the file, if any, open on the given channel. If the /LINES + switch is given, counts lines in the file. If the /LIST switch + is given, the result is printed. If the /NOLIST switch is given, + the result is not printed. /QUIET is a synonym for /NOLIST. If + neither /LIST nor /NOLIST is given, the result is printed if the + command is given at top level, i.e. not from a command file or + macro. In all cases, the result of the most recent FILE COUNT + command is stored in the variable \v(f_count). Note that FILE + COUNT /LINE works (and can only work) by reading the entire + file; expect it to take some time if the file is large. Synonym: + FCOUNT. + + FILE REWIND channel + Moves the read/write pointer to the beginning of the file. + Equivalent to FILE SEEK channel 0. Synonym: FREWIND. + + FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF } + Moves the read/write pointer for the file on this channel to the + given position, which may be a byte (character) number or a line + number, expressed in either absolute or relative terms. + Switches: + + /BYTE + The number given is a byte number. Synonym: /CHARACTER. + + /LINE + The number given is a line number. + + /ABSOLUTE + The number given is absolute. + + /RELATIVE + The number given is relative to the current position. + + By default, or if the /BYTE switch is given, the number is a + byte number (0 = first byte). If /LINE is given, the number is a + line number (0 = first line). EOF means to move to the end of + the file. LAST means to move to the last line or character of + the file, depending on whether it's a line or character seek. + + If neither the /RELATIVE nor the /ABSOLUTE switch is given, then + if a signed number is given, the motion is relative to the + current position. An expression that evaluates to a negative + number is not considered signed for this purpose; that is, a + sign (+ or -) must be included as the first character of the + number in the command itself to force a relative seek (in the + absence of /RELATIVE or /ABSOLUTE). + + If the number has no sign, or if the /ABSOLUTE switch is given, + the number represents an absolute position (relative to the + beginning of the file). Subsequent FILE READs or WRITEs will + take place at the new position. + + If the read/write pointer is placed after the end of the file, a + subsequent FILE READ will fail, but a FILE WRITE will succeed + (possibly creating a file with "holes"). If a FILE SEEK /BYTE + command is given, the current line becomes unknown (unless the + position is 0) and subsequent FILE SEEK /RELATIVE /LINE commands + will fail until the next non-relative FILE SEEK /LINE command is + given. Synonym: FSEEK. + + An absolute FILE SEEK to a negative position fails silently, as does a + relative seek to a position before the beginning of the file. + + A caution about relative SEEKs: remember that the number is relative to + the current position. Whenever you read or write, this changes the + position. In each of the following examples, assume the file open on + channel \%c is positioned at line n (the FREAD target variable is + omitted for lack of space): + + { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c } <-- Reads line n twice + { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c } <-- Reads lines n and n+1 + { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c } <-- Reads lines n and n+2 + { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c } <-- Reads lines n and n-1 + { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c } <-- Reads lines n and n-2 + + Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the + same disk block (e.g. when sampling a database record that is + frequently updated) might not give you updated disk blocks due to the + internal buffering and caching of the C library (this probably varies + from one platform/compiler combination to another). If necessary you + can force a fresh disk read with a close/open sequence: + + FCLOS \%c + FOPEN \%c samefilename + FSEEK \%c samespot + FREAD /SIZE:howmanybytes \%c variable + +1.22.3. FILE Command Examples + + To read the last 10 lines of a text file into an array: + + fopen /read \%c oofa.txt ; Open the file + if fail exit 1 Can't open oofa.txt ; Always check for failure + dcl \&a[10] ; Declare a 10-element array + fcount /line \%c ; Count lines in the file + fseek /line \%c \v(f_count)-10 ; Seek to 10 lines from the end + if fail exit 1 Can't seek ; Check for failure + for \%i 1 10 1 { fread \%c \&a[\%i] } ; Read the last 10 lines + fclose \%c ; Close the file + + Note that blank lines show up as empty (undefined) array elements, for + example if you give a "show array a" command at this point. This is + normal. You can still use these elements; e.g.: + + for \%i 1 10 1 { echo \%i. \&a[\%i] } ; Display the 10 lines + + Here is how to read the last line of a file (already open on channel + \%c): + + fseek /line \%c last ; Seek directly to last line + + Alternatively: + + fseek /line \%c eof ; Seek to end of file + fseek /line \%c -1 ; Seek to beginning of last line + + Alternatively: + + fcount /line \%c ; Count the file's lines + fseek /line \%c \v(f_count)-1 ; Seek to last line + fread \%c ; Read it + + To read every other line from the file (using relative SEEK), skipping + the first line: + + fopen /read \%c oofa.txt ; Open the file + while ( success ) { ; Loop through lines + fseek /line \%c +1 ; Skip a line + if success fread \%c ; Read & display a line + } + fclose \%c ; Close the file + + Here is how to read the lines of a file in reverse order: + + fopen /read \%c oofa.txt ; Open + if fail exit 1 ; Check + fseek /line \%c last ; Seek to last line + while success { ; Loop + fread \%c ; Read line + fseek /line \%c -2 ; Seek backwards two lines + } + fclose \%c ; Close the file + + The loop works because a relative SEEK outside the file fails. + + It is also possible to use block i/o to manage random-access files with + fixed-length records (as long as they don't contain NUL characters). + Suppose, for example, you have a file of "card image" records with + fixed-field information about customers, such as: + + Name: Columns 1-32 (column numbers are 1-based) + Address: Columns 33-72 + Balance: Columns 73-80 + + The records are indexed by customer number, starting with 0. There are + no line terminators separating them. Therefore the record for customer + number n starts at position nx 80 (\%n*80). + + Now suppose we received a payment from customer number 173 and want to + update the balance: + + .\%n = 173 ; Customer (record) number + .\%a = 12.72 ; Amount + fopen /read /write \%c customer.db ; Open the file + if fail stop 1 OPEN FAILED: \f_errmsg() ; Check + fseek /byte \%c 80*\%n ; Seek to record + fread /size:80 \%c r ; Read the record + if fail stop 1 READ FAILED: \f_errmsg() ; Check (IMPORTANT) + .\%b := \fright(\m(r),8) ; Extract the balance + .\%b := \ffpadd(\%b,\%a,2) ; Add the new payment + if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records + .r := {\fleft(\m(r),72)\flpad(\%b,8)} ; Update the record + fseek /byte \%c 80*\%n ; Reposition to same spot + fwrite /size:80 \%c {\m(r)} ; Replace the record + if fail stop 1 WRITE FAILED: \f_errmsg() ; Check + fclose \%c ; Close the file + + REMEMBER: Using FILE SEEK to move beyond the end of file can result in + a file with holes when writing; when reading, an end-of-file error will + occur -- be sure to check for it. + +1.22.4. Channel Numbers + + C-Kermit's channel numbers are integers from 0 to some + platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)). + This is the limit placed by the operating system on the number of files + that may be opened by one process or user or job, minus the standard + input, output, and error files, and minus the number of files reserved + by C-Kermit for logs, OPEN READ and WRITE, and file transfer (and maybe + some command files -- the \v(f_max) number can't be exact). + + Although you must include a variable in the FILE OPEN command, to which + the channel number is assigned, you don't have to use a variable in the + other FILE commands if you know what the number is -- you can just put + the number. This saves you a few keystrokes when typing commands at the + prompt: + + fopen \%c oofa.txt + flist + 0. /usr/olga.oofa.txt (R) 0 + + This tells the channel number is 0 (the number on the left is the + channel file's channel number). Of course you can also find it by + echoing the variable: + + echo \%c + 0 + + Or with "fstatus \%c". Now you can type commands like: + + fread 0 + + to read a line from the file. Obviously, however, using digits rather + than a variable for the channel number would be poor practice in a + script. + + If in commands like: + + fread \%c \%a + + you have trouble remembering which variable is which, note that the + channel number is, indeed, a number. Anywhere C-Kermit accepts a number + it can also accept an expression, so you can put parentheses around the + channel number to remind you it's the channel number and not the + variable into which data is to be read: + + fread (\%c) \%a + + Normally channel numbers are assigned sequentially as 0, 1, 2, ... up + to the limit. However, once you start closing files, there can be holes + in the sequence. New channels are assigned to fill in the holes. Thus + you can't depend on channel numbers being in any particular sequence. + +1.22.5. FILE Command Errors + + Each FILE command sets the variable \v(f_error) to one of the following + values: + + 0 = No error + -1 = System error + -2 = Attempt to read after end of file + -3 = Channel not open + -4 = Channel number out of range (negative or too large) + -5 = Numeric argument (size, ...) out of range + -6 = File not found + -7 = Bad or missing filename + -8 = Too many files are already open (FILE OPEN only) + -9 = Forbidden operation (e.g. write to a read-only file) + -10 = Access denied + -11 = Illegal combination of OPEN modes (FILE OPEN only) + -12 = Buffer overflow + -13 = Current line number unknown (for relative line seeks) + -14 through -98: Reserved. + -99 = Requested operation not implemented in this version of C-Kermit + -999 = Unknown error + + When \v(f_error) is -1, this means the FILE command failed because + because of a system error, in which case you can examine the following + variables: + + \v(errno) = System error number. + \v(errstring) = Error message corresponding to \v(errno). + + A special function is available for translating the \v(f_error) code to + an error message string: + +\f_errmsg([code]) + If the code is -1, returns error message of the most recent system + error; otherwise if the code is a valid \v(f_error) value, the associated + message is returned. If the code is omitted, the status message + corresponding to the current \v(f_error) value is returned. + + A FILE command that fails prints the appropriate error message + automatically, except when the command is READ or SEEK and the error is + -2 (end of file); in that case, the command still fails, but does not + print a message. This allows constructions such as: + + fopen \%c oofa.txt + while success { fread \%c } + fclose \%c + + to work as expected, i.e. without an annoying message when the end of + file is reached. + +1.22.6. File I/O Variables + + The variables associated with the file i/o package are: + + \v(f_count) + Result of the most recent FILE COUNT (FCOUNT) command. + + \v(f_error) + Numeric error code of most recent FILE command (0 = no error). + + \v(f_max) + Maximum number of files open simultaneously. + +1.22.7. File I/O Functions + + Some of the FILE commands can also be issued as function calls, which + makes script writing a bit more convenient, especially for C + programmers. Also, several functions are provided that do not have + command equivalents. Each of these functions takes a channel number as + the first argument. These functions do not work for OPEN { READ, !READ, + WRITE, !WRITE, and APPEND } files. + + \f_status(channel) + Returns 0 if the channel is not open, otherwise a number between + 1 and 15 which is the sum of the OPEN modes: + + 1 = /READ + 2 = /WRITE + 4 = /APPEND + 8 = /BINARY + + The remaining functions work only for open channels. Each of these + functions can fail for the applicable reasons listed in [387]Section + 1.22.5. For instructions on handling function errors, see [388]Section + 7.12. + + \f_pos(channel) + Returns the file's current read/write pointer (0-based). There + is no FILE command equivalent. + + \f_line(channel) + Returns the file's current line number (0-based), if known, + otherwise -1. There is no FILE command equivalent. The line + number is known as long as no character or block i/o has been + done on the channel. + + \f_handle(channel) + Returns the "file handle" of the file. That is, it translates + the portable C-Kermit channel number into a system-specific file + handle or number that can be passed to other programs on the + same platform. In UNIX this is a file descriptor. There is no + FILE command equivalent. + + \f_eof(channel) + Returns 1 if the read/write pointer of the file on the given + channel is at the end of the file, 0 otherwise. Convenient in + WHILE statements, e.g.: + + while not \f_eof(\%c) { fread \%c } + + \f_getchar(channel) + Equivalent to FREAD /CHAR. Returns the character actually read. + If \f_getchar() does not fail but the return value is empty, + this means a NULL character was read. + + \f_getline(channel) + Equivalent to FREAD /LINE. Returns the line actually read, but + with the line terminator stripped. If \f_getline() does not fail + but the return value is empty, this normally means an empty line + was read. + + \f_getblock(channel,n) + Equivalent to FREAD /SIZE:n. Returns the block of characters + actually read. If the returned block is smaller than n, it + indicates either that the end of file was reached or a NUL + character is in the block. + + \f_putchar(channel,c) + Equivalent to FWRITE /CHARACTER. Writes the character c. If c + contains more than one character, only the first is written. If + c is empty a NUL is written. Returns the number of characters + written on success, or a negative error code upon failure. + + \f_putline(channel,string) + Equivalent to FWRITE /LINE. Writes the string and adds the + appropriate line termination character or sequence. If the + string is empty or omitted, an empty line is written. Returns + the number of characters written on success, or a negative error + code upon failure. + + \f_putblock(channel,string) + Equivalent to FWRITE /STRING. Writes the string as given. If the + string is empty or omitted, nothing is written. Returns the + number of characters written on success, or a negative error + code upon failure. + +1.22.8. File I/O Function Examples + + fopen /read \%c oofa.txt ; Open our favorite file for reading + if failure exit 1 ; Check that it's open + while not \f_eof(\%c) { ; Loop until EOF + .line := \f_getline(\%c) ; Get a line + if success echo {\m(line)} ; Echo it + } + if not \f_eof(\%c) { ; Check reason for loop exit + exit 1 File Error: \f_errmsg() ; If not EOF say so. + } + + frewind \%c ; Rewind the file + while not \f_eof(\%c) { ; Same thing but with block i/o + .block := \f_getblock(\%c,256) ; (much faster than line i/o) + if success xecho {\m(block)} + } + + frewind \%c ; Rewind again + while not \f_eof(\%c) { ; Same deal but with character i/o + .c := \f_getchar(\%c) ; (much slower than line i/o) + if success xecho {\m(c)} + } + close \%c + + To close all open files (equivalent to FCLOSE ALL): + + for \%i 0 \v(f_max)-1 1 { + if \f_status(\%i) fclose \%i + } + +1.23. The EXEC Command + + The EXEC command is available only in UNIX. + + EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ] + Runs the given command with the arguments in such a way that the + command replaces C-Kermit in memory, and C-Kermit ceases to + execute. EXEC is like RUN, except instead of returning to + C-Kermit when finished, the command returns to whatever process + invoked Kermit. + + In the normal case, no files are closed, so the EXEC'd command inherits + the open files, read/write pointers, working directory, process ID, + user ID (unless command is SUID), group ID (unless command is SGID), + groups, etc. (In UNIX, the EXEC command is simply a front end for + execvp().) + + If the /REDIRECT switch is included, then if a connection is open (SET + LINE or SET HOST), it becomes the standard input and output of the + EXEC'd program. If no connection is open, the /REDIRECT switch has no + effect. For example to use C-Kermit for PPP dialing in Linux: + + set modem type usr ; Specify the kind of modem you have + set line /dev/ttyS1 ; Specify the device it's connected to + set speed 57600 ; and the speed + set flow rts/cts ; and flow control. + set dial retries 100 ; Try the dial sequence up to 100 times. + dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}} + if fail exit 1 + for \%i 1 16 1 { ; Try up to 16 times to get login prompt + input 10 Login: ; Wait 10 sec for it to appear + if success break ; Got it - proceed... + output \13 ; Send a carriage return and try again + } + if ( > \%i 16 ) stop 1 NO LOGIN PROMPT + lineout \(myuserid) ; Send user ID + input 30 assword: ; Wait for Password prompt + if fail stop 1 NO PASSWORD PROMPT + lineout \m(mypassword) ; Send the password. + exec /redirect pppd ; Replace ourselves with pppd. + + In this example we assume that the script has already set up the + myuserid and mypassword variables -- normally the password should be + prompted for, rather than stored on disk. Notice the advantages over + the well-known "chat script": + * You don't have to control the modem itself with AT commands; + Kermit's DIAL command does this for you. + * You can have Kermit automatically redial as many times as you want + until it gets a connection (if this is legal in your country). + * You can have Kermit fetch the number or numbers from a dialing + directory. + * You can have Kermit cycle through a list of phone numbers (this is + new in C-Kermit 7.0; see [389]Section 2.1.16) without having to + enter the numbers in a dialing directory. + * Dialing is location-independent; you can use the same script to + dial from different areas or countries. + * Once the connection is made, the full power of Kermit's script + language is available to manage the dialog with the terminal server + or other device that answers the phone call. + + NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000, + whose APIs do not provide a method for an application to hand over a + connection to the PPP or SLIP driver. + +1.24. Getting Keyword Lists with '?' + + Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab + to request keyword completion. Kermit beeps, indicating that more than + one command starts with "te". But if you type '?' to see what they are, + Kermit shows only "telnet". So why the beep? Because of invisible + keywords like "telopt", "terminal", and "text". Lots of keywords are + invisible because they are either synonyms for other keywords or else + esoteric options to be used only in special circumstances, so we don't + want them cluttering up the menus. + + But then there is no way for you to discover them. So in C-Kermit 7.0, + if you type '?' AFTER the beginning of a keyword field, then invisible + keywords are shown too: + + C-Kermit> te + C-Kermit> te? Command, one of the following: + telnet telopt terminal text + C-Kermit>te + + But if '?' is typed at the beginning of a field, only visible keywords + are shown, as before (so, in this example, if '?' is typed at the + C-Kermit> prompt, "telnet" is the only command shown that starts with + "te"). + +2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a +synonym for SET LINE) commands have new synonyms, in which the word SET is +replaced by the word OPEN: OPEN LINE, etc. There is no new functionality +here, but OPEN is a better verb, since SET generally takes no action, whereas +these commands actually try to open a connection. Furthermore, there is the +symmetry with CLOSE. 2.0. SET LINE and SET HOST Command SwitchesThe SET LINE +(SET PORT) and SET HOST commands now allow switches before the device or host +name, in most cases, and under certain circumstances, also at the end. The +new syntax is backwards compatible with the previous syntax; thus SET LINE, +SET PORT, and SET HOST commands in command files written for C-Kermit 6.0 or +earlier still work. The expanded syntax is: + +{ OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches +] + +The first group of switches is: + + /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...} + When more than one network type is available, this lets you + specify the type of network to use for this connection without + affecting your global SET NETWORK TYPE. See [390]Section 2.7 + about pipes and ptys. + + /USERID:[string] + This switch is equivalent to SET LOGIN USERID. If a string is + given, it sent to host during Telnet negotiations; if this + switch is given but the string is omitted, no user ID is sent to + the host. If this switch is not given, your current LOGIN USERID + (\v(userid) value), if any, is sent. Unlike most other switches, + this one is "sticky", since the value must persist throughout + the session in case the server requests the ID string at a later + time. + + /CONNECT + Enter CONNECT mode immediately and automatically after the + device or connection is open. On serial devices, however, when + CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier + Detect signal to appear before trying to connect, to give the + device time to react DTR, which might have been off prior to + opening the device. + + /SERVER + Enter server mode immediately and automatically after the device + or connection is open. Treatment of carrier is the same as for + /CONNECT. + + /WAIT + /NOWAIT + For Telnet connections only: Like SET TELNET WAIT { ON, OFF }, + but applies only to this connection, and in fact applies only + when OPENing this connection (which is usually the only place it + matters). Typically you would use TELNET /NOWAIT to make a + connection to a misbehaving Telnet server that does not reply to + negotiations as required by the Telnet protocol definition. + + Note: /CONNECT and /SERVER switches are not available in the RLOGIN and + TELNET commands, since these commands already include an implicit + /CONNECT and preclude automatic entry into server mode. + + The /CONNECT and /SERVER switches are especially useful with "set host + *" connections. For example, suppose you want to start a Kermit server + on socket 3000 of your TCP host. Normally you would have to give the + command: + + set host * 3000 + + and then wait for a connection to come in, and only then could you give + the SERVER command (or else define a macro to do this, and then execute + the macro). Now you can do it in one step: + + set host /server * 3000 + + This tells C-Kermit to wait for the connection and then enter server + mode once it comes in, no matter how long it takes. Similarly, "set + host /conn *" can be used to wait for a "chat" connection to come in. + + Another set of switches is available in VMS only, for use only with SET + LINE: + + /SHARE + Allows the SET LINE device to be opened in shared mode. Normally + it makes no sense to open a serial device in shared mode, but + it's necessary when C-Kermit is running in an environment such + as DECIntact, that opens your job's controlling terminal in such + a way that C-Kermit can't open it too, unless it enables SHARE + privilege. Note: SHARE privilege is required. + + /NOSHARE + Requires that the SET LINE device not be in use by any other + process in order for it to be successfully opened by C-Kermit. + If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used. + + The second group of switches is: + + /NO-TELNET-INIT + Do not send initial Telnet negotiations even if this is a Telnet + port. + + /RAW-SOCKET + This is a connection to a raw TCP socket ([391]Section 2.3.5). + + /RLOGIN + Use Rlogin protocol even if this is not an Rlogin port. + + /TELNET + Send initial Telnet negotiations even if this is not a Telnet + port. + + As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an + implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit + sends initial Telnet negotiations. This makes sense, since that's what + "telnet" means. + + If you want to make a connection to a non-Telnet port without sending + initial Telnet negotiations, use: + + set host [ /connect ] name-or-address port + + or: + + telnet name-or-address port /no-telnet-init + + Additional switches might be added in the future; type "set host ?" or + "set line ?" to see a current list. + +2.1. Dialing + + Automatic redialing is illegal or restricted in many countries, so + until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL + RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES + command has been given, a default is picked dynamically at DIAL time + based on the calling country code, if known. At this writing, the only + country code known to have no restrictions on automatic redialing is 1. + So in this case a limit of 10 is chosen; otherwise 1. If you have not + given an explicit SET DIAL RETRIES command, SHOW DIAL shows the value + as "(auto)", and then the value actually used is shown when you give + the DIAL command. + + As of C-Kermit 7.0, automatic redialing is automatically canceled if + the call could not be placed because no dialtone was detected. + +2.1.1. The Dial Result Message + + If DIAL DISPLAY is not ON, the "Call complete" message now shows the + modem's call result message, for example: + + Dialing: ... + Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS" + + The exact format and contents of this message, of course, depends on + the make, model, and configuration of your modem, so use your modem + manual to interpret it. The call result message is also available in + C-Kermit's \v(dialresult) variable. + + C-Kermit> echo \v(dialresult) + CONNECT 31200/ARQ/V32/LAPM/V42BIS + C-Kermit> echo Speed = \fword(\v(dialresult),2) + Speed = 31200 + C-Kermit> + + Suppose your modem reports the modulation speed as shown above and you + want to ensure your call is completed at (say) 24000 bps or more. You + can use a little macro to do the job: + +define HSDIAL { ; High Speed DIAL + local \%s + if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number + set dial retries 100 + set dial interval 1 + while true { + dial \%* + if fail end 1 DIAL failed. + asg \%s \fword(\v(dialresult),2) + if def \%s if numeric \%s if not < \%s 24000 break + } +} + + (See [392]Section 7.5 about the \%* variable.) + +2.1.2. Long-Distance Dialing Changes + + Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area + codes and dialing rules are changing all the time. In the North + American Numbering Plan (NANP) countries (USA, Canada, etc), area codes + are split or overlayed with increasing frequency, and 10- and 11-digit + dialing is gradually becoming the norm for local calls. Changes are + occurring In Europe, too, partly for these reasons and partly because + of some new EC rules. + + In France, effective 18 October 1996, all calls, even local ones, must + be dialed with an area code. French area codes are presently 1-digit + numbers, 1-6, and the long-distance dialing prefix is 0. All calls + within France are considered long distance and begin with 01, 02, ..., + 06. + + Effective 1 May 1997, all calls within the US state of Maryland, even + local ones, must be dialed with an area code but without the + long-distance prefix -- this is the now widely-known North American + phenomenon of "ten digit dialing". The same is happening elsewhere -- + many cities in Florida adopted 10-digit dialing in 1998. + + In Italy beginning 19 June 1998, all calls to fixed (as opposed to + mobile) numbers must be prefixed by 0. When calling into Italy from + outside, the 0 must follow the country code (39). Calls to cell phones, + however, must be placed without the 0. Then on 29 December 2000, the 0 + will become a 4 (for calling fixed numbers) and a prefix of 3 must used + for calling mobile phones. More info at: + http://www.telecomitalia.it/npnn/. + + In Spain, effective 4 April 1998, with hard cutover on 18 July 1998, + all calls within the country must be dialed with 9 digits, and all + calls from outside Spain must also be dialed with 9 digits (after the + country code, 34). The new 9-digit numbers all begin with "9". More + info at: [393]http://www.telefonica.es/cambiodenumeracion/ + + Several new dialing features and commands have been added in version + 6.1 and 7.0 to address these changes. + + C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French + situation via a reasonable subterfuge (setting the local area code to a + nonexistent one), but did not handle "ten-digit dialing" well at all; + the recommended technique was to change the long-distance dialing + prefix to nothing, but this defeated Kermit's "list numbers for one + name" feature when the numbers were in different locations. For + example: + + set dial ld-prefix + dial onlineservice + + where "onlineservice" is a dialing directory entry name corresponding + to entries that are in (say) Maryland as well as other states, would + not correctly dial the numbers not in Maryland. + + A new command lets you specify a list of area codes to be considered + local, except that the area code must be dialed: + + SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ] + The list may include up to 32 area codes. If a number is called + whose area code is in this list, it is dialed WITHOUT the + long-distance prefix, but WITH the area code. + + So in Maryland, which (last time we looked) has two area codes, 410 and + 301, the setup would be: + + SET DIAL LC-AREA-CODES 410 301 + + Example: + + SET DIAL LD-PREFIX 1 + SET DIAL AREA-CODE 301 + SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region + DIAL +1 (301) 765-4321 <-- Dials 3017654321 (local with area code) + DIAL +1 (410) 765-4321 <-- Dials 4107654321 (local with area code) + DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance) + + The SET DIAL LC-AREA-CODES command does not replace the SET DIAL + AREA-CODE command. The latter specifies the area code you are dialing + from. If the called number is in the same area code, then the area code + is dialed if it is also in the LC-AREA-CODES list, and it is not dialed + otherwise. So if "301" had not appeared in the LC-AREA-CODES list in + the previous example: + + SET DIAL LD-PREFIX 1 + SET DIAL AREA-CODE 301 + SET DIAL LC-AREA-CODES 410 <-- Area codes in 10-digit dialing region + DIAL +1 (301) 765-4321 <-- Dials 7654321 (local) + DIAL +1 (410) 765-4321 <-- Dials 4107654321 (local with area code) + DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance) + + The new Kermit versions also add a Local Call Prefix and Local Call + Suffix, in case you have any need for it. These are added to the + beginning and of local phone numbers (i.e. numbers that are not + long-distance or international). Examples: + + SET DIAL LD-PREFIX 1 + SET DIAL LC-PREFIX 9 + SET DIAL LC-SUFFIX * + SET DIAL LC-AREA-CODES 410 <-- Area codes in 10-digit dialing region + SET DIAL AREA-CODE 301 + DIAL +1 (301) 765-4321 <-- Dials 97654321* (local) + DIAL +1 (410) 765-4321 <-- Dials 94107654321* (local with area code) + DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance) + +2.1.3. Forcing Long-Distance Dialing + + Suppose a number is in your country and area, but for some reason you + need to dial it long-distance anyway (as is always the case in France). + There have always been various ways to handle this: + + 1. Temporarily set your area code to a different (or nonexistent or + impossible) one (but this required knowledge of which area codes + were nonexistent or impossible in each country). + 2. Dial the number literally instead of using the portable format, but + this defeats the purpose of the portable dialing directory. + + Now there is also a new command that, very simply, can force + long-distance dialing: + + SET DIAL FORCE-LONG-DISTANCE { ON, OFF } + If a call is placed to a portable phone number within the same + country code as the calling number, it is dialed with the + long-distance prefix and the area code if FORCE-LONG-DISTANCE is + ON. If OFF, the regular rules and procedures apply. + + Example (France): + + SET DIAL COUNTRY-CODE 33 + SET DIAL AREA-CODE 6 + SET DIAL FORCE-LONG-DISTANCE ON + + (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL + FORCE-LONG-DISTANCE ON...) + + Example (USA, for a certain type of reverse-charge calling in which the + called number must always be fully specified): + + SET DIAL PREFIX 18002666328$ ; 1-800-COLLECT + SET DIAL COUNTRY-CODE 1 + SET DIAL AREA-CODE 212 + SET DIAL FORCE-LONG-DISTANCE ON + + Example (Toronto, where calls to exchange 976 within area code 416 must + be dialed as long distance, even when you are dialing from area code + 416): + + SET DIAL COUNTRY-CODE 1 + SET DIAL AREA-CODE 416 + SET DIAL FORCE-LONG-DISTANCE ON + DIAL +1 (416) 976-xxxx + + If dialing methods were consistent and sensible, of course it would be + possible to always dial every domestic call as if it were long + distance. But in many locations this doesn't work or if it does, it + costs extra. The following macro can be used for dialing any given + number with forced long-distance format: + + define LDIAL { + local \%x + set dial force-long-distance on + dial \%* + asg \%x \v(success) + set dial force-long-distance off + end \%x + } + + (See [394]Section 7.5 about the \%* variable.) + +2.1.4. Exchange-Specific Dialing Decisions + + This applies mainly to the North American Numbering Plan (NANP). Refer + to the section "Alternative notations" in [395]Using C-Kermit 2nd + Edition, pages 106-107, and the story about Toronto on page 110. Using + the new LC-AREA-CODES list, we can address the problem by treating the + exchange as part of the area code: + + SET DIAL LD-PREFIX 1 + SET DIAL AREA-CODE 416 + SET DIAL LC-AREA-CODES 905276 + DIAL +1 416 765 4321 <-- 7654321 (local) + DIAL +1 905 276 4321 <-- 9052764321 (local with area code) + DIAL +1 905 528 4321 <-- 19055284321 (long distance) + + The same technique can be used in Massachusetts (story at top of page + 111) and in any other place where dialing to some exchanges within a + particular area code is local, but to others in the same area code is + long distance. + +2.1.5. Cautions about Cheapest-First Dialing + + Kermit does not maintain a knowledge base of telephony information; it + only provides the tools to let you enter a phone number in a standard + format and dial it correctly from any location in most cases. + + In particular, Kermit does not differentiate the charging method from + the dialing method. If a call that is DIALED as long-distance (e.g. + from 212 to 718 in country code 1) is not CHARGED as long distance, we + have no way of knowing that without keeping a matrix of charging + information for every area-code combination within every country, and + any such matrix would be obsolete five minutes after it was + constructed. Thus, "cheapest-first" sorting is only as reliable as our + assumption that the charging method follows the dialing method. A good + illustration would be certain online services that have toll-free + dialup numbers which they charge you a premium (in your online service + bill) for using. + +2.1.6. Blind Dialing (Dialing with No Dialtone) + + C-Kermit's init string for Hayes-like modems generally includes an X4 + command to enable as many result codes as possible, so that Kermit can + react appropriately to different failure reasons. One of the result + codes that X4 enables is "NO DIALTONE". A perhaps not obvious side + effect of enabling this result code that the modem must hear dialtone + before it will dial. + + It is becoming increasingly necessary to force a modem to dial even + though it does not hear a dialtone on the phone line; for example, with + PBXs that have strange dialtones, or with phone systems in different + countries, or with ISDN phones, etc. This is called "blind dialing". + + C-Kermit 7.0 has two new commands to cope with this situation: + + SET DIAL IGNORE-DIALTONE { ON, OFF } + OFF (the default) means to tell the modem to wait for dialtone + before dialing. ON means to enable "blind dialing", i.e. tell + the modem NOT to wait for dialtone before dialing. Generally + this is accomplished by sending ATX3 to the modem just prior to + dialing. SET MODEM TYPE xxx and then SHOW MODEM displays + Kermit's built-in "ignore dialtone" command. + + SET DIAL COMMAND IGNORE-DIALTONE text + This lets you change the built-in ignore-dialtone command (such + as ATX3) to whatever you choose, in case the built-in one does + not work, or another command works better. + + Notes: + 1. The ignore-dialtone command is not sent unless SET DIAL + IGNORE-DIALTONE is ON. + 2. The ATX3 command generally disables not only NO DIALTONE, but also + BUSY. So this will prevent Kermit from detecting when the line is + busy. This is a property of the modem, not of Kermit. + +2.1.7. Trimming the Dialing Dialog + + The command: + + SET MODEM COMMAND action [ command ] + + is used to override Kermit's built-in modem commands for each action, + for each kind of modem in its internal database. If you include a + command, this is used instead of the built-in one. If you omit the + command, this restores the original built-in command. + + If you want to omit the command altogether, so Kermit doesn't send the + command at all, or wait for a response, use: + + SET MODEM COMMAND action {} + + That is, specify a pair of empty braces as the command, for example: + + SET MODEM COMMAND ERROR-CORRECTION ON {} + +2.1.8. Controlling the Dialing Speed + + The rate at which characters are sent to the modem during dialing is + normally controlled by the built-in modem database. You might want to + override this if Kermit seems to be dialing too slowly, or it is + sending characters to the modem faster than the modem handle them. A + new command was added for this in C-Kermit 7.0: + + SET DIAL PACING number + Specifies the number of milliseconds (thousandths of seconds) to + pause between each character when sending commands to the modem + during DIAL or ANSWER command execution. 0 means no pause at + all, -1 (the default) or any other negative number means to use + the value from the database. Any number greater than 0 is the + number of milliseconds to pause. + + HINT: You might also need to control the rate at which the modem + generates Touch Tones during dialing, for example when sending a + numeric page. There are two ways to do this. One way is to insert pause + characters into the dialing string. For modems that use the AT command + set, the pause character is comma (,) and causes a 2-second pause. On + most modems, you can use the S8 register to change the pause interval + caused by comma in the dialing string. The other way is to set your + modem's tone generation interval, if it has a command for that. Most + AT-command-set modems use S11 for this; the value is in milliseconds. + For example on USR modems: + + ATS11=200 + + selects an interval of 200 milliseconds to separate each dialing tone. + + Hint: To add S-Register settings or other commands to your dialing + procedure, use the new SET MODEM COMMAND PREDIAL-INIT command + ([396]Section 2.2.2). + +2.1.9. Pretesting Phone Number Conversions + + The LOOKUP command now accepts telephone numbers as well as + directory-entry names, for example: + + LOOKUP +1 (212) 7654321 + + When given a phone number, LOOKUP prints the result of converting the + phone number for dialing under the current dialing rules. For example, + if my country code is 1 and my area code is 212, and I am dialing out + from a PBX whose outside-line prefix is "93,": + + C-Kermit> lookup +1 (212) 7654321 + +1 (212) 7654321 => 93,7654321 + C-Kermit> + + You can also use the \fdialconvert(phone-number) function ([397]Section + 2.1.11) to do this programmatically: + + C-Kermit> echo "\fdialconvert(+1 (212) 7654321)" + "93,7654321" + C-Kermit> + + So the new LOOKUP behaves as follows: + + LOOKUP portable-format-phone-number + Displays how the number would actually be dialed Sets FAILURE if + there was a conversion error, otherwise SUCCESS. + + LOOKUP literal-format-phone-number + Displays the same literal-format-phone-number Always sets + SUCCESS. + + LOOKUP dialing-directory-name + Displays all matching entries and converts portable phone + numbers. Sets SUCCESS if at least one entry was found, otherwise + FAILURE. + + LOOKUP =anything + Displays "=anything" and sets SUCCESS. + + There is, at present, no programmatic way to fetch numbers from the + dialing directory. This will be considered for a future release. + +2.1.10. Greater Control over Partial Dialing + + The following rules now apply to partial dialing: + + * Phone number transformations based on country and area code, + application of prefixes, etc, are performed only on the first + PDIAL. + * Each PDIAL argument is looked up in the dialing directory, so it is + possible have directory entries for pieces of phone numbers or + other information. + * Suffixes are not applied automatically, since there is no way for + C-Kermit to know in which PDIAL segment you want them to be + applied. + + However, the suffix that *would* have been applied, based on the + dialing rules that were invoked when processing the first PDIAL + command, is stored in the variable: + + \v(dialsuffix) + + which you can include in any subsequent PDIAL or DIAL commands. + + Example: + + pdial {\m(my_long_distance_pager_number_part_1)} + pdial {\m(my_long_distance_pager_number_part_2)} + pdial {\v(dialsuffix)} + pdial {\m(my_long_distance_pager_number_part_3)} + pdial {@\m(numeric_pager_code)#} + +2.1.11. New DIAL-related Variables and Functions + + \fdialconvert(s) + s is a phone number in either literal or portable format (not a + dialing directory entry name). The function returns the dial + string that would actually be used by the DIAL command when + dialing from the current location, after processing country + code, area code, and other SET DIAL values, and should be the + same as the result of LOOKUP when given a telephone number. + + \v(dialsuffix) + Contains the suffix, if any, that was applied in the most recent + DIAL command, or the suffix that would have been applied in the + most recent PDIAL command. Use this variable to send the dial + suffix at any desired point in a PDIAL sequence. + + \v(dialtype) + A number indicating the type of call that was most recently + placed. Can be used after a normal DIAL command, or after the + first PDIAL command in a PDIAL sequence. Values are: + + -2: Unknown because TAPI handled the phone number translation. + -1: Unknown because some kind of error occured. + 0: Internal within PBX. + 1: Toll-free. + 2: Local within calling area. + 3: Unknown (e.g. because a literal-format phone number was given). + 4: Long distance within country. + 5: International + + \v(dialcount) + The current value of the DIAL retry counter, for use in a DIAL + macro ([398]Section 2.1.13). + + \v(d$px) + PBX Exchange (see [399]Section 2.1.12). + + Other dial-related variables, already documented in [400]Using C-Kermit + (or other sections of this document, e.g. [401]Section 2.1.1), include + \v(dialnumber), \v(dialstatus), etc. A convenient way to display all of + them is: + + show variable dial ; hint: abbreviate "sho var dial" + + This shows the values of all the variables whose names start with + "dial". Also "show variable d$" (to show the \v(d$...) variables). + +2.1.12. Increased Flexibility of PBX Dialing + + Refer to [402]Using C-Kermit, 2nd Edition, pages 107-108. Recall that + three commands are needed to configure C-Kermit for dialing from a PBX: + + SET DIAL PBX-EXCHANGE number + SET DIAL PBX-INSIDE-PREFIX number + SET DIAL PBX-OUTSIDE-PREFIX number + + Unfortunately, this model does not accommodate PBXs that have more than + one exchange. For example our PBX at Columbia University (which must + handle more than 10,000 phones) has 853-xxxx and 854-xxxx exchanges. + + Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a + list of exchanges, e.g.: + + SET DIAL PBX-EXCHANGE 853 854 + + (multiple exchanges are separated by spaces, not commas). + + So now when dialing a portable-format number that has the same country + and area codes as those of your dialing location, C-Kermit compares the + exchange of the dialed number with each number in the PBX Exchange list + (rather than with a single PBX Exchange number, as it did formerly) to + determine whether this is an internal PBX number or an external call. + If it is an external call, then the PBX Outside Prefix is applied, and + then the normal dialing rules for local or long-distance calls. + + If it is an inside call, the exchange is replaced by the PBX Inside + Prefix. But if the PBX has more than one exchange, a single fixed PBX + Inside Prefix is probably not sufficient. For example, at Columbia + University, we must dial 3-xxxx for an internal call to 853-xxxx, but + 4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final + digit of the exchange we are dialing. For this reason, C-Kermit 7.0 + provides a method to determine the inside prefix dynamically at dialing + time, consisting of a new variable and new syntax for the SET DIAL + PBX-INSIDE-PREFIX command: + + \v(d$px) + This variable contains the exchange that was matched when a PBX + internal call was detected. For example, if the PBX exchange + list is "853 854" and a call is placed to +1 (212) 854-9999, + \v(d$px) is set to 854. + + SET DIAL PBX-INSIDE-PREFIX \fxxx(...) + If the PBX Inside Prefix is defined to be a function, its + evaluation is deferred until dialing time. Normally, this would + be a string function having \v(d$px) as an operand. Of course, + you can still specify a constant string, as before. + + So given the following setup: + + SET DIAL COUNTRY-CODE 1 + SET DIAL AREA-CODE 212 + SET DIAL PBX-OUTSIDE-PREFIX 93, + SET DIAL PBX-EXCHANGE 853 854 + SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1) + + The following numbers give the results indicated: + + Number Result + +1 (212) 854-9876 4-9876 + +1 (212) 853-1234 3-1234 + +1 (212) 765-4321 93,765-4321 + +1 (333) 765-4321 93,1333765-4321 + + Furthermore, the K_PBX_XCH environment variable may now be set to a + list of exchanges to automatically initialize C-Kermit's PBX exchange + list, for example (in UNIX ksh or bash): + + export K_PBX_XCH="853 854" + + (Quotes required because of the space.) Of course, this variable can + also be set to a single exchange, as before: + + export K_PBX_XCH=853 + +2.1.13. The DIAL macro - Last-Minute Phone Number Conversions + + After a DIAL or LOOKUP command is given, a list of phone numbers is + assembled from the dialing directory (if any), with all + location-dependent conversion rules applied as described in Chapter 5 + of [403]Using C-Kermit. + + However, additional conversions might still be required at the last + minute based on local or ephemeral conditions. So that you can have the + final word on the exact format of the dial string, C-Kermit 7.0 lets + you pass the converted string through a macro of your own design for + final processing before dialing. The relevant command is: + + SET DIAL MACRO [ name ] + Specifies the name of a macro to be run on each phone number + after all built-in conversions have been applied, just before + the number is dialed. If no name is given, no macro is run. The + phone number, as it would have been dialed if there were no dial + macro, is passed to the macro. + + The dial macro can do anything at all (except start a file transfer). + However, the normal use for the macro would be to modify the phone + number. For this reason the phone number is passed to the macro as + argument number 1 (\%1). To cause a modified number to be dialed, the + macro should terminate with a RETURN statement specifying a return + value. To leave the number alone, the macro should simply end. Example: + + define xxx return 10108889999$\%1 + set dial macro xxx + dial xyzcorp + + This defines a DIAL MACRO called xxx, which puts an access code on the + front of the number. Another example might be: + + def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,}) + set dial macro xxx + dial xyzcorp + + which replaces any dollar-sign in the dial string by a series of five + commas, e.g. because this particular modem does not support the "wait + for bong" feature (remember that commas that are to be included + literally in function arguments must be enclosed in braces to + distinguish them from the commas that separate the arguments) and when + the IF condition is not satisfied, the macro does not return a value, + and so the number is not modified. Then when a DIAL command is given + referencing a dialing directory entry, "xyzcorp". The macro is + automatically applied to each matching number. + + Numerous dial-, modem-, communications-, and time-related variables are + available for decision making your dial macro. Type SHOW VARIABLES for + a list. Of particular interest is the \v(dialcount) variable, which + tells how many times the DIAL command gone through its retry loop: 1 on + the first try, 2 on the second, 3 on the third, and so on, and the + \v(dialresult) and \v(dialstatus) variables. + + Here are some other applications for the DIAL MACRO (from users): + + * Phone numbers in the dialing directory are formatted with '-' for + readability, but some modems don't like the hyphens, so the DIAL + macro is used to remove them before dialing; e.g 0090-123-456-78-99 + becomes 00901234567899: "def xxx return \freplace(\%1,-)". + * To set some specific modem (or other) options depending on the + called customer or telephone number. + * Choosing the most appropriate provider based on (e.g.) time of day, + or cycling through a list of providers in case some providers might + be busy. + + To illustrate the final item, suppose you have a choice among many + phone service providers; the provider is chosen by dialing an access + code before the number. Different providers might be better (e.g. + cheaper) for certain times of day or days of the week, or for dialing + certain locations; you can use the DIAL macro to add the access for the + most desirable provider. + + Similarly, when the same number might be reached through multiple + providers, it's possible that one provider might not be able to + complete the call, but another one can. In that case, you can use the + DIAL macro to switch providers each time through the DIAL loop -- + that's where the \v(dialcount) variable comes in handy. + + The following command can be used to debug the DIAL macro: + + SET DIAL TEST { ON, OFF } + Normally OFF, so the DIAL command actually dials. When ON, the + DIAL command performs all lookups and number conversions, and + then goes through the number list and retry loop, but instead of + actually dialing, lists the numbers it would have called if none + of the DIAL attempts succeeded (or more precisely, every number + was always busy). + +2.1.14. Automatic Tone/Pulse Dialing Selection + + SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE } + Chooses the dialing method for subsequent calls. + + Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default, + meaning it does not specify a dialing method to the modem, but relies + on the modem to have an appropriate default dialing method set. So, for + example, when using Hayes compatible modems, the dial string would be + something like ATD7654321, rather than ATDT7654321 or ATDP7654321. + + In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the + environment variable: + + K_DIAL_METHOD + + when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g. + (UNIX): + + set K_DIAL_METHOD=TONE; export K_DIAL_METHOD + + In the absence of a K_DIAL_METHOD definition, the new default SET DIAL + METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the + local country code is known, then if tone dialing is universally + available in the corresponding area, tone dialing is used; if dialing + from a location where pulse dialing is mandatory, pulse dialing is + used. + + The "tone country" and "pulse country" lists are preloaded according to + our knowledge at the time of release. You can see their contents in the + SHOW DIAL listing. You can change the lists with: + + SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ] + Replaces the current TONE-COUNTRIES list with the one given. + Each cc is a country code; separate them with spaces (not + commas). Example: + + set dial tone-countries 1 358 44 46 49 + + If no country codes are given, the current list, if any, is + removed, in which case SET DIAL METHOD AUTO is equivalent to SET + DIAL METHOD DEFAULT. + + SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ] + Replaces the current PULSE-COUNTRIES list with the one give. + Syntax and operation is like SET DIAL TONE-COUNTRIES. + + If the same country code appears in both lists, Pulse takes precedence. + + The SET DIAL TONE- and PULSE-COUNTRIES commands perform no verification + whatsoever on the cc's, since almost any syntax might be legal in some + settings. Furthermore, there is no facility to edit the lists; you can + only replace the whole list. However, since the only purpose of these + lists is to establish a basis for picking tone or pulse dialing + automatically, all you need to override the effect of the list is to + set a specific dialing method with SET DIAL METHOD TONE or SET DIAL + METHOD PULSE. + +2.1.15. Dial-Modifier Variables + + As of C-Kermit 7.0, dial modifiers are available in the following + variables: + + \v(dm_lp) Long pause + \v(dm_sp) Short pause + \v(dm_pd) Pulse dial + \v(dm_td) Tone dial + \v(dm_wa) Wait for answer + \v(dm_wd) Wait for dialtone + \v(dm_rc) Return to command mode + + You can use these in your dial strings in place of hardwired modifiers + like "@", ",", etc, for increased portability of scripts. Example: + + C-Kermit>set modem type usrobotics + C-Kermit>sho variables dm + \v(dm_lp) = , + \v(dm_sp) = / + \v(dm_pd) = P + \v(dm_td) = T + \v(dm_wa) = @ + \v(dm_wd) = W + \v(dm_rc) = ; + C-Kermit>exit + +2.1.16. Giving Multiple Numbers to the DIAL Command + + Prior to C-Kermit 7.0, the only way to give a DIAL command a list of + phone numbers to try until one answers was to create a dialing + directory that had multiple entries under the same name, and then use + that entry name in the DIAL command. Now a list of numbers can be given + to the DIAL command directly in the following format: + + dial {{number1}{number2}{number3}...} + + This is the same list format used by SEND /EXCEPT: and other commands + that allow a list where normally a single item is given. Restrictions + on this form of the DIAL command are: + + * The first two braces must be adjacent; spacing is optional + thereafter. + * Each number must be an actual number to dial, not a dialing + directory entry. + * Dialing directory entries may not contain number lists in this + format. + + In all other respects, the numbers are treated as if they had been + fetched from the dialing directory; they can be in literal or portable + format, etc. Example: + + dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }} + + The list can be any length at all, within reason. + + This feature is especially handy for use with the K95 Dialer, allowing + a list of phone numbers to be specified in the Telephone Number box + without having to set up or reference a separate dialing directory. + + You can also use it to add commonly-dialed sequences as variables in + your C-Kermit customization file, e.g.: + + define work {{7654321}{7654322}{7654323}} + + and then: + + dial {\m(work)} + + (the variable name must be enclosed in braces). + + Or more simply: + + define work dial {{7654321}{7654322}{7654323}} + + and then: + + work + +2.2. Modems + +2.2.1. New Modem Types + + Since C-Kermit 6.0: + + atlas-newcom-33600ifxC Atlas/Newcom 33600 + att-keepintouch AT&T KeepinTouch PCMCIA V.32bis Card Modem + att-1900-stu-iii AT&T Secure Data STU-III Model 1900 + att-1910-stu-iii AT&T Secure Data STU-III Model 1910 + bestdata Best Data + cardinal Cardinal V.34 MVP288X series. + compaq Compaq Data+Fax (e.g. in Presario) + fujitsu Fujitsu Fax/Modem Adapter + generic-high-speed Any modern error-correcting data-compressing modem + itu-t-v25ter/v250 ITU-T (CCITT) V.25ter (V.250) standard command set + megahertz-att-v34 Megahertz AT&T V.34 + megahertz-xjack Megahertz X-Jack + motorola-codex Motorola Codex 326X Series + motorola-montana Motorola Montana + mt5634zpx Multitech MT5634ZPX + rockwell-v90 Rockwell V.90 56K + rolm-244pc Siemens/Rolm 244PC (AT command set) + rolm-600-series Siemens/Rolm 600 Series (AT command set) + spirit-ii QuickComm Spirit II + suprasonic SupraSonic V288+ + supra-express-v90 Supra Express V.90 + + One of the new types, "generic-high-speed" needs a bit of explanation. + This type was added to easily handle other types that are not + explicitly covered, without going through the bother of adding a + complete user-defined modem type. This one works for modern modems that + use the AT command set, on the assumption that all the default + ("factory") settings of the modem (a) are appropriate for Kermit, (b) + include error correction, data compression, and speed buffering; and + (c) are recallable with the command AT&F. + + If the command to recall your modem's profile is not AT&F, use the SET + MODEM COMMAND INIT-STRING command to specify the appropriate modem + command. The default init-string is AT&F\13 (that is, AT, ampersand, F, + and then carriage return); a survey of about 20 modern modem types + shows they all support this, but they might mean different things by + it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F, + which is equivalent to AT&F0, which recalls an inappropriate profile), + so for USR modems: + + set modem type generic-high-speed + set modem command init AT&F1\13 + + Of course, USR modems already have their own built-in modem type. But + if you use this one instead, it will dial faster because it has fewer + commands to give to the modem; in that sense "&F1" is like a macro that + bundles numerous commands into a single one. See your modem manual for + details about factory profiles and commands to recall them. + + WARNING: Do not use the generic-high-speed modem type in operating + systems like VMS where hardware flow control is not available, at least + not unless you change the init string from AT&F\13 to something else + that enables local Xon/Xoff or other appropriate type of flow control. + + Also see [404]Section 2.1.7 for additional hints about making dialing + go faster. + +2.2.2. New Modem Controls + + SET MODEM CAPABILITIES list + In C-Kermit 7.0, this command automatically turns MODEM + SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and + turns it ON if SB is absent. + + SET MODEM COMMAND PREDIAL-INIT [ text ] + Commands to be sent to the modem just prior to dialing. Normally + none. + + SET MODEM SPEAKER { ON, OFF } + Determines whether modem speaker is on or off while call is + being placed. ON by default. Note: This command does not provide + fine-grained control over when the speaker is on or off. + Normally, ON means while the call is being placed, until the + point at which carrier is successfully established. If your + modem has a different speaker option that you want to choose, + then use the SET MODEM COMMAND SPEAKER ON text command to + specify this option. + + SET MODEM COMMAND SPEAKER { ON, OFF } [ text ] + Specify or override the commands to turn your modem's speaker on + and off. + + SET MODEM VOLUME { LOW, MEDIUM, HIGH } + When MODEM SPEAKER is on, select volume. Note: In some modems, + especially internal ones, these commands have no effect; this is + a limitation of the particular modem, not of Kermit. + + SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ] + Specify or override the commands to set your modem's speaker + volume. + + SET MODEM COMMAND IGNORE-DIALTONE [ text ] + The command to enable blind dialing ([405]Section 2.1.6). + + SET MODEM ESCAPE-CHARACTER code + Has been augmented to allow codes of 0 or less: < 0 means the + escape mechanism is disabled. = 0 means to use (restore) the + default value from the modem database. > 0 and < 128 is a + literal value to be used instead of the default one. > 127 means + the escape mechanism is disabled. This affects "modem hangup". + When the escape mechanism is disabled, but SET MODEM + HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command + immediately, without the +++ business first. This + is useful (for example) when sending lots of numeric pages, a + process in which never we go online, and so never need to escape + back. Eliminating the unnecessary pauses and escape sequence + allows a lot more pages to be sent per unit time. + + Recall that C-Kermit can dial modems to which it is connected via + TCP/IP (Telnet or Rlogin) as described on page 126 of [406]Using + C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be + MODEM-COMMAND, since RS-232 signals don't work over TCP/IP connections. + As noted in the manual, such connections are set up by the following + sequence: + + set host host [ port ] + set modem type name + dial number + + But this can cause complications when you use Kermit to switch between + serial and TCP/IP connections. In the following sequence: + + set host name + set modem type name + set port name + + the first two commands obey the rules for dialing out over Telnet. + However, the SET PORT command requires that Kermit close its current + (Telnet) connection before it can open the serial port (since Kermit + can only have one connection open at a time). But since a modem type + was set after the "set host" command was given, Kermit assumes it is a + Telnet dialout connection and so sends the modem's hangup sequence is + sent to the Telnet host. To avoid this, close the network connection + explicitly before opening the serial one: + + set host name + close + set modem type name + set port name + +2.3. TELNET and RLOGIN + + For additional background, please also read the [407]TELNET.TXT file, + also available on the Web in [408]HTML format. + + Cautions: + + * If making a Telnet connection with C-Kermit takes a very long time, + like over a minute, whereas the system Telnet program makes the + same connection immediately, try including the /NOWAIT switch: + C-Kermit> telnet /nowait hostname + + See [409]TELNET.TXT or [410]TELNET.HTM for details. If it also + takes a very long time to make a Telnet connection with system + Telnet, then the delay is most likely caused by reverse DNS lookups + when your host is not properly registered in DNS. + * When supplying numeric IP addresses to C-Kermit or to any other + application (regular Telnet, Rlogin, etc), do not include leading + 0's in any fields unless you intend for those fields to be + interpreted as octal (or hex) numbers. The description of the + Internet address interpreter (the sockets library inet_addr() + routine) includes these words: + + All numbers supplied as "parts" in a "." notation may be decimal, + octal, or hexadecimal, as specified in the C language (that is, a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + To illustrate, 128.59.39.2 and 128.059.039.002 are not the same + host! Even though most of the fields contain non-octal digits. + Using system Telnet (not Kermit): + $ telnet 128.059.039.002 + Trying 128.49.33.2 ... + + Of course the same thing happens with Kermit because it uses (as it + must) the same system service for resolving network addresses that + Telnet, FTP, and all other TCP/IP applications use. + * The RLOGIN section on page 123 does not make it clear that you can + use the SET TELNET TERMINAL-TYPE command to govern the terminal + type that is reported by C-Kermit to the RLOGIN server. + * Note that the SET TCP commands described on pages 122-123 might be + absent; some platforms that support TCP/IP do not support these + particular controls. + + New commands: + + TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK, + DO, DONT, NOP, SB, SE, SUSP, WILL, WONT } + This command was available previously, but supported only DO, + DONT, WILL, and WONT. Now it lets you send all the Telnet + protocol commands. Note that certain commands do not require a + response, and therefore can be used as nondestructive "probes" + to see if the Telnet session is still open; e.g.: + + set host xyzcorp.com + ... + telopt nop + if fail stop 1 Connection lost + + SET TCP ADDRESS [ ip-address ] + Specifies the IP address of the computer that C-Kermit is + running on. Normally this is not necessary. The exception would + be if your machine has multiple network adapters (physical or + virtual) with a different address for each adapter AND you want + C-Kermit to use a specific address when making outgoing + connections or accepting incoming connections. + + SET TCP DNS-SERVICE-RECORDS { ON, OFF } + Tells C-Kermit whether to try to use DNS SRV records to + determine the host and port number upon which to find an + advertised service. For example, if a host wants regular Telnet + connections redirected to some port other than 23, this feature + allows C-Kermit to ask the host which port it should use. Since + not all domain servers are set up to answer such requests, this + feature is OFF by default. + + SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO } + Tells Kermit whether to perform a reverse DNS lookup on TCP/IP + connections. This allows Kermit to determine the actual hostname + of the host it is connected to, which is useful for connections + to host pools, and is required for Kerberos connections to host + pools and for incoming connections. If the other host does not + have a DNS entry, the reverse lookup could take a long time + (minutes) to fail, but the connection will still be made. Turn + this option OFF for speedier connections if you do not need to + know exactly which host you are connected to and you are not + using Kerberos. AUTO, the default, means the lookup is done on + hostnames, but not on numeric IP addresses. + + SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF } + Each Telnet option must be fully negotiated either On or Off + before the session can continue. This is especially true with + options that require sub-negotiations such as Authentication, + Encryption, and Kermit; for proper support of these options + Kermit must wait for the negotiations to complete. Of course, + Kermit has no way of knowing whether a reply is delayed or not + coming at all, and so will wait a minute or more for required + replies before continuing the session. If you know that Kermit's + Telnet partner will not be sending the required replies, you can + set this option of OFF to avoid the long timeouts. Or you can + instruct Kermit to REFUSE specific options with the SET TELOPT + command. + + SET TELOPT [ { /CLIENT, /SERVER } ] option + { ACCEPTED, REFUSED, REQUESTED, REQUIRED } + [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ] + SET TELOPT lets you specify policy requirements for Kermit's + handling of Telnet option negotiations. Setting an option is + REQUIRED causes Kermit to offer the option to the peer and + disconnect if the option is refused. REQUESTED causes Kermit to + offer an option to the peer. ACCEPTED results in no offer but + Kermit will attempt to negotiate the option if it is requested. + REFUSED instructs Kermit to refuse the option if it is requested + by the peer. + + Some options are negotiated in two directions and accept + separate policies for each direction; the first keyword applies + to Kermit itself, the second applies to Kermit's Telnet partner; + if the second keyword is omitted, an appropriate + (option-specific) default is applied. You can also include a + /CLIENT or /SERVER switch to indicate whether the given policies + apply when Kermit is the Telnet client or the Telnet server; if + no switch is given, the command applies to the client. + + Note that some of Kermit's Telnet partners fail to refuse + options that they do not recognize and instead do not respond at + all. In this case it is possible to use SET TELOPT to instruct + Kermit to REFUSE the option before connecting to the problem + host, thus skipping the problematic negotiation. + + Use SHOW TELOPT to view current Telnet Option negotiation + settings. SHOW TELNET displays current Telnet settings. + +2.3.0. Bug Fixes + + If "set host nonexistent-host" was given (and it properly failed), + followed by certain commands like SEND, the original line and modem + type were not restored and C-Kermit thought that it still had a network + hostname; fixed in 7.0. + +2.3.1. Telnet Binary Mode Bug Adjustments + + SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192 + after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO. + The default for both is OFF. ON should be used when communicating with + a Telnet partner (client or server) that mistakenly believes that + telling C-Kermit to enter Telnet binary mode also means that it, too, + is in binary mode, contrary to the Telnet specification, which says + that binary mode must be negotiated in each direction separately. + +2.3.2. VMS UCX Telnet Port Bug Adjustment + + A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with + UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or + earlier. If you try to use VMS C-Kermit to make a Telnet connection + using a port name (like "telnet", which is used by default), the + underlying UCX getservbyname() function might return the service number + with its bytes swapped and the connection will fail. If "telnet + hostname 23" works, then your version of UCX has this bug and you can + put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around + it. + +2.3.3. Telnet New Environment Option + + The TELNET NEW-ENVIRONMENT option ([411]RFC 1572) is supported as 7.0. + This option allows the C-Kermit Telnet client to send certain + well-known variables to the Telnet server, including USER, PRINTER, + DISPLAY, and several others. This feature is enabled by default in + Windows and OS/2, disabled by default elsewhere. The command to enable + and disable it is: + + SET TELNET ENVIRONMENT { ON, OFF } + + When ON, and you Telnet to another computer, you might (or might not) + notice that the "login:" or "Username:" prompt does not appear -- + that's because your username was sent ahead, in which case the remote + system might prompt you only for your password (similar to Rlogin). Use + "set telnet environment off" to defeat this feature, particularly in + scripts where the dialog must be predictable. You can also use this + command to specify or override specific well-known environment variable + values: + + SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ] + +2.3.4. Telnet Location Option + + The TELNET LOCATION option ([412]RFC 779) is supported in 7.0. This + option allows the C-Kermit Telnet client to send a location string to + the server if the server indicates its willingness to accept one. If an + environment variable named LOCATION exists at the time C-Kermit starts, + its value is used as the location string. If you want to change it, + use: + + SET TELNET LOCATION text + + If you omit the text from this command, the Telnet location feature is + disabled. + + SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable that + is sent to the host, as well as the the XDISPLAY location. + +2.3.5. Connecting to Raw TCP Sockets + + The SET HOST and TELNET commands now accept an optional switch, + /RAW-SOCKET, at the end, only if you first give a host and a port. + Example: + + set host xyzcorp.com 23 /raw-socket + set host 128.49.39.2:2000 /raw-socket + telnet xyzcorp.com 3000 /raw + + Without this switch, C-Kermit behaves as a Telnet client when (a) the + port is 23 or 1649, or (b) the port is not 513 and the server sent what + appeared to be Telnet negotiations -- that is, messages starting with + 0xFF (IAC). With this switch, Kermit should treat all incoming bytes as + raw data, and will not engage in any Telnet negotiations or NVT CRLF + manipulations. This allows transparent operation through (e.g.) raw TCP + ports on Cisco terminal servers, through the 'modemd' modem server, + etc. + +2.3.6. Incoming TCP Connections + + Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but + for UNIX only. In Version 7.0, they are also available for VMS. + +2.4. The EIGHTBIT Command + + EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL + BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit + clean connection in a single command. + +2.5. The Services Directory + + Chapter 7 of [413]Using C-Kermit does not mention the ULOGIN macro, + which is used by our sample services directory, CKERMIT.KND. Unlike + UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that require + a user ID but no password. Therefore it doesn't prompt for a password + or wait for a password prompt from the remote service. + + In version 7.0, the CALL macro was changed to not execute a SET MODEM + TYPE command if the given modem type was the same as the current one; + otherwise the new SET MODEM TYPE command would overwrite any + customizations that the user had made to the modem settings. Ditto for + SET LINE / SET PORT and SET SPEED. + +2.6. Closing Connections + + Until version 7.0, there was never an obvious and general way to close + a connection. If a serial connection was open, it could be closed by + "set line" or "set port" (giving no device name); if a network + connection was open, it could be closed by "set host" (no host name). + + In version 7.0, a new command closes the connection in an obvious and + straightforward way, no matter what the connection type: + + CLOSE [ CONNECTION ] + + The CLOSE command was already present, and required an operand such as + DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The + new CONNECTION operand is now the default operand for CLOSE, so CLOSE + by itself closes the connection, if one is open, just as you would + expect, especially if you are a Telnet or Ftp user. + + Also see the description of the new SET CLOSE-ON-DISCONNECT command in + [414]Section 2.10. + +2.7. Using C-Kermit with External Communication Programs + + C-Kermit 7.0 includes a new ability to create and conduct sessions + through other communications programs. Two methods are available: + + 1. Pty (pseudoterminal): The external program is run on a + "pseudoterminal", which is controlled by Kermit. This method works + with practically any external program, but it is not portable. At + this writing, it works only on some (not all) UNIX versions, and + not on any non-UNIX platforms. + 2. Pipe: The external program's standard input and output are + redirected through a "pipe" controlled by Kermit. This method is + relatively portable -- it should work across all UNIX versions, and + it also works in Windows and OS/2 -- but it is effective only when + the external program actually uses standard i/o (and many don't). + + The two methods are started differently but are used the same way + thereafter. + + The purpose of this feature is to let you use C-Kermit services like + file transfer, character-set translation, scripting, automatic dialing, + etc, on connections that Kermit can't otherwise make itself. + + This feature is the opposite of the REDIRECT feature, in which C-Kermit + makes the connection, and redirects an external (local) command or + program over this connection. In a pty or pipe connection, C-Kermit + runs and controls a local command or program, which makes the + connection. (The same method can be used to simply to control a local + program without making a connection; see [415]Section 2.8.) + + To find out if your version of Kermit includes PTY support, type "show + features" and look for NETPTY in the alphabetical list of options. For + pipes, look for NETCMD. + + The commands are: + + SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE + SET HOST command + where command is any interactive command. If the command does + not use standard i/o, you must use SET NETWORK TYPE PTY. + + Notes: + + * COMMAND is an invisible synonym for PIPE. + * The command and its arguments are case-sensitive in UNIX. + + The SET NETWORK TYPE, SET HOST sequence sets the given network type for + all subsequent SET HOST commands until another SET NETWORK TYPE command + is given to change it. + + You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or + simply /PIPE or /PTY) switches on the SET HOST command itself: + + SET HOST /NETWORK-TYPE:PIPE command ; These two are the same + SET HOST /PIPE command + + SET HOST /NETWORK-TYPE:PTY command ; Ditto + SET HOST /PTY command + + These are like SET NETWORK TYPE followed by SET HOST, except they apply + only to the connection being made and do not change the global network + type setting (see [416]Section 1.5 about the difference between + switches and SET commands). + + Include any command-line options with the command that might be needed, + as in this example where C-Kermit uses another copy of itself as the + communications program: + + SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com + + IMPORTANT: In Unix, wildcards and redirectors are interpreted by the + shell. If you want to run a program with (say) SET HOST /PTY with + its i/o redirected or with wildcard file arguments, you will need to + invoke the shell too. Example: + +SET HOST /PTY {sh -c "crypt < foo.x"} +SET HOST /PTY {sh -c "grep somestring *.txt"} + + As usual, if you include the /CONNECT switch, SET HOST enters CONNECT + mode immediately upon successful execution of the given command. + Therefore new commands are available as a shorthand for SET HOST + /CONNECT /PTY and /PIPE: + + PTY [ command ] + PIPE [ command ] + The PTY and PIPE commands work like the TELNET and RLOGIN + commands: they set up the connection (in this case, using the + given command) and then enter CONNECT mode automatically (if the + PIPE or PTY command is given without a command, it continues the + current session if one is active; otherwise it gives an error + message). + + The PIPE command is named after the mechanism by which C-Kermit + communicates with the command: UNIX pipes. C-Kermit's i/o is "piped" + through the given command. Here is a typical example: + + PIPE rlogin -8 xyzcorp.com + + This is equivalent to: + + SET HOST /PIPE rlogin -8 xyzcorp.com + CONNECT + + and to: + + SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com + + IMPORTANT: + If you are writing a script, do not use the PIPE, PTY, TELNET, + or RLOGIN command unless you really want C-Kermit to enter + CONNECT mode at that point. Normally SET HOST is used in scripts + to allow the login and other dialogs to be controlled by the + script itself, rather than by an actively participating human at + the keyboard. + + Throughput of pty and pipe connections is limited by the performance of + the chosen command or program and by the interprocess communication + (IPC) method used and/or buffering capacity of the pipe or pty, which + in turn depends on the underlying operating system. + + In one trial (on SunOS 4.1.3), we observed file transfer rates over an + rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps + for uploads on the same connection with the same settings (similar + disparities were noted in HP-UX). Examination of the logs revealed that + a write to the pipe could take as long as 5 seconds, whereas reads were + practically instantaneous. On the other hand, using Telnet as the + external program rather than rlogin, downloads and uploads were better + matched at about 177K each. + + Most external communication programs, like C-Kermit itself, have escape + characters or sequences. Normally these begin with (or consist entirely + of) a control character. You must be sure that this control character + is not "unprefixed" when uploading files, otherwise the external + program will "escape back" to its prompt, or close the connection, or + take some other unwanted action. When in CONNECT mode, observe the + program's normal interaction rules. Of course C-Kermit's own escape + character (normally Ctrl-\) is active too, unless you have taken some + action to disable it. + + On PTY connections, the underlying PTY driver is not guaranteed to be + transparent to control characters -- for example, it might expand tabs, + translate carriage returns, generate signals if it sees an interrupt + character, and so on. Similar things might happen on a PIPE connection. + For this reason, if you plan to transfer files over a PTY or PIPE + connection, tell the file sender to: + + SET PREFIXING ALL + This causes all control characters to be prefixed and + transmitted as printable ASCII characters. + + If the external connection program is not 8-bit clean, you should also: + + SET PARITY SPACE + This causes 8-bit data to be encoded in 7 bits using single + and/or locking shifts. + + And if it does not make a reliable connection (such as those made by + Telnet, Rlogin, Ssh, etc), you should: + + SET STREAMING OFF + This forces C-Kermit to treat the connection as unreliable and + to engage in its normal ACK/NAK protocol for error detection and + correction, rather than "streaming" its packets, as it normally + does on a network connection ([417]Section 4.20). + + In some cases, buffer sizes might be restricted, so you might also need + to reduce the Kermit packet length to fit; this is a trial-and-error + affair. For example, if transfers always fail with 4000-byte packets, + try 2000. If that fails too, try 1000, and so on. The commands are: + + SET RECEIVE PACKET-LENGTH number + This tells the file receiver to tell the file sender the longest + packet length it can accept. + + SET SEND PACKET-LENGTH number + This tells the file sender not to send packets longer than the + given length, even if the receiver says longer ones are OK. Of + course, if the receiver's length is shorter, the shorter length + is used. + + If none of this seems to help, try falling back to the bare minimum, + lowest-common-denominator protocol settings: + + ROBUST + No sliding windows, no streaming, no control-character + unprefixing, packet length 90. + + And then work your way back up by trial and error to get greater + throughput. + + Note that when starting a PIPE connection, and the connection program + (such as telnet or rlogin) prints some greeting or information messages + before starting the connection, these are quite likely to be printed + with a stairstep effect (linefeed without carriage return). This is + because the program is not connected with the UNIX terminal driver; + there's not much Kermit can do about it. Once the connection is made, + everything should go back to normal. This shouldn't happen on a PTY + connection because a PTY is, indeed, a terminal. + + On a similar note, some connection programs (like Solaris 2.5 rlogin) + might print lots of error messages like "ioctl TIOCGETP: invalid + argument" when used through a pipe. They are annoying but usually + harmless. If you want to avoid these messages, and your shell allows + redirection of stderr, you can redirect stderr in your pipe command, as + in this example where the user's shell is bash: + + PIPE rlogin xyzcorp.com 2> /dev/null + + Or use PTY rather than PIPE, since PTY is available on Solaris. + +2.7.0. C-Kermit over tn3270 and tn5250 + + Now you can make a connection from C-Kermit "directly" to an IBM + mainframe and transfer files with it, assuming it has Kermit-370 + installed. Because tn3270 is neither 8-bit clean nor transparent to + control characters, you must give these commands: + + SET PREFIXING ALL ; Prefix all control characters + SET PARITY SPACE ; Telnet connections are usually not 8-bit clean + + and then: + + SET HOST /PTY /CONNECT tn3270 abccorp.com + + or simply: + + pty tn3270 abccorp.com + + SET HOST /PIPE does not work in this case, at least not for file + transfer. File transfer does work, however, with SET HOST /PTY, + provided you use the default packet length of 90 bytes; anything longer + seems to kill the session. + + You can also make connections to IBM AS/400 computers if you have a + tn5250 program installed: + + pty tn5250 hostname + + In this case, however, file transfer is probably not in the cards since + nobody has ever succeeded in writing a Kermit program for the AS/400. + Hint: + + define tn3270 { + check pty + if fail end 1 Sorry - no PTY support... + pty tn3270 \%* + } + + Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used in + macros and scripts to test whether PTY or PIPE support is available. + +2.7.1. C-Kermit over Telnet + + Although C-Kermit includes its own Telnet implementation, you might + need to use an external Telnet program to make certain connections; + perhaps because it has access or security features not available in + C-Kermit itself. As noted above, the only precautions necessary are + usually: + + SET PREFIXING ALL ; Prefix all control characters + SET PARITY SPACE ; Telnet connections might not be 8-bit clean + + and then: + + SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com + + or, equivalently: + + PTY (or PIPE) telnet abccorp.com + +2.7.2. C-Kermit over Rlogin + + C-Kermit includes its own Rlogin client, but this can normally be used + only if you are root, since the rlogin TCP port is privileged. But ptys + and pipes let you make rlogin connections with C-Kermit through your + computer's external rlogin program, which is normally installed as a + privileged program: + + SET PREFIXING ALL + + and then: + + SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com + + or, equivalently: + + PTY (or PIPE) rlogin -8 abccorp.com + + The "-8" option to rlogin enables transmission of 8-bit data. If this + is not available, then include SET PARITY SPACE if you intend to + transfer files. + + Note that the normal escape sequence for rlogin is Carriage Return + followed by Tilde (~), but only when the tilde is followed by certain + other characters; the exact behavior depends on your rlogin client, so + read its documentation. + +2.7.3. C-Kermit over Serial Communication Programs + + Ptys and pipes also let you use programs that make serial connections, + such as cu or tip. For example, C-Kermit can be used through cu to make + connections that otherwise might not be allowed, e.g. because C-Kermit + is not installed with the required write permissions to the dialout + device and the UUCP lockfile directory. + + Suppose your UUCP Devices file contains an entry for a serial device + tty04 to be used for direct connections, but this device is protected + against you (and Kermit when you run it). In this case you can: + + SET CONTROL PREFIX ALL + PTY (or PIPE) cu -l tty04 + + (Similarly for dialout devices, except then you also need to include + the phone number in the "cu" command.) + + As with other communication programs, watch out for cu's escape + sequence, which is the same as the rlogin program's: Carriage Return + followed by Tilde (followed by another character to specify an action, + like "." for closing the connection and exiting from cu). + +2.7.4. C-Kermit over Secure Network Clients + + DISCLAIMER: There are laws in the USA and other countries regarding + use, import, and/or export of encryption and/or decryption or other + forms of security software, algorithms, technology, and intellectual + property. The Kermit Project attempts to follow all known statutes, + and neither intends nor suggests that Kermit software can or should + be used in any way, in any location, that circumvents any + regulations, laws, treaties, covenants, or other legitimate canons + or instruments of law, international relations, trade, ethics, or + propriety. + + For secure connections or connections through firewalls, C-Kermit 7.0 + can be a Kerberos, SRP, and/or SOCKS client when built with the + appropriate options and libraries. But other application-level security + acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an alarming + rate and are (a) impossible to keep up with, (b) usually mutually + incompatible, and (c) have restrictions on export or redistribution and + so cannot be included in C-Kermit itself. + + However, if you have a secure text-based Telnet (or other) client that + employs one of these security methods, you can use C-Kermit "through" + it via a pty or pipe. + +2.7.4.1. SSH + + C-Kermit does not and can not incorporate SSH due to licensing, patent, + and USA export law restrictions. + + The UNIX SSH client does not use standard input/output, and therefore + can be used only by Kermit's PTY interface, if one is present. The + cautions about file transfer, etc, are the same as for Rlogin. Example: + + SET PREFIXING ALL + PTY ssh XYZCORP.COM + + Or, for a scripted session: + + SET PREFIXING ALL + SET HOST /PTY ssh XYZCORP.COM + + Hint: + + define ssh { + check pty + if fail end 1 Sorry - no PTY support... + pty ssh \%* + } + +2.7.4.2. SSL + + Secure Sockets Layer (SSL) is another TCP/IP security overlay, this one + designed by and for Netscape. An SSL Telnet client is available for + UNIX from the University of Queensland. More info at: + + [418]http://www.psy.uq.oz.au/~ftp/Crypto/ + + Interoperability with C-Kermit is unknown. C-Kermit also includes its + own built-in SSL/TLS support, but it is not exportable; [419]CLICK HERE + file for details. + +2.7.4.3. SRP + + SRP(TM) is Stanford University's Secure Remote Password protocol. An + SRP Telnet client is available from Stanford: + + [420]http://srp.stanford.edu/srp/ + + Stanford's SRP Telnet client for UNIX has been tested on SunOS and + works fine with C-Kermit, as described in [421]Section 2.7.1, e.g. + + SET PREFIX ALL + PTY (or PIPE) srp-telnet xenon.stanford.edu + + C-Kermit itself can be built as an SRP Telnet client on systems that + have libsrp.a installed; the C-Kermit support code, however, may not be + exported outside the USA or Canada. + +2.7.4.4. SOCKS + + C-Kermit can be built as a SOCKS-aware client on systems that have a + SOCKS library. See section 8.1.1 of the [422]ckccfg.txt file. + + C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients + with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your + system is SOCKS enabled but C-Kermit is not. Make Kermit connections + like this: + + SET PREFIX ALL + PTY (or PIPE) telnet zzz.com + +2.7.4.5. Kerberos + + UNIX C-Kermit can be built with MIT Kerberos IV or V authentication and + encryption. Instructions are available in a [423]separate document. + Additional modules are required that can not be exported from the USA + to any country except Canada, by US law. + + If you have Kerberos installed but you don't have a Kerberized version + of C-Kermit, you can use ktelnet as C-Kermit's external communications + program to make secure connections without giving up C-Kermit's + services: + + SET PREFIX ALL + PTY (or PIPE) ktelnet cia.gov + +2.8. Scripting Local Programs + + If your version of Kermit has PTY support built in, then any text-based + program can be invoked with SET HOST /PTY or equivalent command and + controlled using the normal sequence of OUTPUT, INPUT, IF SUCCESS + commands (this is the same service that is provided by the 'expect' + program, but controlled by the Kermit script language rather than Tcl). + + When PTY service is not available, then any program that uses standard + input and output can be invoked with SET HOST /PIPE. + + Here's an example in which we start an external Kermit program, wait + for its prompt, give it a VERSION command, and then extract the numeric + version number from its response: + + set host /pty kermit -Y + if fail stop 1 {Can't start external command} + input 10 C-Kermit> + if fail stop 1 {No C-Kermit> prompt} + output version\13 + input 10 {Numeric: } + if fail stop 1 {No match for "Numeric:"} + clear input + input 10 \10 + echo VERSION = "\fsubstr(\v(input),1,6)" + output exit\13 + + This technique could be used to control any other interactive program, + even those that do screen formatting (like Emacs or Vi), if you can + figure out the sequence of events. If your Kermit program doesn't have + PTY support, then the commands are restricted to those using standard + i/o, including certain shells, interactive text-mode "hardcopy" editors + like ex, and so on. + + If you are using the PTY interface, you should be aware that it runs + the given program or command directly on the pty, without any + intervening shell to interpret metacharacters, redirectors, etc. If you + need this sort of thing, include the appropriate shell invocation as + part of your command; for example: + + pty echo * + + just echoes "*"; whereas: + + pty ksh -c "echo *" + + echoes all the filenames that ksh finds matching "*". + + Similarly for redirection: + + set host /pty ksh -c "cat > foo" ; Note: use shell quoting rules here + set transmit eof \4 + transmit bar + + And for that matter, for built-in shell commands: + + set host /pty ksh -c "for i in *; do echo $i; done" + + The PIPE interface, on the other hand, invokes the shell automatically, + so: + + pipe echo * + + prints filenames, not "*". + +2.9. X.25 Networking + + X.25 networking is documented in [424]Using C-Kermit, 2nd Edition. When + the book was published, X.25 was available only in SunOS, Solaris, and + Stratus VOS. Unlike TCP/IP, X.25 APIs are not standardized; each + vendor's X.25 libraries and services (if they have them at all) are + unique. + + This section describes new additions. + +2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX + + Support for X.25 was added via IBM's Network Provider Interface (NPI), + AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0. + Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking in + particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX + version of C-Kermit, when built to include X.25 networking, has neither + a PAD command, nor a SET PAD command. The same is true for the + underlying AIX system: no PAD support. Thus it is not possible to have + an interactive shell session over an X.25 connection into an AIX system + (as far as we know), even from X.25-capable Kermit versions (such as + Solaris or VOS) that do include PAD support. + + Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer + connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike + the Solaris, SunOS, and VOS versions, the AIX version can accept + incoming X.25 connections: + + set network type x.25 + if fail stop 1 Sorry - no X.25 support + ; Put any desired DISABLE or ENABLE or SET commands here. + set host /server * + if fail stop 1 X.25 "set host *" failed + + And then access it from the client as follows: + + set network type x.25 + if fail stop 1 Sorry - no X.25 support + set host xxxxxxx ; Specify the X.25/X.121 address + if fail stop 1 Can't open connection + + And at this point the client can use the full range of client commands: + SEND, GET, REMOTE xxx, FINISH, BYE. + + The AIX version also adds two new variables: + + \v(x25local_nua) + The local X.25 address. + + \v(x25remote_nua) + The X.25 address of the host on the other end of the connection. + + C-Kermit's AIX X.25 client has not been tested against anything other + than a C-Kermit X.25 server on AIX. It is not known if it will + interoperate with C-Kermit servers on Solaris, SunOS, or VOS. + + To make an X.25 connection from AIX C-Kermit, you must: + + set x25 call-user-data xxxx + + where xxxx can be any even-length string of hexadecimal digits, e.g. + 123ABC. + +2.9.2. HP-UX X.25 + + Although C-Kermit presently does not include built-in support for HP-UX + X.25, it can still be used to make X.25 connections as follows: start + Kermit and tell it to: + + set prefixing all + set parity space + pty padem address + + This should work in HP-UX 9.00 and later (see [425]Section 2.7). If you + have an earlier HP-UX version, or the PTY interface doesn't work or + isn't available, try: + + set prefixing all + set parity space + pipe padem address + + Failing that, use Kermit to telnet to localhost and then after logging + back in, start padem as you would normally do to connect over X.25. + +2.10. Additional Serial Port Controls + + C-Kermit 7.0 adds the following commands for greater control over + serial ports. These commands are available only in C-Kermit versions + whose underlying operating systems provide the corresponding services + (such as POSIX and UNIX System V), and even then their successful + operation depends on the capabilities of the specific device and + driver. + + SET DISCONNECT { ON, OFF } + On a SET LINE or SET PORT connection with SET CARRIER ON or + AUTO, if the carrier signal drops during the connection, + indicating that the connection has been lost, and C-Kermit + notices it, this setting governs what happens next. With SET + DISCONNECT OFF, which is consistent with previous behavior, and + therefore the default, C-Kermit continues to keep the device + open and allocated. With SET DISCONNECT ON, C-Kermit + automatically closes and releases the device when it senses a + carrier on-to-off transition, thus allowing others to use it. + However, it remains the default device for i/o (DIAL, REDIAL, + INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is + given, the device is reopened if it is still available. When it + has been automatically closed in this manner, SHOW + COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the + lockfile disappears -- both from SHOW COMM and from the lockfile + directory itself. Synonym: SET CLOSE-ON-DISCONNECT. + + SET EXIT ON-DISCONNECT { ON, OFF } + Like DISCONNECT, but makes the program exit if a connection + drops. + + Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply only + to connections that drop; they do not apply to connections that can't + be made in the first place. For example, they have no effect when a SET + LINE, SET HOST, TELNET, or DIAL command fails. + + HANGUP + If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given + on a serial device, and the carrier signal is no longer present + after the HANGUP command, the device is closed and released. + + SET PARITY HARDWARE { EVEN, ODD } + Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7 + data bits plus the indicated kind of parity (to be done in + software by Kermit itself), SET PARITY HARDWARE selects 8 data + bits plus even or odd parity, to be done by the underlying + hardware, operating system, or device driver. This command is + effective only with a SET LINE or SET PORT device. That is, it + has no effect in remote mode, nor on network connections. There + is presently no method for selecting 8 data bits plus mark or + space parity. If hardware parity is in effect, the variable + \v(hwparity) is set to "even" or "odd". Note: some platforms + might also support settings of SPACE, MARK, or NONE. + + SET STOP-BITS { 1, 2 } + This tells the number of 1-bits to insert after an outbound + character's data and parity bits, to separate it from the next + character. Normally 1. Choosing 2 stop bits should do no harm, + but will slow down serial transmission by approximately 10 + percent. Historically, 2 stop bits were used with Teletypes (at + 110 bps or below) for print-head recovery time. There is + presently no method for choosing any number of stop bits besides + 1 and 2. + + SET SERIAL [ dps ] + dps stands for Data-bits, Parity, Stop-bits. This is the + notation familiar to many people for serial port configuration: + 7E1, 8N1, 7O2, etc. The data bits number also becomes the + TERMINAL BYTESIZE setting. The second character is E for Even, O + for Odd, M for Mark, S for Space, or N for None. The list of + available options depends on the capabilities of the specific + platform. If dps is omitted, 8N1 is used. Type "set serial ?" + for a list of available choices. Examples: + + SET SERIAL 7E1 + Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM + BYTE 7. + + SET SERIAL 8N1 + Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM + BYTE 8. + + SET SERIAL 7E2 + Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET + TERM BYTE 7. + + SET SERIAL 8E2 + Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET + TERM BYTE 8. + + SET SERIAL + Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM BYTE + 8. + + Notes: + + * The SET SERIAL xx2 options are available only in Kermit versions + where the SET PARITY HARDWARE command is also available. (SHOW + FEATURES includes "HWPARITY" in its options list.) + * The SET SERIAL 7xx and 8N1 options affect the software parity + setting, even for network connections. + * As noted in the manual, selecting 8 data bits does not give you + 8-bit terminal sessions in CONNECT mode unless you also SET + TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to + protect against the situation where the remote host is generating + parity but you don't know about it. If the terminal bytesize was 8 + by default and you CONNECTed to such a host, you would see only + garbage on your screen. + * If you do not give a SET STOP-BITS or SET SET SERIAL command, + C-Kermit does not attempt to set the device's stop bits; instead, + it uses whatever setting the device uses when not given explicit + instructions about stop bits. + + SHOW COMMUNICATIONS displays the current settings. Stop bits and + hardware parity are shown only for SET PORT / SET LINE (serial) + devices, since they do not apply to network connections or to remote + mode. STOP-BITS is shown as "(default)" if you have not given an + explicit SET STOP-BITS or SET SERIAL command. + + The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc). + +2.11. Getting Access to the Dialout Device + + This section is for UNIX only; note the special words about QNX at + the end. Also see [426]Section 2.0 for SET LINE switches, + particularly the /SHARE switch for VMS only. + + C-Kermit does its best to obey the UUCP lockfile conventions of each + platform (machine, operating system, OS version) where it runs, if that + platform uses UUCP. + + But simply obeying the conventions is often not good enough, due to the + increasing likelihood that a particular serial device might have more + than one name (e.g. /dev/tty00 and /dev/term/00 are the same device in + Unixware 7; /dev/cua and /dev/cufa are the same device in NeXTSTEP), + plus the increasingly widespread use of symlinks for device names, such + as /dev/modem. + + C-Kermit 7.0 goes to greater lengths than previous versions to + successfully interlock with other communications program (and other + instances of Kermit itself); for example, by: + + * Creation of dual lockfiles whenever a symlink is used; one for the + link name and one for the real name. + * Creation of dual lockfiles in HP-UX according to HP rules. + * Creation of dual uppercase/lowercase lockfile names in SCO + UNIX/ODT/OSR5. + * The use of ttylock() in versions of AIX where it works. + * The use, wherever possible, of lockfile names based on + inode/major/minor device number rather than device name. + + See the [427]ckuins.txt and [428]ckubwr.txt files for details. + + QNX is almost unique among UNIX varieties in having no UUCP programs + nor UUCP-oriented dialout-device locking conventions. QNX does, + however, allow a program to get the device open count. This can not be + a reliable form of locking unless all applications do it (and they + don't), so by default, Kermit uses this information only for printing a + warning message such as: + + C-Kermit>set line /dev/ser1 + WARNING - "/dev/ser1" looks busy... + + However, if you want to use it as a lock, you can do so with: + + SET QNX-PORT-LOCK { ON, OFF } + + QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to + open any dialout device when its open count indicates that another + process has it open. SHOW COMM (in QNX only) displays the setting, and + if you have a port open, it also shows the current open count (with + C-Kermit's own access always counting as 1). + +2.12. The Connection Log + + C-Kermit 7.0 adds the ability to log connections, so you can see where + you've been and have a record of calls you've made. A connection is + defined as any communications session that is begun by SET LINE, SET + PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged + unless you request it; the command is: + + LOG CX [ filename [ { NEW, APPEND } ] ] + Enables logging of connections in the given file. If the + trailing { NEW, APPEND } keyword is omitted, the file is opened + for appending; i.e. new records are written to the end. If NEW + is specified, a new file is created; if a file of the same name + already existed, it is overwritten. If the filename is omitted, + CX.LOG in your home (login) directory is used (note: uppercase). + To accept all defaults, just use "log connections" (or "l c" for + short). Synonym: LOG CONNECTIONS. + + CLOSE CX-LOG + This closes the connection log if it was open. (Note, the CLOSE + CONNECTION command closes the connection itself). + + SHOW CX + This shows your current connection, if any, including the + elapsed time (since you opened it). Synonym: SHOW CONNECTION. + + \v(cx_time) + This variable shows the elapsed time of your current connection, + or if there is no current connection, of your most recent + connection, of if there have been no connections, 0. + + The connection contains one line per connection, of the form: + + yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ] + + where the timestamp (in columns 1-18) shows when the connection was + made; username is the login identity of the person who made the + connection; pid is Kermit's process ID when it made the connection. The + p's are parameters that depend on the type of connection, and the v's + are their values: + + T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc). + H = The name of the Host from which the connection was made. + N = Destination phone Number or Network host name or address. + D = Serial connections only: Device name. + O = Dialed calls only: Originating country code & area code if known. + E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc). + + If you always want to keep a connection log, simply add: + + log connections + + to your C-Kermit customization file. Note, however, that if you make a + lot of connections, your CX.LOG will grow and grow. You can handle this + by adding a "logrotate" procedure like the following to your + customization file, before the "log connections" command: + + define LOGROTATE { ; Define LOGROTATE macro + local \%i \%m \%d \%n \%f MAX + def MAX 4 ; How many months to keep + if not def \%1 - ; No argument given + end 1 \%0: No filename given + if not = 1 \ffiles(\%1) - ; Exactly 1 file must match + end 1 \%0: \%1 - File not found + .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month + if = \%d - ; Compare file year & month + \fsubstr(\v(ndate),1,6) - ; with current year & month + end 0 ; Same year & month - done + rename \%1 \%1.\%d ; Different - rename file + .\%n := \ffiles(\%1.*) ; How many old files + if < \%n \m(MAX) end 0 ; Not enough to rotate + .\%m := \%1.999999 ; Initial compare string + for \%i 1 \%n 1 { ; Loop thru old logs + .\%f := \fnextfile() ; Get next file name + if llt \%f \%m .\%m := \%f ; If this one older remember it + } + delete \%m ; Delete the oldest one + } + log connections ; Now open the (possibly new) log + logrotate \v(home)CX.LOG ; Run the LOGROTATE macro + + As you can see, this compares the yyyymm portion of the modification + date (\fdate()) of the given file (\%1) with the current yyyymm. If + they differ, the current file has the yyyymm suffix (from its most + recent modification date) appended to its name. Then we search through + all other such files, find the oldest one, and delete it. Thus the + current log, plus the logs from the most recent four months, are kept. + This is all done automatically every time you start C-Kermit. + + On multiuser systems, it is possible to keep a single, shared, + system-wide connection log, but this is not recommended since (a) it + requires you keep a publicly write-accessible logfile (a glaring target + for mischief), and (b) it would require each user to log to that file + and not disable logging. A better method for logging connections, in + UNIX at least, is syslogging (see [429]ckuins.txt Section 15 and + [430]Section 4.2 of the [431]IKSD Administration Guide for details). + +2.13. Automatic Connection-Specific Flow Control Selection + + Beginning in C-Kermit 7.0, the appropriate flow-control method for each + connection type is kept in a table, for example: + + Remote: NONE + Modem: RTS/CTS + Direct-Serial: NONE + TCPIP: NONE + + The size of the table and values for each connection type can vary from + platform to platform. Type "set flow ?" for a list of available + flow-control types. + + The table is used to automatically select the appropriate kind of flow + control whenever you make a connection. You can display the table with: + + SHOW FLOW-CONTROL + + The defaults are as follows: + + Remote: + NONE or XON/XOFF. This is because C-Kermit is not allowed to + find out what type of connection the incoming user has (*). No + kind of flow control will work on every kind of connection, + including (unexpectedly) KEEP, which we would have liked to use, + but not turning off flow control at the remote end during file + transfer on TCP/IP connections is fatal to the transfer (except + in VMS and HP-UX, where it must be set to Xon/Xoff!) Therefore + if you are dialing in to a serial port on a server (UNIX or VMS) + where C-Kermit is running, you will need to tell C-Kermit to + "set flow keep" before transferring files (assuming the modem + and port are configured correctly by the system administrator; + otherwise you'll need to give a specific kind of flow control, + e.g. "set flow xon/xoff"), so in this case C-Kermit will not + disable flow control, as it must do when you are coming via + Telnet (directly or through a terminal server, except on VMS and + HP-UX). + + Modem: + This applies when you dial out with a modem. In this case, the + MODEM FLOW-CONTROL setting takes affect after the SET FLOW + setting, so it can pick the most appropriate flow control for + the combination of the particular modem and the + computer/port/driver that is dialing. + + Direct-Serial: + The default here is NONE because C-Kermit has no way of knowing + what kind of flow control, if any, is or can be done by the + device at the other end of the connection. RTS/CTS would be a + bad choice here, because if the CTS signal is not asserted, the + connection will hang. And since direct connections are often + made with 3-wire cables, there is a good chance the CTS signal + will not be received. + + TCPIP: + NONE, since TCP and IP provide their own flow control + transparently to the application, except in VMS, where Xon/Xoff + is the default due to the requirements of the VMS TCP/IP + products. + + Other networks: + NONE, since networks should provide their flow control + transparently to the application. + + (*) This is possibly the worst feature of UNIX, VMS, and other + platforms where C-Kermit runs. If C-Kermit was able to ask the + operating system what kind of connection it had to the user, it could + set up many things for you automatically. + + You can modify the default-flow-control table with: + + SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... } + + where "xxx" is the connection type, e.g. + + SET FLOW /REMOTE NONE + SET FLOW /DIRECT RTS/CTS + + If you leave out the switch, SET FLOW works as before, choosing the + flow control method to be used on the current connection: + + SET FLOW XON/XOFF + + Thus, whenever you make a connection with SET PORT, SET LINE, DIAL, SET + HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is + selected automatically. You can override the automatic selection with a + subsequent SET FLOW command, such as SET FLOW NONE (no switch + included). + + The flow control is changed automatically too when you give a SET MODEM + TYPE command. For example, suppose your operating system (say Linux) + supports hardware flow control (RTS/CTS). Now suppose you give the + following commands: + + set line /dev/ttyS2 ; Automatically sets flow to NONE + set modem type usr ; Automatically sets flow to RTS/CTS + set modem type rolm ; Doesn't support RTS/CTS so now flow is XON/XOFF + + IMPORTANT: This new feature tends to make the order of SET LINE/HOST + and SET FLOW commands matter, where it didn't before. For example, in + VMS: + + SET FLOW KEEP + SET LINE TTA0: + + the SET LINE undoes the SET FLOW KEEP command; the sequence now must + be: + + SET FLOW /DIRECT KEEP + SET LINE TTA0: + + or: + + SET LINE TTA0: + SET FLOW KEEP + +2.14. Trapping Connection Establishment and Loss + + If you define a macro called ON_OPEN, it is executed any time that a + SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command + succeeds in opening a connection. The argument is the host or device + name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This + macro can be used for all sorts of things, like automatically setting + connection- or host-specific parameters when the connection is opened. + Example: + + def ON_OPEN { + switch \%1 { + :abccorp.com, set reliable off, break + :xyzcorp.com, set receive packet-length 1000, break + etc etc... + } + } + + If you define a macro called ON_CLOSE, it will be executed any time + that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind + of connection that C-Kermit has made is closed, either by the remote or + by a local CLOSE, HANGUP, or EXIT command or other local action, such + as when a new connection is opened before an old one was explicitly + closed. + + As soon as C-Kermit notices the connection has been closed, the + ON_CLOSE macro is invoked at (a) the top of the command parsing loop, + or (b) when a connection is closed implicitly by a command such as SET + LINE that closes any open connection prior to making a new connection, + or (c) when C-Kermit closes an open connection in the act of exiting. + + The ON_CLOSE macro was inspired by the neverending quest to unite + Kermit and SSH. In this case using the "tunnel" mechanism: + + def TUNNEL { ; \%1 = host to tunnel to + local \%p + if not def \%1 stop 1 + assign tunnelhost \%1 ; Make global copy + undef on_close + set macro error off + close connection ; Ignore any error + open !read tunnel start \%1 + read \%p ; Get port number + if fail stop 1 Tunnel failure: \%1 + close read + if fail stop 1 Tunnel failure: \%1 ; See [432]Section 4.2.8.1 + assign on_close { ; Set up close handler + echo Closing tunnel: \m(tunnelhost) + !tunnel stop \m(tunnelhost) + undef on_close + } + set host localhost:\%p /telnet + if success end 0 + undef on_close + stop 1 Connection failure: \%1 + } + + In this case, when the connection stops, we also need to shut down the + tunnel, even if it is at a later time after TUNNEL has finished + executing. This way we can escape back, reconnect, transfer files, and + so on until the connection is broken by logging out from the remote, or + by explicitly closing it, or by EXITing from C-Kermit, at which time + the tunnel is shut down. + + When the connection is closed, no matter how, the ON_CLOSE macro + executes and then undefines (destroys) itself, since we don't want to + be closing tunnels in the future when we close subsequent connections. + + Other such tricks can be imagined, including ending ON_CLOSE with a + STOP command to force the command stack to be peeled all the way back + to the top, for example in a deeply nested script that depends on the + connection being open: + + def on_close { stop 1 CONNECTION LOST } + + When C-Kermit invokes the ON_CLOSE macro, it supplies one argument + (\%1): the reason the connection was closed as a number, one of the + following: + + 2 - Fatal failure to negotiate a required item on a network connection. + 1 - Closed by C-Kermit command. + 0 - All others (normally closed by remote). + + which may be used for any purpose; for example, to add a comment to the + connection log: + + def on_close { + local \%m + if not open cx end 0 + switch \%1 { + :0, .\%m = Closed by remote, break + :1, .\%m = Closed by me, break + :2, .\%m = Network protocol negotiation failure, break + } + if def \%m writeln cx {# \%m} + } + +2.15. Contacting Web Servers with the HTTP Command + + C-Kermit 7.0 (at this writing, the UNIX version only) supports direct + contact and interaction with Web servers via HTTP 1.0 protocol. To make + a connection, use Kermit's normal method for making a TCP/IP + connection, but specify the HTTP port: + + SET HOST host http [ switches ] + + where host is the IP hostname or address, and http is the name of the + TCP port for the Web server. Relevant switches include: + + /RAW + Treat the connection as a transparent binary pipe. This switch + may be required if a port other than 'http' is used. + + /SSL + Make an secure private connection with SSL (only if SSL support + is included in your version of Kermit). In this case the port + name might need to be https rather than http, e.g. "set host + secureserver.xyxcorp.com https /ssl". + + /TLS + Make an secure private connection with TLS (only if TLS support + is included in your version of Kermit). In this case the port + name would be https rather than http. + + Then you can issue an HTTP command. In most cases, the server closes + the connection when the command is complete. Example: + + SET HOST www.columbia.edu http + IF FAIL EXIT 1 Can't contact server + HTTP GET kermit/index.html + + At this point the connection is closed, since that's how HTTP 1.0 + works. If you want to perform additional operations, you must establish + a new connection with another SET HOST command. + + The HTTP command acts as a client to the Web server, except instead of + displaying the results like a Web browser would, it stores them. Any + HTTP command can (but need not) include any or all of the following + switches: + + /AGENT:user-agent + Identifies the client to the server; "C-Kermit" or "Kermit-95" + by default. + + /HEADER:header-line + Used for specifying any optional headers. A list of headers is + provided using braces for grouping: + + /HEADER:{{tag:value}{tag:value}...} + + For a listing of valid tag value and value formats see [433]RFC + 1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of + eight headers may be specified. + + /USER:name + In case a page requires a username for access. + + /PASSWORD:password + In case a page requires a password for access. + + /ARRAY:arrayname + Tells Kermit to store the response headers in the given array, + one line per element. The array need not be declared in advance. + Example: + + C-Kermit? http /array:c get kermit/index.html + C-Kermit? show array c + Dimension = 9 + 1. Date: Fri, 26 Nov 1999 23:12:22 GMT + 2. Server: Apache/1.3.4 (Unix) + 3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT + 4. ETag: "bc049-f72-37d441ce" + 5. Accept-Ranges: bytes + 6. Content-Length: 3954 + 7. Connection: close + 8. Content-Type: text/html + + As you can see, the header lines are like MIME e-mail header lines: + identifier, colon, value. The /ARRAY switch is the only method + available to a script to process the server responses for a POST or PUT + command. + + The HTTP commands are: + + HTTP [ switches ] GET remote-filename [ local-filename ] + Retrieves the named file. If a local-filename is given, the file + is stored locally under that name; otherwise it is stored with + its own name. + + HTTP [ switches ] HEAD remote-filename local-filename + Like GET except without actually getting the file; instead it + gets only the headers, storing them into the given file, whose + name must be given, one line per header item, as shown above in + the /ARRAY: switch description. + + HTTP [ switches ] INDEX remote-directory [ local-filename ] + Retrieves the file listing for the given server directory. NOTE: + This command is not supported by most Web servers. + + HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file + Used to send a response as if it were sent from a form. The data + to be posted must be read from a file. + + HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file + Uploads a local file to a server file. + + HTTP [ switches ] DELETE remote-filename + Instructs the server to delete the specified filename. + +3. TERMINAL CONNECTION + +3.1. CONNECT Command Switches + + The following switches (see [434]Section 1.5) were added to the CONNECT + command in 7.0: + + /QUIETLY + Don't print the "Connecting to..." or "Back at..." messages. CQ + is an invisible command synonym for CONNECT /QUIETLY. + + /TRIGGER:string + Specify a trigger or triggers ([435]Section 3.2) effective for + this CONNECT command only, temporarily overriding any current + SET TERMINAL TRIGGER values ([436]Section 3.2). + + Note: Other switches might also be available; type "connect ?" for a + list, "help connect" for a description of each. + +3.2. Triggers + + Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0. + + SET TERMINAL TRIGGER string + Tells C-Kermit to look for the given string during all + subsequent CONNECT sessions, and if seen, to return to command + mode automatically, as if you had escaped back manually. If the + string includes any spaces, you must enclose it in braces. + Example: + + set terminal trigger {NO CARRIER} + + Comparisons are made after character-set translation. + + If a string is to include a literal brace character, precede it with a + backslash: + + ; My modem always makes this noise when the connection is lost: + set terminal trigger |||ppp\{\{\{\{UUUUUUU + + If you want Kermit to look for more than one string simultaneously, use + the following syntax: + + set terminal trigger {{string1}{string2}...{stringn}} + + In this case, C-Kermit will return to command mode automatically if any + of the given strings is encountered. Up to 8 strings may be specified. + + If the most recent return to command mode was caused by a trigger, the + new variable, \v(trigger), shows the trigger value; otherwise + \v(trigger) is empty. + + The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as + well as the \v(trigger) value. + +3.3. Transparent Printing + + As noted in the manual, C-Kermit's CONNECT command on UNIX is not a + terminal emulator, but rather a "semitransparent pipe" between the + terminal or emulator you are using to access C-Kermit, and the remote + host to which C-Kermit is connected. The "semitransparent" qualifier is + because of character-set translation as well as several actions taken + by the emulator in response to the characters or strings that pass + through it, such as APCs, Kermit packets (autodownload), triggers, etc. + + The UNIX version of C-Kermit 7.0 adds another such action: Transparent + printing, also called Controller printing (as distinct from Autoprint + or line or screen print). It is intended mainly for use on UNIX + workstation consoles (as opposed to remote logins), but with some care + can also be used when accessing C-Kermit remotely. + + Transparent printing is related to APC by sharing C-Kermit's built-in + ANSI escape-sequence parser to detect "printer on" and "printer off" + sequences from the host. When the printer-on sequence is received, all + subsequent arriving characters -- including NUL, control characters, + and escape sequences -- are sent to the SET PRINTER device instead of + to your screen until the printer-off sequence is received, or you + escape back, whichever happens first. These bytes are not translated or + modified or filtered in any way by Kermit (except for possibly + stripping of the 8th bit, as noted below), but if filtering or + translation is desired, this can be accomplished by your SET PRINTER + selection (e.g. by choosing a pipeline of filters). + + By default, your SET PRINTER device is your default UNIX printer, but + it can also be a file, a command, or the null device (which causes all + printer material to be discarded). See [437]Using C-Kermit, 2nd Ed., + p.41 for details. + + Transparent printing is controlled by the command: + + SET TERMINAL PRINT { ON, OFF } + When ON, transparent-print sequences are obeyed, and printing + occurs on the system where C-Kermit is running. When OFF, + transparent print sequences are ignored and passed through to + your actual terminal or emulator, along with the data they + enclose. OFF is the default, for compatibility with earlier + C-Kermit releases. As noted in the manual, when the current SET + PRINTER device is a file, transparent-print material is appended + to it; the file is not overwritten. + + SET TERMINAL BYTESIZE { 7, 8 } + SET PARITY { EVEN, ODD, MARK, SPACE, NONE } + If the terminal bytesize is 7, or PARITY is not NONE, the 8th + bit of each byte is stripped prior to printing. + + The transparent-print escape sequences are: + + [5i + Printer On. Send all subsequent incoming bytes to the printer + without any kind of filtering, translation, or alteration. Note: + stands for ASCII character number 27 (decimal), Escape. + + [4i + Printer Off. Resume displaying incoming bytes on the screen. + + These are the same sequences used by DEC VT100 and higher terminals and + other ANSI X3.64 and ISO 6429 compatible terminals. There is no + provision for selecting other printer-control sequences. + + Restrictions: + + 1. You must SET TERM TRANSPARENT-PRINT ON before you can use this + feature. + 2. Only the 7-bit forms of the escape sequences are supported. The + 8-bit CSI C1 control is not recognized. + 3. Autoprint is not supported, since this requires a full-fledged + terminal emulator with direct access to the screen. + 4. The start-print and stop-print sequences pass through to the screen + (there is no way to avoid this without causing unacceptable delays + or deadlocks in CONNECT mode). Thus if your terminal or emulator + also supports transparent printing via these same sequences, an + empty file will be sent to its printer. Normally this has no + effect. + + Point (4) is similar to the situation with autodownload and APC -- when + you have several Kermit clients in a chain, you should take care that + these features are enabled in only one of them. + + Example 1: + + set printer {|lpr -Plaser} ; Specify the printer (if not default). + set term print on ; Enable transparent printing. + set term byte 8 ; Enable 8-bit characters. + connect ; Enter CONNECT mode. + + Example 2: + + set printer /home/users/olga/printer.log ; Send printer material to a file. + + Example 3: + + set printer {| grep -v ^Received | lpr} ; Filter out some lines + + Then use "pcprint" or "vtprint" commands on the host to initiate + transparent print operations. See [438]Using C-Kermit, 2nd Ed., p.406 + for details. + + Here is a sample "pcprint" shell script for UNIX: + + #!/bin/sh + echo -n '[5i' + if [ $# -eq 0 ]; then + cat + else + cat $* + fi + echo -n '[4i' + # (end) + + (Replace "" by the actual ASCII Escape character and "" by the + ASCII Formfeed character). + + If you always want transparent printing enabled, put "set term print + on" in your C-Kermit customization file (~/.mykermrc in UNIX). The "set + term bytesize" selection, however, is a property of each separate + connection. + +3.4. Binary and Text Session Logs + + C-Kermit 7.0 corrects an oversight in earlier releases, in which binary + session logs (SET SESSION-LOG BINARY) translated character sets and + performed various formatting transformations (e.g. "newline mode") + before writing characters to the session log. In C-Kermit 7.0, + binary-mode session logging writes characters as they come in, before + anything (other that parity-bit stripping) is done to them. Text-mode + session logging records the characters after processing. + +4. FILE TRANSFER + + Every file is transferred either in text mode (which implies + record-format and character-set translation) or binary mode (in which + each byte is sent literally without any kind of conversion). The mode + in which a file is transferred is controlled by (a) the default mode, + in the absence of any other indications; (b) the SET FILE TYPE command; + (c) various automatic mechanisms based on client/server negotiations, + directory information or filename patterns, etc. + + The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0 + because: + + * Transferring a text file in binary mode does less damage than + transferring a binary file in text mode. + * Only binary-mode transfers can be recovered from the point of + failure. + * The automatic transfer-mode mechanisms switch to text mode on a + per-file basis anyway, so only those files that are not covered by + the automatic mechanisms are affected. + * All file transfers on the Web are done in binary mode, so people + are accustomed to it and expect it. + +4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS + +4.0.0. Filenames with Spaces + + Filenames that contain spaces are a major nuisance to a program like + Kermit, whose command language is line- and word-oriented, in which + words are separated by spaces and a filename is assumed to be a "word". + In general (unless noted otherwise in the description of a particular + command), there is only one way to refer to such files in Kermit + commands, and that is to enclose the name in braces: + + send {this file} + + Tells Kermit to send the file whose name is "this file" (two words, no + quotes). Of course, various circumlocutions are also possible, such as: + + define \%a this file + send \%a + + BUT, perhaps contrary to expectation, you can't use "\32" to represent + the space: + + send this\32file + + does not work. Why? Because the Kermit parser, which must work on many + operating systems including Windows, has no way of knowing what you + mean by "this\32file". Do you mean a file whose name is "this file" in + the current directory? Or do you mean a file whose name is "32file" in + the "this" subdirectory of the current directory? Guessing won't do + here; Kermit must behave consistently and deterministically in all + cases on all platforms. + + Note that you can't use Esc or Tab within {...} for filename + completion, or question mark to get a filename list. However, you can + include wildcards; for example: + + send {* *} + + sends all files whose name contains a space. + + All things considered, it is best to avoid spaces in file and directory + names if you can. Also see [439]Section 5.4 on this topic. + +4.0.1. Packet out of Window + + C-Kermit 6.0 could send packets "out of window" if the window size was + greater than 1 and ACKs had arrived out of order. Fixed in 6.1. + +4.0.2. MOVE after ADD SEND-LIST + + ADD SEND-LIST followed by MOVE did not delete original files; fixed in + 6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit + checks for this (but results can not be guaranteed). In any case, the + protocol will eventually time out if the connection is lost. + +4.0.3. GET and RECEIVE As-Names + + In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not + properly override the RECEIVE PATHNAMES setting. In 7.0 it does. + +4.0.4. New Brief Statistics Listing + + Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display + a short file-transfer statistics report. /BRIEF is now the default. Use + /VERBOSE to see the full display, which is about 25 lines long. + +4.0.5. Improved FAST Command + + The preinstalled definition of the FAST macro did not take enough + factors into account. Now it sets packet lengths and window sizes + appropriate to the configuration. Furthermore, in IRIX only, it might + restrict the SEND packet length to 4000, to work around a bug in the + IRIX Telnet server, depending on the IRIX version (see [440]ckubwr.txt, + IRIX section). To see the built-in definition of the FAST macro, type + "show macro fast". To change it, simply define it to be whatever you + want -- it's just a macro, like any other. + +4.0.6. The SET SEND BACKUP Command + + Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether backup + files should be sent. Backup files are the ones created by Kermit (and + EMACS, and possibly other applications) to preserve old copies of files + when creating new ones with the same name. Kermit does this when + receiving a file and its FILE COLLISION setting is BACKUP (or RENAME, + in which case it the new file gets the backup name). On most platforms, + the backup name is formed by adding: + + .~n~ + + to the end of the filename, where "n" is a number. For example, if the + original file is oofa.txt, a backup file might be called: + + oofa.txt.~1~ + + (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit + not to send files that have backup names. Normally, SET SEND BACKUP is + ON (as shown by SHOW PROTOCOL), and backup files are sent if their + names match the SEND file specification. + + Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY + /[NO]BACKUP. + +4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command + + VMS Only. Normally when sending files, VMS C-Kermit strips the version + number. For example, if the file is FOO.BAR;34, the name is sent as + FOO.BAR (without the ";34"). If you want to keep version numbers on + when sending files, use SET SEND VERSION-NUMBERS ON. The effect depends + on the receiver. + + Normally when receiving files, and an incoming filename includes a + VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it + before trying to create the new file; this way the new file receives + the next highest version number in the customary manner for VMS. If you + want version numbers on incoming filenames to be used in creating the + new files, use SET RECEIVE VERSION-NUMBERS ON. + + Normally these commands would be effective only when VMS C-Kermit is + exchanging files with a non-VMS Kermit program, since VMS-to-VMS + transfers use labeled mode unless you have gone out of your way to + defeat it. + + Example: You want to send all versions of all files in the current + directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use: + + set send version-numbers on + send *.*;* + + The resulting Unix files will have VMS-style version numbers as part of + their name, for example "foo.bar;1", "foo.bar;2", etc. + + Now suppose you want to send these files from Unix to another VMS + system and preserve the version numbers. Again we have a Unix C-Kermit + server and VMS C-Kermit client. Give these commands to the client: + + set receive version-numbers on + get * + +4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands + + These commands are persistent global versions of the /MOVE-TO: and + /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They + should normally be used only when setting up a dedicated + transaction-processing application, in which each file is to be moved + or renamed immediately after, and only if, it is transferred + successfully, so that (for example) an independent, concurrent process + can notice when new files appear and process them immediately without + having to guess whether they are complete. + +4.0.9. SET FILE INCOMPLETE AUTO + + SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or + discard incompletely received files, has a new option, AUTO, which is + also the default. It means KEEP the incomplete file if the transfer is + in binary mode, otherwise DISCARD it. This reduces the chances that a + subsequent recovery operation (RESEND, REGET, etc) could produce a + corrupt file, since recovery works only for binary-mode transfers. + +4.1. FILE-TRANSFER FILENAME TEMPLATES + + File-transfer filename templates allow files to be renamed + automatically by the file sender, the receiver, or both, during + transfer of groups of files. + +4.1.1. Templates in the As-Name + + Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could + be used to affect the names of files being transferred were SET + FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES { + ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and + RECEIVE commands. + + Previously, the as-name could be used only for a single file. For + example: + + SEND FOO BAR + + would send the file FOO under the name BAR, but: + + SEND *.TXT anything + + was not allowed, since it would give the same name to each file that + was sent. When receiving: + + RECEIVE FOO + + would rename the first incoming file to FOO before storing it on the + disk, but subsequent files would not be renamed to FOO, since this + would result in overwriting the same file repeatedly. Instead, they + were stored under the names they arrived with. + + Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to + specify as-names in SEND, RECEIVE, and related commands even for file + groups. This is accomplished by using replacement variables in the + as-name, along with optional material such character-string functions + and/or constant strings. An as-name containing replacement variables is + called a filename template. + + The key to filename templates is the new variable: + + \v(filename) + + During file transfer it is replaced by the name of each file currently + being transferred (after transfer, it is the name of the last file + transferred). + + So, for example: + + send *.txt \v(filename).new + + sends each file with its own name, but with ".new" appended to it. Of + course if the name already contains periods, this could confuse the + file receiver, so you can also achieve fancier effects with + constructions like: + + send *.txt \freplace(\v(filename),.,_).new + + which replaces all periods in the original filename by underscores, and + then appends ".new" to the result. So, for example, oofa.txt would be + sent as oofa_txt.new. + + Another new variable that is useful in this regard is \v(filenumber), + which is the ordinal number of the current file in the file group, so + you can also: + + send *.txt FILE\flpad(\v(filenum),2,0) + + resulting in a series of files called FILE00, FILE01, FILE02, etc. (At + the end of the transfer, \v(filenum) tells the number of files that + were transferred). + + If you specify a constant as-name when sending a file group: + + send *.txt thisnameonly + + Kermit complains and asks you to include replacement variables in the + as-name. You should generally use \v(filename) or \v(filenumber) for + this purpose, since other variables (with the possible exception of + date/time related variables) do not change from one file to the next. + But Kermit accepts any as-name at all that contains any kind of + variables for file group, even if the variable will not change. So: + + send *.txt \%a + + is accepted, but all files are sent with the same name (the value of + \%a, if it has one and it is constant). If the variable has no value at + all, the files are sent under their own names. + + Of course, the value of \%a in the previous example need not be + constant: + + define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time) + send *.txt \%a + + The RECEIVE command, when given without an as-name, behaves as always, + storing all incoming files under the names they arrive with, subject to + SET FILE NAME and SET RECEIVE PATHNAMES modifications ([441]Section + 4.10). + + However, when an as-name is given in the RECEIVE command, it is applied + to all incoming files rather than to just the first. If it does not + contain replacement variables, then the current FILE COLLISION setting + governs the result. For example: + + receive foo + + will result in incoming files named foo, foo.~1~, foo.~2~, and so on, + with the default FILE COLLISION setting of BACKUP. If it does contain + replacement variables, of course they are used. + + When receiving files, the \v(filename) variable refers to the name that + was received in the incoming file-header packet, BEFORE any processing + by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the filenames in + file-header packets are usually in uppercase, you would need to convert + them explicitly if you want them in lowercase, e.g.: + + receive \flower(\v(filename)).new + +4.1.2. Templates on the Command Line + + On the command-line, use templates as shown above as the -a option + argument, bearing in mind the propensity of UNIX and perhaps other + shells to treat backslash as a shell escape character. So in UNIX (for + example): + + kermit -s oofa.* -a x.\\v(filenum) + + By the way, this represents a change from 6.0 and earlier releases in + which the as-name (-a argument or otherwise) was not evaluated by the + command parser. Thus, for example, in VMS (where the shell does not + care about backslashes), it was possible to: + + kermit -s oofa.txt -a c:\tmp\oofa.txt + + Now backslashes in the as-name must be quoted not only for the shell + (if necessary) but also for Kermit itself: + + kermit -s oofa.txt -a c:\\tmp\\oofa.txt ; Kermit only + kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt ; Shell and Kermit + + You can also use the \fliteral() function for this: + + kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt) ; Kermit only + kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt) ; Shell and Kermit + +4.1.3. Post-Transfer Renaming + + Filename templates are now also useful in SET { SEND, RECEIVE } + RENAME-TO and in the /RENAME-TO: switch, that can be given to the SEND, + GET, or RECEIVE commands; this is similar to an as-name, but is + effective on a per-file basis if and only if the file was transferred + successfully. + + MOVE-TO and RENAME-TO address a requirement commonly stated for + transaction processing and similar systems. Suppose, for example, a + central system "X" accepts connections from multiple clients + simultaneously; a process on X waits for a file to appear and then + processes the file. This process must have a way of knowing when the + file has been completely and successfully transferred before it starts + to process it. This can be accomplished easily using C-Kermit's SET { + SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or + /RENAME-TO: switches, described in [442]Sections 4.7.1 through + [443]4.7.3. + + Here's an example for the client side, in which files to be sent are + placed in a certain directory (/usr/olga/tosend in this example) by + another process when they are ready to go. This might be in a hospital + or big doctor's office, where medical insurance claims are entered at a + number of workstations, and then deposited in the "tosend" directory, + from which they are sent to a claims clearinghouse. We assume the + connection is already made and a Kermit server is on the other end. + + local srcdir findir ; Declare local (automatic) variables + assign srcdir /usr/olga/tosend ; Local source directory (files to send) + assign findir /usr/olga/sent ; Where to move files after they are sent + log transactions ; Keep a log of transfers + cd \m(srcdir) ; Change to the source directory + while true { ; Loop forever... + send /move-to:\m(findir) * ; Send all files + sleep 60 ; Sleep a minute + } ; Go back and do it again + + Note how simple this is. Once each file is sent, it is moved so it + won't be sent again (you could also use SEND /RENAME-TO: or even SEND + /DELETE). If a transfer fails, the file is not moved and so we try + again to send it next time around. If there are no files to send, the + SEND command does nothing but a message is printed; you can avoid the + message by checking first to see if any files are in the directory: + + while true { ; Loop forever... + if > \ffiles(*) 0 - ; If there are any files + send /move-to:\m(findir) * ; send them. + sleep 60 ; Sleep a minute. + } ; Go back and do it again. + + It's even simpler on the server side (here again we assume the + connection is already in place): + + local rcvdir findir ; Declare local (automatic) variables + assign rcvdir /usr/ivan/tmp ; Temporary receiving directory + assign findir /usr/ivan/new ; Where to move files after reception + log transactions ; Keep a log of transfers + cd \m(rcvdir) ; Change to the source directory + set receive move-to \m(findir) ; Declare move-to directory. + server ; Enter server mode. + + A separate process (e.g. the medical claim-form decoder) can look for + files appearing in the /usr/ivan/new directory and process them with + every confidence that they have been completely received. + + Note that the use of MOVE-TO can result in moved files overwriting one + another (the application would normally avoid this by assigning each + transaction a unique, e.g. based on customer number and claim number). + But if filename collisions are a possibility in your application, + RENAME-TO might be a better choice; you can use any variables you like + in the template to ensure uniqueness of the RENAME-TO filename; for + example: + + SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid) + +4.2. FILE-TRANSFER PIPES AND FILTERS + +4.2.1. INTRODUCTION + + Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send + from a command, or "pipe", as well as from a file, and to receive to a + pipe or command. In a typical example, we might want to transfer an + entire directory tree from one UNIX system to another (but without + using the methods described in [444]Sections 4.3 , [445]4.10, + [446]4.11, and [447]4.15). We could do this in multiple steps as + follows: + + 1. Create a tar archive of the desired directory tree + 2. Compress the tar archive + 3. Transfer it in binary mode to the other computer + 4. Decompress it + 5. Extract the directory tree from the tar archive + + But this is inconvenient and it requires a temporary file, which might + be larger than we have room for. + + The new pipe-transfer feature lets you do such things in a single step, + and without intermediate files. + + Additional new features, also discussed here, let you specify pre- and + post- processing filters for outbound and incoming files, and give you + a way to insert the output from shell or system commands into C-Kermit + commands. + + The file-transfer related features are available only with Kermit + protocol, not with any external protocols, nor with K95's built-in + XYZMODEM protocols (because XYZMODEM recovers from transmission errors + by rewinding the source file, and you can't rewind a pipe). + + This section begins by discussing the simple and straightforward use of + these features in UNIX, in which pipes and input/output redirection are + a fundamental component and therefore "just work", and then goes on to + discuss their operation in Windows and OS/2, where matters are much + more complicated. + +4.2.1.1. TERMINOLOGY + + Standard Input + This is a precise technical term denoting the normal source of + input for a command or program, which is the keyboard of your + terminal by default, but which can be redirected to a file or + pipe. + + Stdin + Abbreviation for Standard Input. + + Standard Output + A precise technical term denoting the normal destination for + output from a command or program, which is your terminal screen + by default, but which can be redirected to a file. + + Stdout + Abbreviation for Standard Output. + + Stdio + Abbreviation for Standard Input / Standard Output. + + I/O + Abbreviation for Input / Output. + + Shell + Text-based system command processor, such as the UNIX shell, DOS + COMMAND.COM, etc. + + Pipe + A mechanism by which the standard output of one program is sent + to the standard input of another. + + Pipeline + A series of programs connected by pipes. + +4.2.1.2. NOTATION + + In command descriptions, "command" is replaced by a shell or system + command or pipeline. The command names specified in these commands are + interpreted by your shell, just as if you were typing them at the shell + prompt, and so if they are in your PATH, they will be found in the + expected manner. Therefore you don't have to specify complete pathnames + for commands that are programs (but it shouldn't hurt if you do). + + The normal notation for I/O redirection is as follows: + + < Read Stdin from the given file. + > Send Stdout to the given file. + | Send Stdout from the command on the left to the command on the right. + + Examples: + + sort < foo > bar + Sorts the lines in file "foo" and writes the results to file + "bar" + + grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr + This is a command pipeline composed of 5 commands: + + grep -c "some text" *.txt + Looks in all files whose names end with ".txt" for the string + "some text" and writes to Stdout the names of each file followed + by a colon and the number of occurrences in each. + + grep -v ":0" + Prints to Stdout the lines from Stdin that do NOT contain the + string ":0", in this case, it removes the names of files that do + not contain "some text". + + sort + Sorts the lines from Stdin alphabetically to Stdout. + + pr -3 + Arranges the lines from Stdin in three columns. + + lpr + Prints its Stdin on the default printer. + + Note that the Kermit features described here work only with commands + that use Stdio. If you attempt to use them with commands whose input + and output can not be redirected, Kermit will most likely get stuck. + Kermit has no way of telling how an external command works, nor what + the syntax of the shell is, so it's up to you to make sure you use + these features only with redirectable commands. + + The quoting rules of your shell apply to the command. Thus in UNIX, + where C-Kermit tries to use your preferred shell for running commands, + shell "metacharacters" within commands must be escaped if they are to + be taken literally, using the methods normal for your shell. For + example, the UNIX tr (translate) command must have its arguments in + quotes: + + tr "[a-z]" "[A-Z]" + + otherwise the shell is likely to replace them by all filenames that + match, which is probably not what you want. This is also true when + using your shell directly, and has nothing to do with Kermit. + +4.2.1.3. SECURITY + + Some sites might not wish to allow access to system commands or + external programs from within Kermit. Such access, including all the + features described here, can be disabled in various ways: + + 1. When building from source code, include -DNOPUSH among the CFLAGS. + 2. At runtime, give the NOPUSH command. + 3. For server mode, give the DISABLE HOST command. + 4. Implicit use of pipes can be disabled as described in [448]Section + 4.2.4. + + Note: 3 and 4 are not necessary if you have done 1 or 2. + +4.2.2. Commands for Transferring from and to Pipes + + SEND /COMMAND sends data from a command or command pipeline, and + RECEIVE /COMMENT writes data to a command or pipeline. The GET /COMMAND + command asks a server to send material, and then writes the incoming + material to a command or pipeline. These features, along with switches + (like "/COMMAND", described in [449]Section 4.7) are new to C-Kermit + 6.1. The following synonyms are also provided: + + CSEND = SEND /COMMAND + CRECEIVE = RECEIVE /COMMAND + CGET = GET /COMMAND + + None of these commands can be used if a SEND or RECEIVE FILTER + (respectively, [450]Section 4.2.3) is in effect, or if a NOPUSH command + ([451]Section 4.2.1.3) has been given, or if the current protocol is + not Kermit. + +4.2.2.1. Sending from a Command + + SEND /COMMAND command [ as-name ] + SEND /AS-NAME:as-name /COMMAND command + CSEND command [ as-name ] + These three forms are the same. They work like the SEND command, + but instead of sending a file, it sends the standard output of + the given command, either under the command's own name, or else + with the given as-name. If the command contains spaces, it must + be enclosed in braces. Braces should also be used for the + as-name if it contains spaces. If braces are included around + either the command or the as-name, they are removed after + parsing but before use. As with SEND, the transfer is in text or + binary mode according the current FILE TYPE setting, unless you + override the global transfer mode by including a /TEXT or + /BINARY switch. The command must require no input. + + When sending from a command or pipeline, C-Kermit has no way of knowing + in advance how much data will be sent, and so it can not send the size + to the other Kermit in the Attribute packet, and so the receiving + Kermit has no way of displaying "percent done" or a progress bar + (thermometer). + + Examples that make sense in text mode (illustrated by common UNIX + commands): + + SEND /COMMAND finger + CSEND finger + sends the current "finger" listing (who's logged in) under the + name "finger". The two forms "send /command" and "csend" are + equivalent; we won't bother showing them both in the rest of the + examples. + + SEND /COMMAND:{finger} + CSEND {finger} + Same as previous example (braces are removed from "{finger}"). + + SEND /COMMAND:{ finger } + CSEND { finger } + Same as previous example, but note that the spaces are kept. + This does not prevent the shell from running the "finger" + program, but its output is sent under the name " finger " (with + a leading and trailing space). + + SEND /COMMAND:finger /AS-NAME:userlist + CSEND finger userlist + sends the current finger listing under the name "userlist". + + SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist + CSEND {finger | sort -r} userlist + sends the current finger listing, sorted in reverse order, under + the name "userlist". The braces are needed to distinguish the + command from the as-name. + + SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist} + CSEND {finger | sort -r} {userlist} + Same as previous example (braces are removed from "{userlist}"). + + SEND /COMMAND:{finger | sort -r} + /AS-NAME:{\freplace(\v(filename),\32,_)} + + CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)} + Like the previous example, but sends the output of the command + under the name of the command, but with all spaces (\32) + replaced by underscores, so the as-name is "finger_|_sort_-r". + + Examples that make sense in binary mode (three equivalent forms are + shown): + + SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz + SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c} + CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz + Makes a tar archive of the current directory, compresses it with + the GNU gzip program, and sends it as "mydir.tar.gz". The other + Kermit can, of course, just store it as a file, or it can use + CRECEIVE to uncompress and dearchive it as part of the transfer + process. + + When using a "pipeline" of commands in the command field, obviously, + the first command must not require any input, and the last command + should produce some output, and all intermediate commands should get + some input and produce some output. + +4.2.2.2. Receiving to a Command + + RECEIVE /COMMAND command + CRECEIVE command + This is like RECEIVE, except incoming material is written to the + standard input of the given command, in text or binary mode + according to the normal rules for file reception. Be sure to + include a redirector to a file (if the command normally writes + to standard output), or the output of the command won't go + anywhere. The command may contain spaces; braces are not needed, + but they are removed if used. + + WARNING: C-Kermit has no way of knowing anything about the command, or + even whether it is a command. Thus this command will always cause + C-Kermit to enter protocol mode, as long as some text is specified in + the command field. However, if the text does not correspond to a + command, the transfer will eventually fail with a message such as + "Error writing data" or "Failure to close file". + + Examples for text mode (in UNIX): + + RECEIVE /COMMAND sort -r > reverse.txt + CRECEIVE sort -r > reverse.txt + The text that is received is sorted in reverse order and stored + in the file "reverse.txt". The two forms shown are equivalent. + + RECEIVE /COMMAND {sort -r > reverse.txt} + CRECEIVE {sort -r > reverse.txt} + The same as the previous example; if braces are included, they + are simply removed. + + RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse} + CRECEIVE {sort -r > \flower(\v(filename)).reverse} + Same but stores result under the incoming filename, lowercased, + and with ".reverse" appended to it. + + RECEIVE /COMMAND sort + CRECEIVE sort + Does nothing useful, since the output of sort has nowhere to go. + + RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet + CRECEIVE sort -r | pr -3 | lpr -Plaserjet + The text that is received is sorted in reverse order, arranged + into three columns, and sent to the "laserjet" printer. + + Examples for binary mode: + + RECEIVE /COMMAND:{gunzip -c | tar xf -} + CRECEIVE {gunzip -c | tar xf -} + Assuming the data that is received is a compressed tar archive, + uncompresses the archive and passes it to tar for extraction. In + this case the braces are needed because otherwise the final "-" + would be taken as a command continuation character (see + [452]Using C-Kermit, 2nd Edition, p.33). + + GET /COMMAND remote-file command + GET /COMMAND /AS-NAME:command remote-file + CGET remote-file command + This command tells the Kermit client to send a GET request for + the given remote file to a Kermit server. Unlike GET, however, + the incoming material is written to a command, rather than to a + file. If the remote-file or the command contain spaces, they + must be enclosed in braces. The same cautions about the command + apply as for CRECEIVE. + + Examples (for UNIX): + + GET /COMMAND oofa.txt sort -r > oofa.new + GET /COMMAND {oofa.txt} {sort -r > oofa.new} + CGET oofa.txt sort -r > oofa.new + CGET {oofa.txt} {sort -r > oofa.new} + These four are equivalent. Each of them requests the server to + send its "oofa.txt" file, and as it arrives, it is sorted in + reverse order and written to "oofa.new". + + GET /COMMAND {profile exec a} lpr + GET /COMMAND {profile exec a} {lpr} + GET /COMMAND /AS-NAME:lpr {profile exec a} + GET /COMMAND /AS-NAME:{lpr} {profile exec a} + GET /COMMAND /AS:lpr {profile exec a} + CGET {profile exec a} lpr + CGET {profile exec a} {lpr} + Here the remote filename contains spaces so it MUST be enclosed + in braces. As it arrives it is sent to the lpr program for + printing. Braces are optional around "lpr" since it contains no + spaces. + + GET /COMMAND *.txt {cat >> new.txt} + GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt + CGET *.txt {cat >> new.txt} + This gets all the ".txt" files from the server and concatenates + them all into a single "new.txt" file on the client. + + GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt} + CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt} + As above, but inserts each file's name before its contents. + +4.2.3. Using File-Transfer Filters + + The commands described in [453]Section 4.2.2 let you send the output of + a command, or receive data into a command. But what if you want to + specify preprocessing for files that you send, or postprocessing of + files that you receive, even when multiple files are involved? For this + you need a way to specify send and receive filters. The commands are + SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the + current settings. + +4.2.3.1. The SEND Filter + + SET SEND FILTER [ command ] + This command specifies a command to be run on any file that you + SEND (or MOVE, MSEND, etc). It also applies to files sent when + in server mode, in response to GET commands, but not to the + results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE, + REMOTE HOST, etc. The command may be, but need not be, enclosed + in braces; if it is, the braces are stripped before use. The + output of this command is sent, rather than the file itself. The + current FILE TYPE setting (TEXT or BINARY) applies to the output + of the command. The command must contain at least one instance + of \v(filename), for which the name of the actual file is + substituted. If the command is omitted, the send filter is + removed and files are sent in the normal manner. + + The SET SEND FILTER sets up a "global" filter -- that is, one that + applies to all subsequent file-sending commands until you change or + remove it. You can also specify a "local" filter to be used in a + specific file-sending command by using the /FILTER switch (see + [454]Section 1.5); for example: + + SEND /FILTER:command [ other-switches ] filename + + Besides \v(filename), you can include any other script programming + notation in the send filter: variable names, array references, calls to + built-in string or other functions, and so on. These are evaluated + during file transfer, NOT during parsing, and they are evaluated + separately for each file. + + When the SEND or MOVE (SEND /DELETE) command is used with a send + filter, the output from the filter is sent under the file's original + name unless you specify an "as-name" or template. The Attribute packet + (if any) contains the original file's attributes (size, creation date, + etc). So (for example) if the filter changes the file's size, the + progress thermometer might be wrong. (We can't send the size of the + output from the filter, because it is not known until the transfer is + finished.) If you prefer that the size not be sent, use "set attributes + size off". + + You can not use send filters with RESEND (SEND /RECOVER) or PSEND (SEND + /START). + + Examples for text mode: + + SET SEND FILTER sort -r \v(filename) ; Braces may be omitted + SET SEND FILTER {sort -r \v(filename)} ; Braces may be included + SEND *.txt + This sends every file in the current directory whose name ends + with ".txt" under its own name, but with its lines sorted in + reverse order. + + SEND /FILTER:{sort -r \v(filename)} *.txt + Same as above, but the filter applies only to this SEND command. + Braces are required in this case. + + SET SEND FILTER {sort -r \v(filename)} + SEND oofa.txt reverse.txt + Sends the oofa.txt file with its lines sorted in reverse order + under the name "reverse.txt". + + SET SEND FILTER {sort -r \v(filename)} + SEND oofa.* \v(filename).reverse + Sends all the oofa.* files with their lines sorted in reverse + order; each file is sent under its own name but with ".reverse" + appended to it. + + SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)} + SEND *.txt + Sends all ".txt" files under their own names, but uppercasing + their contents. + + Note that the SEND FILTER applies not only to files that are sent with + SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server + in response to GET requests. + + Examples for binary mode: + + SET SEND FILTER {gzip -c \v(filename)} + SEND /BINARY oofa.txt oofa.txt.gz + Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz. + + SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz + As above, but the filter applies only to this SEND command. + + SET SEND FILTER {gzip -c \v(filename)} + SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ + Sends all the oofa.* files, compressed by gzip, each under its + own name, but with the name uppercased, all periods within the + name converted to underscores, and ".GZ" appended to it. So, for + example, "oofa.txt" is sent as "OOFA_TXT.GZ". + + In the gzip examples, note that the amount of data that is sent is + normally less than the original file size because gzip compresses the + file. But Kermit sends the original file size ahead in the attribute + packet anyway (unless you tell it not too). Thus the transfer will + probably appear to terminate early, e.g. when the receiver's + file-transfer display thermometer is only at 40%. If this annoys you, + tell Kermit to "set attribute length off". On the other hand, you can + use the final position of the thermometer as a measure of the + effectiveness of compression. + +4.2.3.2. The RECEIVE Filter + + SET RECEIVE FILTER [ command ] + This command specifies that the given command will be run on any + file that is received before it is written to disk. The command + may be, but need not be, enclosed in braces; if it is the braces + are stripped before use. The following two commands are + equivalent: + + SET RECEIVE FILTER sort -r > \v(filename) + SET RECEIVE FILTER {sort -r > \v(filename)} + + The RECEIVE filter command may contain a "\v(filename)" sequence to be + replaced by the incoming filename from the file header packet, but it + is not required. However you must use it whenever your filter would + normally write to Stdout, otherwise its output will be lost. + + The RECEIVE filter command may contain one or more "\v(filename)" + sequence to be replaced by the incoming filename from the file header + packet, but it is not required. However you must use it whenever your + filter would normally write to Stdout, otherwise its output will be + lost. + + RECEIVE /FILTER:command and GET /FILTER:command can also be used to + specify a filter to be used for only one file-transfer operation. + + UNIX examples for text mode: + + SET RECEIVE FILTER lpr + RECEIVE + All the files that are received are sent to the default UNIX + print spooler. + + RECEIVE /FILTER:lpr + Same as above, except the lpr filter is used only with this + RECEIVE command. + + RECEIVE lpr + This is probably not what you want; it creates a file called + lpr. + + SET RECEIVE FILTER {sort -r > \v(filename)} + RECEIVE + Stores each incoming file with its lines sorted in reverse + order, under its own name. + + RECEIVE /FILTER:{sort -r > \v(filename)} + As above, but the filter is used only for this RECEIVE command. + + SET RECEIVE FILTER sort -r > \v(filename) + RECEIVE reverse.txt + Stores each incoming file with its lines sorted in reverse + order, under the name "reverse.txt". The actual result depends + on the FILE COLLISION setting. If it is OVERWRITE and multiple + files arrive, then each incoming file destroys the previous one. + If it is BACKUP (the default), filename conflicts are resolve by + adding "version numbers" to the filenames: reverse.txt, + reverse.txt.~1~, reverse.txt.~2~, etc. + + SET RECEIVE FILTER sort -r > \v(filename) + RECEIVE \v(filename).reverse + Stores each incoming file with its lines sorted in reverse + order, under the name it arrived with, but with ".reverse" + appended to it. + + SET RECEIVE FILTER sort -r > \v(filename) + RECEIVE \flower(\v(filename)).reverse + Like the previous example, but ensures that the filename is + lowercase. + + Examples for binary mode: + + SET RECEIVE FILTER gunzip -c > \v(filename) + RECEIVE + This receives one or more presumably compressed file and + uncompresses each one into a file having the same name it was + sent with. For example, if the file is sent with the name + OOFA.TXT.GZ, it is stored with that name, even after + decompression. + + SET RECEIVE FILTER gunzip -c > \v(filename) + RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3)) + Like the previous example, but the resulting filename has its + rightmost three characters removed from it and the remainder is + lowercased. So if the incoming filename is OOFA.TXT.GZ, it is + stored as oofa.txt after decompression. + + Of course you don't want to type such long hideous commands, so we have + also introduced several new functions: + + \fstripx(string[,character]) + This function removes the rightmost segment of the string that + starts with the given character. If no character is given, + period (.) is used. Thus it is most conveniently used for + stripping the extension from a filename (or the decimal portion + from a floating-point number written in US/UK style). Examples: + + \fstripx(OOFA.TXT.GZ) => OOFA.TXT + \fstripx(OOFA.TXT.GZ,.) => OOFA.TXT + \fstripx(OOFA.TXT.GZ,X) => OOFA.T + \fstripx(\fstripx(OOFA.TXT.GZ)) => OOFA + \fstripx($100.00) => $100 + + \fstripn(string,number) + Removes the rightmost number characters from the string. + Examples: + + \fstripn(OOFA.TXT.GZ) => OOFA.TXT.GZ + \fstripn(OOFA.TXT.GZ,3) => OOFA.TXT + \fstripn(OOFA.TXT.GZ,7) => OOFA + + \fstripb(string[,c1[,c2]]) + Strips enclosing matching braces, brackets, parentheses, or + quotes from the string. The second argument, c1, specifies which + kind of enclosure to look for; if not specified, any enclosing + (), [], <>, {}, "", '', or `' are removed. If c1 is specified + and c2 is not, then if c1 is an opening brace, bracket, or + parenthesis, the matching closing one is supplied automatically + as c2. If both c1 and c2 are specified, then to be stripped the + string must begin with c1 and end with c2. If the string is not + enclosed in the indicated manner, the result is the original + string. Examples: + + \fstripb("abc") => abc + \fstripb([abc]) => abc + \fstripb([abc) => [abc + \fstripb() => abc + \fstripb(,[) => + \fstripb((abc)) => abc + \fstripb((abc),[) => (abc) + \fstripb((abc),{(}) => abc + \fstripb(+abc+) => +abc+ + \fstripb(+abc+,+) => abc + \fstripb(+abc+,+,^) => +abc+ + \fstripb(+abc^,+,^) => abc + \fstripb('abc') => abc + \fstripb(`abc') => abc + \fstripb(``abc'') => `abc' + \fstripb(\fstripb(``abc'')) => abc + + Notice the special syntax required for including a literal + parenthesis in the argument list. As the last two examples + illustrate, \fstripb() strips only one level at at a time; + nesting can be used to strip a small fixed number of levels; + loops can be used to strip larger or indeterminate numbers of + levels. + + \flop(string[,char]) + Removes the leftmost segment of the string that ends with the + given character. If no character is given, period (.) is used. + Examples: + + \flop(OOFA.TXT.GZ) => TXT.GZ + \flop(OOFA.TXT.GZ,.) => TXT.GZ + \flop(OOFA.TXT.GZ,X) => T.GZ + + To remove the leftmost number characters, just use + \fsubstring(s,number+1). To return the rightmost number + characters, use \fright(s,number). + + So the hideous example: + + receive \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3)) + + can now be written as: + + receive \flower(\fstripx(\v(filename))) + + That is, the filename stripped of its extension and then lowercased. + This is not only shorter and less hideous, but also does not depend on + the length of the extension being 3. + + Note that when a receive filter is in effect, this overrides your FILE + COLLISION setting, since Kermit has no way of knowing what the final + destination filename will be (because it does not know, and can not be + expected to know, the syntax of every version of every command shell on + every platform on the planet). + +4.2.4. Implicit Use of Pipes + + If you wish, C-Kermit can also examine incoming filenames to see if + they start with "!", and if so, the subsequent text is treated as a + command to read from or write to. For example, if a Kermit client is + given the following command: + + get {!finger | sort} + + the server on the other end, if it supports this feature, will run the + "finger" program, pipe its standard output to the "sort" program, and + send sort's standard output back to you. Similarly, if you: + + send oofa.txt !sort -r > oofa.new + + or, equivalently: + + send oofa.txt {!sort -r > oofa.new} + + or: + + send /as-name:{!sort -r > oofa.new} oofa.txt + + this has the receiver send the contents of the incoming oofa.txt file + to the sort program, which sorts the text in reverse order and stores + the result in oofa.new. + + This use of the exclamation mark should be familiar to UNIX users as + the "bang" feature that lets you run an external application or command + from within another application. + + Kermit's "bang" feature is disabled by default, since it is not unheard + for filenames to actually begin with "!". So if you want to use this + feature, you must enable it with the following command: + + SET TRANSFER PIPES { ON, OFF } + ON enables the recognition of "!" notation in incoming filenames + during file transfer as an indicator that the remaining text is + the name of a command. OFF, the default, disables this feature + and uses the text as a filename in the normal fashion. This + command does NOT affect SEND /COMMAND, GET /COMMAND, CSEND, etc. + + So using a combination of CSEND (SEND /COMMAND) and the "bang" feature, + you can transfer a directory tree all in one command (assuming the + remote Kermit supports pipe transfers and has them enabled): + + CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -} + + or: + + SEND /COMMAND:{tar cf - . | gzip -c} /as:{!gunzip -c | tar xf -} + + Pay close attention to the syntax. Braces are needed around the command + because it contains spaces; braces are needed around the as-name + because it ends with "-". The as-name must begin with "!" or receiving + Kermit will not recognize it as a command. The CSEND command must NOT + begin with "!" unless you are running a command whose name really does + start that character. + + Similarly, you have a Kermit server send a directory tree to be + unpacked on the client end: + + CGET {!tar cf - . | gzip -c} {gunzip -c | tar xf -} + + or: + + GET /COMMAND {!tar cf - . | gzip -c} /as:{gunzip -c | tar xf -} + + Notice how, in this case, the bang is required in the remote command, + to distinguish it from a filename, but not in the local command, since + by definition of CGET (or GET /COMMAND), it is known to be a command. + + SEND and RECEIVE FILTERs supersede the bang feature. For example, if a + file arrives under the name "!gunzip -c | tar xf -", but the receiving + Kermit also has been given a command like: + + set receive filter sort -r > \v(filename) + + then the incoming data will be sorted rather than gunzipped. + + Finally, if SET TRANSFER PIPES is ON (and in this case, this must be + done in your C-Kermit initialization file), you can send from a pipe on + the C-Kermit command line: + + kermit -s "!finger | sort -r" -a userlist + + In this case the "filename" contains spaces and so must be quoting + using your shell's quoting rules. + +4.2.5. Success and Failure of Piped Commands + + Commands or programs started by Kermit as a result of CSEND or CRECEIVE + commands, CGET, SEND /COMMAND, REDIRECT commands (see [455]Section + 4.2.8.2), implicit use of pipes, RUN commands, and so forth, should + return their exit status codes to the Kermit command that caused them + to be run, and therefore IF SUCCESS and IF FAILURE tests after these + commands should work as expected. For example: + + CSEND blah < filename + + should fail if there is no command called "blah" or if there is no file + called "filename". However, this is not foolproof and sometimes + C-Kermit might think a command succeeded when it failed, or vice versa. + This is most likely to happen when the highly system-dependent methods + that Kermit must use to determine a command's exit status code do not + supply the right information. + + It can also happen because some commands might define success and + failure differently from what you expect, or because you are using a + pipeline composed of many commands, and one of them fails to pass + failing exit status codes up the chain. The most likely culprit is the + shell itself, which in most cases must be interposed between Kermit and + any external program to be run. + + In any case, you can examine the following variable to find out the + exit status code returned to Kermit by the process most recently run by + any command that runs external commands or programs, including CSEND, + CRECEIVE, REDIRECT, RUN, etc: + + \v(pexitstat) + + In UNIX, Windows and OS/2, the value should be -2 if no command has + been run yet, 0 if the most recent command succeeded, -1, -3, or -4 if + there was an internal error, and a positive number returned by the + command itself if the command failed. If the number is in the range + 1-127, this is the program's exit status code. If it is 128 or greater, + this is supposed to indicate that the command or program was + interrupted or terminated from outside itself. + + In Windows 95 and 98, the return values of the default shell are + unreliable; various third-party shells can be used to work around this + deficiency. + + In VMS, it is the actual exit status code of the command that was run. + This is an odd number if the command succeeded, and an even number if + it failed. You can see the associated message as follows: + + run write sys$output f$message(\v(pexitstat)) + + Or, more conveniently, use the new Kermit function: + + echo \ferrstring(\v(pexitstat)) + + which converts a system error code (number) to the corresponding + message. + +4.2.6. Cautions about Using Pipes to Transfer Directory Trees + + Although utilities such as tar and zip/unzip might be available on + different platforms (such as UNIX and Windows), this does not + necessarily mean you can use them successfully to transfer directory + trees between unlike platforms. For example: + + CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -} + + when used from UNIX to Windows will have satisfactory results for + binary files, but not for text files. UNIX text files have lines ending + with Linefeed (LF) only, whereas Windows text files have lines ending + in Carriage Return and Linefeed (CRLF). Thus any text files that were + in the archive formed by the first tar command will be unpacked by the + second tar command in their original form, and will display and print + incorrectly in Windows (except in applications that have been + explicitly coded to handle UNIX-format text files). On the other hand + if you told gzip to use "text mode" to do record format conversion + (assuming there was a way to tell it, as there is with most "zip" + programs), this would destroy any binary files in the archive. + + Furthermore, if the archive contains text files that are written in + languages other than English, the "special" (accented and/or non-Roman) + characters are NOT translated, and are therefore likely show up as + gibberish on the target system. For example, West European languages + are usually encoded in ISO Latin Alphabet 1 in UNIX, but in PC code + page 850 on the PC. Capital A with acute accent is code point 193 + (decimal) Latin-1, but 181 in CP850. So A-acute in the UNIX file + becomes Middle Box Bottom on the PC, and similarly for all the other + special characters, and for all other languages -- Greek, Russian, + Hebrew, Japanese, etc. + + So when transferring text files between unlike platforms, you should + use direct Kermit file transfers so Kermit can apply the needed + record-format and character-set transformations. Use pipelines + containing archivers like tar or zip only if all the files are binary + or the two systems use the same record format and character set for + text files. + + Also see [456]Sections 4.3, [457]4.10, [458]4.11, and [459]4.15 for how + to transfer directory trees between both like and unlike systems + directly with Kermit. + +4.2.7. Pipes and Encryption + + Of course pipelines could be used for encrypted file transfers, + assuming proper precautions could be taken concerning the transmission + of the key. But there is rarely a good way to do this. To illustrate + using UNIX crypt: + + csend {crypt key < filename} {!crypt key > filename} + + Or, more ambitiously: + + csend {tar cf - . | gzip -c | crypt key} {!crypt key | gunzip -c | tar xf -} + + transmits the key in the file header packet as part of the (clear-text) + remote command, defeating the entire purpose of encrypting the file + data. + + But if you are connected in terminal mode to the remote computer and + type: + + creceive {crypt key > filename} + + at the remote Kermit prompt, you have also transmitted the key in clear + text over the communications link. + + At present, the only secure way to use CSEND and CRECEIVE with an + encryption filter is to have a human operator at both ends, so the key + does not have to be transmitted. + + Theoretically it would be possible to use PGP software (Pretty Good + Privacy, by Phil Zimmerman, Phil's Pretty Good Software) to avoid key + transmission (since PGP uses separate public and private key and "lets + you communicate securely with people you've never met, with no secure + channels needed for prior exchange of keys"), but the specific method + has yet to be worked out. + + HINT: See the PGP User's Guide, e.g. at: + [460]http://www.telstra.com.au/docs/PGP/ + Especially the topic "Using PGP as a UNIX-Style Filter": + [461]http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html + + In any case, better and more convenient security options are now + available: Kerberos authentication and encryption ([462]CLICK HERE for + details) and the new ability to run C-Kermit "though" other + communication programs, described in [463]Section 2.7. + +4.2.8. Commands and Functions Related to Pipes + +4.2.8.1. The OPEN !READ and OPEN !WRITE Commands + + These are described in [464]Using C-Kermit, and are generally useful + with reading output from commands that produce more than one line on + their standard output, or writing multiple lines into commands that + accept them on their standard input. + + In C-Kermit 7.0 CLOSE !READ is accepted as a synonym for CLOSE READ, + and CLOSE !WRITE for CLOSE WRITE. + + Testing the success and failure of these commands, however, can be a + bit tricky. Consider: + + open !read lalaskjfsldkfjsldkfj + + (where "lalaskjfsldkfjsldkfj" is neither a valid command nor the name + of a program or script that can be run). OPEN !READ, in UNIX at least, + translates this into execl(shellpath,shellname,"-c",command). This + means it starts your preferred shell (e.g. from the SHELL environment + variable) and asks it to execute the given command. It must be this + way, because your command can be a either an internal shell command + (which only your shell can execute) or an external command, which only + your shell knows how to find (it knows your PATH and interprets, etc). + Therefore unless OPEN !READ can't start your shell, it always succeeds. + + Continuing with the nonexistent-command example: + + C-Kermit> open !read lalaskjfsldkfjsldkfj + C-Kermit> status + SUCCESS + C-Kermit> read line + C-Kermit> status + SUCCESS + C-Kermit> echo "\m(line)" + "bash: lalaskjfsldkfjsldkfj: command not found" + C-Kermit> close read + C-Kermit> status + FAILURE + C-Kermit> + + In other words, the failure can not be detected on OPEN, since the OPEN + command succeeds if it can start your shell. It can't be detected on + READ, since all this does is read output from the shell, which in this + case happens to be an error message. However, failure IS detected upon + close, since this is the occasion upon which the shell gives Kermit its + exit status code. + + For an illustration of this situation, see [465]Section 2.14. + +4.2.8.2. The REDIRECT Command + + A second method of I/O redirection is offered by the REDIRECT command. + This is a rather advanced and tricky feature that is presently + supported only in UNIX C-Kermit, in OS-9 C-Kermit, and in Kermit 95. + Syntax: + + REDIRECT command + Runs the given command, sending its standard output to the + current communications channel (SET LINE, SET PORT, or SET HOST + connection), and reading its standard input from the same + connection. Works only in local mode -- i.e. a connection is + required -- and then only if the given command uses Standard + I/O. + + Example: + + redirect finger + + runs the local "finger" command and sends its output over the + connection as plain text, where presumably there is a process set up to + read it. Another example: + + redirect finger | sort -r + + shows the use of a pipeline. + + Note: REDIRECT differs from CSEND/CRECEIVE in two important ways: (1) + it does not use the Kermit protocol, and (2) it uses a bidirectional + pipe rather than a one-way pipe. + + The primary use of the REDIRECT command is to run external protocols, + such as sz/rz in UNIX for ZMODEM, when they work over Standard I/O(*). + Example: + + set host xyzcorp.com + (login, etc) + redirect sz oofa.zip + + lets you make a Telnet connection with C-Kermit and then do a ZMODEM + transfer over it. ZMODEM protocol messages go both ways over the same + connection simultaneously. + + It is possible to use C-Kermit on UNIX as your PPP dialer and then to + REDIRECT the connection to the PPP software, but C-Kermit 7.0 offers a + better approach to PPP dialing in its new EXEC command ([466]Section + 1.23). + + In theory, you can also redirect an interactive process. For example, + suppose you tell Kermit 95 to wait for an incoming TCP/IP connection: + + set host * 3000 + + and then tell C-Kermit on UNIX to: + + set host kermit95hostname 3000 + redirect ksh + + and then tell Kermit 95 to CONNECT: now you are talking to the UNIX + K-shell; you can give commands (pwd, ls, etc) and see the results. In + practice, the K-shell's terminal modes are messed up because (a) it is + not going through the Unix terminal driver, and (b) it is "smart" and + knows it is being redirected, and so acts in a decidedly inhospitable + manner (other applications like EMACS, vi, etc, simply refuse to run if + their standard i/o has been redirected). + + (*) The publicly-distributed sz/rz programs do not work as clients. + However, Omen Technology does offer an up-to-date redirectable + client XYZMODEM program called crzsz. + +4.2.8.3. Receiving Mail and Print Jobs + + As of 7.0, and in UNIX only, files that are sent to C-Kermit as mail + (when the other Kermit uses a MAIL or SEND /MAIL command) or to be + printed (via REMOTE PRINT or SEND /PRINT) are now piped directly to the + mail or print program, rather than written to temporary files and then + mailed or printed and then deleted. This has the advantages of (a) not + requiring a temporary file, and (b) allowing mail to have a proper + subject in place of the filename. Temporary files were bad not only + because they required (a) space, and (b) writeability of the current + directory, but also because using them could result in wiping out an + existing file. See [467]Section 4.7 for more about SEND /MAIL and SEND + /PRINT. + +4.2.8.4. Pipe-Related Functions + + The \fcommand(command) function runs the given shell or system command + and returns the command's standard output as its value (with any + newline characters stripped from the end), unless the result is too + long, in which case it returns the empty string. The maximum length for + the result is at least 1022 bytes, and it might be longer on some + platforms. Examples (UNIX): + + C-Kermit> echo "\fcommand(date)" + "Fri Apr 18 13:31:42 1997" + C-Kermit> echo "\fcommand(finger | wc -l)" ; how many users logged in? + " 83" + C-Kermit> evaluate \fcommand(finger | wc -l) * 2 + 166 + C-Kermit> echo Welcome to \fcommand(tty) on \fcommand(date) + Welcome to /dev/ttyre on Fri Apr 18 13:31:42 1997 + C-Kermit> echo "\fcommand(ls oofa.*)" + "oofa.c + oofa.h + oofa.o" + C-Kermit> cd /directory-with-thousands-of-files + C-Kermit> echo "\fcommand(ls -l)" ; This would be too long + "" + C-Kermit> + + If a command's output would be too long, you can use the other, more + laborious method of reading from a command: OPEN !READ command, READ + each line, CLOSE !READ. + + The \frawcommand(command) function is identical to \fcommand(command), + except it does not remove trailing newline characters: + + C-Kermit> echo "\frawcommand(date)" + "Fri Apr 18 13:31:42 1997 + " + C-Kermit> echo "\frawcommand(ls oofa.*)" + "oofa.c + oofa.h + oofa.o + " + C-Kermit> + + Use \frawcommand() if you want to retain the final line terminators, or + if the command's output is "binary". But remember that if the result of + this (or any other) function contains any NUL (ASCII code 0) + characters, the first NUL will terminate the result string because this + is how C strings work (it's "C-Kermit", remember?). + + These functions are useful not only locally, but also in the + client/server arena. If you need to get the results from a system + command on the server end into a variable on the client end, just do: + + [ remote ] query kermit command(date) + + The result is in the local \v(query) variable; see [468]Using C-Kermit, + 2nd Ed., pp.359-360 for details. + +4.3. Automatic Per-File Text/Binary Mode Switching + + When transferring files between like systems (e.g. UNIX-to-UNIX), + binary mode can be used for all files unless character-set translation + is needed, and in fact Kermit programs of recent vintage recognize each + others' platforms and switch to binary mode automatically when it is + appropriate (e.g. DOS to OS/2, or UNIX to UNIX). (Exception: LABELED + mode is chosen for VMS-to-VMS and OS/2-to-OS/2 transfers so complex + file formats can be preserved.) + + On a client/server connection between like systems, the transfer mode + is currently determined by the file sender, rather than always by the + client. If the client is sending, it controls the transfer mode. If a + GET command is sent to the server, the server sends all files in binary + mode if its TRANSFER CHARACTER-SET is TRANSPARENT; otherwise it uses + text mode for text files (according to its text-pattern list) and + binary mode for binary files. Of course, the client can control the + server's transfer character-set with the REMOTE SET TRANSFER + CHARACTER-SET command. + + When transferring files between unlike systems, however, (e.g. + UNIX-to-DOS), some files (such as executable program images) must be + transferred in binary mode but others (such as plain-text files) must + be transferred in text mode so their record format and character sets + can be appropriately converted. If a binary file is transferred in text + mode, it is ruined. If a text file is transferred in binary mode, then + at the very least, its format can be incorrect; at worst it is also + corrupted because its character set was not converted (in extreme cases + the corruption is total, e.g. because one system is ASCII-based and the + other EBCDIC). + +4.3.1. Exceptions + + VMS C-Kermit, when sending files to a non-VMS system, switches to text + or binary mode automatically for each file, based on the record format + in the file's directory entry; thus the mechanisms described in this + section do not apply to VMS C-Kermit, yet the effect is the same: + automatic text/binary mode switching when VMS C-Kermit is sending + files. See the VMS Appendix of [469]Using C-Kermit for details. + + Kermit versions that support LABELED or IMAGE transfer mode are + likewise not affected by this feature when one of those modes is + selected (normally used only when transferring between like systems). + + Kermit versions that support file-transfer pipes and filters are not + affected by this feature when pipes or filters are used, since the + output of a pipe or filter (such as gzip) is likely to require transfer + in a different mode than the original file. + + Finally, SEND /TEXT or SEND /BINARY will force files to be sent in the + indicated mode, overriding all automatic transfer-mode-choosing + mechanisms. + +4.3.2. Overview + + Suppose you give C-Kermit a command like: + + SEND *.* + + And suppose the pattern *.* matches a mixture of text files (such as + program source code) and binary files (such os object modules or + executable programs). + + C-Kermit 6.0 and earlier (except on VMS) send all files in the same + mode: whatever you said in your most recent SET FILE TYPE command, or + else whatever mode was chosen automatically according to the rules on + page 236 of Using C-Kermit, 2nd Ed. + + But when text and binary files are mixed in the same group, and the + files are being transferred to an unlike system (e.g. UNIX to IBM + Mainframe), this results in corruption of either all the text files or + all the binary files. + + Stream-oriented file systems such as in UNIX and DOS do not record any + information about the file to tell us whether the file should be + transferred in binary or text mode, making it impossible to select the + transfer mode for each file in a group automatically with any + certainty. + + However, we can use some fairly-well established file naming + conventions for this purpose. C-Kermit 7.0 lets you provide lists of + filename patterns that are used to separately determine the file type + for each individual file being transfered. A pattern is a string, + possibly containing the special characters "*" (asterisk, which matches + any string of zero of more characters) and/or "?" (question mark, which + matches any single character). For example "a*b" matches all files + whose names start with "a" and end with "b", such as "ab", "arb", + "ababababab", etc, but not "abba". And "a?b" matches any file whose + name starts with "a", ends with "b", and is exactly 3 characters long. + + NOTE: When typing commands at the C-Kermit prompt, you must prefix + "?" with \ to override its normal function of giving help. + + (Also see [470]Section 4.9 for additional pattern-matching notations + that might be available in your version of C-Kermit.) + + When you have specified filename recognition patterns, C-Kermit can + transfer the ones whose names match any of the binary-mode patterns in + binary mode, and those with names that match any of the text-mode + patterns in text mode, and those whose names match neither in the + prevailing mode you have chosen, or that was chosen automatically via + peer recognition. + +4.3.3. Commands + + SET FILE PATTERNS { ON, OFF, AUTO } + This tells Kermit whether to do per-file filename + pattern-matching to determine text or binary mode. The normal + and default setting is AUTO, which means to use pattern lists to + switch transfer mode only when it is certain that the other + Kermit program supports automatic notification of transfer mode + (via Attribute packets) on a per-file basis (this information is + obtained automatically during protocol startup negotiation). ON + means to always determine the transfer mode from the filename + and pattern list when sending files. Use OFF to disable this + feature (without resetting your pattern lists). Also note that + if you have selected LABELED file transfer (SET FILE TYPE + LABELED), this takes precedence over filename-matching patterns + and all files are sent in labeled mode. + + SET TRANSFER MODE MANUAL + Disables the use of filename patterns, no matter what the FILE + PATTERNS setting. + + REMOTE SET TRANSFER MODE MANUAL + Client command to disable automatic transfer mode, and therefore + also filename patterns, in the server. Synonym: REMOTE SET XFER + MODE MANUAL. + + { GET, SEND, etc } { /BINARY, /TEXT } + Including a /BINARY or /TEXT (or, where supported, /IMAGE or + /LABELED) switch with a file-transfer command changes the + transfer mode to manual for that command only, and therefore + disables patterns that that command. + + SET FILE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + A list of zero or more patterns, separated by spaces (not + commas). Letters in a pattern are case-sensitive if the + underlying filenames are case sensitive (as in UNIX), and + case-insensitive otherwise (as in Windows). If a file's name is + matched by any pattern in the list and SET FILE PATTERNS is ON, + the file is sent in binary mode. Examples: + + SET FILE BINARY-PATTERNS *.gz *.Z *.tar *.zip *.o *.so *.a *.out ; UNIX + SET FILE BINARY-PATTERNS *.EXE *.ZIP *.OBJ *.COM ; DOS or OS/2 or Windows + + If a pattern contains spaces, enclose it in braces. + + SET FILE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + Like SET FILE BINARY-PATTERNS, but the patterns choose text + files rather than binary ones. Examples: + + SET FILE TEXT-PATTERNS *.TXT *.KSC *.HTM* *.BAT ; DOS, Windows, OS/2 + + ADD BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + Adds one or more patterns to the BINARY-PATTERN list. + + ADD TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + Adds one or more patterns to the TEXT-PATTERN list. + + REMOVE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + Removes one or more patterns from the BINARY-PATTERN list. The + given patterns are matched with the ones in the BINARY-PATTERNS + list with case sensitivity if the underlying file system has + case-sensitive names (as do UNIX and OS-9), otherwise with case + independence. + + REMOVE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ] + Removes one or more patterns from the TEXT-PATTERN list. + + SHOW PATTERNS + Displays the current pattern selections. + + Whenever you give a SET FILE BINARY-PATTERNS or SET FILE TEXT-PATTERNS + command, the previous list is replaced. If you give one of these + commands without a pattern list, the previous list is removed. + + When patterns are active and files are being sent, text patterns (if + any) are applied first (but only if not RESENDing and not sending in + LABELED mode), then binary patterns, so if the same pattern appears in + both lists, binary mode is chosen. + +4.3.4. Examples + + Here's an example that might be used when sending files from UNIX: + + set file type binary + set file text-patterns *.c *.h *.w *.txt makefile + set file binary-patterns *.o + msend makefile wermit wart ck*.[cwho] ck*.txt + + Note that "wermit" and "wart" do not match any patterns so they are + sent in the prevailing mode, which is binary. Also note the use of + "makefile" as a pattern that does not contain any wildcard characters + (there is no other convention to distinguish among "wermit" and "wart", + which are binary executables, and "makefile", which is a text file, + purely by their names). + + Most C-Kermit implementations have a default pattern list built in, + which includes patterns that are almost certain to succeed in picking + the right transfer mode. Others are omitted due to ambiguity. For + example ".hlp", and ".ini" are generally binary types in Windows but + text types everywhere else. + + NOTE: ".doc", used for decades to denote plain-text documentation + files, now more often than not denotes a Microsoft Word Document, so + ".doc" is now considered a binary type since it does less harm to + transfer a plain-text document in binary mode than it does to + transfer an MS Word file in text mode (except when IBM mainframes + are involved!) + + ANOTHER NOTE: ".com" files are binary in DOS-like operating systems, + but they are text (DCL command procedures) in VMS. VMS C-Kermit + sends .COM files in text mode; K95 sends them in binary mode. If you + download a .COM file from VMS to DOS or Windows, and then upload it + to another VMS system, be sure to use SEND /TEXT to preserve its + textness. + + You can see the default pattern list by starting C-Kermit without its + initialization file (e.g. "kermit -Y") and using the SHOW PATTERNS + command. If you will be depending on this feature, be sure to examine + the list carefully in conjunction with the applications that you use. + + The default pattern list does not take "backup files" into account + because (a) people usually don't want to transfer them; and (b) it + would make the pattern lists more than twice as long. For example, we + would need to include both *.txt and *.txt.~[0-9]*~ for ".txt" files, + and similarly for all the others. Instead, you can use SEND /NOBACKUP + (or SET SEND BACKUP OFF) to skip over all backup files. + + Put your most commonly-used safe pattern declarations in your C-Kermit + customization file (ckermod.ini, .mykermrc, k95custom.ini, etc). + + As noted, SET FILE PATTERNS is ON by default. Sometimes, however, it is + desirable, or necessary, to force files to be sent in a particular + mode, and often this must be done from the command line (e.g. when + using Kermit as a download helper in a Web browser like Lynx). The -V + command-line options is equivalent to SET FILE PATTERNS OFF and SET + TRANSFER MODE MANUAL. Example: + + kermit -Vis oofa.txt + + forces oofa.txt to be sent in binary mode, even though ".txt" might + match a text pattern. + +4.4. File Permissions + + "Permissions" refers to a code associated with a file that specifies + who is allowed to access it, and in what manner. For example, the + owner, the members of one or more groups, the system administrator, and + everybody else, might be allowed various combinations of Read, Write, + Append, Execute, or Listing access. + + The permission code goes by different names on different platforms. In + UNIX, it might be called the filemode. In VMS, it is called the file + protection (or protection mask). + + The comments in this section presently apply only to the UNIX and VMS + versions of C-Kermit, to which these features were added in version + 7.0; the DOS, Windows, and OS/2 file systems embody no notions of + protection, and so MS-DOS Kermit and Kermit 95 do not send file + permissions, and ignore them when received. + + The permissions for a received file are determined by a combination of + the file transfer mode (VMS-to-VMS transfers only), whether a file of + the same name exists already, whether permissions of the file are + received in the file attribute packet, and the setting of ATTRIBUTES + PROTECTION. + + The default for ATTRIBUTES PROTECTION is ON. If no attributes are + received, the effect is the same as if attributes PROTECTION were OFF. + + For VMS-to-VMS transfers, the default LABELED mode simply copies the + protection code from source to destination. + +4.4.1. When ATTRIBUTES PROTECTION is OFF + + If no file of the same name exists, system defaults determine the + permissions of the new file. Otherwise, the actions taken depend on the + current FILE COLLISION setting: BACKUP, OVERWRITE, RENAME, etc, as + documented in [471]Using C-Kermit. But now the new file (if it is + created at all) automatically inherits the permissions (mode bits) of + the existing file in a way that is appropriate for the platform. + +4.4.1.1. Unix + + All mode bits are inherited except the directory bit, since the + incoming file can not possibly be a directory. (In any case, it is not + possible to receive a file that has the same name as an existing + directory unless FILE COLLISION is set to RENAME). + +4.4.1.2. VMS + + Files with the same name as an existing file, transferred in modes + other than LABELED between VMS systems, inherit the protection of the + prior version. + +4.4.2 When ATTRIBUTES PROTECTION is ON + + File permissions can be conveyed as part of the file transfer process, + in accordance with the Kermit protocol definition. If the file sender + puts system-dependent and/or system-independent versions of the file + protection (permissions) into the Attribute (A) packet, the file + receiver can set the new file's permissions from them. Otherwise, the + permissions are set the same as for ATTRIBUTES PROTECTION OFF. + + When the incoming A packet contains system-dependent permissions, the + file receiver checks to see if the sender has the same system ID (e.g. + both the sending and receiving systems are UNIX, or both are VMS); if + so, it decodes and uses the system-dependent permissions; otherwise it + uses the generic ones (if any) and applies them to the owner field, + setting the other fields appropriately as described in the following + sections. + + Setting the incoming file's protection from the A packet is controlled + by SET ATTRIBUTES PROTECTION (or PERMISSION), which is ON by default, + and its status is displayed by SHOW ATTRIBUTES. + + The main benefit of this feature is to not have to "chmod +x" an + executable file after transfer from UNIX to UNIX. Its cross-platform + benefits are less evident, perhaps to retain the status of the Unix 'x' + bit on a VMS system, for subsequent transfer back to a Unix system. + +4.4.2.1. System-Specific Permissions + + System-specific file permissions are used when the two Kermit programs + recognize each other as running on the same type of system. For + example, both are running under some form of UNIX (it doesn't matter + which UNIX variation -- HP-UX, Solaris, AIX, etc -- all use the same + scheme for file permissions); or both are running under VMS (even if + one is on an Alpha and the other on a VAX, and/or one is old and the + other is new). + +4.4.2.1.1. UNIX + + UNIX supports three categories of users, File Owner, Group, and World, + and three types of file access permission: Read, Write, and Execute. + Thus, a UNIX file's permissions are expressed in 9 bits. + + The system-dependent permission string for UNIX is a 3-digit octal + string, the low-order 9 bits of the st_mode member of the stat struct; + we deliberately chop off the "file format" bits because they are not + permissions, nor do we convey the setuid/setgid bits, lock bit, sticky + bit, etc. + +4.4.2.1.2. VMS + + VMS supports four categories of users, System, File Owner, Group, and + World, and four types of file access permission: Read, Write, Execute, + and Delete. Thus, a VMS file's permissions are expressed in 16 bits. + + The system-dependent protection string for VMS is a 4-digit hexadecimal + string, corresponding to the internal-format protection word of the + file (RWED for each of World,Group,Owner,System). A new file normally + gets all 16 protection bits from the original file of the same name. + + Note: VMS-to-VMS transfers take place in LABELED mode when the two + C-Kermits recognize each other's platform as VMS (unless you have + disabled LABELED-mode transfers). In this case, all of a file's + attributes are preserved in the transfer and the protection mask (and + other information) is taken from the file's internal information, and + this takes precedence over any information in the Attribute packets. + You can defeat the automatic switching into LABELED mode (if you want + to) with SET TRANSFER MODE MANUAL. + +4.4.2.2. System-Independent Permissions + + The system-independent ("generic") protection is used when the system + IDs of the two Kermit programs do not agree (e.g. one is UNIX, the + other is VMS). The generic protection attribute includes the following + permissions (not all are applicable to every file system): Read, Write, + Append, Execute, Delete, Search. The generic permissions are derived + from the owner permissions of the source file, thus, a Unix 'w' + permission becomes VMS Write,Delete. + + The Owner field of the new file's permissions is set from the incoming + generic protection attribute. + + In UNIX, the Group and World permissions are set according to your + umask, except that execute permission is NOT set in these fields if it + was not also set in the generic protection (and consequently, is set in + the Owner field). + + In VMS, the System, Group, and World permissions are set according to + the process default file permission (as shown in VMS by SHOW + PROTECTION), except that no permissions are allowed in these fields + that are not included in the generic permissions. + + Note that the VMS and UNIX interpretations of Execute permission are + not identical. In UNIX, a file (binary executable, shell script, etc) + may not be executed unless it has Execute permission, and normally + files that are not intended for execution do not have Execute + permission. In VMS, Read permission implicitly supplies Execute + capability. Generally files that have Read permission also have + explicit Execute permission, but files (binary executables, DCL command + procedures) that have Read permission and not Execute permission can + still be executed. + +4.5. File Management Commands + +4.5.1. The DIRECTORY Command + + Prior to C-Kermit 7.0, the DIRECTORY command always ran an external + system command (such as "ls" on UNIX) or program to product the + directory listing. This had certain advantages, mostly that you could + include system-dependent options for customized listings, e.g. on UNIX: + + dir -lt c* | more + + or in VMS: + + directory /size/date/protection/except=*.obj oofa.*;0 + + This approach, however, carries some disadvantages: C-Kermit can't + return SUCCESS or FAILURE status for (e.g.) "dir foo" according to + whether the file "foo" exists; and it runs an inferior process, which + might be a problem in some environments for resource and/or security + reasons, and won't work at all in a "nopush" environment (e.g. one in + which C-Kermit is configured to forbid access to exterior commands and + programs, e.g. in a VMS "captive account"). + + In C-Kermit 7.0 on VMS and UNIX, and in K95 1.1.19 and later, the + DIRECTORY command is internal to Kermit. It can be run in a "nopush" + environment and returns SUCCESS or FAILURE status appropriately. In + UNIX it prints all dates and times in a consistent way (unlike ls). In + VMS it prints precise file sizes, rather than "blocks". It offers + several formatting and other options, but it is not necessarily more + flexible than the corresponding external commands or programs (the UNIX + "ls" program, the VMS "directory" command). The syntax is: + + DIRECTORY [ switch [ switch [ ... ] ] ] [ filespec ] + + If no filespec is given, all files in the current directory are listed. + + Optional switches include all the standard file-selection switches + presented in [472]Section 1.5.4, plus: + + /ALL + Show both regular files and directories; this is the default. + + /ARRAY:x + Instead of displaying a directory listing, put the files that + would have been shown (based on the filespec and other selection + switches) in the given array. The array need not (and should + not) be predeclared; if the array already exists, it is + destroyed and reused. The array name can be a single letter, + like "a", or any fuller form, such as "&a", "\&a", "\&a[]", etc. + If the /ARRAY switch is included, the following other switches + are ignored: /BRIEF, /VERBOSE, /HEADING, /PAGE, /ENGLISHDATE, + /ISODATE, /XFERMODE, /MESSAGE, /SORT, /REVERSE, /ASCENDING. In + other words, only file selection switches are meaningful with + /ARRAY: /FILES, /DIRECTORIES, /ALL, /DOTFILES, /NOBACKUP, + /RECURSIVE, /SMALLER, /LARGER, /AFTER, /BEFORE, /EXCEPT, etc. + The resulting array has the number of files (n) as its 0th + element, and the filenames in elements 1 through n Example: + + dir /array:&a /files /nobackup /after:19990101 /larger:10000 [ab]* + show array &a + + /FILES + Only show regular files. + + /DIRECTORIES + Only show directories. + + /BACKUP + In UNIX, OS-9, K-95, and other versions that support SET FILE + COLLISION BACKUP and create backup files by appending .~n~ to + the filename (where "n" is a number), /BACKUP means to include + these files in directory listings. This is the default. + + /NOBACKUP + This is the opposite of /BACKUP: that is, do not include backup + files in the listing. + + /BRIEF + List filenames only; use a compact format, as many filenames as + will fit across the screen (based on the longest name). A brief + listing is always sorted alphabetically. + + /VERBOSE + List one file per line, and include date, size, and (in UNIX + only) permissions of each file. This is the opposite of /BRIEF, + and is the default. + + /PAGE + Pause at the end of each screenful and give a "more?" prompt, + even if SET COMMAND MORE-PROMPTING is OFF. + + /NOPAGE + Don't pause at the end of each screenful and give a "more?" + prompt, even if SET COMMAND MORE-PROMPTING is ON. If neither + /PAGE or /NOPAGE is given, paging is according to the prevailing + COMMAND MORE-PROMPTING setting (which can be displayed with SHOW + COMMAND). + + /ENGLISHDATE + Show dates in dd-mmm-yyyy format; mmm is the first three letters + of the English month name. + + /ISODATE + Show dates in yyyy-mm-dd format; mm is the month number, 1-12. + This is the opposite of /ENGLISHDATE, and is the default. + + /HEADINGS + Print a heading before the listing and a summary at the end. + + /NOHEADINGS + Don't print a heading before the listing or a summary at the + end. This is the opposite of /HEADINGS, and is the default. + + /XFERMODE + Only in Kermit programs that support SET FILE PATTERNS. If this + switch is included, and the filename matches any FILE + BINARY-PATTERN ([473]Section 4.3), "(B)" is printed after the + filename; otherwise, if it matches a FILE TEXT-PATTERN, "(T)" is + printed. + + /NOXFERMODE + Don't display transfer-mode indicators. This is the opposite of + /XFERMODE and is the default. + + /RECURSIVE + Show files not only in the given directory, but also in its + subdirectories (if any), their subdirectories, etc. + + /NORECURSIVE + Don't show files in subdirectories. This is the opposite of + /RECURSIVE, and is the default. + + /MESSAGE:text + This lets you specify a short text string to be appended to the + end of each directory listing line (a space is supplied + automatically). If the text contains any spaces, enclose it in + braces, e.g. /MESSAGE:{two words}. + + /NOMESSAGE + Don't append any message to the end of each directory listing + line (default). + + /SORT:[{NAME,SIZE,DATE}] + Sort the listing by name, size, or date. If the /SORT switch is + given but the "sort-by" keyword is omitted, the listing is + sorted by name. /SORT:NAME /ASCENDING (alphabetic sort by name) + is the default. + + /NOSORT + Don't sort the listing. Files are listed in whatever order they + are supplied by the operating system, e.g. inode order in UNIX. + + /REVERSE + If the /SORT switch is given, reverse the order of the sort. + Synonym: /DESCENDING. + + /ASCENDING + If the /SORT switch is given, sort the listing in normal order. + This is the opposite of /REVERSE and is the default. + + Note that most of the DIRECTORY-specific switches come in pairs, in + which one member of a pair (e.g. /NOHEADINGS) is the opposite of the + other (e.g. /HEADINGS). + + If you always want to use certain options, you can set them with the + SET OPTIONS DIRECTORY command ([474]Section 1.5.5). Use SHOW OPTIONS to + list the options currently in effect. To make the desired options apply + every time you run C-Kermit, put a SET OPTIONS DIRECTORY command in + your C-Kermit customization file, specifying the desired options. + Options set in this manner apply to every subsequent DIRECTORY command. + Of course, if you include switches in a DIRECTORY command, these + override any defaults, built-in or custom. Example: + + DIRECTORY ; Use "factory defaults" + SET OPTIONS DIRECTORY /SORT:SIZE /REVERSE /HEADINGS ; Customize defaults + DIRECTORY ; Use customized defaults + DIR /SORT:NAME ; Override customized default SORT key + SET OPT DIR /RECURS ; Add /RECURSIVE to customized defaults + DIR /ASCEND ; Override customized default SORT order + + Notes: + + * Only a single sort key is supported; there is presently no way to + have multiple sort keys. + * If the /BRIEF switch is given, all other switches (except + /[NO]RECURSIVE, /[NO]DOTFILES, /DIRECTORIES, /FILES, and /ALL) are + ignored. + * /SORT:anything gives incorrect results if any files have lengths + greater than 10 digits (i.e. that are more than 9999999999 bytes + long, i.e. if they are 10GB or more in size) because the overlong + length field causes the date and name fields to be misaligned. + * /SORT:NAME is redundant in VMS since VMS returns filenames in + alphabetic order anyway. + * /SORT:NAME ignores alphabetic case on platforms where case does not + matter in filenames, but this works only for unaccented Roman + letters A-Z. + * /SORT:NAME is currently based on code values, and so works fine for + ASCII, but will probably produce unexpected results for files with + non-ASCII or 8-bit characters in their names. (Locale-based sorting + raises rather significant issues of portability, size, performance, + etc.) + * /SORT:DATE works right only for ISO-format dates, not English ones. + * /SORT:SIZE sorts the size field lexically. On some platforms (e.g. + Windows), the size of a directory file is listed as "" rather + than as a number; in this case, the "" files are gathered at + the end (or beginning, depending on the sort order) of the listing. + * /RECURSIVE is accepted but ignored in AOS/VS. Use the normal + system-specific filespec notation, e.g. "dir #.txt". + * /RECURSIVE has no affect when a full, absolute pathname is given; + e.g. "dir /recursive /tmp/foo" (where "foo" is a regular file) only + shows the "/tmp/foo" file. If you want to see all "foo" files in + the /tmp tree, do "cd /tmp" and then "dir /recursive foo". + * If a file size of -1 is shown, or date-time of 0000-00-00 00:00:00, + this means the file was located, but access to information about + the file was denied to C-Kermit. + * In VMS, if FOO.DIR;1 is a directory within your current directory, + "directory foo" and "directory [.foo]" list the files in the [.FOO] + subdirectory, but "directory foo.dir" lists the directory file + itself; similarly for "*.dir" versus "[.*]", etc. + * In UNIX, if "foo" is a directory within your current directory, + "directory foo" lists the files in the foo directory. If you want + to list the foo directory file itself, put an asterisk at the end: + "dir foo*". + + Hint: How to find the biggest files in a directory tree: + + cd xxx ; (root of tree) + directory /sort:size /recursive /reverse /dotfiles /page + + Another hint: If you often use several different directory-listing + formats, define macro shortcuts for them: + + DEFINE WD DIRECTORY /SORT:DATE /REVERSE \%* ; Reverse chronological order + DEFINE SD DIRECTORY /SORT:SIZE /REVERSE \%* ; Reverse order of size + DEFINE ND DIRECTORY /SORT:NAME /ASCEND \%* ; Alphabetical by name + DEFINE DL DIR /DIR /SORT:NAME /ASCEND \%* ; Alphabetical directory list + + Put these definitions in your C-Kermit customization file. Note that + "\%*" ([475]Section 7.5) in these definitions lets you include other + switches in your macro invocations, e.g.: + + wd /headings *.txt + + Of course you can still access your external directory listing program + by using RUN or "!", e.g. in VMS: + + run directory /size/date/protection/except=*.obj oofa.*;0 + + or: + + !dir /size/date/prot/exc=*.obj oofa.*;0 + + In UNIX, use "!ls" or just "ls" (which is a special synonym for "!ls"). + +4.5.2. The CD and BACK Commands + + In C-Kermit 7.0, the CD command has a new friend, the BACK command. + BACK means "CD to my previous current directory". A second BACK brings + you back to where you were before the first one; thus successive BACK + commands switch back and forth between two directories. + +4.5.2.1. Parsing Improvements + + The CD command, as well as other commands that parse a directory name, + were changed in 7.0 to provide all the expected functions: completion + on Tab or Esc, directory-name lists on ?, etc. Other affected commands + include SET SERVER GET-PATH, SET TEMP-DIRECTORY, SET FILE + DOWNLOAD-DIRECTORY, and SPACE. CD and REMOTE CD also now work with + logical names. + + In VMS, the situation is a bit complicated since a directory name can + look like "DEV:", "[FOO.BAR]", "DEV:[FOO.BAR]", "[FOO]BAR.DIR;1", etc. + Completion and ?-help might not always work, but they do in many cases. + Examples: + + cd ? Lists all subdirectories of the current directory + cd []? Ditto + cd k? Ditto, but only those starting with K + cd [foo]? Lists all subdirectories of the [FOO] directory + cd [-]? Lists all subdirectories of the superior directory + cd [--]? Lists all subdirectories of the directory 2 levels up + cd [...]? Lists all directories below the current one + cd [foo.? Does not work. + + C-Kermit allows all of the following in VMS: + + cd bar CD to subdirectory BAR of the current directory + cd .bar Ditto + cd [.bar] Ditto + cd bar.dir etc... + cd bar.dir; + cd bar.dir;1 + cd [foo.bar] + cd + cd bar.baz This can go more than 1 level deep... + cd dir: (where logical name DIR is defined as [FOO.BAR]) + + As well as the following: + + cd .. Go up one level as in UNIX + cd . The current directory + cd My login directory + + Note that "cd -" (go up one level) does not work as expected, because + "-" is Kermit's command continuation character. However, "cd [-]", and + " + cd {-}" have the desired effect (and so does "cd ..", which is easier + to type). + +4.5.2.2. The CDPATH + + The CD command in the UNIX, Windows, OS/2, and VMS versions of + C-Kermit, as of version 6.1 / 1.1.12, searches the CDPATH for the given + directory, if it is not absolute and if a CDPATH environment variable + is defined. Example (in UNIX ksh or bash): + + $ export CDPATH=$HOME:$HOME/kermit:/tmp + + Now if you give a "cd xxx" command, no matter what your current + directory is, if the "xxx" directory is not a subdirectory of your + current directory, then the xxx subdirectory of your home directory is + used or if that does not exist, then the xxx subdirectory of the kermit + subdirectory of your home directory is used or if that does not exist, + then /tmp/xxx is used. This is how the ksh "cd" command works, and now + the C-Kermit CD command works the same way. + + In VMS, you can define CDPATH to be a list of directories that contain + actual directory delimiters, and/or logical names representing + directories, using commas to separate them, e.g.: + + $ define cdpath [HOME],[SOMEOTHERDIR],[HOME.MISC] + $ define cdpath SYS$LOGIN:,DISK1:[HOME],DISK2:[SCRATCH.IVAN] + + Example: + + $ define cdpath SYS$LOGIN:,[IVAN],[OLAF],[OLGA.MISC] + $ kermit + DISK1:[OLGA] C-Kermit> cd blah + + tries the BLAH subdirectory of the user's login directory, then + [OLGA.BLAH], [IVAN.BLAH], [OLAF.BLAH], and [OLGA.MISC.BLAH], in that + order, using the first one it finds, failing if it finds none. + + In C-Kermit 7.0, you may also set the CDPATH from the Kermit prompt: + + SET CD PATH path + Allows the CD PATH to be set from within C-Kermit. + + SHOW CD shows the CD path and all other information relevant to the CD + command. + +4.5.2.3. CD Messages + + Whenever you change directory, you can have C-Kermit display a "Read + Me" file from the new directory automatically. The commands are: + + SET CD MESSAGE { ON, OFF, FILE list } + ON enables this feature; OFF (the default) disables it. File + lets you specify the name of the "Read Me" file. A list of names + to look for can be given in the following format: + + {{name1}{name2}{name3}{...}} + + e.g.: + + SET SERVER CD-MESSAGE FILE {{./.readme}{README.TXT}{READ.ME}} + + The default list of CD-message files is system dependent. + + SHOW CD shows your current directory, previous directory, CD path, and + CD message info. + +4.5.3. Creating and Removing Directories + + The MKDIR command now allows you to create multiple directories at + once: + + C-Kermit> mkdir a/b/c/d + + creates the directory a in the current directory (if it doesn't exist + already), and then creates subdirectory b in the a directory (if it + didn't exist already), and so on. + + If you use MKDIR to try to create a directory that already exists, + C-Kermit will print a warning ("?Directory already exists"), but the + MKDIR command will still succeed. If you want to avoid the warning + message, use IF DIRECTORY first to check if the directory already + exists. + + The RMDIR command, however, will not remove more than one directory, + nor will it remove a directory that contains any files. (There is, as + yet, no RMDIR /RECURSIVE command, although one might be added later.) + + In VMS, these commands (like CD) are more forgiving of your syntax than + is the DCL command shell; "mkdir oofa" is equivalent to "mkdir [.oofa]" + and so on. Also in VMS, you'll find that C-Kermit's RMDIR command is + easier than deleting a directory in DCL, since it automatically first + gives it owner delete permission if you are the owner. + +4.5.4. The DELETE and PURGE Commands + + The DELETE command now offers a selection of switches, and has a new + companion, the PURGE command. First, DELETE: + + DELETE [ switches... ] filespec + Deletes the file or files that match the filespec, which may + contain wildcards ([476]Section 4.9). + + Optional switches include the standard file-selection switches + presented in [477]Section 1.5.4, plus: + + /ASK + Before deleting each file, ask permission interactively. Answers + are Yes or OK (delete the file), No (don't delete it), or Quit + (stop executing the DELETE command). + + /NOASK + Don't ask permission to delete each file. + + /LIST + List each file and show whether it was deleted. Synonyms: /LOG, + /VERBOSE. + + /NOLIST + Don't list files while deleting them. Synonyms: /NOLOG, /QUIET. + + /HEADING + Print a heading and summary line. + + /NOHEADING + Don't print a heading and summary line. + + /PAGE + When listing, pause at the end of each screenful and give the + "More?" prompt. If you reply "n" (no), the DELETE command + terminates. + + /SIMULATE + Do everything implied by the given switches and filespec, except + do not actually delete any files. This lets you preview which + files would be deleted; implies /LIST. + + Now the PURGE command: + + PURGE [ switches... ] [ filespec ] + (VMS only) Runs the DCL PURGE command. Switches and filespec, if + any, are passed directly to DCL without parsing or verification. + Deletes excess versions of the given (or all) files. The rest of + this section does not apply to VMS. + + PURGE [ switches... ] [ filespec ] + (UNIX only) Deletes "backup files" that match the filespec, + which may contain wildcards ([478]Section 4.9). If no filespec + is given, all backup files in the current directory are selected + (subject to modification by any switches). Do not include backup + notation in the filespec. + + Explanation: + + To avoid destroying preexisting files when a new file arrives that has + the same name, C-Kermit backs up the old file by appending a "backup + number" to its name. In UNIX, the backup suffix consists of a period, a + tilde, a number, and another tilde. For example, if a file called + oofa.txt exists and a new oofa.txt file arrives, the original is + renamed to oofa.txt.~1~. If another oofa.txt file arrives, the existing + one is renamed to oofa.txt.~2~. And so on. This system is compatible + with the one used by EMACS. Thus over time, if you receive a lot of + files with C-Kermit or edit them with EMACS, backup files can build up. + The new PURGE command lets you clean out accumulated backup files: + + Optional switches include the standard file-selection switches + presented in [479]Section 1.5.4, plus all the switches listed above for + the DELETE command, plus: + + /KEEP:n + Retains the n most recent (highest-numbered) backup files for + each file. For example, if oofa.txt, oofa.txt.~1~, oofa.txt.~2~, + oofa.txt.~10~, oofa.txt.~12~, and oofa.txt.~100~ exist, "purge + /keep:2 oofa.txt" deletes oofa.txt.~1~, oofa.txt.~2~, and + oofa.txt.~10~, and keeps oofa.txt, oofa.txt.~12~, and + oofa.txt.~100~. If /KEEP is given without a number, one (the + highest numbered) backup file is kept. + + CAUTION: The PURGE command should be used only when *.~*~ files truly + are backup files. This is the case for EMACS, and it is the DEFAULT for + C-Kermit. However, if C-Kermit's FILE COLLISION has been set to RENAME, + newly received files will look like backup files. In that case, don't + use the PURGE command or you'll be removing new files rather than old + ones. (Use SHOW FILE to find the FILE COLLISION setting.) + + The PURGE command is presently available only in UNIX. The command + succeeds if it deleted any files, or if it deleted no files but there + were no errors. It fails if it deleted no files and there were errors + (i.e. deletion was attempted but failed). In VMS, backup file versions + are handled automatically by the OS, and a PURGE command can be used at + the VMS prompt to clean them up. + + If you want certain switches to be supplied automatically with each + DELETE or PURGE command, you can set them with SET OPTIONS + ([480]Section 1.5.5) and you can display any such settings with SHOW + OPTIONS. Of course you can override them on a per-command basis by + including switches in your PURGE or DELETE command. + + Also see SET FILE COLLISION, SHOW FILE, SEND /NOBACKUP, SET SEND + BACKUP, and DIRECTORY /[NO]BACKUP. + +4.6. Starting the Remote Kermit Server Automatically + + As noted on pages 275-276 of [481]Using C-Kermit 2nd edition, you can + have Kermit send "kermit receive" commands automatically when it is in + local mode and you give a SEND or similar command, to start the remote + Kermit receiver in case it is not already started. The "kermit receive" + commands are specified by: + + SET PROTOCOL KERMIT binary-receive-command text-receive-command + + As of version 7.0, a Kermit protocol option has been added to send a + string to the host in advance of any Kermit packets when you give a + GET-class or REMOTE command. This will switch the remote C-Kermit into + the appropriate mode or, if the remote system is at a system command + (shell) prompt, execute the string on the remote system. The new syntax + of the SET PROTOCOL KERMIT command is: + + SET PROTOCOL KERMIT [ s1 [ s2 [ s3 ] ] ] + + where: + + Default Meaning + s1 {kermit -ir} Remote "kermit receive in binary mode" command. + s2 {kermit -r} Remote "kermit receive in text mode" command. + s3 {kermit -x} Remote "start kermit server" command. + + NOTE: If the remote Kermit is 6.0, the following are recommended for + fast startup and high-performance file transfer (see Appendix I in + [482]Using C-Kermit, second Edition, for command-line options): + + s1 kermit -YQir (Kermit receive binary, skip init file, fast.) + s2 kermit -YQTr (Kermit receive text, skip init file, fast.) + s3 kermit -YQx (Kermit server, skip init file, fast.) + + If the remote is C-Kermit 7.0 or later, change the -x option (enter + server mode) to -O (uppercase letter O), which means "enter server mode + for One transaction only); this way, it is not stuck in server after + the transfer. Also note that the Q is redundant in version 7.0, since + fast Kermit protocol settings are now the default. + + Note that in case the C-Kermit executable is called "wermit" or + "ckermit" you can change "kermit" in the strings above to "wermit" or + "ckermit" and C-Kermit 7.0 or later will recognize these as synonyms + for "kermit", in case it is at its command prompt when one of these + strings is sent to it. + +4.7. File-Transfer Command Switches + + Over the years, various new methods of transferring a file have + accumulated, until we had, in addition to the SEND command, also MOVE + (send and then delete), MAIL (send as email), REMOTE PRINT (send to be + printed), CSEND (send the output of a command), PSEND (send a part of a + file), BSEND (send in binary mode), RESEND (resume an interrupted + SEND), etc etc. Similarly: GET, REGET, CGET, RETRIEVE, and so on. + + Not only is it confusing to have different names for these commands, + many of which are not real words, but this also does not allow all + combinations, like "send a file as mail, then delete it". + + In C-Kermit 7.0, the SEND, GET, and RECEIVE commands were restructured + to accept modifier switches (switches are explained in [483]Section + 1.5). + +4.7.1. SEND Command Switches + + Without switches, the SEND command still works exactly as before: + + send oofa.txt ; send a single file + send oofa.* ; send multiple files + send oofa.txt x.x ; send oofa.txt as x.x (tell receiver its name is x.x) + send ; send from SEND-LIST + + But now the following modifier switches may be included between "send" + and the filename. Zero, one, two, or more switches may be included in + any combination that makes sense. Switch names (such as /BINARY) can be + abbreviated, just like any other keywords. Most of these switches work + only when using Kermit protocol (/TEXT and /BINARY are the exceptions). + + /AFTER:date-time + Specifies that only those files modified (or, in VMS, created) + after the given date-time (see [484]Section 1.6) are to be sent. + Examples: + + send /text /after:{2-Feb-1997 10:28:30} *.txt + send /text /after:\fdate(oofa.txt) *.txt + + Synonym: /SINCE. + + /ARRAY:arrayname + Specifies that instead of sending a file, C-Kermit is to send + the contents of the given array. Since an array does not have a + filename, you should include an /AS-NAME switch to specify the + name under which the array is to be sent (if you do not, the + name "_array_x_" is used, where 'x' is replaced by the array + designator). See [485]section 7.10 for array-name syntax. As + noted in that section, you can also include a range to have a + segment of the array sent, rather than the whole thing; for + example: "send /array:&a[100:199]". It is strongly recommended + that you accompany the /ARRAY switch with a /TEXT or /BINARY + switch to force the desired transfer mode, since otherwise the + various automatic mechanisms might switch to binary mode when + you really wanted text, or vice versa. In text mode a line + terminator is added to the end of each array element, but not in + binary mode. For details and examples see [486]Section 7.10.11. + + /AS-NAME:text + Specifies "text" as the name to send the file under. You can + also still specify the as-name as the second filename on the + SEND command line. The following two commands are equivalent: + + send oofa.txt oofa.new + send /as:oofa.new oofa.txt + + /BEFORE:date-time + Specifies that only those files modified (or, in VMS, created) + before the given date-time ([487]Section 1.6) are to be sent. + + /BINARY + Performs this transfer in binary mode without affecting the + global transfer mode, overriding not only the FILE TYPE and + TRANSFER MODE settings, but also the FILE PATTERN setting, but + for this SEND command only. In other words, SEND /BINARY means + what it says: send the file in binary mode, regardless of any + other settings. Example: + + set file type text ; Set global transfer mode to text + send /binary oofa.zip ; Send a file in binary + send oofa.txt ; This one is sent in text mode + + /COMMAND + SEND /COMMAND is equivalent to CSEND ([488]Section 4.2.2) -- it + says to send the output from a command, rather than the contents + of a file. The first "filename" on the SEND command line is + interpreted as the name of a command; the second (if any) is the + as-name. Examples: + + send /command {grep Sunday oofa.txt} sunday.txt + send /as-name:sunday.txt /command {grep Sunday oofa.txt} + send /bin /command {tar cf - . | gzip -c} {!gunzip -c | tar xf -} + + /DELETE + Deletes the file (or each file in the group) after it has been + sent successfully (but does not delete it if it was not sent + successfully). SEND /DELETE is equivalent to MOVE. Has no effect + when used with /COMMAND. Example: + + send /delete *.log + + /DOTFILES + (UNIX and OS-9 only) Normally files whose names begin with "." + are skipped when matching wildcards that do not also beging with + ".". Include /DOTFILES to force these files to be included too. + + /RECURSIVE + Descend the through the directory tree when locating files to + send. Automatically sets /PATHNAMES:RELATIVE. Explained in + [489]Section 4.11 . + + /EXCEPT:pattern + See [490]Section 1.5.4. + + /NOBACKUP + This means to skip backup files when sending, even if they match + the SEND file specification. This is equivalent to using SEND + /EXCEPT and including *.~[0-9]*~ in the exception list (or *.~*~ + if Kermit was built without pattern-matching support; see + [491]Section 4.9.1). Including this switch is equivalent to + giving SET SEND BACKUP OFF ([492]Section 4.0.6) prior to SEND, + except its effect is local to the SEND command with which it was + given. + + /NODOTFILES + The opposite of /DOTFILES (q.v.) + + /FILENAMES:{CONVERTED,LITERAL} + Use this switch to override the current global SET FILE NAMES + setting for this transfer only. + + /FILTER:command + This specifies a filter to pass the file through before sending + it. See the [493]section on file-transfer pipes and filters. The + /FILTER switch applies only to the file-transfer command it is + given with; it does not affect the global SEND FILTER setting, + if any. + + /IMAGE + VMS: Sends in image mode. Non-VMS: same as /BINARY. + + /LABELED + VMS and OS/2 only: Sends in labeled mode. + + /LARGER-THAN:number + Specifies that only those files that are longer than the given + number of bytes are to be sent. + + /LISTFILE:filename + Specifies that the files to be sent are listed in a file with + the given filename. The file contains one filename per line. + These filenames are not checked in any way; each filename is + taken and does not use or depend on any Kermit-specific syntax. + In particular, backslashes are not treated specially, leading + and trailing spaces are not stripped, etc. However, if a + filename contains wildcards, they are expanded. Example: If a + file named files.txt contains the following lines: + + blah.txt + oofa* + x.x + + (but without leading or trailing spaces), then the C-Kermit + command "send /listfile:files.txt" will send the files blah.txt, + x.x, and all files whose names start with "oofa", assuming the + files exist and are readable. The /LISTFILE switch, can, of + course, be used with other switches when it makes sense, for + example, /EXCEPT, /BINARY, /AFTER, /SMALLER, /MOVE-TO, /DELETE, + /AS-NAME with a template, etc. + + /MAIL:address + Sends the file as e-mail to the given address or addresses. + "send /mail:address filename" is equivalent to "mail filename + address". You can include multiple addresses separated by + commas. Examples: + + send /mail:kermit-support@columbia.edu packet.log + send /mail:cmg,fdc,jrd oofa.txt + + As with any switch argument, if the address or address list + contains any spaces, you must enclose it in braces. The format + of the addresses must agree with that understood by the + mail-sending program on the receiver's computer. + + /MOVE-TO:directory-name + Specifies that after each (or the only) source file is sent + successfully, and ONLY if it is sent successfully, it should be + moved to the named directory. If the directory name contains + spaces, enclose it in braces. If the directory does not exist, + it is created if possible; if it can't be created, the command + fails and an error message is printed. Example: + + send /text /move-to:/users/olga/backup/ *.txt + + /NOT-AFTER:date-time + Specifies that only those files modified at or before the given + date and time are to be sent. + + /NOT-BEFORE:date-time + Specifies that only those files modified at or after the given + date and time are to be sent. + + /PATHNAMES:{OFF,ABSOLUTE,RELATIVE} + Use this switch to override the current global SET SEND + PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE or + RELATIVE also sets /FILENAMES:LITERAL (also for this transfer + only) since pathnames are not sent otherwise. + + /RENAME-TO:text + Specifies that after the (or each) source file is sent + successfully, and ONLY if it is sent successfully, it should be + renamed to the name given. If the name contains spaces, enclose + it in braces. If a file group is being sent, then the "text" + must contain a variable reference such as \v(filename) (see + [494]Section 4.1). Example: + + send /rename-to:ok_\v(filename) *.* + + This sends each file in the current directory and if it was sent + successfully, changes its name to begin with "ok_". + + /SMALLER-THAN:number + Specifies that only those files that are smaller than the given + number of bytes are to be sent. + + /SUBJECT:text + Subject for email. Actually, this is just a synonym for + /AS-NAME. If the text includes spaces, you must enclose it in + braces. If you don't specify a subject (or as-name), the name of + the file is used as the subject. Example: + + send /mail:kermit-support@columbia.edu /subj:{As requested} packet.log + + /PRINT:options + Sends the file to be printed, optionally specifying options for + the printer. Equivalent to REMOTE PRINT filename options. + Examples: + + send /print oofa.txt ; No options. + send /print:/copies=3 oofa.txt ; "/copies=3" is a VMS PRINT switch. + send /print:-#3 oofa.txt ; "-#3" is a UNIX lpr switch. + + /PROTOCOL:name + Uses the given protocol to send the file (Kermit, Zmodem, etc) + for this transfer without changing global protocol. Only + available in Kermit 95, UNIX, and OS-9. Example: + + set protocol kermit ; Set global protocol + send /proto:zmodem /bin oofa.zip ; Send just this file with Zmodem + send oofa.txt ; This file is sent with Kermit + + /QUIET + When sending in local mode, this suppresses the file-transfer + display. + + /RECOVER + Used to recover from a previously interrupted transfer; SEND + /RECOVER is equivalent to RESEND. Recovery only works in binary + mode; SEND /RECOVER and RESEND include an implied /BINARY + switch. Even then, recovery will successful only if (a) the + original (interrupted) transfer was also in binary mode, or (b) + if it was in text mode, the two Kermit programs run on platforms + where text-mode transfers are not length-changing. + + /STARTING:number + Starts sending the file from the given byte position. SEND + /STARTING:n filename is equivalent to PSEND filename n. + + /TEXT + Performs this transfer in text mode without affecting the global + transfer mode, overriding not only the FILE TYPE and TRANSFER + MODE settings, but also the FILE PATTERN setting, for this SEND + command only. In other words, SEND /TEXT really send the file in + text mode, regardless of any other settings or negotiations. + + About mail... Refer to [495]Section 4.7.1. The same rules apply as for + file transfer. If you are mailing multiple files, you can't use an + as-name (in this case, a subject) unless it contains replacement + variables like \v(filenum). For example, if you: + + send /mail:somebody@xyz.com *.txt + + Then each file will arrive as a separate email message with its name as + the subject. But if you: + + send /mail:somebody@xyz.com /subject:{Here is a file} *.txt + + Then each file message will have the same subject, which is probably + not what you want. You can get around this with constructions like: + + send /mail:somebody@xyz.com /subject:{Here is \v(filename)} *.txt + + which embed the filename in the subject. + + The MOVE, CSEND, MAIL, and RESEND commands now also accept the same + switches. And the switches are also operative when sending from a + SEND-LIST (see [496]Using C-Kermit, 2nd Ed, pp.191-192), so, for + example, it is now possible to SEND /PRINT or SEND /MAIL from a + SEND-LIST. + + The MSEND and MMOVE commands also take switches, but not all of them. + With these commands, which take an arbitrary list of filespecs, you can + use /BINARY, /DELETE, /MAIL, /PRINT, /PROTOCOL, /QUIET, /RECOVER, and + /TEXT (and /IMAGE or /LABELED, depending on the platform). MMOVE is + equivalent to MSEND /DELETE. (If you want to send a group of files, but + in mixed transfer modes with per-file as-names, use ADD SEND-LIST and + then SEND.) + + The MSEND/MMOVE switches come before the filenames, and apply to all of + them: + + msend /print /text *.log oofa.txt /etc/motd + + If you type any of these commands (SEND, CSEND, MSEND, etc) followed by + a question mark (?), you will see a list of the switches you can use. + If you want to see a list of filenames, you'll need to type something + like "send ./?" (UNIX, OS/2, Windows, etc), or "send []?" (VMS), etc. + Of course, you can also type pieces of a filename (anything that does + not start with "/") and then "?" to get a list of filenames that start + that way; e.g. "send x.?" still works as before. + + In UNIX, where "/" is also the directory separator, there is usually no + ambiguity between a fully-specified pathname and a switch, except when + a file in the root directory has the same name as a switch (as noted in + [497]Section 1.5): + + send /etc/motd ; Works as expected + send /command ; ??? + + The second example interprets "/command" as a switch, not a filename. + To send a file actually called "command" in the root directory, use: + + send {/command} + + or other system-dependent forms such as //command, /./command, + c:/command, etc, or cd to / and then "send command". + +4.7.2. GET Command Switches + + Without switches, the GET command still works about the same as before: + + get oofa.txt ; GET a single file + get oofa.* ; GET multiple files + + However, the mechanism for including an "as-name" has changed. + Previously, in order to include an as-name, you were required to use + the "multiline" form of GET: + + get + remote-filespec + local-name + + This was because the remote filespec might contain spaces, and so there + would be no good way of telling where it ended and where the local name + began, e.g: + + get profile exec a foo + + But now since we can use {braces} for grouping, we don't need the + multiline GET form any more, and in fact, support for it has been + removed. If you give a GET command by itself on a line, it fails and an + error message is printed. The new form is: + + GET [ switches... ] remote-name [ local-name ] + Ask the server to send the file whose name is remote-name. If + the optional local-name is given, store it locally under this + name. If the remote-name or local-name contains spaces, they + must be enclosed in braces: + + get {profile exec a} foo + get oofa.txt {~/My Files/Oofa text} + + If you want to give a list of remote file specifications, use the MGET + command: + + MGET [ switches... ] remote-name [ remote-name [ remote-name ... ] ] + Ask the server to send the files whose names are given. + + Now you can also include modifier switches between GET or MGET and the + remote-name; most of the same switches as SEND: + + /AS-NAME:text + Specifies "text" as the name to store the incoming file under. + (This switch is not available for MGET.) You can also still + specify the as-name as the second filename on the GET command + line. The following two commands are equivalent: + + get oofa.txt oofa.new + get /as:oofa.new oofa.txt + + /BINARY + Tells the server to send the given file(s) in binary mode + without affecting the global transfer mode. Example: + + set file type text ; Set global transfer mode to text + get /binary oofa.zip ; get a file in binary mode + get oofa.txt ; This one is transferred in text mode + + Or, perhaps more to the point: + + get /binary foo.txt ; where "*.txt" is a text-pattern + + This has the expected effect only if the server is C-Kermit 7.0 + or later or K95 1.1.19 or later. + + /COMMAND + GET /COMMAND is equivalent to CGET ([498]Section 4.2.2) -- it + says to receive the file into the standard input of a command, + rather than saving it on disk. The /AS-NAME or the second + "filename" on the GET command line is interpreted as the name of + a command. Examples: + + get /command sunday.txt {grep Sunday oofa.txt} + get /command /as-name:{grep Sunday oofa.txt} sunday.txt + get /bin /command {!gunzip -c | tar xf -} {tar cf - . | gzip -c} + + /DELETE + Asks the Kermit server to delete the file (or each file in the + group) after it has been transferred successfully (but not to + delete it if it was not sent successfully). GET /DELETE is + equivalent to RETRIEVE. Example: + + get /delete *.log + + /EXCEPT:pattern + Specifies that any files whose names match the pattern, which + can be a regular filename, or may contain "*" and/or "?" + metacharacters, are to be refused upon arrival. To specify + multiple patterns (up to 8), use outer braces around the group, + and inner braces around each pattern: + + /EXCEPT:{{pattern1}{pattern2}...} + + See the description of SEND /EXCEPT in [499]Section 4.7.1 for + examples, etc. Refusal is accomplished using the Attribute + Rejection mechanism (reason "name"), which works only when + Attribute packets have been successfully negotiated. + + /FILENAMES:{CONVERTED,LITERAL} + Use this switch to override the current global SET FILE NAMES + setting for this transfer only. + + /FILTER:command + This specifies a filter to pass the incoming file through before + writing to disk. See the [500]section on file-transfer pipes and + filters. The /FILTER switch applies only to the file-transfer + command it is given with; it does not affect the global RECEIVE + FILTER setting, if any. + + /IMAGE + VMS: Transfer in image mode. Non-VMS: same as /BINARY. + + /LABELED + VMS and OS/2 only: Specifies labeled transfer mode. + + /MOVE-TO:directory + This tells C-Kermit to move each file that is successfully + received to the given directory. Files that are not successfully + received are not moved. By default, files are not moved. + + /PATHNAMES:{OFF,ABSOLUTE,RELATIVE,AUTO} + Use this switch to override the current global SET RECEIVE + PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE or + RELATIVE also sets /FILENAMES:LITERAL (also for this transfer + only) since incoming pathnames would not be treated as pathnames + otherwise. See [501]Section 4.10. + + /QUIET + When sending in local mode, this suppresses the file-transfer + display. + + /RECOVER + Used to recover from a previously interrupted transfer; GET + /RECOVER is equivalent to REGET. Recovery only works in binary + mode; SEND /RECOVER and RESEND include an implied /BINARY + switch. Even then, recovery will successful only if (a) the + original (interrupted) transfer was also in binary mode, or (b) + if it was in text mode, the two Kermit programs run on platforms + where text-mode transfers are not length-changing. + + /RECURSIVE + Tells the server that the GET file specification applies + recursively. This switch also automatically sets + /PATHNAMES:RELATIVE in both the server AND the client. When used + in conjunction with /DELETE, this "moves" a directory tree from + the server's computer to the client's computer (except that only + regular files are deleted from the server's computer, not + directories; thus the original directories will be left, but + will contain no files). Note that all servers that support + /RECURSIVE do not necessarily do so in combination with other + switches, such as /RECOVER. (Servers that do include C-Kermit + 7.0 and later, K95 1.1.19 and later.) + + /RENAME-TO:string + This tells C-Kermit to rename each file that is successfully + received to the given string. Files that are not successfully + received are not renamed. By default, files are not renamed. The + string can be a literal string, which is appropriate when only + one file is being received, or it can contain one or more + variables that are to be evaluated at the time each file is + received, such as \v(filename), \v(filenumber), \v(ntime), + \v(pid), \v(user), etc. WARNING: if you give a literal string + and more than one file arrives, each incoming file will be given + the same name (but SET FILE COLLISION BACKUP or RENAME can be + used to keep the incoming files from overwriting each other). + + /TEXT + Tells the server to perform this transfer in text mode without + affecting its global transfer mode. See /BINARY for additional + info. + + The /MAIL and /PRINT options are not available (as they are for SEND), + but you can use /COMMAND to achieve the same effect, as in these UNIX + examples: + + get /command oofa.txt {mail kermit@columbia.edu} + get /command oofa.txt lpr + + In OS/2 or Windows, you can GET and print like this: + + get oofa.txt prn + + The CGET, REGET, RETRIEVE commands also accept the same switches as + GET. CGET automatically sets /COMMAND; REGET automatically sets + /RECOVER and /BINARY, and RETRIEVE automatically sets /DELETE. + +4.7.3. RECEIVE Command Switches + + Without switches, the RECEIVE command still works as before: + + receive ; Receives files under their own names + receive /tmp ; Ditto, but into the /tmp directory + r ; Same as "receive" + receive foo.txt ; Receives a file and renames to foo.txt + + Now you can also include modifier switches may be included between + "receive" and the as-name; most of the same switches as GET: + + /AS-NAME:text + Specifies "text" as the name to store the incoming file under. + You can also still specify the as-name as a filename on the + command line. The following two commands are equivalent: + + r oofa.new + r /as:oofa.new + + /BINARY + Performs this transfer in binary mode without affecting the + global transfer mode. NOTE: This does not override the incoming + filetype (as it does with GET), so this switch is useful only if + ATTRIBUTE TYPE is OFF, or if the other Kermit does not send a + TYPE (text or binary) attribute. In any case, it has no affect + whatsoever on the file sender. + + /COMMAND + RECEIVE /COMMAND is equivalent to CRECEIVE ([502]Section 4.2.2) + -- it says to receive the file into the standard input of a + command, rather than saving it on disk. The /AS-NAME or the + "filename" on the RECEIVE command line is interpreted as the + name of a command. + + r /command {grep Sunday oofa.txt} + r /command /as-name:{grep Sunday oofa.txt} + r /bin /command {tar cf - . | gzip -c} + + /EXCEPT:pattern + Specifies that any files whose names match the pattern, which + can be a regular filename, or may contain "*" and/or "?" + metacharacters, are to be refused upon arrival. To specify + multiple patterns (up to 8), use outer braces around the group, + and inner braces around each pattern: + + /EXCEPT:{{pattern1}{pattern2}...} + + See the description of SEND /EXCEPT in [503]Section 4.7.1 for + examples, etc. Refusal is accomplished using the Attribute + Rejection mechanism (reason "name"), which works only when + Attribute packets have been successfully negotiated. + + /FILENAMES:{CONVERTED,LITERAL} + Use this switch to override the current global SET FILE NAMES + setting for this transfer only. + + /FILTER:command + This specifies a filter to pass the incoming file through before + writing to disk. See the [504]section on file-transfer pipes and + filters. The /FILTER switch applies only to the file-transfer + command it is given with; it does not affect the global RECEIVE + FILTER setting, if any. + + /IMAGE + VMS: Transfer in image mode. Non-VMS: same as /BINARY. See + comments under RECEIVE /BINARY. + + /LABELED + VMS and OS/2 only: Specifies labeled transfer mode. See comments + under RECEIVE /BINARY. + + /MOVE-TO:directory + This tells C-Kermit to move each file that is successfully + received to the given directory. Files that are not successfully + received are not moved. By default, files are not moved. + + /PATHNAMES:{ABSOLUTE,RELATIVE,OFF,AUTO} + Use this switch to override the current global SET RECEIVE + PATHNAMES setting for this transfer only. See [505]Section 4.10. + + /RECURSIVE + When used with the RECEIVE command, /RECURSIVE is simply a + synonym for /PATHNAMES:RELATIVE. + + /RENAME-TO:string + This tells C-Kermit to rename each file that is successfully + received to the given string. Files that are not successfully + received are not renamed. By default, files are not renamed. The + string can be a literal string, which is appropriate when only + one file is being received, or it can contain one or more + variables that are to be evaluated at the time each file is + received, such as \v(filename), \v(filenumber), \v(ntime), + \v(pid), \v(user), etc. WARNING: if you give a literal string + and more than one file arrives, each incoming file will be given + the same name (but SET FILE COLLISION BACKUP or RENAME can be + used to keep the incoming files from overwriting each other). + + /QUIET + When receiving in local mode, this suppresses the file-transfer + display. + + /TEXT + Receives in text mode without affecting the global transfer + mode. See comments under RECEIVE /BINARY. + + The /MAIL and /PRINT options are not available, but you can use + /COMMAND to achieve the same effect, as in these UNIX examples: + + r /command {mail kermit@columbia.edu} + r /command lpr + + In OS/2 or Windows, you can RECEIVE and print like this: + + receive prn + + The CRECEIVE command now also accepts the same switches. + +4.8. Minor Kermit Protocol Improvements + +4.8.1. Multiple Attribute Packets + + C-Kermit 7.0 now sends more than one Attribute packet if a file's + attributes do not fit into a single packet of the negotiated length. If + a particular attribute (such as file creation date-time) does not fit + within the negotiated length (which will only happen when the + negotiated length is around 20 or less), that attribute is not sent at + all. + +4.8.2. Very Short Packets + + There are certain situations where extremely short packets must be + used; 20 or 30 bytes at most. This can happen when one or more devices + along the communication path have very small buffers and lack an + effective means of flow control. Examples are sometimes cited involving + radio modems. + + When the maximum packet length is shorter than certain packets that + would be sent, those packets are either truncated or else broken up + into multiple packets. Specifically: + + 1. Parameter negotiation packets (I, S, and their ACKs) are truncated + to the negotiated length. Any parameters that do not fit are reset + to their default values. There is no provision in the Kermit + protocol for fragmentation and reassembly of parameter strings. + 2. File header packets (containing the filename) are simply truncated. + There is no provision in the Kermit protocol for fragmentation and + reassembly of filenames. + 3. Attribute packets are fragmented and reassembled as described in + 4.8.1 without loss of data, except in case a field will not fit at + all in the negotiated length (the longest attribute is usually the + date and time of file creation/modification) because of the rule + that attributes may not be broken across packets. + 4. Data packets and other packets are unaffected -- they can be as + short as they need to be, within reason. + +4.9. Wildcard / File Group Expansion + + "Wildcard" refers to the notation used in filenames to specify a group + of files by pattern matching. + +4.9.1. In UNIX C-Kermit + + Prior to C-Kermit 7.0, C-Kermit was capable of expanding wildcard + strings containing only the "metacharacters" '*' and '?': + + * + Matches any sequence of zero or more characters. For example: + "ck*.c" matches all files whose names start with "ck" and end + with ".c", including "ck.c". + + ? + Matches any single character. For example, "ck?.c" matches all + files whose names are exactly 5 characters long and start with + "ck" and end with ".c". When typing commands at the prompt, you + must precede any question mark to be used for matching by a + backslash (\) to override the normal function of question mark, + which is providing menus and file lists. + + C-Kermit 7.0 adds the additional features that users of ksh, csh, and + bash are accustomed to: + + [abc] + Square brackets enclosing a list of characters matches any + single character in the list. Example: ckuusr.[ch] matches + ckuusr.c and ckuusr.h. + + [a-z] + Square brackets enclosing a range of characters; the hyphen + separates the low and high elements of the range. For example, + [a-z] matches any character from a to z. + + [acdm-z] + Lists and ranges may be combined. This example matches a, c, d, + or m through z. + + {string1,string2,...} + Braces enclose a list of strings to be matched. For example: + ck{ufio,vcon,cmai}.c matches ckufio.c, ckvcon.c, or ckcmai.c. + The strings may themselves contain metacharacters, bracket + lists, or indeed, other lists of strings, but (when matching + filenames) they may not contain directory separators. + + Thus, the metacharacters in filenames (and in any other field + that can be a pattern, such as the IF MATCH pattern, SEND or GET + exception lists, etc) are: + + * ? [ { + + And within braces only, comma (,) is a metacharacter. + + To include a metacharacter in a pattern literally, precede it with a + backslash '\' (or two if you are passing the pattern to a macro). + Examples: + + send a*b ; Send all files whose names start with 'a' and end with 'b'. + send a?b ; Ditto, but the name must be exactly three characters long. + send a[a-z]b ; Ditto, but the second character must be a lowercase letter. + send a[x\-z]b ; Ditto, except the second character must be 'x', '-', or 'y'. + send a[ghi]b ; Ditto, except the second character must be 'g', 'h', or 'i'. + send a[?*]b ; Ditto, except the second character must be '?' or '*'. + send a[\?\*]b ; Same as previous. + send *?[a-z]* ; All files with names containing at least one character + ; that is followed by a lowercase letter. + + Or, more practically: + + send ck[cuw]*.[cwh] ; Send the UNIX C-Kermit source files. + + To refer to the C-Kermit sources files and makefile all in one + filespec: + + {{makefile,ck[cuw]*.[cwh]}} + + (NOTE: if the entire pattern is a {stringlist}, you must enclose it it + TWO pairs of braces, since the SEND command strips the outer brace + pair, because of the "enclose in braces if the filename contains + spaces" rule). + + If the makefile is called ckuker.mak: + + ck[cuw]*.{[cwh],mak} + + (NOTE: double braces are not needed here since the pattern does not + both begin and end with a brace.) + + To add in all the C-Kermit text files: + + ck[cuw]*.{[cwh],mak,txt} + + All of these features can be used anywhere you would type a filename + that is allowed to contain wildcards. + + When you are typing at the command prompt, an extra level of quoting is + required for the '?' character to defeat its regular function of + producing a list of files that match what you have typed so far, for + example: + + send ck[cu]? + + lists all the files whose names start with ckc and cku. If you quote + the question mark, it is used as a pattern-matching character, for + example: + + send ck\?[ft]io.c + + sends all the file and communications i/o modules for all the + platforms: ckufio.c, ckutio.c, ckvfio.c, ckvtio.c, etc. + + If, however, a filename actually contains a question mark and you need + to refer to it on the command line, you must use three (3) backslashes. + For example, if the file is actually called ck?fio.c, you would use: + + send ck\\\?fio.c + + Further notes on quoting: + + * A single backslash is sufficient for quoting a special character at + the command prompt or in a command file. However, when passing + patterns to macros you'll need double backslashes, and when + referring to these patterns within the macro, you'll need to use + \fcontents(\%1) (see [506]Section 1.11.5). You should enclose macro + argument references in braces in case grouped arguments were + passed. Example: + define ismatch { + if match {\fcont(\%1)} {\fcont(\%2)} { + end 0 MATCH + } else { + end 1 NO MATCH + } + } + ismatch ab*yz a*\\**z ; Backslash must be doubled + ismatch {abc def xyz} *b*e*y* ; Braces must be used for grouping + + * Watch out for possible conflicts between {} in filename patterns + and {} used for grouping multiple words into a single field, when + the pattern has outer braces. For example, in: + if match {abc xyz} {a* *z} echo THEY MATCH + + braces must be used to group "abc xyz" into a single string. Kermit + strips off the braces before comparing the string with the pattern. + Therefore: + if match makefile {makefile,Makefile} echo THEY MATCH + + does not work, but: + if match makefile {{makefile,Makefile}} echo THEY MATCH + + does. + * If you use a pattern that has outer braces, like {*.txt,*.doc}, in + a field that accepts a pattern list (like SEND /EXCEPT:xxx), you'll + need to add two extra sets of outer braces: + send /except:{{{*.txt,*.doc}}} *.* + + C-Kermit's new pattern matching capabilities are also used when + C-Kermit is in server mode, so now you can send requests such as: + + get ck[cuw]*.[cwh] + + to a C-Kermit server without having to tell it to SET WILD SHELL first. + Previously this would have required: + + mget ckc*.c ckc*.w ckc*.h cku*.c cku*.w cku*.h ckw*.c ckw*.w ckw*.h + + The new pattern matching features make SET WILD SHELL redundant, and + barring any objections, it will eventually be phased out. (One possible + reason for retaining it would be as an escape mechanism when Kermit + does not understand the underlying file system.) + + By the way, patterns such as these are sometimes referred to as + "regular expressions", but they are not quite the same. In a true + regular expression (for example), "*" means "zero or more repetitions + of the previous item", so (for example), "([0-9]*)" would match zero or + more digits in parentheses. In Kermit (and in most shells), this + matches one digit followed by zero or more characters, within + parentheses. Here are some hints: + + * Although you can't match any sequence of digits (or letters, etc), + you can match (say) 1, 2, or 3 of them in row. For example, the + following pattern matches Kermit backup files (with backup numbers + from 1 to 999): + *.~{[1-9],[1-9][0-9],[1-9][0-9][0-9]}~ + + * There is presently no NOT operator, so no way to match any + character or string EXCEPT the one(s) shown. + + In other wildcarding news... + + * You may now "send xxx" where "xxx" is a directory name, and this + will send all the files from the directory xxx, as if you had typed + "send xxx/*". You can also use the special shorthand "send ." to + send all the files from the current directory. + * To easily skip over backup files (the ones whose names end like + .~22~) when sending, you can use SEND /NOBACKUP (see [507]Section + 4.0.6 for details). + * When choosing Kermit to expand wildcards, rather than the shell, + you can choose whether "dot files" -- files whose names begin with + ".", which are normally "invisible" -- should be matched: + SET WILD KERMIT /NO-MATCH-DOT-FILES (this is the default) + SET WILD KERMIT /MATCH-DOT-FILES (this allows matching of "." files) + + or include the /DOTFILES or /NODOTFILES switch on the command you + are using, such as SEND or DIRECTORY. + * Commands such as DIRECTORY and SEND allow recursive directory + traversal. There are also new functions for this to use in scripts. + See [508]Section 4.11 for details. + + When building file lists in UNIX, C-Kermit follows symbolic links. + Because of this, you might encounter any or all of the following + phenomena: + + * Multiple copies of the same file; e.g. one from its real directory + and others from links to its real directory, if both the real + directory and the links to it are in the wildcard expansion list. + * A command might unexpectedly "hang" for a long time because an NFS + link might not be responding, or the directory you are looking at + contains a link to a huge directory tree (example: "directory + /recursive /etc" when /etc/spool is a symlink to /var/spool, which + is a large organization's incoming email directory, containing tens + of thousands of subdirectories). + + The size of the file list that Kermit can build is limited in most + C-Kermit implementations. The limit, if any, depends on the + implementation. Use the SHOW FEATURES command and look in the + alphabetized options list for MAXWLD to see the value. + +4.9.2. In Kermit 95 + + Kermit 95 1.1.19 and later uses the same pattern matching syntax as in + UNIX, but (as always) you will encounter numerous difficulties if you + use backslash (\) as the directory separator. In any command where K95 + parses filenames itself (that is, practically any file-oriented command + except RUN), you can use forward slash (/) as the directory separator + to avoid all the nasty conflicts. + +4.9.3. In VMS, AOS/VS, OS-9, VOS, etc. + + Platforms other than UNIX, Windows 95/98/NT, and OS/2 have their own + filename matching capabilities that are, in general, different from + Kermit's built-in ones and in any case might conflict with them. For + example, [] encloses directory names in VMS. + + Nevertheless you can still use all the pattern-matching capabilities + described in [509]Section 4.9.1 by loading a file list into an array + (e.g. with \ffiles(*,&a), see [510]Section 4.11.3) and then using IF + MATCH on the members. + +4.10. Additional Pathname Controls + + In version 6.0 and earlier, C-Kermit's SET { SEND, RECEIVE } PATHNAMES + command had only ON and OFF as options. In version 7.0, there are more + choices: + + SET SEND PATHNAMES OFF + When sending a file, strip all disk/directory information from + the name. Example: "send /usr/olga/letters/oofa.txt" sends the + file as "oofa.txt". This applies to actual filenames, not to any + as-name you might specify. + + SET SEND PATHNAMES RELATIVE + When sending a file, leave the pathname on as given. For + example, if your current directory is /usr/olga, "send + letters/oofa.txt" sends the file as "letters/oofa.txt", not + "/usr/olga/letters/oofa.txt" or "letters.txt". + + SET SEND PATHNAMES ABSOLUTE + When sending a file, convert its name to the full, absolute + local pathname. For example, if your current directory is + /usr/olga, "send letters/oofa.txt" sends the file as + "/usr/olga/letters/oofa.txt". NOTE: Even with this setting, + device and/or node names are not included. For example, in VMS, + any node or device name is stripped; in Windows or OS/2, any + disk letter is stripped. + + SET RECEIVE PATHNAMES OFF + When receiving a file, strip all disk/directory information from + the name before attempting to store it. This applies to incoming + filename, not to any as-name you might specify. Example: If a + file arrives under the name "/usr/olga/letters/oofa.txt" it is + stored simply as "oofa.txt" in your download directory or, if no + download directory has been specified, in your current + directory. + + SET RECEIVE PATHNAMES RELATIVE + When receiving a file, leave the pathname on as it appears in + the incoming name, but if the incoming name appears to be + absolute, make it relative to your current or download + directory. Examples: + + + "oofa.txt" is stored as "oofa.txt". + + "letters/oofa.txt" is stored as "letters/oofa.txt"; the + "letters" subdirectory is created if it does not already + exist. + + "/usr/olga/letters/oofa.txt" is stored as + "usr/olga/letters/oofa.txt" in your current or download + directory, and the "usr", "usr/olga", etc, directories are + created if they do not exist. + + SET RECEIVE PATHNAMES ABSOLUTE + The incoming filename is used as given. Thus it cannot be stored + unless the given path (if any) already exists or can be created. + In this case, node, device, or disk designations are NOT + stripped, since they most likely were given explicitly by the + user as an as-name, meant to be used as given. + + SET RECEIVE PATHNAMES AUTO + This is the default, and means RELATIVE if the sender tells me + it is a recursive transfer, OFF otherwise. + + Set FILE NAMES CONVERTED now also affects pathnames too. When PATHNAMES + are RELATIVE or ABSOLUTE and FILE NAMES are CONVERTED, the file sender + converts its native directory-name format to UNIX format, and the file + receiver converts from UNIX format to its native one; thus UNIX format + is the common intermediate representation for directory hierarchies, as + it is in the ZIP/UNZIP programs (which is why ZIP archives are + transportable among, UNIX, DOS, and VMS). + + Here's an example in which a file is sent from Windows to UNIX with + relative pathnames and FILE NAMES CONVERTED: + + Source name Intermediate name Destination Name + C:\K95\TMP\OOFA.TXT K95/TMP/OOFA.TXT k95/tmp/oofa.txt + + In a more complicated example, we send the same file from Windows to + VMS: + + Source name Intermediate name Destination Name + C:\K95\TMP\OOFA.TXT K95/TMP/OOFA.TXT [.K95.TMP]OOFA.TXT + + (Note that disk letters and device designations are always stripped + when pathnames are relative). + + As you can imagine, as more and more directory formats are considered, + this approach keeps matters simple: on each platform, Kermit must know + only its own local format and the common intermediate one. In most + cases, the receiver can detect which format is used automatically. + +4.11. Recursive SEND and GET: Transferring Directory Trees + + C-Kermit 7.0 in selected versions (UNIX, VMS, VOS, AOS/VS, Windows, and + OS/2 at this writing) now permits the SEND command to traverse + directories "recursively" if you ask it to; that is, to send files from + the current or specified directory and all of its subdirectories too, + and their subdirectories, etc. (Some other commands can do this too, + including DIRECTORY.) + + This feature is new to UNIX, Windows, VOS, and OS/2. VMS and AOS/VS + have always included "wildcard" or "template" characters that allow + this, and in this case, recursive directory traversal could happen + behind Kermit's back, i.e. Kermit does not have to do it itself (in + VMS, the notation is "[...]" or "[directory...]"; in AOS/VS is "#"). In + C-Kermit 7.0, however, SEND /RECURSIVE is supported by C-Kermit itself + for VMS. + +4.11.1. Command-Line Options + + To descend a directory tree when sending files, use the -L command-line + option to indicate that the send operation is to be recursive, and + include a name or pattern to be sent. When giving a pattern, you should + enclose it in quotes to prevent the shell from expanding it. Examples: + + $ kermit -Ls "/usr/olga/*" # send all of Olga's files in all her directories + $ kermit -Ls foo.txt # send all foo.txt files in this directory tree + $ kermit -Ls "*.txt" # send all .txt files in this directory tree + $ kermit -Ls "letters/*" # send all files in the letters directory tree + $ kermit -Ls letters # send all files in the letters directory tree + $ kermit -Ls "*" # send all files in this directory tree + $ kermit -Ls . # UNIX only: send all files in this directory tree + $ kermit -s . # UNIX only: a filename of . implies -L + + If you let the shell expand wildcards, Kermit only sends files whose + names match files in the current or given directory, because the shell + replaces an unquoted wildcard expression with the list of matching + files -- and the shell does not build recursive lists. Note that the + "." notation for the tree rooted at the current directory is allowed + only in UNIX, since in Windows and OS/2, it means "*.*" (nonrecursive). + +4.11.2. The SEND /RECURSIVE Command + + If you include the /RECURSIVE switch in a SEND (or MOVE, or similar) + command, it means to descend the current or specified directory tree + searching for files whose names match the given name or pattern. Since + this is not terribly useful unless you also include pathnames with the + outbound files, the /RECURSIVE switch also includes an implicit + /PATHNAMES:RELATIVE switch (which you can undo by including an explicit + /PATHNAMES switch after the /RECURSIVE switch). + + Examples: + + SEND /RECURSIVE * + Sends all of the files in the current directory and all the + files in all of its subdirectories, and all of their + subdirectories, etc, including their relative pathnames. Empty + directories are not sent. + + SEND /RECURSIVE /PATHNAMES:ABSOLUTE * + Sends all of the files in the current directory and all the + files in all of its subdirectories, and all of their + subdirectories, etc, including their absolute pathnames. + + SEND /RECURSIVE /PATHNAMES:OFF * + Sends all of the files in the current directory and all the + files in all of its subdirectories, and all of their + subdirectories, etc, without pathnames. + + SEND /RECURSIVE /usr/olga/* + Sends all of the files in the /usr/olga directory and all the + files in all of its subdirectories, and all of their + subdirectories, etc. + + SEND /RECURSIVE /usr/olga (or /usr/olga/) + Same as above. If the name is a directory name (with or without + a trailing slash), its files are sent, and those of its + subdirectories, and their subdirectories, etc (see [511]Section + 4.9). + + SEND /RECURSIVE /TEXT /usr/olga/*.txt + As above, but only files whose names end with ".txt" are sent, + and they are sent in text mode (as they would be by default + anyway if SET FILE PATTERNS is ON or AUTO). + + SEND . + UNIX only: Send all the files in the current directory. + + SEND /RECURSIVE . + UNIX only: Sends all of the files in the current directory and + all of its subdirectories, etc ([512]Section 4.9). + + The /RECURSIVE switch is different from most other switches in that its + effect is immediate (but still local to the command in which it is + given), because it determines how filenames are to be parsed. For + example, "send *.txt" fails with a parse error ("No files match") if + there are no *.txt files in the current directory, but "send /recursive + *.txt" succeeds if there are ".txt" files anywhere in the tree rooted + at the current directory. + + The /RECURSIVE switch also affects the file lists displayed if you type + "?" in a filename field. "send ./?" lists the regular files in the + current directory, but "send /recursive ./?" lists the entire directory + tree rooted at the current directory. + +4.11.3. The GET /RECURSIVE Command + + In a client/server setting, the client can also request a recursive + transfer with: + + GET /RECURSIVE [ other switches ] remote-filespec [ local-spec ] + + In which remote file specification can be a directory name, a filename, + a wildcard, or any combination. If the local-spec is not given (and + PATHNAMES are RELATIVE), incoming files and directories go into the + current local directory. If local-spec is given and is a directory, it + becomes the root of the tree into which the incoming files and + directories are placed. If local-spec has the syntax of a directory + name (e.g. in UNIX it ends with /), C-Kermit creates the directory and + then places the incoming files into it. If local-spec is a filename + (not recommended), then all incoming files are stored with that name + with collisions handled according to the FILE COLLISION setting. + + Again, the normal method for transferring directory trees uses relative + pathnames, and this is the default when the sender has been given the + /RECURSIVE switch. The action at the receiver depends on its RECEIVE + PATHNAMES setting. The default is AUTO, meaning that if the sender + tells it to expect a recursive transfer, then it should automatically + switch to relative pathnames for this transfer only; otherwise it obeys + the RECEIVE PATHNAMES setting of OFF, ABSOLUTE, or RELATIVE. + + What happens if a file arrives that has an absolute pathname, when the + receiver has been told to use only relative pathnames? As a security + precaution, in this case the receiver treats the name as if it was + relative. For example, if a file arrives as: + + /usr/olga/oofa.txt + + The receiver creates a "usr" subdirectory in its current directory, and + then an "olga" subdirectory under the "usr" subdirectory in which to + store the incoming file. + + Suppose, however there is a sequence of directories: + + /usr/olga/a/b/c/d/ + + in which "a" contains nothing but a subdirectory "b", which in turn + contains nothing but a subdirectory "c", which in turn contains nothing + but a subdirectory "d", which contains nothing at all. Thus there are + no files in the "/usr/olga/a/" tree, and so it is not sent, and + therefore it is not reproduced on the target computer. + +4.11.4. New and Changed File Functions + + C-Kermit 7.0 adds the following functions: + + \ffiles(pattern[,&a]) + This function has been changed to match only regular files in + the current or given directory, and to take an optional array + name as a second argument (explained below). + + \fdirectories(pattern[,&a]) + Returns the number of directories that match the given pattern. + If the pattern does not include a directory, then the search is + performed in the current directory. + + \frfiles(pattern[,&a]) + Returns the number of files in the current or given directory + and all of its subdirectories, and their subdirectories, etc, + that match the given pattern. Warning -- this one can take quite + some time if performed at the root of a large directory tree. + + \frdirectories(pattern[,&a]) + Returns the number of directories in the current or given + directory and all of its subdirectories, and their + subdirectories, etc, that match the given pattern. + + Each of these functions builds up a list of files to be returned by the + \fnextfile() function, just as \ffiles() always has done. (This can + also be done with the /ARRAY switch of the DIRECTORY command; see + [513]Sections 4.5.1 and [514]7.10). + + Each of these functions can be given an array name as an optional + second argument. If an array name is supplied, the array will contain + the number of files as its 0th element, and the filenames in elements 1 + through last. If the array already existed, its previous contents are + lost. For example, if the current directory contains two files, + oofa.txt and foo.bar, then "\ffiles(*,&a)" creates an array \&a[] with + a dimension of 2, containing the following elements: + + \&a[0] = 2 + \&a[1] = oofa.txt + \&a[2] = foo.bar + + If no files match the specification given in the first argument, the + array gets a dimension of 0, which is the same as undeclaring the + array. + + Note that the order in which the array is filled (and in which + \fnextfile() returns filenames) is indeterminate (but see [515]Section + 7.10.5). + + Here's an example that builds and prints a list of all the file whose + names end in .txt in the current directory and all its descendents: + + asg \%n \frfiles(*.txt) + declare \&a[\%n] + for \%i 1 \%n 1 { + asg \&a[\%i] \fnextfile() + echo \flpad(\%i,4). "\&a[\%i]" + } + + Alternatively, using the array method, and then printing the filenames + in alphabetic order (see [516]Section 7.10.3 and [517]7.10.5): + + asg \%n \frfiles(*.txt,&a) + sort &a + for \%i 1 \%n 1 { + echo \flpad(\%i,4). "\&a[\%i]" + } + + Or even more simply: + + asg \%n \frfiles(*.txt,&a) + sort &a + show array &a + + As noted elsewhere, the file lists built by \ffiles(), \frfiles(), etc, + are now "safe" in the sense that SEND and other file-related commands + can reference \fnextfile() without resetting the list: + + set send pathnames relative + for \%i 1 \frfiles(*.txt) 1 { + asg \%a \fnextfile() + echo Sending \%a... + send \%a + if fail break + } + + Copying to an array (as shown on p.398 of [518]Using C-Kermit 2nd Ed) + is no longer necessary. + +4.11.5. Moving Directory Trees Between Like Systems + +4.11.5.1. UNIX to UNIX + + Transferring a directory tree from one computer to another replicates + the file sender's arrangement of files and directories on the file + receiver's computer. Normally this is done using relative pathnames, + since the user IDs might not be identical on the two computers. Let's + say both computers are UNIX based, running C-Kermit 7.0 or later. On + the sending computer (leaving out the connection details, etc): + + C-Kermit> cd /usr/olga + C-Kermit> send /recursive . + + The /RECURSIVE switch tells C-Kermit to descend through the directory + tree and to include relative pathnames on outbound filenames. + + On the receiving computer: + + C-Kermit> mkdir olgas-files ; Make a new directory. + C-Kermit> cd olgas-files ; CD to it. + C-Kermit> receive /recursive ; = /PATHNAMES:RELATIVE + + Each Kermit program recognizes that the other is running under UNIX and + switches to binary mode and literal filenames automatically. + Directories are automatically created on the receiving system as + needed. File dates and permissions are automatically reproduced from + source to destination. + +4.11.5.2. VMS to VMS + + To send recursively from VMS, simply include the /RECURSIVE switch, for + example at the sender: + + $ kermit + C-Kermit> cd [olga] + C-Kermit> send /recursive *.*;0 + + And at the receiver: + + C-Kermit> cd [.olga] + C-Kermit> receive /recursive + + The notation "..." within directory brackets in VMS means "this + directory and all directories below it"; the /RECURSIVE switch, when + given to the sender, implies the use of "..." in the file specification + so you don't have to include "..."; but it makes no difference if you + do: + + $ kermit + C-Kermit> send /recursive [olga...]*.*;0 + + And at the receiver: + + C-Kermit> cd [.olga] + C-Kermit> receive /recursive + + In either case, since both systems recognize each other as VMS, they + switch into LABELED transfer mode automatically. + +4.11.6. Moving Directory Trees Between Unlike Systems + + There are several difficulties with recursive transfers between unlike + systems: + + * File formats can be different, especially text files character sets + and record formats. This can now be handled by using SET FILE + PATTERN, SET FILE TEXT-PATTERNS, and SET FILE BINARY-PATTERNS + ([519]Section 4.3). + * File naming conventions are different. For example, one system + might allow (and use) longer filenames than the other. You can tell + Kermit how to handle file names with the normal "set file names" + and "set file collision" mechanisms. Most modern Kermits are fairly + tolerant of illegal filenames and should not fail simply because of + an incoming filename; rather, it will do its best to convert it to + a recognizable and unique legal filename. + * Directory notations can be different, e.g. backslashes instead of + slashes, brackets, parentheses, spaces, etc. But this is now + handled by converting pathnames to a standard format during + transfer ([520]Section 4.10). + + So now, for the first time, it is possible to send directory trees + among any combination of UNIX, DOS, Windows, OS/2, VMS, AOS/VS, etc. + Here's an example sending files from an HP-UX system (where text files + are encoded in the HP Roman8 character set) to a PC with K95 (where + text files are encoded in CP850): + + Sender: + cd xxx ; CD to root of source tree + set file type binary ; Default transfer mode + set file character-set hp-roman8 ; Local character set for text files + set xfer character-set latin1 ; Transfer character set + set file patterns on ; Enable automatic file-type switching... + set file binary-patterns *.Z *.gz *.o ; based on these patterns... + set file text-patterns *.txt *.c *.h ; for binary and text files. + send /recursive * ; Send all the file in this directory tree + + Receiver: + cd yyy ; CD to root of destination tree + set file character-set cp850 ; Local character set for text files + receive /pathnames:relative ; Receive with pathnames + + Notes: + * Replace "xxx" and "yyy" with the desired directories. + * Replace the file character sets appropriately. + * Change the patterns as needed (or just use the built-in default + lists). + * SEND /RECURSIVE also implies /PATHNAMES:RELATIVE. + * The file sender tells the file receiver the transfer mode of each + file. + * The file sender tells the file receiver the transfer character set. + * By default, destination file dates will be the same as on the + source. + * Many of the settings shown might already be set by default. + * See [521]Sections 4.3, [522]4.10, and [523]4.15 for additional + explanation. + + If you are refreshing an existing directory on the destination + computer, use "set file collision update" or other appropriate file + collision option to handle filename collisions. + +4.12. Where Did My File Go? + + Now that Kermit can be started by clicking on desktop icons (thus + obscuring the concept of "current directory"), and can have a download + directory, and can create directories for incoming files on the fly, + etc, sometimes it is easy to lose a file after transfer. Of course, if + you keep a transaction log: + + LOG TRANSACTIONS + + it will record the fate and final resting place of each file. But in + case you did not keep a log, the new command: + + WHERE + + added in C-Kermit 7.0, gives you as much information as it has about + the location of the last files transferred, including the pathname + reported by the receiving Kermit, if any, when C-Kermit is the sender. + This information was also added to SHOW FILE in somewhat less detail. + +4.13. File Output Buffer Control + + (UNIX only). The new command SET FILE OUTPUT lets you control how + incoming files are written to disk: + + SET FILE OUTPUT BUFFERED [ size ] + Chooses buffered file output; this is the default. UNIX does its + normal sort of disk buffering. The optional size specifies + Kermit's own file output buffer size, and therefore the + frequency of disk accesses (write() system calls) -- the bigger + the size, the fewer the disk accesses. + + SET FILE OUTPUT UNBUFFERED [ size ] + This forces each file output write() call to actually commit the + data to disk immediately. Choosing this option will usually slow + file reception down. + + SET FILE OUTPUT BLOCKING + Write() calls should not return until they are complete. This is + the normal setting, and it lets Kermit detect disk-write errors + immediately. + + SET FILE OUTPUT NONBLOCKING + Write() calls should return immediately. This can speed up file + reception, but also delay the detection of disk-write errors. + + Experimentation with these parameters should be harmless, and might (or + might not) have a perceptible, even dramatic, effect on performance. + +4.14. Improved Responsiveness + + In version 7.0, C-Kermit's file-transfer protocol engine has been tuned + for additional speed and responsiveness. + + * Binary-mode transfers over 8-bit connections, a very common case, + are now handled in a special way that minimizes overhead. + * SET TRANSFER CRC-CALCULATION is now OFF by default, rather than ON. + (This affects only the overall per-transfer CRC, \v(crc16), not the + per-packet CRCs) + * Connection loss during file transfer is now detected immediately in + most cases on Internet connections and on serial connections when + CARRIER-WATCH is not set to OFF. + +4.15. Doubling and Ignoring Characters for Transparency + + The following commands were added in 7.0, primarily to allow successful + file transfer through ARPAnet TACs and with Honeywell DPS6 systems, but + can be used in any setting where they might be needed: + + SET SEND DOUBLE-CHAR { [ char [ char [ ... ] ] ], NONE } + Tells C-Kermit to double the specified characters (use decimal + notation) in packets that it sends. For example, if you are + sending files through a device that uses @ as an escape + character, but allows you to send a single copy of @ through by + doubling it, use "set send double 64". + + SET RECEIVE IGNORE-CHAR [ char [ char [ ... ] ] ] + Tells C-Kermit to ignore the specified character(s) in incoming + packets. Use this, for example, when something between the + sender and receiver is inserting linefeeds for wrapping, NULs + for padding, etc. + +4.16. New File-Transfer Display Formats + + SET TRANSFER DISPLAY { BRIEF, CRT, FULLSCREEN, NONE, SERIAL } + Selects the file-transfer display format. + + BRIEF is the new one. This writes one line to the screen per file, + showing the file's name, transfer mode, size, the status of the + transfer, and when the transfer is successful, the effective data rate + in characters per second (CPS). Example: + + SEND ckcfn3.o (binary) (59216 bytes): OK (0.104 sec, 570206 cps) + SEND ckcfns.o (binary) (114436 bytes): OK (0.148 sec, 772006 cps) + SEND ckcmai.c (text) (79147 bytes): OK (0.180 sec, 438543 cps) + SEND ckcmai.o (binary) (35396 bytes): OK (0.060 sec, 587494 cps) + SEND ckcnet.o (binary) (62772 bytes): REFUSED + SEND ckcpro.o (binary) (121448 bytes): OK (0.173 sec, 703928 cps) + SEND ckcpro.w (text) (63687 bytes): OK (0.141 sec, 453059 cps) + SEND makefile (text) (186636 bytes): OK (0.444 sec, 420471 cps) + SEND wermit (binary) (1064960 bytes): OK (2.207 sec, 482477 cps) + + Note that transfer times are now obtained in fractional seconds, rather + than whole seconds, so the CPS figures are more accurate (the display + shows 3 decimal places, but internally the figure is generally precise + to the microsecond). + +4.17. New Transaction Log Formats + + The new command: + + SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF [ separator ] } + + lets you choose the format of the transaction log. VERBOSE (the + default) indicates the traditional format described in the book. BRIEF + and FTP are new. This command must be given prior to the LOG + TRANSACTION command if a non-VERBOSE type is desired. + +4.17.1. The BRIEF Format + + BRIEF chooses a one-line per file format suitable for direct + importation into databases like Informix, Oracle, or Sybase, in which: + + * Each record has 8 fields. + * Fields are separated by a non-alphanumeric separator character. + * The default separator character is comma (,). + * Any field containing the separator character is enclosed in + doublequotes. + * The final field is enclosed in doublequotes. + + The fields are: + + 1. Date in yyyymmdd format + 2. Time in hh:mm:ss format + 3. Action: SEND or RECV + 4. The local filename + 5. The size of the file + 6. The transfer mode (text, binary, image, labeled) + 7. The status of the transfer: OK or FAILED + 8. Additional status-dependent info, in doublequotes. + + Examples: + + 20000208,12:08:52,RECV,/u/olga/oofa.txt,5246,text,OK,"0.284sec 18443cps" + 20000208,12:09:31,SEND,/u/olga/oofa.exe,32768,binary,OK,"1.243sec 26362cps" + 20000208,12:10:02,SEND,"/u/olga/a,b",10130,text,FAILED,"Refused: date" + + Note how the filename is enclosed in doublequotes in the final example, + because it contains a comma. + + To obtain BRIEF format, you must give the SET TRANSACTION-LOG BRIEF + command before the LOG TRANSACTIONS command. (If you give them in the + opposite order, a heading is written to the log by the LOG command.) + +4.17.2. The FTP Format + + SET TRANSACTION-LOG FTP (available only in UNIX) chooses a format that + is compatible with the WU-FTPD (Washington University FTP daemon) log, + and so can be processed by any software that processes the WU-FTPD log. + It logs only transfers in and out, both successful and failed (but + success or failure is not indicated, due to lack of a field in the + WU-FTPD log format for this purpose). Non-transfer events are not + recorded. + + Unlike other logs, the FTP-format transaction log is opened in append + mode by default. This allows you to easily keep a record of all your + kermit transfers, and it also allows the same log to be shared by + multiple simultaneous Kermit processes or (permissions permitting) + users. You can, of course, force creation of a new logfile by + specifying the NEW keyword after the filename, e.g. + + log transactions oofa.log new + + All records in the FTP-style log are in a consistent format. The first + field is fixed-length and contains spaces; subsequent fields are + variable length, contain no spaces, and are separated by one or more + spaces. The fields are: + + Timestamp + This is an asctime-style timestamp, example: "Wed Sep 16 + 20:19:05 1999" It is always exactly 24 characters long, and the + subfields are always in fixed positions. + + Elapsed time + The whole number of seconds required to transfer the file, as a + string of decimal digits, e.g. "24". + + Connection + The name of the network host to which C-Kermit is connected, or + the name of the serial device through which it has dialed (or + has a direct connection), or "/dev/tty" for transfers in remote + mode. + + Bytes transferred + The number of bytes transferred, decimal digits, e.g. "1537904". + + Filename + The name of the file that was transferred, e.g. + "/pub/ftp/kermit/a/README.TXT". If the filename contains any + spaces or control characters, each such character is replaced by + an underscore ('_') character. + + Mode + The letter 'b' if the file was transferred in binary mode, or + 'a' if it was transferred in text (ASCII) mode. + + Options + This field always contains an underscore ('_') character. + + Direction + The letter 'o' if the file was transferred Out, and 'i' if the + file was transferred In. + + User class + The letter 'r' indicates the file was transferred by a Real + user. + + User identification + The ID of the user who transferred the file. + + Server identification + The string "kermit". This distinguishes a Kermit transfer log + record from a WU-FTPD record, which contains "ftp" in this + field. + + Authentication class + The digit '1' if we know the user's ID on the client system, + otherwise '0'. Currently, always '0'. + + Authenticated user + If the authentication class is '1', this is the user's ID on the + client system. Otherwise it is an asterisk ('*'). Currently it + is always an asterisk. + + Examples: + + Thu Oct 22 17:42:48 1998 0 * 94 /usr/olga/new.x a _ i r olga kermit 0 * + Thu Oct 22 17:51:29 1998 1 * 147899 /usr/olga/test.c a _ o r olga kermit 0 * + Thu Oct 22 17:51:44 1998 1 * 235 /usr/olga/test.o b _ i r olga kermit 0 * + Fri Oct 23 12:10:25 1998 0 * 235 /usr/olga/x.ksc a _ o r olga kermit 0 * + + Note that an ftp-format transaction log can also be selected on the + Kermit command line as follows: + + kermit --xferfile:filespec + + This is equivalent to: + + SET TRANSACTION-LOG FTP + LOG TRANSACTIONS filespec APPEND + + Conceivably it could be possible to have a system-wide shared Kermit + log, except that UNIX lacks any notion of an append-only file; thus any + user who could append to the log could also delete it (or alter it). + This problem could be worked around using setuid/setgid tricks, but + these would most likely interfere with the other setuid/setgid tricks + C-Kermit must use for getting at dialout devices and UUCP logfiles. + +4.18. Unprefixing NUL + + As of 6.1.193 Alpha.10, C-Kermit can finally send and receive + file-transfer packets in which NUL (ASCII 0) is unprefixed (no more + NUL-terminated packets!). NUL is, of course, extremely prevalent in + binary files such as executables, and this has been a significant + source of packet overhead. For example, when transferring itself (the + SunOS C-Kermit executable) with minimal prefixing and 9000-byte + packets, we see: + + File size: 1064960 + Packet chars with 0 prefixed: 1199629 overhead = 12.65% + Packet chars with 0 unprefixed: 1062393 overhead = -0.03% + + Transfer rates go up accordingly, not only because of the reduced + amount of i/o, but also because less computation is required on each + end. + +4.19. Clear-Channel Protocol + + Now that C-Kermit itself is capable of sending and receiving any byte + at all on a clear channel ([524]Section 4.18), it is, for the first + time, in a position to negotiate a clear channel with the other Kermit, + giving it permission (but not requiring it) to unprefix any and all + characters that it knows are safe. In general this means all but the + Kermit start-of-packet character (normally Ctrl-A), Carriage Return + (not only Kermit's end-of-packet character, but also treated specially + on Telnet NVT links), and IAC (255, also special to Telnet). + + By default, C-Kermit will say it has a clear channel only if it has + opened a TCP socket. Since the Kermit program on the far end of a + TCP/IP connection generally does not know it has a TCP/IP connection, + it will not announce a clear channel unless it has been told to do so. + The command is: + + SET CLEAR-CHANNEL { ON, OFF, AUTO } + + AUTO is the default, meaning that the clear-channel status is + determined automatically from the type of connection. ON means to + announce a clear channel, OFF means not to announce it. Use SHOW + STREAMING ([525]Section 4.20) to see the current CLEAR-CHANNEL status. + Synonym: SET CLEARCHANNEL. + + CLEAR-CHANNEL is also set if you start C-Kermit with the -I switch (see + [526]Section 4.20). + + Whenever a clear channel is negotiated, the resulting control-character + unprefixing is "sticky"; that is, it remains in effect after the + transfer so you can use SHOW CONTROL to see what was negotiated. + + You can also see whether a clear channel was negotiated in the + STATISTICS /VERBOSE Display. + + The advantage of the clear channel feature is that it can make file + transfers go faster automatically. The disadvantage would be + file-transfer failures if the channel is not truly clear, for example + if C-Kermit made a Telnet connection to a terminal server, and then + dialed out from there; or if C-Kermit made an Rlogin connection to host + and then made a Telnet connection from there to another host. If a file + transfer fails on a TCP/IP connection, use SHOW CONTROL to check + whether control characters became unprefixed as a result of protocol + negotiations, and/or SHOW STREAMING ([527]Section 4.20) to see if + "clear-channel" was negotiated. If this happened, use SET CLEAR-CHANNEL + OFF and SET PREFIXING CAUTIOUS (or whatever) to prevent it from + happening again. + +4.20. Streaming Protocol + + A new Kermit protocol option called "streaming" was added in C-Kermit + 7.0. The idea is that if the two Kermit partners have a reliable + transport (such as TCP/IP or X.25) between them, then there is no need + to send ACKs for Data packets, or NAKs, since a reliable transport + will, by definition, deliver all packets in order and undamaged. On + such a connection, streaming cuts down not only on Kermit program + overhead (switching back and forth between reading and sending + packets), but also tends to make the underlying transport use itself + more efficiently (e.g. by defeating the Nagle algorithm and/or Delayed + ACK stratagem of the TCP layer). Furthermore, it allows transfers to + work smoothly on extremely slow network congestions that would + otherwise cause timeouts and retransmissions, and even failure when the + retry limit was exceeded. + + The trick is knowing when we can stream: + + 1. If C-Kermit has opened a TCP socket or X.25 connection, it offers + stream. + 2. If C-Kermit has been started with the -I (uppercase) option, or if + it has been told to SET RELIABLE ON, it offers to stream. + 3. If C-Kermit is in remote mode, and has been told to SET RELIABLE + AUTO (or ON), it always offers to stream, and also always agrees to + stream, if the other Kermit offers. Unless you take explicit + actions to override the defaults, this allows the local Kermit (the + one that made the connection, and so knows whether it's reliable) + to control streaming. + + (Note that an offer to stream also results in a Clear-Channel + announcement if CLEAR-CHANNEL is set to AUTO; see [528]Section 4.19.) + + When BOTH Kermits offer to stream, then they stream; otherwise they + don't. Thus streaming-capable Kermit programs interoperate + automatically and transparently with nonstreaming ones. If the two + Kermits do agree to stream, you'll see the word "STREAMING" on the + fullscreen file-transfer display in the Window Slots field. You can + also find out afterwards with the STATISTICS or SHOW STREAMING + commands. + + WARNING: Automatic choice of streaming is based on the assumption of + a "direct" end-to-end network connection; for example, a Telnet or + Rlogin connection from host A to host B, and transferring files + between A and B. However, if your connection has additional + components -- something "in the middle" (B) that you have made a + network connection to, which makes a separate connection to the + destination host (C), then you don't really have a reliable + connection, but C-Kermit has no way of knowing this; transferring + files between A and C will probably fail. In such cases, you'll need + to tell the *local* C-Kermit to "set reliable off" before + transferring files (it does no good to give this command to the + remote Kermit since the local one controls the RELIABLE setting). + + Streaming is like using an infinite window size, with no timeouts and + no tolerance for transmission errors (since there shouldn't be any). It + relies on the underlying transport for flow control, error correction, + timeouts, and retransmission. Thus it is very suitable for use on + TCP/IP connections, especially slow or bursty ones, since Kermit's + packet timeouts won't interfere with the transfer -- each packet takes + as long to reach its destination as it takes TCP to deliver it. If TCP + can't deliver the packet within its own timeout period (over which + Kermit has no control), it signals a fatal error. Just like FTP. + + Streaming goes much faster than non-streaming when a relatively small + packet length is used, and it tends to go faster than non-streaming + with even the longest packet lengths. The Kermit window size is + irrelevant to streaming protocol, but still might affect performance in + small ways since it can result in different paths through the code. + + The definition of "reliable transport" does not necessarily demand + 8-bit and control-character transparency. Streaming can work with + parity and/or control-character prefixing just as well (but not as + fast) as without them; in such cases you can leave RELIABLE set to ON, + but set CLEARCHANNEL and/or PARITY appropriately. + + Maximum performance -- comparable to and often exceeding FTP -- is + achieved on socket-to-socket connections (in which the considerable + overhead of the terminal driver and Telnet or Rlogin server is + eliminated) with long packets and the new "brief" file-transfer display + ([529]Section 4.16). + +4.20.1. Commands for Streaming + + SET RELIABLE { ON, OFF, AUTO } + SET RELIABLE ON tells Kermit that it has a reliable transport. + SET RELIABLE OFF tells Kermit the transport is not reliable. + SET RELIABLE AUTO tells Kermit that it should SET RELIABLE ON + whenever it makes a reliable connection (e.g. TELNET or SET HOST + on a TCP/IP or X.25 network), and when in remote mode it should + believe the transport is reliable if the other Kermit says it is + during Kermit protocol negotiation. + + AUTO is the default; the Kermit program that makes the connection knows + whether it is reliable, and tells the remote Kermit. + + The RELIABLE setting has several effects, including: + + * It can affect the timeouts used during normal ACK/NAK protocol. + * It can affect the clear-channel announcement. + * It can affect streaming. + + If you TELNET or SET HOST somewhere, this includes an implicit SET + RELIABLE ON command. The -I command-line option is equivalent to SET + RELIABLE ON. + + Since SET RELIABLE ON (and -I) also implies SET CLEAR CHANNEL ON, you + might find that in certain cases you need to tell Kermit that even + though the connection is reliable, it doesn't have a clear channel + after all: + + SET CLEAR-CHANNEL OFF + SET PREFIXING CAUTIOUS ; or whatever... + + You can control streaming without affecting the other items with: + + SET STREAMING { ON, OFF, AUTO } + + AUTO is the default, meaning streaming will occur if Kermit has made a + TCP/IP connection or if RELIABLE is ON (or it was started with the -I + command line option). OFF means don't stream; ON means offer to stream + no matter what. + +4.20.2. Examples of Streaming + + Here we look at the use and behavior of streaming on several different + kinds of connections, and compare its performance with non-streaming + transfers. + +4.20.2.1. Streaming on Socket-to-Socket Connections + + Here we get streaming automatically when both Kermit programs are + capable of it, since they both make socket connections. For example, on + the far end: + + C-Kermit> set host * 3000 + C-Kermit> server + + and on the near end: + + C-Kermit> set host foo.bar.xyz.com 3000 + (now give SEND and GET command) + + All subsequent file transfers use streaming automatically. + + Here are the results from 84 trials, run on a production network, + disk-to-disk, in which a 1-MB binary file (the SunOS C-Kermit Sparc + executable) was sent from a Sun Sparc-10 with SunOS 4.1.3 to an IBM + Power Server 850 with AIX 4.1, socket-to-socket, over a 10Mbps 10BaseT + Ethernet, using minimal control-character unprefixing, window sizes + from 10 to 32, and packet sizes from 1450 to 9010: + + Streaming Nonstreaming + Max CPS 748955 683354 + Min CPS 221522 172491 + Mean CPS 646134 558680 + Median CPS 678043 595874 + Std Dev 101424 111493 + + Correlations: + + CPS and window size: -0.036 + CPS and packet length: 0.254 + CPS and streaming: 0.382 + + Note that the relationship between streaming and throughput is + significantly stronger than that between CPS and window size or packet + length. + + Also note that this and all other performance measurements in this + section are snapshots in time; the results could be much different at + other times when the load on the systems and/or the network is higher + or lower. + + In a similar socket-to-socket trial, but this time over a wide-area + TCP/IP connection (from New York City to Logan, Utah, about 2000 + miles), the following results were obtained: + + Streaming Nonstreaming + Max CPS 338226 318203 + Min CPS 191659 132314 + Mean CPS 293744 259240 + Median CPS 300845 273271 + Std Dev 41914 52351 + + Correlations: + + CPS and window size: 0.164 + CPS and packet length: 0.123 + CPS and streaming: 0.346 + +4.20.2.2. Streaming on Telnet Connections + + In this case the local copy of Kermit is told to TELNET or SET HOST, + and so it knows it has a reliable connection and -- unless it has been + told not to -- will offer to stream, and the other Kermit program, + since it has STREAMING set to AUTO, agrees. + + Since we have a reliable connection, we'll also get control-character + unprefixing automatically because of the new clear-channel protocol + ([530]Section 4.19). + + Any errors that occur during streaming are fatal to the transfer. The + message is "Transmission error on reliable link". Should this happen: + + 1. Check the remote Kermit's flow control setting (SHOW + COMMUNICATIONS). If it is NONE, change it to XON/XOFF, or vice + versa. If it is XON/XOFF (or you just changed it to XOFF/XOFF), + make sure the file sender is prefixing the XON and XOFF characters. + In the most drastic case, use "set prefix all" to force prefixing + of all control characters. + 2. The remote Telnet server might chop off the 8th bit. In that case, + tell C-Kermit to "set parity space". Or, you might be able to force + the Telnet to allow eight-bit data by telling C-Kermit to "set + telopt binary request accept" -- that is, request the Telnet server + to enter binary mode, and accept binary-mode bids from the server. + 3. The remote Telnet server might have a buffering limitation. If a + and b don't cure the problem, tell the file receiver to "set + receive packet-length 1000" (or other number -- use the largest one + that works). This too, is no different from the non-streaming case + (more about this in [531]Section 4.20.2.3). + + And remember you can continue interrupted binary-mode transfers where + they left off with the RESEND (= SEND /RECOVER) command. + + Here are the figures for the same 84 trials between the same Sun and + IBM hosts as in 4.20.2.1, on the same network, but over a Telnet + connection rather than socket-to-socket: + + Streaming Nonstreaming + Max CPS 350088 322523 + Min CPS 95547 173152 + Mean CPS 321372 281830 + Median CPS 342604 291469 + Std Dev 40503 29948 + + Correlations: + + CPS and window size: 0.001 + CPS and packet length: 0.152 + CPS and streaming: 0.128 + + Here the effect is not as emphatic as in the socket-to-socket case, yet + on the whole streaming tends to be beneficial. + + Additional measurements on HP-UX using C-Kermit 7.0 Beta.06: + + Windowing Streaming + HP-UX 8->8 not tested 14Kcps + HP-UX 8->9 not tested 76Kcps + HP-UX 8->10 36Kcps 66Kcps + HP-UX 9->9 not tested 190Kcps + HP-UX 9->10 160Kcps 378Kcps + +4.20.2.3. Streaming with Limited Packet Length + + The IRIX telnet server (at least the ones observed in IRIX 5.3 and 6.2) + does not allow Kermit to send packets longer than 4096 bytes. Thus when + sending from IRIX C-Kermit when it is on the remote end of a Telnet + connection, the packet length must be 4K or less. Trials in this case + (in which packet lengths range from 1450 to 4000) show a strong + advantage for streaming, which would be evident in any other case where + the packet length is restricted, and stronger the shorter the maximum + packet length. + + Streaming Nonstreaming + Max CPS 426187 366870 + Min CPS 407500 276517 + Mean CPS 415226 339168 + Median CPS 414139 343803 + Std Dev 6094 25851 + + Correlations: + + CPS and window size: 0.116 + CPS and packet length: 0.241 + CPS and streaming: 0.901 + +4.20.2.4. Streaming on Dialup Connections + + Here "dialup" refers to a "direct" dialup connection, not a SLIP or PPP + connection, which is only a particular kind of TCP/IP connection. + + Attempt this at your own risk, and then only if (a) you have + error-correcting modems, and (b) the connections between the modems and + computers are also error-free, perfectly flow-controlled, and free of + interrupt conflicts. Streaming can be used effectively and to fairly + good advantage on such connections, but remember that the transfer is + fatal if even one error is detected (also remember that should a + binary-mode transfer fail, it can be recovered from the point of + failure with RESEND). + + To use streaming on an unreliable connection, you must tell both + Kermits that the connection is reliable: + + kermit -I + + or: + + C-Kermit> set reliable on + + In this case, it will probably be necessary to prefix some control + characters, for example if your connection is through a terminal server + that has an escape character. Most Cisco terminal servers, for example, + require Ctrl-^ (30, as well as its high-bit equivalent, 158) to be + prefixed. To unprefix these, you'll need to defeat the "clear channel" + feature: + + C-Kermit> set reliable on + C-Kermit> set clear-channel off + C-Kermit> set prefixing none + C-Kermit> set control prefix 1 13 30 158 ; and whatever else is necessary + + Dialup trials were done using fixed large window and packet sizes. They + compare uploading and downloading of two common types of files, with + and without streaming. Configuration: + + HP-9000/715/33 -- 57600bps, RTS/CTS -- USR Courier V.34 -- + V.34+V.42, 31200bps -- USR V.34+ Rackmount -- 57600bps, RTS/CTS -- + Cisco terminal server -- Solaris 2.5.1. Packet size = 8000, Window + Size = 30, Control Character Unprefixing Minimal (but including the + Cisco escape character). + + Since this is not a truly reliable connection, a few trials failed when + a bad packet was received (most likely due to UART overruns); the + failure was graceful and immediate, and the message was informative. + The results of ten successful trials uploading and downloading the two + files with and without streaming are: + + Streaming.. + Off On + Upload 5194 5565 txt (= C source code, 78K) + 3135 3406 gz (= gzip file, compressed, 85K) + Download 5194 5565 txt + 3041 3406 gz + + Each CPS figure is the mean of 10 results. + + A brief test was also performed on a LAT-based dialout connection from + a VAX 3100 with VMS 5.5 to a USR Courier V.34 connected to a DECserver + 700 at 19200 bps. The 1-MB Sparc executable downloaded from a Sun to + the VAX at 1100cps without streaming and 1900cps with streaming, using + 8000-byte packets, 30 window slots, and minimal prefixing in both + cases. + +4.20.2.5. Streaming on X.25 Connections + + We have only limited access to X.25 networks. One trial was performed + in which the 1MB Solaris 2.4 Sparc executable was transferred over a + SunLink X.25 connection; nothing is known about the actual physical + connection. With a packet length of 8000 and a window size of 30, the + file transferred at 6400 cps (using a maximum of 6 window slots). With + the same packet length, but with streaming, it transferred without + mishap at 6710 cps, about 5% faster. + +4.20.3. Streaming - Preliminary Conclusions + + The results vary with the particular connection, but are good overall. + Although numerous lower-level tricks can be used to improve performance + on specific platforms or connection methods, streaming occurs at a + high, system-independent level of the Kermit protocol and therefore can + apply to all types of platforms and (reliable) connections + transparently. + +4.21. The TRANSMIT Command + + Prior to C-Kermit 7.0, the TRANSMIT command transmitted in text or + binary mode according to SET FILE TYPE { TEXT, BINARY }. But now that + binary mode is likely to be the default for protocol transfers, it is + evident that this not also an appropriate default for TRANSMIT, since + binary-mode TRANSMIT is a rather specialized and tricky operation. + Therefore, TRANSMIT defaults to text mode always, regardless of the + FILE TYPE setting. + + C-Kermit 7.0 expands the capabilities of the TRANSMIT command by adding + the following switches (see [532]Section 1.5). The new syntax is: + + TRANSMIT [ switches... ] filename + + Zero or more switches may be included: + + /PIPE + When /PIPE is included, "filename" is interpreted as a system + command or program whose output is to be sent. Synonym: + /COMMAND. Example: + + transmit /pipe finger + + You may enclose the command in braces, but you don't have to: + + xmit /pipe {ls -l | sort -r +0.22 -0.32 | head} + + /BINARY + Transmits the file (or pipe output) in binary mode. + + /TEXT + Transmits the file (or pipe output) in line-oriented text mode. + Current FILE CHARACTER-SET and TERMINAL CHARACTER-SET selections + govern translation. Default. + + /TRANSPARENT + Specifies text mode without character-set translation, no matter + what the FILE and TERMINAL CHARACTER-SET selections are. + + /NOWAIT + This is equivalent to SET TRANSMIT PROMPT 0, but for this + TRANSMIT command only. Applies only to text mode; it means to + not wait for any kind of echo or turnaround character after + sending a line before sending the next line. (Normally Kermit + waits for a linefeed.) + + When TRANSMIT ECHO is ON, C-Kermit tries to read back the echo of each + character that is sent. Prior to C-Kermit 7.0, 1 second was allowed for + each echo to appear; if it didn't show up in a second, the TRANSMIT + command would fail. Similarly for the TRANSMIT PROMPT character. + However, with today's congested Internet connections, etc, more time is + often needed: + + SET TRANSMIT TIMEOUT number + + Specifies the number of seconds to wait for an echo or the prompt + character when TRANSMIT PROMPT is nonzero; the default wait is 1 + second. If you specify 0, the wait is indefinite. When a timeout + interval of 0 is specified, and a desired echo or prompt does not show + up, the TRANSMIT command will not terminate until or unless you + interrupt it with Ctrl-C; use SET TRANSMIT TIMEOUT 0 with caution. + + Note: to blast a file out the communications connection without any + kind of synchronization or timeouts or other manner of checking, use: + + SET TRANSMIT ECHO OFF + SET TRANSMIT PROMPT 0 (or include the /NOWAIT switch) + SET TRANSMIT PAUSE 0 + TRANSMIT [ switches ] filename + + In this case, text-file transmission is not-line oriented and large + blocks can be sent, resulting in a significant performance improvement + over line-at-at-time transmission. Successful operation depends (even + more than usual for the TRANSMIT command!) on a clean connection with + effective flow control. + + For details on TRANSMIT and character sets, see [533]Section 6.6.5.4. + + 4.22. Coping with Faulty Kermit Implementations + + Kermit protocol has been implemented in quite a few third-party + commercial, shareware, and freeware software packages, with varying + degrees of success. In most cases operation is satisfactory but slow -- + only the bare minimum subset of the protocol is available -- short + packets, no sliding windows, no attributes, etc. In other cases, the + implementation is incorrect, resulting in failures at the initial + negotiation stage or corrupted files. + + C-Kermit 7.0 and Kermit 95 1.1.19 include some new defense mechanisms + to help cope with the most common situations. However, bear in mind + there is only so much we can do in such cases -- the responsibility for + fixing the problem lies with the maker of the faulty software. + + 4.22.1. Failure to Accept Modern Negotiation Strings + + The published Kermit protocol specification states that new fields can + be added to the parameter negotiation string. These are to be ignored + by any Kermit implementation that does not understand them; this is + what makes the Kermit protocol extensible. Unfortunately, some Kermit + implementations become confused (or worse) when receiving a negotiation + string longer than the one they expect. You can try working around such + problems by telling Kermit to shorten its negotiation string (and thus + disable the corresponding new features): + + SET SEND NEGOTIATION-STRING-MAX-LENGTH number + + Try a number like 10. If that doesn't work, try 9, 8, 7, 6, and so on. + + 4.22.2. Failure to Negotiate 8th-bit Prefixing + + The published Kermit protocol specification states that 8th-bit + prefixing (which allows transfer of 8-bit data over a 7-bit connection) + occurs if the file sender puts a valid prefix character (normally "&") + in the 8th-bit-prefix field of the negotiation string, and the receiver + puts either a letter "Y" or the same prefix character. At least one + faulty Kermit implementation exists that does not accept the letter + "Y". To force C-Kermit / K-95 to reply with the other Kermit's prefix + character rather than a "Y", give the following (invisible) command: + + SET Q8FLAG ON + + Use SET Q8FLAG OFF to restore the normal behavior. + + 4.22.3. Corrupt Files + + Refer to [534]Section 4.22.2. Some Kermit implementations mistakenly + interpret the "Y" as a prefix character. Then, whenever a letter Y + appears in the data, the Y and the character that follows it are + replaced by a garbage character. At this writing, we are not sure if + there is any solution, but try "set send negotiation-string-max-length + 6" and/or "set q8flag on". + + File corruption can also occur when control characters within the file + data are sent without prefixing, as at least some are by default in + C-Kermit 7.0 and K-95. Some Kermit implementations do not handle + incoming "bare" control characters. To work around, "set prefixing + all". + + 4.22.4. Spurious Cancellations + + The Kermit protocol specification states that if an ACK to a Data + packet contains X in its data field, the transfer of the current file + is canceled, and if it contains a Z, the entire transfer is canceled. + At least one overzealous Kermit implementation applies this rule to + non-Data packets as well, the typical symptom being that any attempt to + transfer a file whose name begins with X or Z results in cancellation. + This is because the file receiver typically sends back the name under + which it stored the file (which might not be the same as the name it + was sent with) in the ACK to the File Header packet. This is + information only and should not cause cancellation. To work around the + problem, use: + + SET F-ACK-BUG { ON, OFF } + + ON tells Kermit not to send back the filename in the ACK to the file + header packet as it normally would do (OFF puts Kermit back to normal + after using ON). + + A variation on the this bug occurs in an obscure Kermit program for + MUMPS: When this Kermit program sends a file called (say) FOO.BAR, it + requires that the ACK to its F packet contain exactly the same name, + FOO.BAR. However, C-Kermit likes to send back the full pathname, + causing the MUMPS Kermit to fail. SET F-ACK-BUG ON doesn't help here. + So a separate command has been added to handle this situation: + + SET F-ACK-PATH { ON, OFF } + + Normally it is ON (regardless of the SET SEND PATHNAMES setting). Use + SET F-ACK-PATH OFF to instruct Kermit to send back only the filename + without the path in the ACK to the F packet. + + 4.22.5. Spurious Refusals + + Some Kermit implementations, notably PDP-11 Kermit 3.60 and earlier, + have bugs in their handling of Attribute packets that can cause + unwarranted refusal of incoming files, e.g. based on date or size. This + can be worked around by telling one or both of the Kermit partners to: + + SET ATTRIBUTES OFF + + 4.22.6. Failures during the Data Transfer Phase + + This can be caused by control-character unprefixing ([535]Section + 4.22.3 ), and fixed by: + + SET PREFIXING ALL + + It can also have numerous other causes, explained in Chapter 10 of + [536]Using C-Kermit: the connection is not 8-bit transparent (so use + "set parity space" or somesuch), inadequate flow control, etc. Consult + the manual. + + 4.22.7. Fractured Filenames + + At least one well-known PC-based communications package negotiates data + compression, which (according to the protocol specification) applies to + both the filename and the file data, but then fails to decompress the + filename. Example: C-Kermit sends a file called R000101.DAT (where + 000101 might be non-Y2K-wise YYMMDD notation), and the package in + question stores the files as R~#0101.DAT. Workaround: Tell C-Kermit to + SET REPEAT COUNTS OFF. + + 4.22.8. Bad File Dates + + At least one well-known PC-based communications package negotiates the + passing of file timestamps from sender to receiver, but when it is + sending files, it always gives them a timestamp of 1 February 1970. + Workaround: tell C-Kermit to SET ATTRIBUTE DATE OFF. You don't get the + file's real date, but you also don't get 1 Feb 1970; instead the file + gets the current date and time. + + 4.23. File Transfer Recovery + + Prior to C-Kermit 7.0, RESEND (SEND /RECOVER) and REGET (GET /RECOVER) + refused to work if FILE TYPE was not BINARY or the /BINARY switch was + not included. Now these commands include an implied /BINARY switch, + meaning they set the file type to binary for the duration of the + command automatically. + + In the client/server arrangement, this also forces the server into + binary mode (if it is C-Kermit 7.0 or greater, or K95 1.1.19 or + greater) so the recovery operation proceeds, just as you asked and + expected. + + BUT... Just as before, the results are correct only under the following + conditions: + + * If the prior interrupted transfer was also in binary mode; or: + * If the prior transfer was in text mode and the other computer was a + "like platform" (e.g. UNIX-to-UNIX, Windows-to-Windows, + DOS-to-Windows) AND there was no character-set translation (i.e. + TRANSFER CHARACTER-SET was TRANSPARENT). + + Note that these circumstances are more likely to obtain in C-Kermit + 7.0, in which: + + * The default FILE TYPE in C-Kermit 7.0 is BINARY. + * The default FILE INCOMPLETE setting is AUTO, which means KEEP if + the transfer is in binary mode, DISCARD otherwise. + * C-Kermit 7.0, Kermit 95 1.1.17, and MS-DOS Kermit 3.15 and later + can recognize "like platforms" and switch into binary mode + automatically. Transfers between like platforms are always binary + unless character-set translation has been requested, and then is + still binary for all files whose names match a binary pattern, + unless the automatic mechanisms have been disabled (with a /TEXT + switch, or with SET TRANSFER MODE MANUAL). + * SEND /BINARY and GET /BINARY always force binary-mode transfers, + even when FILE TYPE is TEXT, even when TRANSFER MODE is AUTOMATIC, + even when PATTERNS are ON and the file's name matches a text + pattern. + + But also note that the automatic client/server transfer-mode + adjustments do not work with versions of C-Kermit prior to 7.0 or K95 + prior to 1.1.16. + + If the prior transfer was in text mode: + + * If text-mode transfers between the two platforms are + "length-changing" (as they are between UNIX -- which terminates + text lines with LF -- and DOS or Windows -- which terminates text + lines with CRLF), the recovered file will be corrupt. + * If text-mode transfers between the two platforms are not + length-changing, but character-set translation was active in the + prior transfer, the result will be a file in which the first part + has translated characters and the second part does not. + + But in C-Kermit 7.0 and K95 1.1.19 and later, incompletely transferred + text files are not kept unless you change the default. But if you have + done this, and you have an incompletely transferred text file, you'll + need to: + + * Transfer the whole file again in text mode, or: + * Use SEND /STARTING-AT: to recover the transfer at the correct + point; but you have to find out what that point is, as described in + the manual. + + Kermit has no way of knowing whether the previous transfer was in text + or binary mode so it is your responsibility to choose the appropriate + recovery method. + + If you use C-Kermit to maintain parallel directories on different + computers, using SET FILE COLLISION to transfer only those files that + changed since last time, and the files are big enough (or the + connection slow enough) to require SEND /RECOVER to resume interrupted + transfers, you should remember that SEND /RECOVER (RESEND) overrides + all FILE COLLISION settings. Therefore you should use SEND /RECOVER + (RESEND) only on the file that was interrupted, not the file group. For + example, if the original transfer was initiated with: + + SEND * + + and was interrupted, then after reestablishing your connection and + starting the Kermit receiver with SET FILE COLLISION UPDATE on the + remote end, use the following sequence at the sender to resume the + transfer: + + SEND /RECOVER name-of-interrupted-file + + and then: + + SEND * + + (In C-Kermit 7.0 and later, \v(filename) contains the name of the file + most recently transferred, as long you have not EXITed from Kermit or + changed directory, etc. + + 4.24. FILE COLLISION UPDATE Clarification + + In UNIX, file modification dates are used when comparing the file date + with the date in the attribute packet. In VMS, however, the file + creation date is used. These two policies reflect the preferences of + the two user communities. + + Also, remember that the file date/time given in the attribute packet is + the local time at the file sender. At present, no timezone conversions + are defined in or performed by the Kermit protocol. This is primarily + because this feature was designed at a time when many of the systems + where Kermit runs had no concept of timezone, and therefore would be + unable to convert (say, to/from GMT or UTC or Zulu time). + + As a consequence, some unexpected results might occur when transferring + files across timezones; e.g. commands on the target system that are + sensitive to file dates might not work (UNIX "make", backups, etc). + + Timezone handling is deferred for a future release. + + 4.25. Autodownload Improvements + + Refer to pages 164-165 of [537]Using C-Kermit about the hazards of + autodownload when C-Kermit is "in the middle". As of C-Kermit 7.0, no + more hazards. If C-Kermit has TERMINAL AUTODOWNLOAD ON and it detects a + packet of the current protocol type (Kermit or Zmodem), it "erases" the + visual aspect of the packet that would be seen by the terminal (or, + more to the point, the emulator, such as K95). This way, only C-Kermit + goes into RECEIVE mode, and not also the terminal emulator through + which C-Kermit is accessed. And therefore, it is no longer necessary to + SET TERMINAL AUTODOWNLOAD OFF to prevent multiple Kermits from going + into receive mode at once, but of course it is still necessary to + ensure that, when you have multiple Kermits in a chain, that the + desired one receives the autodownload. + + The defaults have not been changed; Kermit 95 still has autodownload ON + by default, and C-Kermit has it OFF by default. + + 5. CLIENT/SERVER + + 5.0. Hints + + If you use SET SERVER GET-PATH to set up your server, and the GET-PATH + does not include the server's current directory, clients can become + quite confused. For example, "remote dir oofa.txt" shows a file named + oofa.txt, but "get oofa.txt" fails. In this situation, you should + either DISABLE DIR or make your GET-PATH include the current directory. + + 5.1. New Command-Line Options + + The -G command-line option is like -g (GET), except the incoming file + is sent to standard output rather than written to disk. + + The -I option ("Internet") is used to tell a remote C-Kermit program + that you are coming in via Internet Telnet or Rlogin and therefore have + a reliable connection. The -I option is equivalent to SET RELIABLE ON + and SET FLOW NONE. + + The -O option ("Only One") tells C-Kermit to enter server mode but then + exit after the first client operation. + + See [538]Section 9.3 for details. + + 5.2. New Client Commands + + BYE and FINISH no longer try to do anything if a connection is not + active. Thus a sequence like "hangup" followed by "bye" or "finish" + will no longer get stuck in a long timeout-and-retransmission cycle, + nor will it try to open a new connection. + + REMOTE EXIT + Similar to FINISH, except it ensures that the Kermit server + program exits back to the operating system or shell prompt. + (FINISH would return it to its interactive prompt if it was + started in interactive mode, and would cause it to exit if it + entered server mode via command-line option.) When C-Kermit is + to be the server, you can use { ENABLE, DISABLE } EXIT to + control the client's access to this feature. + + REMOTE MKDIR directory-name + Tells the client to ask the server to create a directory with + the given name, which can be absolute or relative. The syntax of + the directory name depends on the Kermit server (see [539]next + section); in all cases, it can be in the syntax of the system + where the server is running (UNIX, VMS, DOS, etc) but newer + servers also accept UNIX syntax, no matter what the underlying + platform. The server will not execute this command if (a) it + does not understand it, (b) a DISABLE MKDIR command has been + given, or (c) a DISABLE CWD command has been given; otherwise, + the command is executed, but will fail if the directory can not + be created, in which cases most servers will attempt to return a + message giving the reason for failure. The REMOTE MKDIR command + succeeds if the remote directory is created, or if it already + exists and therefore does not need to be created, and fails + otherwise. + + REMOTE RMDIR directory-name + Tells the client to ask the server to remove (delete) a + directory with the given name. The same considerations apply as + for REMOTE MKDIR. + + REMOTE SET FILE INCOMPLETE { DISCARD, KEEP, AUTO } + Previously this was only available in its earlier form, REMOTE + SET INCOMPLETE (no FILE). The earlier form is still available, + but invisible. Also, AUTO was added, meaning KEEP if in binary + mode, DISCARD otherwise. + + REMOTE SET TRANSFER MODE { AUTOMATIC, MANUAL } + Tells the client to ask the server to set the given + file-transfer mode. Automatic means (roughly): if the client and + the server are running on the same kind of computer (e.g. both + are on UNIX), then use binary mode automatically; if the system + types are different, use some other method to automatically + determine text or binary mode, such as filename pattern + matching. MANUAL means, in this context, obey the client's FILE + TYPE setting (TEXT or BINARY). Synonym: REMOTE SET XFER MODE. + + [ REMOTE ] QUERY KERMIT function(args...) + Prior to C-Kermit 7.0, the arguments were not evaluated locally. + Thus it was not possible to have the server run the function + with client-side variables as arguments. Now: + + define \%a oofa.* + remote query kermit files(\%a) ; Client's \%a + remote query kermit files(\\%a) ; Server's \%a + + [ REMOTE ] LOGIN [ user [ password ] ] + LOGIN is now a synonym for REMOTE LOGIN. + + LOGOUT + This command, when given in local mode, is equivalent to REMOTE + LOGOUT. When given at the IKSD prompt, it logs out the IKSD. + When given at the C-Kermit prompt when it has no connection, it + does nothing. + + Note that in C-Kermit 7.0, the REMOTE (or R) prefix is not required for + QUERY, since there is no local QUERY command. The new top-level QUERY + command does exactly what REMOTE QUERY (RQUERY) does. + + All REMOTE commands now have single-word shortcuts: + + Shortcut Full Form + RASG REMOTE ASSIGN + RCD REMOTE CD + RCOPY REMOTE COPY + RDEL REMOTE DELETE + RDIR REMOTE DIRECTORY + REXIT REMOTE EXIT + RHELP REMOTE HELP + RHOST REMOTE HOST + RPWD REMOTE PWD + RSET REMOTE SET + etc. + + The R prefix is not applied to LOGIN because there is already an RLOGIN + command with a different meaning. It is not applied to LOGOUT either, + since LOGOUT knows what to do in each case, and for symmetry with + LOGIN. + + 5.2.1. Remote Procedure Definitions and Calls + + This is nothing new, but it might not be obvious... REMOTE ASSIGN and + REMOTE QUERY may be used to achieve remote procedure execution. The + remote procedure can be defined locally or remotely. + + A remote procedure call is accomplished as noted in the previous + section: + + [ remote ] query kermit function-name(args...) + + This invokes any function that is built in to the Kermit server, e.g.: + + [ remote ] query kermit size(foo.bar) + + returns the size of the remote file, foo.bar. + + Now note that C-Kermit includes an \fexecute() function, allowing it to + execute any macro as if it were a built-in function. So suppose MYMACRO + is the name of a macro defined in the server. You can execute it from + the client as follows (the redundant "remote" prefix is omitted in the + remaining examples): + + query kermit execute(mymacro arg1 arg2...) + + The return value, if any, is the value of the RETURN command that + terminated execution of the macro, for example: + + define addtwonumbers return \feval(\%1+\%2) + + The client invocation would be: + + query kermit execute(addtwonumbers 3 4) + 7 + + The result ("7" in this case) is also assigned to the client's + \v(query) variable. + + To execute a remote system command or command procedure (shell script, + etc) use: + + query kermit command(name args...) + + Finally, suppose you want the client to send a macro to the server to + be executed on the server end. This is done as follows: + + remote assign macroname definition + query kermit execute(macroname arg1 arg2...) + + Quoting is required if the definition contains formal parameters. + + 5.3. New Server Capabilities + + 5.3.1. Creating and Removing Directories + + The C-Kermit 7.0 server responds to REMOTE MKDIR and REMOTE RMDIR + commands. The directory name may be in either the native format of the + server's computer, or in UNIX format. For example, a server running on + VMS with a current directory of [IVAN] can accept commands from the + client like: + + remote mkdir olga ; Makes [IVAN.OLGA] (nonspecific format) + remote mkdir .olga ; Makes [IVAN.OLGA] (VMS format without brackets) + remote mkdir olga/ ; Makes [IVAN.OLGA] (UNIX relative format) + remote mkdir /ivan/olga ; Makes [IVAN.OLGA] (UNIX absolute format) + remote mkdir [ivan.olga] ; Makes [IVAN.OLGA] (VMS absolute format) + remote mkdir [.olga] ; Makes [IVAN.OLGA] (VMS relative format) + + 5.3.1.1. Creating Directories + + If a directory name is given that contains more than one segment that + does not exist, the server attempts to create all the segments. For + example, if the client says: + + REMOTE MKDIR letters/angry + + a "letters" subdirectory is created in the server's current directory + if it does not already exist, and then an "angry" subdirectory is + created beneath it, if it does not already have one. This can repeated + to any reasonable depth: + + REMOTE MKDIR a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/z/y/z + + 5.3.1.2. Removing Directories + + When attempting to execute a REMOTE RMDIR, the server can remove only a + single directory, not an entire sequence or tree. The system service + that is called to remove the directory generally requires not only that + the server process has write delete access, but also that the directory + contain no files. + + In the future, a REMOTE RMDIR /RECURSIVE command (and the accompanying + protocol) might be added. For now, use the equivalent REMOTE HOST + command(s), if any. + + 5.3.2. Directory Listings + + Directory listings are generated by C-Kermit itself, rather than by + running the underlying system's directory command. Some control over + the listing format can be obtained with the SET OPTIONS DIRECTORY + command ([540]Section 4.5.1). The following options affect listings + sent by the server: /[NO]HEADING, /[NO]DOTFILES, and /[NO]BACKUP. In + UNIX and VMS, the listing is always sorted by filename. There is, at + present, no protocol defined for the client to request listing options + of the server; this might be added in the future. + + The server's directory listings are in the following format: + + Protection or permissions: + In UNIX and OS-9, this is a 10-character field, left adjusted. + In VMS it is a 22-character field, left-adjusted. In each case, + the protection / permission codes are shown in the server + platform's native format. In other operating systems, this field + is not shown. + + Size in bytes: + This is always a 10-character field. The file's size is shown as + a decimal number, right adjusted in the field. If the file is a + directory and its size can not be obtained, the size is shown as + "". Two blanks follow this field. + + Date: + Always in yyyy-mm-dd hh:mm:ss numeric format, and therefore 19 + characters long. If the file's date/time can't be obtained, + zeros (0) are shown for all the digits. This field is followed + by two blanks. + + Filename: + This field extends to the end of the line. Filenames are shown + relative to the server's current directory. In UNIX, symbolic + links are shown as they are in an "ls -l" listing as "linkname + -> filename". + + In UNIX and VMS, listings are returned by the server in alphabetical + order of filename. There are presently no other sort or selection + options. + + However, since these are fixed-field listings, all fields can be used + as sort keys by external sort programs. Note, in particular, that the + format used for the date allows a normal lexical on that field to + achieve the date ordering. For example, let's assume we have a UNIX + client and a UNIX server. In this case, the server's listing has the + date in columns 22-40, and thus could be sorted by the UNIX sort + program using "sort +0.22 -0.40" or in reverse order by "sort +0.22 + -0.40r". + + Since the UNIX client can pipe responses to REMOTE commands through + filters, any desired sorting can be accomplished this way, for example: + +C-Kermit> remote directory | sort +0.22 -0.40 + + You can also sort by size: + + C-Kermit> remote directory | sort +0.11 -0.19 + + You can use sort options to select reverse or ascending order. "man + sort" (in UNIX) for more information. And of course, you can pipe these + listings through any other filter of your choice, such as grep to skip + unwanted lines. + + 5.4. Syntax for Remote Filenames with Embedded Spaces + + C-Kermit and K95, when in server mode, assume that any spaces in the + file specification in an incoming GET command are filename separators. + Thus if the client gives a command like: + + get {oofa.txt oofa.bin} + + or, equivalently: + + mget oofa.txt oofa.bin + + the server tries to send the two files, oofa.txt and oofa.bin. But what + if you want the server to send you a file named, say: + + D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL + + How does the server know this is supposed to be one file and not seven? + In this case, you need to the send file name to the server enclosed in + either curly braces: + + {D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL} + + or ASCII doublequotes: + + "D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL" + + The method for doing this depends on your client. If your client is + C-Kermit 7.0, any recent version of Kermit 95, or MS-DOS Kermit 3.16, + then you have to enclose the name in braces just so the client can + parse it, so to send braces or doublequotes to the server, you must put + them inside the first, outside pair of braces. And you also need to + double the backslashes to prevent them from being interpreted: + + get {{D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL}} + get {"D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL"} + + To get around the requirement to double backslashes in literal + filenames, of course you can also use: + + set command quoting off + get {{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}} + get {"D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"} + set command quoting on + + If you are giving a "kermit" command to the UNIX shell, you have to + observe the shell's quoting rules, something like this: + + kermit -ig "{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}" + + Here, the quotes go on the outside so UNIX will pass the entire + filename, spaces, braces, and all, as a single argument to Kermit, and + the backslashes are not doubled because (a) the UNIX shell ignores them + since they are in a quoted string, and (b) Kermit ignores them since + the interactive command parser is not activated in this case. + + 5.5. Automatic Orientation Messages upon Directory Change + + C-Kermit 7.0, when acting as a server, can send an orientation message + to the client whenever the server directory changes. For example, when + the client gives a REMOTE CD command, the server sends the contents of + the new directory's "Read Me" file to the client's screen. The + following commands govern this feature: + + SET SERVER CD-MESSAGE FILE name + Given to the servr, allows the message-file name to be specified + at runtime. A list of names to look for can be given in the + following format: + + {{name1}{name2}{name3}{...}} + + e.g. SET SERVER CD-MESSAGE FILE + {{./.readme}{README.TXT}{READ.ME}} + + REMOTE SET SERVER CD-MESSAGE { ON, OFF } + Given to the client, lets the client control whether the server + sends automatic CD messages. + + SHOW SERVER + Given to server, includes CD-Message status. + + The default CD message file name is system dependent. SHOW CD or SHOW + SERVER displays the list. Also see [541]Section 4.5.2. + + 5.6. New Server Controls + + DISABLE ENABLE + Allows the server to configured such that DISABLEd features can + not be re-enabled by any means -- e.g. if the client is somehow + able to get the server into command mode. Once DISABLEd, ENABLE + can not be re-ENABLEd. + + SET SERVER IDLE-TIMEOUT seconds + This was available previously in Kermit 95 only. Now it can be + used in C-Kermit also to specify a maximum number of seconds the + server is allowed to be idle before exiting server mode. 0 + seconds means no idle timeout. In C-Kermit (but not K-95), SET + SERVER TIMEOUT and SET SERVER IDLE-TIMEOUT are mutually + exclusive -- you can have one or the other (or neither), but not + both. (Server timeouts are for the benefit of primitive Kermit + clients that are not capable of timing out on their own; to our + knowledge, no such clients are still in circulation.) + + SET SERVER KEEPALIVE { ON, OFF } + (See next section). + + 5.7. Timeouts during REMOTE HOST Command Execution + + Prior to C-Kermit 7.0, the C-Kermit server would block waiting for + output from a system command invoked via REMOTE HOST from the client. + If the system command took a long time to execute, the client would + time out and send NAK packets. If the command took too long, the client + would reach its retry limit and give up. Even if it didn't, the NAKs + would cause unnecessary retransmissions. + + In version 7.0, the C-Kermit server (VMS and select()-capable UNIX + versions only), sends "keepalive packets" (empty data packets) once per + second while waiting for the system command to complete. This procedure + should be entirely transparent to the Kermit client, and should prevent + the unwanted timeouts and NAKs. When C-Kermit 7.0 itself (or K95 + 1.1.19) is the client, it prints dots to show the keepalive packets. + + The keepalive feature can be turned off and on with: + + SET SERVER KEEPALIVE { ON, OFF } + + Normally it should be on. Turn it off it if causes trouble with the + client, or if it seems to slow down the server (as it might on some + platforms under certain circumstances). + + 6. INTERNATIONAL CHARACTER SETS + + Support for several new single-byte character sets was added in + C-Kermit 7.0. Unicode / ISO 10646 is not yet supported, but is a high + priority for forthcoming releases. + + 6.0. ISO 8859-15 Latin Alphabet 9 + + To accommodate the Euro currency symbol, and to correct several other + longstanding problems with ISO Latin Alphabet 1, ISO 8859-15 Latin + Alphabet 9 was issued in May 1998. It is supported by C-Kermit 7.0 as a + transfer character set, a file character set, and a terminal character + set. Translations that preserve the new characters are available + between Latin-9 and several other sets including: + + PC Code Page 858 (Western European languages, similar to CP850) + Windows Code Page 1252 (Western European languages, similar to Latin-1) + Windows Code Page 1250 (Eastern European languages, similar to Latin-2) + + The Latin-9 transfer character set also allows for the OE digraph + character, used primarily in French, to be preserved in transfers + involving the DEC MCS or NeXT character sets. + + The Euro character is also present in the Universal Character Set, + described in [542]Section 6.6. + + 6.1. The HP-Roman8 Character Set + + The HP-Roman8 character set is supported in C-Kermit 6.0 and later but + was omitted from Table VII-4 in the 2nd Edition of Using C-Kermit due + to lack of space. It is listed in [543]Appendix III. + + 6.2. Greek Character Sets + + Greek character sets were added in 6.1: + + SET FILE CHARACTER-SET { CP869, ELOT927, GREEK-ISO } + SET TRANSFER CHARACTER-SET { GREEK-ISO } + + GREEK-ISO is ISO 8859-7, which the same as ELOT 928. + + The new Greek character sets are listed in [544]Appendix III. + + 6.3. Additional Latin-2 Character Sets + + The following have been added as FILE and TERMINAL CHARACTER-SETs: + + MAZOVIA-PC + A PC code page used in Poland, equivalent to CP437, but with 18 + substitutions needed for Polish. + + CP1250 + The Windows Latin 2 Code Page. Equivalent to ISO 8859-2, but + with different encoding. + + 6.4. Additional Cyrillic Character Sets + + The following have been added as FILE and TERMINAL CHARACTER-SETs: + + BULGARIA-PC + This is the Cyrillic PC code page used in Bulgaria, where it is + called Code Page 856. It is attributed to a company called + DATEC, Inc, but CP856 is not a proper designation, since it + refers to a Hebrew Code Page (see the IBM Registry). + + CP855 + This PC Code Page contains all the Cyrillic letters that are + also in ISO 8859-5, and is therefore useful for non-Russian + Cyrillic text (Ukrainian, Belorussian, etc), unlike CP866, which + has a smaller repertoire of Cyrillic letters. + + CP1251 + The Windows Cyrillic Code Page. Equivalent to CP855, but with + different encoding. + + KOI8R + An extension to "Old KOI-8" that adds upper and lower case + Cyrillic letter Io (looks like Roman E with diaeresis) plus a + selection of box-drawing characters to columns 8 through 11, + which are vacant in original Old KOI-8. KOI8-R is used for the + Russian language. It is specified in [545]RFC 1489. + + KOI8U + A similar extension of Old KOI-8, but for Ukrainian. It is + specified in [546]RFC 2319. + + 6.5. Automatic Character-Set Switching + + Prior to version 7.0, C-Kermit's file character-set always had to be + set explicitly. In 7.0 and later, it is set automatically when: + + 1. This feature is enabled (as it is unless you disable it). + 2. An incoming text-mode transfer includes a transfer-character-set + announcer and you have not previously given a SET FILE + CHARACTER-SET command. In this case, C-Kermit switches to an + appropriate file character set. For example, on an HP-UX + workstation, an incoming Latin-1 file automatically selects + HP-Roman8 for the local copy of the file; in Data General AOS/VS, + it would select DG International. + 3. You give a SET TRANSFER CHARACTER-SET command without having + previously specified a FILE CHARACTER-SET. An appropriate file + character-set is chosen automatically. + + In addition, when you give a SET FILE CHARACTER-SET command, the + appropriate transfer character-set is automatically chosen, to be used + when you are sending files (but this does not override the one + announced by the sender when you are receiving files). + + You might not agree about what is "appropriate", so of course you can + disable or change all of the above actions. + + You can disable (or re-enable) the new automatic character-set + switching feature in each direction separately: + + SET RECEIVE CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL } + AUTOMATIC is the default, causing the behavior described above + when an incoming file arrives. Choose MANUAL to defeat this + behavior and force your current FILE CHARACTER-SET setting to be + used, no matter what it is. Note that SET RECEIVE CHARACTER-SET + MANUAL does not disable recognition of the incoming transfer + character-set announcer, and translation from the corresponding + character-set to your current file character-set. To disable + that, use SET ATTRIBUTE CHARACTER-SET OFF. + + SET SEND CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL } + Again AUTOMATIC is the default, causing the behavior described + above when you give a SET { FILE, TRANSFER } CHARACTER-SET + command. Use MANUAL to allow you to specify the transfer and + file character-sets independently. + + SHOW CHARACTER-SETS + Tells settings of { SEND, RECEIVE } CHARACTER-SET-SELECTION. + + Normally, however, it is more convenient to leave automatic switching + active, and change any associations that are not appropriate for your + application, area, or country. The commands are: + + SHOW ASSOCIATIONS + This command lists all the associations in each direction: for + each possible transfer character-set, it lists the associated + file character-set, and vice versa. These are two separate and + independent lists. + + ASSOCIATE TRANSFER-CHARACTER-SET name1 [ name2 ] + Changes the association for the transfer character-set name1 to + be the file character-set name2. If name2 is omitted, automatic + switching is disabled for this transfer character-set only. + + ASSOCIATE FILE-CHARACTER-SET name1 [ name2 ] + Changes the association for the file character-set name1 to be + the transfer character-set name2. If name2 is omitted, automatic + switching is disabled for this file character-set only. + + 6.6. UNICODE + + C-Kermit 7.0 adds support for Unicode, the Universal Character Set, + for: + + * File Transfer (SEND, RECEIVE, GET, etc) + * Terminal connection (CONNECT) + * Unguarded file capture (LOG SESSION) + * Unguarded file transmission (TRANSMIT) + * Local file character-set conversion (TRANSLATE) + + C-Kermit is not, however, a "Unicode application" in the sense that its + commands, messages, or user interface are Unicode. Rather, it is + "Unicode aware" in its ability to handle and convert Unicode text in + the course of file transfer and terminal connection, and you can also + use Kermit to convert local files between Unicode and other character + sets. TLA's: + + BMP - Base Multilingual Plane + BOM - Byte Order Mark + CJK - Chinese, Japanese, and Korean + ISO - International Standards Organization + TLA - Three-Letter Acronym + UCS - Universal Character Set + UTF - UCS Transformation Format + + Unicode and ISO 10646 are the coordinated and compatible corporate and + international standards for the Universal Character Set (UCS). Unlike + single-byte and even most multibyte character sets, the UCS can + represent all characters in every existing writing system. A flat + plain-text file encoded in some form of UCS can contain any mixture of + English, Spanish, Italian, German, Hebrew, Arabic, Greek, Russian, + Armenian, Georgian, Japanese, Chinese, Korean, Vietnamese, Tibetan, + Hindi, Bengali, Tamil, Thai, Ethiopic, and so on, plus scientific and + mathematical notation, as well as texts in Runes, Ogham, Glagolitic, + and other historic scripts. + + The UCS already covers these scripts and many more, but it's an + evolving standard with efforts underway to accommodate even more + languages and writing systems. Support is growing for native UCS use on + many platforms and in many applications. The goal of the framers of the + UCS is for it to replace ASCII, the ISO Latin Alphabets, ISCII, VISCII, + the Chinese, Japanese, and Korean (CJK) multibyte sets, etc, as well as + the many private character sets in use today, in other words to become + *the* Universal Character Set. + + Until that time, however, conversions between existing sets and the UCS + will be necessary when moving text between platforms and applications. + Now Kermit can help. + + 6.6.1. Overview of Unicode + + For a more complete picture, please visit: + + [547]http://www.unicode.org/ + + and access the various online introductions, FAQs, technical reports, + and other information. For greater depth, order the latest version of + the published Unicode Standard. The following overview contains a great + many oversimplifications and perhaps an opinion or two. + + At present, the UCS is a 16-bit (2-byte) character set, but with + provisions to grow to a 4-byte set. UCS-2 refers to the two-byte set, + also called the Base Multilingual Plane (BMP), in which each character + has 16 bits, and therefore there are 2^16 = 65536 possible characters. + The first 128 characters are the same as US ASCII (C0 control + characters and DEL included), the next 32 are the C1 control characters + of ISO 6429, and the next 96 are the Right Half of ISO 8859-1 Latin + Alphabet 1. The remaining tens of thousands of characters are arranged + newly for the UCS, usually (but not always) in sections corresponding + to existing standards, such as ISO Latin/Cyrillic, often plus + additional characters not appearing in the existing standards due to + lack of space (or other reasons). + + ISO 10646 allows for additional planes, e.g. for Egyptian hieroglyphics + or ancient (or other esoteric) CJK characters, but these planes are not + yet defined and so we will say nothing more about them here, except + that their use will require the 4-byte form of UCS, called UCS-4, in + some form (more about "forms" in [548]Section 6.6.2). + + Unicode and ISO 10646 are constantly under revision, mainly to add new + characters. The Unicode revision is denoted by a version number, such + as 1.0, 1.1, 2.0, 3.0. The ISO 10646 standard revision is identified by + Edition (such as ISO 10646-1 1993), plus reference to any amendments. + The first versions of these standards included encodings for Korean + Hangul syllables (Jamos); these encodings were changed in version 1.1 + of Unicode and by Amendment 5 to ISO 10646-1. The Unicode Technical + Committee and the ISO acknowledge that this was a bad thing to do, and + promise never change encodings or character names again, since this + poses serious problems for conformance and data interchange. + + A UCS-2 value is customarily written like this: + + U+xxxx + + where "xxxx" represents four hexadecimal digits, 0-9 and A-F. For + example, U+0041 is "A", U+00C1 is A-acute, U+042F is uppercase Cyrillic + "Ya", U+FB4F is Hebrew Ligature Alef Lamed, and U+FFFD is the special + character that means "not a character". + + Most characters from widely-used alphabetic writing systems such as the + West European ones, Cyrillic, Greek, Hebrew, Vietnamese, etc, are + available in "precomposed" form; for example Uppercase Latin Letter A + with Acute Accent is a single character (as it is in Latin-1). However, + the UCS also permits composition of a base character with one or more + nonspacing diacritics. This means the same character can be represented + in more than one way, which can present problems in many application + areas, including transfer and character-set conversion of text. + + Conversion from ASCII or Latin-1 to UCS-2 text is "trivial": simply + insert a NUL (0) byte before each ASCII or Latin-1 byte. Converting in + the reverse direction (provided the UCS-2 file contains only U+0000 to + U+00FF) is equally simple (if we ignore the issue of composition): + remove every second (NUL) byte. Conversion of other character sets to + and from UCS, however, requires tables or algorithms specific to each + set. Nevertheless, the relatively transparent upwards compatibility + from ASCII and Latin-1, in which a very large share of the world's + textual data is encoded, gives the UCS an entree onto existing + platforms. + + But the 2-byte format and the preponderance of NUL and other control + bytes in UCS-2 text pose problems for current applications and + transmission methods. And to make matters worse, different hardware + platforms store UCS-2 characters in different byte order. Thus a UCS-2 + file transferred by FTP (or accessed via NFS, etc) between two + computers with different architecture might have its bytes in the wrong + order (or worse; see [549]Section 6.6.5.1 ). + + 6.6.2. UCS Byte Order + + Consider the number 1. In an 8-bit byte, this would be represented by + the following series of 0- and 1-bits: + + +-----------------+ + | 0 0 0 0 0 0 0 1 | + +-----------------+ + + Therefore in a 16-bit "word" the representation might be: + + +-----------------+-----------------+ + | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 | + +-----------------+-----------------+ + + Now consider the number 256, which is 2 to the 8th power. The binary + representation is 100000000 (1 followed by 8 zeros). 256 would go into + a 16-bit word like this: + + +-----------------+-----------------+ + | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 | + +-----------------+-----------------+ + + When a computer works this way, it is said to be Big Endian, meaning it + puts the most significant (biggest) byte first (on the "left") in a + 16-bit word, and the least significant byte second (on the right). + + However, some other computers have the opposite arrangement, called + Little Endian, in which 1 is: + + +-----------------+-----------------+ + | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 | + +-----------------+-----------------+ + + and 256 is: + + +-----------------+-----------------+ + | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 | + +-----------------+-----------------+ + + Computers such as Sparc, MIPS, PA-RISC, and PowerPC are Big Endian, + whereas the PC and the Alpha are Little Endian. Endianness has never + been an issue with 7- or 8-bit characters, but it is with UCS + characters. It can be a tricky business to share or transfer a UCS-2 + file between two different kinds of computers. + + To alleviate (but not entirely solve) the problem, UCS-2 files are + supposed to begin with the Unicode character U+FEFF, Zero-Width + No-Break Space (ZWNBS). This is a kind of "no-op" (note: any such + assertion must normally be qualified with many "but ifs" and "excepts" + which are omitted here in the interest of brevity). If the bytes are + reversed the ZWNBS becomes U+FFFE, which is not (and never will be) a + defined UCS character. U+FEFF at the beginning of a UCS file is + therefore called a Byte Order Mark, or BOM. + + Any application that creates a UCS-2 (or UTF-16, or UCS-4) file should + include a BOM, and any application that reads one should test for a + BOM, and if one is found, infer the byte order from it. This is a + convention, however -- not a standard or a requirement -- and + applications vary in their ability to handle BOMs and "backwards" UCS-2 + files. + + Note that a BOM is useful only at the beginning of a file. If you + append one UCS-2 file to another, and both have BOMs, the internal BOM + is no longer a BOM. And if the byte orders of the two files differ, + then either the first part or the second will be backwards. (Various + other undesirable effects might also occur, not discussed here.) + + 6.6.2. UCS Transformation Formats + + UCS textual data can be modified in various ways for transmission or + storage. Any officially sanctioned method of doing this is called a UCS + Transformation Format, or UTF. One such method, called UTF-16, is + essentially identical with UCS-2 except that it designates certain code + values as "escape sequences" (called surrogate pairs) to access + characters in other planes without having to use full UCS-4. We won't + discuss UTF-16 further here, since at the moment there are no other + planes. Several other UTF's (such as UTF-1, UTF-2, and UTF-7) have + fallen into disuse and are not discussed here. The most important + transformation format today is UTF-8. + + UTF-8, so called because it "serializes" UCS-2 data into a stream of + 8-bit bytes, is designed to allow the UCS to work with present-day + communications gear, computers, and software. The most important + properties of UTF-8 are that byte order is constant (no byte swapping) + and all (7-bit) ASCII characters represent themselves. Therefore + conversion between ASCII and UTF-8 is no conversion at all, and + applications or platforms (such as Plan 9 from Bell Labs) that use + UTF-8 "for everything" can still run traditional ASCII-only + applications and be accessed from them. In particular, unlike UCS-2, + ASCII characters are not padded with NUL bytes. But also unlike UCS-2, + there is no transparency for Latin-1 or any other non-ASCII character + set. Every non-ASCII UCS-2 character is represented by a sequence of 2 + or 3 UTF-8 bytes. Thus UTF-8 is more compact than UCS-2 for text + containing a preponderance of ABC's (or other ASCII characters), about + the same as UCS-2 for other alphabetic scripts (Cyrillic, Roman, Greek, + etc), and larger than UCS-2 for Chinese, Japanese, and Korean. + + The UTF-8 uncoding of the UCS has been adopted by the Internet as the + preferred character set for new applications, and is gradually being + retrofitted into traditional applications like FTP ([550]RFC 2640). + + 6.6.3. Conformance Levels + + Although the Unicode and ISO 10646 standards both describe the same + character set, these standards differ in many ways, including their + stated requirements for conformance and their classification of + conformance levels. + + Kermit has always abided by ISO character-set standards, including ISO + character-set designation and invocation methods. In adapting Unicode, + therefore, we had to choose from among the available ISO designations + which, in turn, correspond with ISO 10646 conformance levels. At + present, Kermit claims the lowest conformance level, 1, meaning + (roughly) that it does not handle combining forms and it does not + handle Korean Hangul Jamos (just as, at present, it does not handle + Korean in general). Note that ISO 10646 Conformance Levels 1 and 2 + sidestep the issue of the code changes for Korean Hangul by announcing + non-support for Hangul regardless of encoding. + + ISO 10646 Conformance Level 1 is approximately equivalent to Unicode + Normalization Form C (described in Unicode Technical Report 15, + incorporated into Unicode 3.0). + + As noted in [551]Section 6.6.2, Kermit does not claim to support UTF-16 + at the present time, hence the UCS-2 nomenclature. Kermit treats + surrogates just as if they were any other UCS-2 characters, rather than + as escapes to other planes, which means that (except when converting + between UCS-2 and UTF-8) they are translated to "error" characters, + since (a) no other planes are defined yet (and if they were, no other + character sets supported by Kermit would encode their characters), and + (b) no valid surrogate character corresponds to any other UCS-2 + character. + + A minor yet significant aspect of Unicode 3.0 and some recent + perturbation of ISO 10646-1 (probably Amendment 18, "Symbols and Other + Characters") is the addition of the Euro Sign at U+20AC. As noted in + [552]Section 6.0, Kermit's "Euro compliance" includes conversion + between Latin Alphabet 9 and various PC code pages. Text can also be + converted between UCS-2 or UTF-8 and any other Euro-compliant character + set (Latin-9, CP858, CP1250, CP1252) without loss of the Euro Sign. + + 6.6.4. Relationship of Unicode with Kermit's Other Character Sets + + Kermit's character sets are divided into two groups: single-byte sets + (such as Roman, Hebrew, Cyrillic, Greek) and multibyte (various + Japanese sets). The two groups are distinct since one normally would + not expect to convert Kanji ideograms to Roman (or other) letters, or + vice versa. + + Unicode character-set conversion works with both groups, but obviously + the result depends on the repertoires of the source and destination + character-sets both including the characters in the file. For example, + you can translate a Hungarian text file between Latin-2 and Unicode, + but not between (say) Unicode and Latin/Greek. By the same token you + can convert Japanese text from Shift-JIS or EUC or JIS-7 to Unicode and + back, but you can't convert the same file to (say) Latin-1 if it + contains Japanese characters. + + JIS-7 is equivalent to DEC Kanji and ISO-2022-JP except that the + latter two do not support halfwidth Katakana. Kermit treats all + three of these sets the same way, i.e. as JIS-7. + + As noted, Kermit presently does not handle combining diacritics, and so + will not correctly convert UCS files that use them into a single-byte + character set. For example, if a UCS file contains Latin Capital Letter + A (U+0041) followed by Combining Acute Accent (U+0301), the result will + be a two-character sequence, A followed by another character. This is + what is meant by Conformance Level 1. (The situation grows worse with + multiple diacritics, since they can occur in any order.) + + A higher level of conformance is possible, in which "canonical + equivalences" are handled via algorithms and databases, at some + (perhaps considerable) cost in performance, since a fair amount of + additional code must be executed for every character during data + transfer (database lookup, sorting of combining sequences into + canonical order, etc). This can be added in future releases if there is + a need (but in many cases, pre- and postpostprocessing might be a + better option). + + Within these constraints, Kermit converts between the UCS and its other + character sets. For example, a mixture of Russian and English (and/or + Dutch, or Latin) text can bet converted between the UCS and ISO + Latin/Cyrillic or KOI-8. But since Kermit does not presently support + Arabic character-set conversion, the new availability of UCS conversion + does not mean that Kermit can convert from Arabic UCS text to some + other character set, because Kermit does not support any other + character set that includes Arabic. Ditto for Thai, Armenian, Georgian, + Tibetan, Chinese, Korean, etc. However, Kermit CAN convert Arabic (or + any other script) between UCS-2 and UTF-8. + + Considering Cyrillic more carefully, note that the UCS also contains + numerous Cyrillic characters not found in any of the Cyrillic sets (ISO + Latin/Cyrillic, KOI8, CP866, etc) that Kermit supports; characters + needed for Abkhasian, Yakut, Tatar, Bashkir, Altaic, Old Church + Slavonic, etc; UCS text containing any of these historic or "extended" + Cyrillic characters can not be converted to any of Kermit's current + single-byte Cyrillic sets without loss. The situation is similar for + Greek, Hebrew, etc, and even worse for Japanese since Unicode contains + thousands of Kanjis that are lacking from the Japanese character sets + based on JIS X 0208, such as EUC-JP, JIS-7, and Shift-JIS. + + In general, when converting from UCS to a single-byte set, there is + always the possibility of data loss, just as there is when converting + from any larger set to a smaller one. For example, if a UCS file + contains Devanagari characters, these characters will be lost when + converting to (say) Latin-1, just as Roman vowels with acute accents + are lost when converting from Latin-1 (an 8-bit set) to German ISO 646 + (a 7-bit set). + + 6.6.5. Kermit's Unicode Features + + C-Kermit can convert between UCS-2 or UTF-8 and any of its other + character sets, and also between UCS-2 and UTF-8. When converting + between UCS-2 or UTF-8 and a non-Unicode character set (such as + Latin-1), the UCS Line Separator (LS, U+2028) and Paragraph Separator + (PS, U+2029) characters are converted to the appropriate line + terminator (CR, LF, or CRLF). When converting from a non-Unicode set to + UCS-2 or UTF-8, however, line terminators are not converted to LS or + PS. This is in accordance with the recommendations of Unicode Technical + Report #13. + + When C-Kermit starts, it tests the native byte order of the computer. + You can see the result in the SHOW FEATURES or SHOW FILE display. It's + also available in the variable \v(byteorder): 0 means Big Endian, 1 + means Little Endian. + + When UCS-2 is involved in file transfer or translation, the following + commands tell C-Kermit what to do about byte order: + + SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN } + This is for reading UCS-2 files that don't have a BOM, and also + for writing UCS-2 files. If this command is not given, the + machine's native byte order is used when writing UCS-2 files, + and also when reading UCS-2 files that don't have a BOM. + + SET FILE UCS BOM { ON, OFF } + This setting is used when creating UCS-2 files. A BOM is added + at the beginning by default. Use OFF to not add the BOM. This + command has no affect when writing files. + + COPY /SWAP-BYTES sourcefile destinationfile + Use this for fixing a UCS-2 file whose bytes are in the wrong + order. + + Use SHOW FILE to display the FILE UCS settings. + + Please note, again, that C-Kermit's user interface, including its + script language, is not internationalized in any way. String + comparisons, case conversion, and so on, work only for US ASCII + (comparisons for equality work with other sets, but not + lexically-greater-or-less-than or caseless comparisons; even + comparisons for equality can fail when composed characters or byte + order are involved). String functions such as \findex() and + \fsubstring() that reference byte positions do just that; they won't + work with UTF-8 text that contains any non-ASCII characters, and they + will not work with UCS-2 text at all since they use C strings + internally, which are NUL-terminated. These are just a few examples to + illustrate that neither Unicode nor any other character-set beyond + ASCII is supported at the user-interface, command, or scripting level + in this version of C-Kermit. + + 6.6.5.1. File Transfer + + Kermit supports both UCS-2 and UTF-8 as file and transfer character + sets in text-mode file transfer. + + To select UCS-2 or UTF-8 as a file character-set, use: + + SET FILE CHARACTER-SET { UCS2, UTF8 } + + If you want to send a UCS-2 text file (or save an incoming file in + UCS-2 format), tell Kermit to: + + SET FILE CHARACTER-SET UCS2 + + and if you want to send a UTF-8 text file (or store an incoming file in + UTF-8 format), tell Kermit to: + + SET FILE CHARACTER-SET UTF8 + + When sending UCS-2 files, Kermit determines the byte order from the + BOM, if there is one (and if there is a BOM, it is stripped, i.e. not + sent). If there is no BOM, the byte order is the one specified in the + most recent SET FILE UCS BYTE-ORDER command, if any, otherwise the + computer's native byte order is assumed. When storing incoming files as + UCS-2, the byte order is according SET FILE UCS BYTE-ORDER, if given, + otherwise the native one; a BOM is written according to SET FILE UCS + BOM. + + A transfer character-set should be chosen that includes all of the + characters in the source file. So, for example, if you are sending a + UCS-2 file containing only German-language text, your transfer + character-set can be Latin-1, Latin-2, Latin-9, UCS-2, or UTF-8. But if + you are sending a file that contains a combination of Hebrew and Greek, + your transfer character-set must be UCS-2 or UTF-8 if you don't want to + lose one script or the other. Furthermore, the transfer character-set + must be one that is supported by the receiving Kermit program. Since + UCS support is new, it is possible that the other Kermit program (if it + supports character sets at all) does not support it, but does support + single-byte sets such as Latin-1, Latin/Cyrillic, etc. + + To select UCS-2 or UTF-8 as a transfer character-set, use: + + SET TRANSFER CHARACTER-SET { UCS2, UTF8 } + + It is up to the receiving Kermit program to convert the transfer format + to its own local format, if necessary. If it does not understand the + UTF-8 or UCS-2 transfer character-set, and your file can not be + adequately represented by any single-byte transfer character-set (such + as Latin-1 or Latin/Cyrillic) then, if UTF-8 format is acceptable on + the receiving computer, use UTF-8 as the transfer character-set, with + the receiver told to "set unknown-char keep", or with the sender told + to "set attribute char off". If you want the file to be stored in UCS-2 + format at the receiver, send it it binary mode if the source file is + also UCS-2, or else use the TRANSLATE command (next section) to convert + it to UCS-2 first, then send it in binary mode. You should not use + UCS-2 as a transfer character-set in text-mode transfers to Kermit + programs that don't support it, because they are likely to corrupt the + result the same way FTP would (see the final paragraph of this + section). + + When UCS-2 is the transfer character set, it always goes into Kermit + packets in Big Endian format, with no BOM. As always, the transfer + character-set is announced by the sender to the receiver. The + announcement for UCS-2 is "I162" (ISO Registration 162 = UCS-2 Level 1) + and by definition it is Big Endian (the standards say that when UCS-2 + is serialized into bytes, the order must be Big Endian). The + announcement for UTF-8 is "I190" (UTF-8 Level 1). + + When receiving a file whose transfer character-set is UCS-2 or UTF-8, + you must choose the appropriate file character set for the result. + There is no way Kermit can do this for you automatically, since UCS + data can be in any script at all, or any combination. + + In general, UTF-8 or UCS-2 should be chosen as a transfer character-set + if the source file is also encoded in some form of UCS and it contains + more than one script. But there are other situations where where UTF-8 + or UCS-2 offer advantages. For example, suppose the source file is on a + NeXTstation and the destination file is on VMS. Both the NeXT and the + DEC Multinational character sets include the French OE digraph, but + Latin-1 does not. Therefore French words containing this character + might not arrive intact when Latin-1 is the transfer character-set, but + will with UTF-8 or UCS-2, since the UCS includes the OE digraph (but so + does Latin-9). + + UCS-2 should be chosen as a transfer character-set only for Japanese + text files that contain a large preponderance of Kanji, since in this + case (and only this case) UCS-2 (two bytes per Kanji) is more efficient + than UTF-8 (three bytes per Kanji). The same will be true for Chinese + and Korean when they are supported by Kermit. UCS-2 should never be + used as a transfer character-set with a transfer partner that does not + support UCS-2 since this can cause file corruption (see last paragraph + in this section). + + Note that Kermit's repeat-count compression is 100% ineffective for + UCS-2, and is also ineffective for multibyte characters in UTF-8 and + EUC-JP; this is because repeat-compression is a transport-level + mechanism that operates on a per-byte basis; it has no knowledge of the + distinction between a byte and a character. + + When C-Kermit starts, it sets up associations ([553]Section 6.5) for + incoming files whose transfer character sets are UCS-2 or UTF-8 + appropriately for the platform so that the file character-set for the + incoming file is UCS-2 in Windows and UTF-8 elsewhere. Otherwise, + C-Kermit does not make any default associations for UCS-2 or UTF-8, but + of course you may add or change associations to suit your needs and + preferences by including the appropriate ASSOCIATE commands in your + Kermit startup file. For example, if you are a PC user and deal only + with text written in Greek and English, you can: + + ASSOCIATE TRANSFER-CHARACTER-SET UTF8 CP869 + ASSOCIATE TRANSFER-CHARACTER-SET UCS2 CP869 + ASSOCIATE FILE-CHARACTER-SET CP869 UTF8 + + Note that when file transfer involves conversion between a single-byte + character set and UCS-2 or UTF-8, the file-transfer thermometer and + estimated time left might be inaccurate, since they are based on the + source file size, not the transfer encoding. This is purely a cosmetic + issue and does not effect the final result. (And is not, strictly + speaking, a bug; Kermit protocol presently includes no method for the + sender to furnish an "estimated transfer size" to the receiver, and in + any case any such guess could be as far off as the file size, given the + many other factors that come into play, such as compression and + prefixing). + + A caution about FTP and UCS-2. As noted previously, if you transfer a + UCS-2 file with FTP in binary mode between two computers with opposite + Endianness, the result will have its bytes in the wrong order. However, + if you use FTP to transfer a UCS-2 file in "ascii" (text) mode to ANY + computer, even if it is identical to yours, the result will be + corrupted because FTP's line-terminator conversions do not account for + UCS-2. The same holds when sending from a UCS-aware Kermit program to + an older Kermit program in text mode with a transfer character-set of + UCS-2. So use UCS-2 as a transfer character-set ONLY with a UCS-2-aware + Kermit partner. + + 6.6.5.2. The TRANSLATE Command + + In Kermit versions that have Unicode support included, TRANSLATE now + always goes through Unicode; that is, the source set is converted to + UCS-2 and thence to the target set. This is a major improvement, since + in prior releases, C-Kermit had to pick the "most appropriate" transfer + character-set as the intermediate set, and this would result in the + loss of any characters that the source and target sets had in common + but were lacking from the intermediate set (for example the OE digraph + when translating from NeXT to DEC MCS through Latin-1). This never + happens when Unicode is the intermediate set because Unicode is a + superset of all other character sets supported by Kermit. A more + dramatic example would be translation between Cyrillic PC code page 866 + and KOI8-R ([554]Section 6.4); formerly all the line- and box-drawing + characters would be lost (since ISO 8859-5 does not have any); now the + ones that these two sets have in common are preserved. + + UCS-2 and UTF-8 are now both supported as source-file and + destination-file character sets by C-Kermit's TRANSLATE command, for + example: + + translate oofa.txt ucs2 latin1 oofa-l1.txt + + translates oofa.txt from UCS-2 to Latin-1, storing the result as + oofa-l1.txt. Similarly: + + translate oofa.txt utf8 latin1 oofa-l1.txt + translate oofa.txt latin1 ucs2 oofa-ucs2.txt + translate oofa.txt latin1 utf8 oofa-utf8.txt + translate oofa.txt ucs2 utf8 oofa-utf8.txt + translate oofa.txt utf8 ucs2 oofa-ucs2.txt + + Treatment of the UCS-2 BOM is exactly the same as for file transfer. + Note that if a UCS-2 source file is in the "wrong" byte order and lacks + a BOM, and you don't tell Kermit about it with SET FILE UCS BYTE-ORDER, + the result of the translation is total gibberish. Recall that you can + use COPY /SWAP-BYTES to switch the byte order of an errant UCS-2 file + (or any other file for that matter, if you can think of a reason to). + Also note that: + + translate oofa.txt ucs2 ucs2 new.txt + + Produces a result in the native (or SET FILE UCS) byte-order as long as + oofa.txt has a BOM. + + As a side benefit of the Unicode work, the TRANSLATE command now works + for the first time also for all Japanese character sets that Kermit + supports. In other words, if you have a Japanese text file in any of + the following encodings: + + EUC-JP + Shift-JIS + JIS-7 + UCS-2 + UTF-8 + + You can use the TRANSLATE command to convert to any other encoding from + the same list. + + 6.6.5.3. Terminal Connection + + The CONNECT command now allows UTF-8 as a local or remote terminal + character-set: + + SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 } + SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 } + SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 } + + (Recall that Kermit's terminal character-set has two "ends" -- the set + used on the host to which Kermit is connected, and the set used on the + local keyboard and screen.) + + UCS-2 is not supported as a terminal character-set (either end) since + (a) it is not used that way anywhere to our knowledge, and (b) the + problems of Endianness and the high likelihood of loss of + synchronization make it impractical. (Telecommunications is + byte-oriented; if one byte, or any odd number of bytes, is lost because + of buffer overruns, circuit resets, etc (or likewise if a burst of + noise appears that takes the guise of an odd number of bytes), the byte + order of the subsequent data stream will be backwards; unlike UTF-8 and + traditional byte-based character sets, UCS-2 is not "self + synchronizing".) + + UTF-8 does not have byte-order or synchronization problems and is + growing in popularity as a terminal character set as well as in other + application areas. It allows a single terminal session to use multiple + scripts (Roman, Cyrillic, Greek, etc) without ISO 2022 character-set + switching (which terminal emulators like Kermit 95 can handle but few + host applications understand or use), and meshes nicely with the + Unicode screen fonts that are beginning to appear. + + UTF-8 was first used in Plan 9 and soon will be available in Linux. It + will probably spread from there (Unicode in some form is, of course, + also used in Windows NT, but only internally -- not for access from + outside). + + To use UTF-8 or any other character set that uses 8-bit bytes in your + terminal session, be sure to tell C-Kermit to: + + SET TERMINAL BYTESIZE 8 + SET COMMAND BYTESIZE 8 + SET PARITY NONE + + (or use the shortcut command, EIGHTBIT, which does all three at once). + + In a setup where your local Kermit program uses a single-byte character + set such as PC Code Page 850 and the remote host uses UTF-8: + + SET TERM CHAR UTF8 CP850 + + or: + + SET TERM REMOTE CHAR UTF8 + SET TERM LOCAL CHAR CP850 + + all works as expected. UTF-8 text on the remote displays correctly on + your screen, and when you type CP850 characters, they are translated to + UTF-8 sequences for transmission, and the echo from the host is + translated from UTF-8 back to CP850. Telnet negotiations and + autodownload take place before any character-set translation and work + as before. The session log (if text mode was selected for it) contains + only the local terminal character-set. And so on. + + Kermit merely supplies translations from UTF-8 to your local terminal + character-set (this includes treating UTF-8 Line Separator and + Paragraph separator as CRLF). However, Kermit does does not, at + present, perform "canonicalization" of composed sequences, nor does it + automatically execute bidirectionality algorithms for display of + mixed-direction text (e.g. Hebrew and English). Such presentation + issues, like all others in the terminal-host regime, are left to the + host. + + By the way, C-Kermit also allows UTF-8 to be the local end of the + terminal character-set, but so far this code is not tested, since we + don't have a UTF-8 console or terminal to work with. However, it can be + stated without doubt that C-Kermit's key mapping will not work for + UTF-8 values, since (a) the key map is indexed by 8-bit byte values and + (b) C-Kermit reads keystrokes a byte at a time (these comments do not + apply to K95, which has direct access to the keyboard and can read + "wide" keycodes and uses them to index a "wide" keymap). + + Restrictions: As noted, the CONNECT command does not support UCS-2 as a + REMOTE TERMINAL character-set. Neither does it support the Japanese + sets EUC-JP, JIS-7, and Shift-JIS. Support for the Japanese sets (and + possibly Chinese and Korean too) might be added in a future release. + Since the TRANSMIT command (next section) uses the same REMOTE TERMINAL + character-sets as the CONNECT command, it has the same restrictions. + + 6.6.5.4. The TRANSMIT Command + + As described in Chapter 15 of [555]Using C-Kermit and [556]Section 4.21 + of this document, the TRANSMIT command can be used to upload a file + without protocol, more or less as if you were typing it on your + keyboard while connected to the host. When TRANSMITting in text mode, + the file's character set is converted to the host's unless you have SET + TERMINAL CHARACTER-SET TRANSPARENT, or you include the new TRANSMIT + switch, /TRANSPARENT. + + Before C-Kermit 7.0, the file character-set was assumed to be the same + as the local end of the terminal character-set, and the TRANSMIT + command used the same translations as the CONNECT command, ignoring the + file character-set. + + In C-Kermit 7.0, that assumption (a poor one to begin with) can no + longer be made, since UCS-2 can be a file character-set but not a + terminal character-set. So now the file's character-set is given by + your most recent SET FILE CHARACTER-SET command. The host's character + set is the remote end of your most recent SET TERMINAL CHARACTER-SET + command: + + SET TERMINAL CHARACTER-SET remote-set [ local-set ] + + or: + + SET TERMINAL REMOTE-CHARACTER-SET remote-set + + The TRANSMIT command converts each source-file character from the FILE + character-set to the REMOTE TERMINAL character-set, and then transmits + the translated characters according to your SET TRANSMIT preferences + (Chapter 15). + + If you have SET TRANSMIT ECHO ON, and the host is echoing the + transmitted characters, the echos are converted from the remote + terminal character-set to the local terminal character-set. + + [ A picture would help... ] + + Confused? Let's work through an example. Suppose your local computer is + a NeXTstation, on which text files are encoded in the NeXT character + set, and that the remote computer is a Data General AViiON, which uses + the Data General International character set. Further suppose that you + are logged in to the NeXT from a VT220 terminal which uses the DEC + Multinational character set. + + You need to convert the file from NeXT encoding to DG encoding and + convert the echoes from DG encoding to DEC encoding. So on the NeXT, + tell C-Kermit to: + + eightbit + set file character-set next + set term character-set dg-international dec-mcs + transmit /text nextdata.txt + + (This assumes you have some sort of collection process already set up + on the Data General, such as a text editor or the venerable "cat > + foo". The EIGHTBIT command is equivalent to SET TERMINAL BYTESIZE 8, + SET COMMAND BYTESIZE 8, SET PARITY NONE.) + + To further complicate matters, suppose your local terminal character + set is the same as the remote one, so you don't need terminal + character-set translation, but you need to TRANSMIT a file that is in a + different character set and you want it translated to the host set. In + this case, use SET TERM CHARACTER-SET to actually specify the character + set used on each end, rather than specifying TRANSPARENT: + + eightbit + set file character-set ucs2 + set term character-set latin1 latin1 + transmit /text ucs2data.txt + + The distinction between: + + SET TERMINAL CHARACTER-SET xxx yyy + + (where xxx and yyy are the same set) and: + + SET TERMINAL CHARACTER-SET TRANSPARENT + + is new to C-Kermit 7.0, but affects only the TRANSMIT command. + + The TRANSMIT command currently does nothing special with UCS-2/UTF-8 + Line and Paragraph Separator characters; more experience is required to + find out how these behave in a genuine Unicode terminal-host setting. + + Restrictions: As noted, the TRANSMIT command translates from the FILE + character-set to the REMOTE TERMINAL character-set. This rules out + translations to any character set that is not supported as a REMOTE + TERMINAL character-set, such as UCS-2, EUC-JP, JIS-7, and Shift-JIS. + + 6.6.5.5. Summary of Kermit Unicode Commands + + Specifying file character-set and byte order: + SET FILE CHARACTER-SET { ..., UCS2, UTF8 } + REMOTE SET FILE CHARACTER-SET { ..., UCS2, UTF8 } (See next + section) + SET FILE UCS BOM { ON, OFF } + SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN } + + Specifying the transfer character-set: + SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 } + REMOTE SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 } + + Specifying the terminal character-set: + SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 } + SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 } + SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 } + + Displaying settings: + SHOW FILE + SHOW TRANSFER + SHOW TERMINAL + SHOW CHARACTER-SETS + + Commands that use these settings include: + SEND, RECEIVE, GET, etc. + CONNECT + TRANSMIT + LOG SESSION + + Converting files: + TRANSLATE infile { ..., UCS-2, UTF-8 } { ..., UCS-2, UTF-8 } + outfile + COPY /SWAP-BYTES infile outfile + + 6.7. Client/Server Character-Set Switching + + A simple mechanism has been added to allow the client to change the + server's FILE CHARACTER-SET: + + REMOTE SET FILE CHARACTER-SET name + The client asks the server to change its file character-set to + the one given. The name must match one of the server's file + character-set names. For convenience, C-Kermit uses its own file + character-set keyword list for parsing this command so you can + use ? for help and Tab or Esc for completion. However, since the + server might have a different repertoire (or even use different + names for the same sets), C-Kermit accepts any string you supply + and sends it to the server. The server, if it supports this + command (C-Kermit 7.0 and K95 1.1.19 do), sets its file + character-set as requested, and also disables automatic + character-set switching ([557]Section 6.5). If the server does + not support this command or if it does not support the given + character set, the REMOTE SET FILE CHARACTER-SET command fails. + + Here's an example that sends a Japanese text file encoded in Shift-JIS + to a server using every combination of Kermit's Japanese-capable file + and transfer character sets: + + dcl \&x[] = euc ucs2 utf8 ; transfer character-sets + dcl \&y[] = eu uc ut ; 2-letter abbreviations for them + dcl \&f[] = shift euc jis7 ucs2 utf8 ; file character-sets + dcl \&g[] = sj eu j7 uc ut ; 2-letter abbreviations + + set file char shift-jis ; local file character-set is Shift-JIS + for \%i 1 \fdim(&x) 1 { ; for each transfer character-set... + set xfer char \&x[\%i] ; set it + for \%j 1 \fdim(&f) 1 { ; for each remote file character-set... + remote set file char \&f[\%j] ; set it + if fail exit 1 SERVER REJECTED CHARSET + send /text meibo-sj.html meibo-sj-\&y[\%i]-\&g[\%j].txt ; send the fil +e + if fail exit 1 TRANSFER FAILED + } + } + + The Kermit-370 server does not support REMOTE SET FILE CHARACTER-SET, + but since it supports REMOTE KERMIT commands, you can get the same + effect with REMOTE KERMIT SET FILE CHARACTER-SET name. + + 7. SCRIPT PROGRAMMING + + (Also see [558]Section 2.8, Scripting Local Programs.) + + 7.0. Bug Fixes + + The following script programming bugs were fixed in C-Kermit 7.0: + + * IF EXIST and IF DIRECTORY were fixed to properly strip braces from + around their arguments, so "if directory {C:\Program Files}", etc, + would work as expected. However, this means that if the file or + directory name is actually enclosed in braces, the braces must be + doubled. + * The READ command did not fail if the READ file wasn't open; now it + does. + * The READ command refused to read the last or only line of a file if + it did not end with a proper line terminator; now it does. + * The END command, when given from within a SWITCH statement, did not + exit from the current macro or command file; instead it just + terminated the SWITCH. + + 7.1. The INPUT Command + + 7.1.1. INPUT Timeouts + + The description of the INPUT command on page 422 fails to mention the + following two points about the timeout (which apply to C-Kermit 6.0 and + later): + + 1. "INPUT -1 text" (or "INPUT \%x text", where \%x is any variable + whose value is -1 or less) means "wait forever". This form of the + INPUT command fails only if it is interrupted, since it will never + time out. + 2. INPUT 0 performs a nonblocking read of material that has already + arrived but has not yet been read, and succeeds immediately if the + target string is found, or fails immediately if it is not found. + + The same points apply to MINPUT. REINPUT ignores its timeout parameter. + + 7.1.2. New INPUT Controls + + The following new INPUT controls were added in version 7.0: + + SET INPUT AUTODOWNLOAD { ON, OFF } + Explained in [559]Section 7.7. + + SET INPUT CANCELLATION { ON, OFF } + This governs whether an INPUT command can be canceled by + "pressing any key" on the keyboard. Normally it can be, in which + case the INPUT command fails immediately and \v(instatus) is set + to 2, indicating interruption. SET INPUT CANCELLATION OFF + disables keyboard cancellations; thus if the search text is not + encountered, the INPUT command will run for its entire timeout + interval. SET INPUT CANCELLATION OFF does not disable + interruption by Ctrl-C, however; every command needs an + emergency exit. (If you really want to disable interruption by + Ctrl-C, use SET COMMAND INTERRUPTION OFF.) + + Also see [560]Section 7.2 for any new variables related to INPUT. + + 7.1.3. INPUT with Pattern Matching + + C-Kermit 7.0 allows INPUT, MINPUT, and REINPUT targets to be a pattern + (explained in [561]Sections 1.19 and [562]4.9). This solves a + long-standing problem illustrated by the following scenario: a certain + company has a bank of TCP/IP modem servers, with hostnames server1, + server2, server3, and so on. Each server's prompt is its name, followed + by a colon (:), for example "Server72:". Without INPUT patterns, it + would be rather difficult to wait for the prompt. The brute force + approach: + + minput 20 Server1: Server2: Server3: ... (enumerating each one) + + is subject to failure whenever a new server is added. A more subtle + approach: + + input 20 Server + if fail ... + input 2 : + + is liable to false positives, e.g. "Welcome to the XYZ Corp Modem + Server. Please read the following message:"... + + With patterns, you can match the prompt with "Server*:" (which doesn't + solve the "false positives" problem, but certainly is more compact than + the brute force method), or with more specific patterns such as + "Server[1-9]:" and "Server[1-9][0-9]:", or equivalently: + + Server{[1-9],[1-9][0-9]}: + + meaning the word "Server" followed by a single digit (1-9) or by two + digits representing a number from 1 to 99, followed by a colon. + + INPUT pattern matching has been added in a way that does not interfere + with existing scripts. No new commands or switches are used. The simple + rule is: if an INPUT search target is the argument of the (new) + \fpattern() function, it is a pattern. Otherwise it is taken literally, + as before. For example: + + input 5 a*b + + searches for an 'a' followed by an asterisk ('*'), followed by a 'b'. + But: + + input 5 \fpattern(a*b) + + searches for an 'a' followed by anything at all up to and including the + first 'b'. This means that any search target to INPUT, MINPUT, or + REINPUT can be a pattern or a literal string, and in particular that + MINPUT can accommodate any mixture of patterns and literal strings. + + In selecting patterns, note that: + + * A leading '*' is always implied so there is no need to include one. + * A trailing '*' is meaningless and ignored. + * A '*' by itself matches the first character that arrives. + + A syntax note: If your pattern is a selection list, meaning a list of + alternatives separated by commas and enclosed in braces, then the outer + braces will be stripped by various levels of parsers, so you must + include three of each: + + input 10 \fpattern({{{abc,mno,xyz}}}) + + Note that this is equivalent to: + + minput 10 abc mno xyz + + except for the setting of the \v(minput) variable. + + And a caution: INPUT pattern matching has a limitation that you + probably never noticed with literal-string matching, namely that there + is a limit on the size of the match. For example, if the pattern is + "a*b", the match will succeed if the 'a' and 'b' are not separated by + more than (say) 8K bytes, but will fail if they are farther apart than + that. In such cases, it better to use two INPUTs (e.g. "input 10 a" and + then "input 100 b"). + + 7.1.4. The INPUT Match Result + + The result of any INPUT, MINPUT, or REINPUT command, no matter whether + the search targets are patterns or literal strings, is available in the + new \v(inmatch) variable. For example: + + minput 10 cat \fpattern([dh]og) + if success echo MINPUT matched "\v(inmatch)" + + This is especially useful when a pattern was matched, since it makes + the string that matched the pattern available to Kermit; there would be + no way to get it otherwise. + + After an INPUT command, you can view all the INPUT-related variables by + typing "show variables in" (abbreviate as "sho var in"), which shows + the values of all built-in variables whose names start with "in". + + 7.2. New or Improved Built-In Variables + + \v(blockcheck) + Current BLOCK-CHECK setting, 1, 2, 3, or 4. 4 is the code for + BLANK-FREE-2. + + \v(byteorder) + The machine's byte order: 0 = Big Endian, 1 = Little Endian. + + \v(cmdbufsize) + The length of the command buffer, which is the maximum size for + a macro, a command, a variable, or anything else in C-Kermit's + script language. + + \v(ctty) + The device name of C-Kermit's controlling (login) terminal. + + \v(filename) + Described in [563]Sections 4.1 and [564]4.2. + + \v(filenumber) + Described in [565]Sections 4.1 and [566]4.2. + + \v(filespec) + As of C-Kermit 7.0, contains fully qualified filenames rather + than (usually) relative ones. + + \v(return) + Now holds the END n value of the macro that most recently + returned, in case END was used rather than RETURN. + + \v(editor) + Pathname of preferred text editor + + \v(editopts) + Command-line options for editor + + \v(editfile) + File most recently edited + + \v(browser) + Pathname of preferred Web browser + + \v(browsopts) + Command-line options for Web browser + + \v(browsurl) + URL most recently given to Web browser + + \v(dialtype) + Type of call most recently placed (see [567]Section 2.1.11). + + \v(kbchar) + The character, if any, that was typed at the keyboard to to + interrupt the most recent PAUSE, SLEEP, WAIT, MSLEEP, or INPUT + command; empty if the most recent such command was not + interrupted from the keyboard. + + \v(lockdir) + UNIX only - The name of the UUCP lockfile directory, if known, + otherwise "(unknown)". + + \v(lockpid) + UNIX only - PID of process that owns the communication port that + you tried to open with a SET LINE command that failed because + the port was in use, otherwise empty. This variable is set with + every SET LINE command. + + \v(cx_time) + If no connection (SET HOST, SET LINE, DIAL, TELNET, etc) is + active, this is 0. If a connection is active, this is the number + of seconds since the connection was made. + + \v(hwparity) + If hardware parity is in effect, this variable gives its value, + such as "even" or "odd" (in which case, the \v(parity) variable + will be "none"). Otherwise this variable is empty. + + \v(serial) + Current serial port settings in 8N1 format ([568]Section 2.10). + + \v(errno) + In UNIX, the current value of the C runtime errno variable, + which is quite volatile (meaning that often an "interesting" + error code can be overwritten by some other library call or + system service that sets errno before you have a chance to look + at it). In VMS, the error code returned by the system or library + call that most recently failed (success codes are not saved). + Not available in other operating systems. + + \v(errstring) + The UNIX or VMS system error message that corresponds to + \v(errno). Not available in all OS's. Also see + [569]\ferrstring(). + + \v(setlinemsg) + The error message, if any, from the most recent SET LINE, SET + PORT, SET HOST, TELNET, or other connection-making command. This + is not necessarily the same as \v(errstring) since these + commands might fail without generating a system error code, for + example (in UNIX) because a lockfile existed indicating the + device was assigned by another user. + + \v(exitstatus) + The exit status C-Kermit would return if it exited now. + + \v(pexitstat) + The exit status of the inferior process most recently invoked by + C-Kermit (by RUN, !, REDIRECT, SEND /COMMAND, etc). In VMS, this + code can be given to \ferrstring() to get the corresponding + error message (in UNIX, program/command return codes are not the + same as system error codes). Not available in operating systems + other than UNIX and VMS. See [570]Section 4.2.5 for details. + + \v(inmatch) + The incoming string of characters, if any, that matched the most + recent INPUT, REINPUT, or MINPUT command. + + \v(intime) + The number of milliseconds (thousandths of seconds) it took for + the most recent INPUT command to find its match, or -1 if no + INPUT command has been given yet. If the INPUT command timed + out, the value is approximately equal to 1000 times the INPUT + timeout. If INPUT failed for some other reason, the value is + undefined (\v(instatus) gives INPUT completion status). If your + version of C-Kermit is built without high-precision + floating-point timers, this number will always be a multiple of + 1000. + + \v(inwait) + The number of seconds specified as the timeout in the most + recent INPUT command. + + \v(dialsuffix) + Dialing suffix for use during PDIAL sequence; see [571]Section + 2.1.10. + + \v(pid) + UNIX, VMS, and K95 only. C-Kermit's primary process ID, numeric, + decimal. If you want to show it in hex, use \fn2hex(\v(pid)) If + you want to show it in octal, use \fn2octal(\v(pid)). + + \v(printer) + Current printer name or SET PRINTER value. + + \v(p_ctl) + Control prefix char \v(p_8bit) 8-bit prefix char (if parity not + none) + + \v(p_rpt) + Repeat prefix char (if repeat compression enabled) + + \v(herald) + Kermit's version herald + + \v(test) + Kermit's test version, if any, or 0 if this is not a test + version. Typical values for test versions are "Alpha.03" or + "Beta.14". + + \v(sendlist) + The number of entries in the SEND-LIST, 0 if none. Note: entries + do not necessarily correspond to files, since an entry might + contain wildcards. Also note that the value does not go back to + 0 after the files in the list are sent. To reset this variable, + use CLEAR SEND-LIST. The purpose of this variable is to + determine if a SEND command, when given without any filenames, + will be legal. Example: + + xif \v(sendlist) { send } else { send oofa.txt } + + \v(trigger) + If the most recent CONNECT session was terminated automatically + by a trigger, this variable contains the trigger value. + + \v(ty_ln) + TYPE line number (during TYPE) + + \v(ty_lc) + TYPE line count (after TYPE) + + \v(ty_mc) + TYPE match count (after TYPE) + + \v(xferstat) + Status of most recent file transfer: + +-1: No transfer yet + 0: Succeeded + 1: Failed + + \v(xfermsg) + If the most recent file transfer failed, this is the reason. If + it succeeded, \v(xfermsg) is an empty string. + + \v(tftime) + Total elapsed time of most recent file transfer operation, in + seconds. + + \v(textdir) + Directory that holds (or is supposed to hold) Kermit text files + such as installation instructions, release notes, update notes, + read-me files, "beware" files, etc. + + \v(name) + The name with which the Kermit program was invoked, e.g. + "kermit", "wermit", "k95", "k2", etc (see [572]Section 9.1). + + \v(osname) + Name of operating system on computer where C-Kermit is running, + obtained at runtime (from uname or equivalent). + + \v(osversion) + Version of operating system on computer where C-Kermit is + running, obtained at runtime (from uname or equivalent). + + \v(osrelease) + Release of operating system on computer where C-Kermit is + running, obtained at runtime (from uname or equivalent). + + \v(model) + The specific hardware model of the computer where C-Kermit is + running, if known. + + \v(math_pi) + The value of Pi (see [573]Section 7.23) + + \v(math_e) + The value of e (see [574]Section 7.23) + + \v(math_precision) + How many significant digits in a floating-point number. + + \v(f_count) + Result of the most recent FILE COUNT (FCOUNT) command. + + \v(f_error) + Numeric error code of most recent FILE command. + + \v(f_max) + Maximum number of files open simultaneously. + + The math constants are given in the precision of underlying computer's + floating-point arithmetic. + + Note the distinction between \v(osname), \v(osversion), and + \v(platform); the latter refers to the platform for which and/or upon + which C-Kermit was built, as opposed to the one on which it is actually + running. Also note that each operating system can, and probably will, + interpret and fill in the os* variables differently, or not at all. + + The SHOW VARIABLES command now accepts a variable name, prefix, or + pattern: + + show variables Shows all variables. + show variables t Shows all variables that start with "t". + show variables *ver* Shows all variables whose names contain "ver". + show variables *ver Ditto (an implied "*" is appended). + + 7.3. New or Improved Built-In Functions + + The following new file-i/o functions are explained in [575]Section + 1.22. + + \f_status(channel) Status of file open on channel + \f_pos(channel) Read/write (byte) pointer of given file + \f_line(channel) Current line of file + \f_handle(channel) Handle of file + \f_eof(channel) Whether given file is at EOF + \f_getchar(channel) Read a char from given file + \f_getline(channel) Read a line from given file + \f_getblock(channel,n) Read a block from given file + \f_putchar(channel,c) Write a char to given file + \f_putline(channel,string) Write a line to given file + \f_putblock(channel,string) Write a block to given file + + The following new date-time-related functions are explained in + [576]Section 1.6: + + \fday() Returns day of week of given date + \fnday() Returns numeric day of week of given date + \ftime() Returns time portion of given date-time + \fntime() Converts time to seconds since midnight + \fn2time() Converts seconds since midnight to hh:mm:ss + \fcvtdate(date-time) Converts free-format date to yyyymmdd hh:mm:ss + \fdayofyear(date-time) Converts date to yyyyddd (day-of-year) format + \fdoy(date-time) Synonym for \fdayofyear() + \fdoy2date(dayofyear) Converts yyyyddd to yyyymmdd + \fmjd(date-time) Converts free-format date to Modified Julian Date + \fmjd2date(mjd) Converts modified Julian date to yyyymmdd + + The new floating-point arithmetic functions are explained in + [577]Section 7.23. f1 and f2 are floating-point (real) numbers; d is + the number of decimal places to show: + + \ffpabsolute(f1,d) Absolute value of f1 + \ffpadd(f1,f2,d) f1 + f1 + \ffpcosine(f1,d) Cosine of f1 + \ffpdivide(f1,f2,d) f1 divided by f2 + \ffpexp(f1,d) e to the f1 power + \ffpint(f1) Integer part of f1 + \ffplog10(f1,d) Log base 10 of f1 + \ffplogn(f1,d) Natural log of f1 + \ffpmaximum(f1,f2,d) Maximum of f1 and f2 + \ffpminimum(f1,f2,d) Minimum of f1 and f2 + \ffpmodulus(f1,f2,d) Modulus of f1 and f2 + \ffpmultiply(f1,f2,d) Product of f1 and f2 + \ffpraise(f1,f2,d) Raise f1 to power f2 + \ffpround(f1,d) Round f1 to d places + \ffpsine(f1,d) Sine of f1 + \ffpsqrt(f1,d) Square root of f1 + \ffpsubtract(f1,f2,d) f2 - f1 + \ffptangent(f1,d) Tangent of f1 + + Integer number functions: + + \fabsolute(n) + Absolute value of integer n. + + \frandom(n) + Returns a random integer between 0 and n-1. + + \fradix(s,n1,n2) + If the string s is an integer in radix n1, the result is the + same number expressed in radix n2, where n1 and n2 may be any + number from 2 through 36, expressed as decimal numbers, or + variables (etc) that evaluate to decimal numbers. For the source + and result, the digits of any radix, r, are the first r + characters in the sequence 0-9,a-z (case doesn't matter for the + letters). The string s may have a sign, + or -; if it starts + with a minus (-) sign, the result also has a minus sign. + + The \fradix() function does not work with floating-point numbers. It + does not reveal the internal storage format of a number; for example, + \fradix(-1,10,16) is -1, not something like FFFFFFFFFF. If all three + arguments are not given, or if n1 or n2 are not numbers between 2 and + 36 inclusive, or s is not a number in radix n1, an error occurs and the + empty string is returned. \fradix() also does not offer + extended-precision arithmetic; number values are limited to those + expressed as a long integer in the architecture of the underlying + computer, usually 32 or 64 bits. If you give it an argument whose + absolute value is larger than can be held in an unsigned long, the + result is -1. + + The next four are shorthand functions for decimal/hexadecimal and + decimal/octal number conversion: + + \fn2hex(n) + Returns the hexadecimal (base 16) representation of the integer + n. This is different from \fhexify(s), which treats its argument + as a string rather than a number. The result is always + left-padded with 0's to make its length even. Examples: + + \n2hex(0) = "00" \fhexify(0) = "30" + \n2hex(255) = "ff" \fhexify(255) = "323535" + \n2hex(256) = "0100" \fhexify(256) = "323536" + + \fhex2n(x) + Converts hexadecimal number x to decimal equivalent decimal + number. This is the inverse of \fn2hex(). Equivalent to + \fradix(s,16,10). + + \fn2octal(n) + Returns the octal (base 8) representation of the number n. + Examples: + + \n2octal(0) = "0" + \n2oct(255) = "377" + \n2oct(256) = "400" + Equivalent to \fradix(n,10,8). + + \foct2n(n) + Returns the decimal representation of the given octal number, n. + The inverse of \fn2octal(). Equivalent to \fradix(n,8,10). + + String functions: + + \s(name[n:m]) + Equivalent to \fsubstring(\m(name),n,m) ([578]Section 7.24). + + \:(name[n:m]) + Equivalent to \fsubstring(name,n,m) (where "name" is any + \-quantity) ([579]Section 7.24). + + \fleft(s,n) + The leftmost ncharacters of string s; equivalent to + \fsubstring(s,1,n). + + \fstripx(string,char) + Returns the part of the string up to the rightmost occurrence, + if any, of the given character. The default character is period + (.) Examples: + + \fstripx(foo/bar,/) = "foo" + \fstripx(foo/bar/baz,/) = "foo/bar" + \fstripx(autoexec.bat,.) = "autoexec" + \fstripx(autoexec.bat) = "autoexec" + \fstripx(fstripx(foo/bar/baz,/),/) = "foo" + + \flop(string,character) + Returns the portion of the string starting after the first + occurrence of the given character. The default character is + period (.) Examples: + + \flop(autoexec.bat) = "bat" + \flop(baz.foo/bar) = "foo/bar" + \flop(baz.foo/bar,/) = "bar + + \fstripn(string,n) + Returns the string with ncharacters removed from the end. + Example: + + \fstripn(12345678,3) = "12345" + + (For more discussion of \fstripx(), \fstripn(), and \flop() see + [580]Section 4.2.3). + + \fb64encode(s) + Returns the Base-64 encoding of the string s. + + \fb64decode(s) + Returns the decoding of the Base-64 string s. Fails if s is not + a Base-64 string, or if its length is not a multiple of 4. Note + that if any of the result bytes are null (0), the result string + stops there. There is no way to represent strings that contain + null bytes in C-Kermit (the same is true for \funhexify()). + + \fword(s1,n,s2,s3) + Extracts word number nfrom string s1. By default, a "word" is + any sequence of ASCII letters or digits; nis 1-based. If n is + omitted, "1" is used. Examples: + + \fword(one two three) = "one" + \fword(one two three,1) = "one" + \fword(one two three,2) = "two" + \fword(one two three,3) = "three" + + and: + + \fword(\v(dialresult),2) = "31200" + + is "31200" if \v(dialresult) is (e.g.) "CONNECT + 31200/ARQ/V32/LAPM/V42BIS". + + If you include s2, this replaces the default break set. For + example, suppose you have a string \%a whose value is: + + $150.00 $300.00 $39.95 + + and you want each dollar amount to be a word; use: + + \fword(\%a,\%n,{ }) + + This returns dollar amount number \%n, e.g. "$300.00" for \%n = + 2. "{ }" denotes a space (you must enclose it in braces, + otherwise it is squeezed out). Note that ASCII control + characters are always included in the break set; you don't have + to specify them (and you can't not specify them). + + The optional s3 argument lists characters (even control + characters) that normally would be considered separators that + you want included in words. So the dollars-and-cents example + could also be handled this way: + + \fword(\%a,\%n,,$.) + + in other words, use the default separator list, but remove "$" + and "." from it so they will be considered part of a word. + + Note that since 8-bit characters are not ASCII, they act as + break characters unless you put them in the include list. + Suppose, for example, you have a file in which each line is a + Tab-separated list of words, numbers, or phrases that might + contain puncuation, special characters like $ and @, 8-bit bit + characters, etc (like something that might have been exported + from a spreadsheet or database), and you want to split only on + Tab; here is a way (\m(line) is a line read from the file): + +undef keep +for \%i 1 255 1 { + if == \%i 9 continue + .keep := \m(keep)\fchar(\%i) +} +while true { + fread /line \%c line + if fail break + .\%n := \fsplit(\m(line),&a,\9,\m(keep)) + ... +} + + This problem is addressed in [581]C-Kermit 9.0. + + \fsplit(s1,&a,s2,s3) + This is like \fword(), except instead of extracting and + returning a particular word from string s1, it counts the words + and optionally assigns them to the array whose identifying + letter, a-z, is given after the "&" in the second argument, with + the first word going into element 1, the second into element 2, + and so on. The rules regarding break and include lists (s2 and + s3) are exactly the same as for \fword(). \fsplit() returns the + number of words that were assigned, which is either the number + of words in the string, or the dimension of the array, whichever + is less. If the array is not declared, \fsplit() creates it and + returns a number which is both the number of words in s1 and the + dimension of the new array. Examples: + + declare \&w[20] ; (Optional.) + ... + read \%s ; \%s is "This is a sentence with seven words." + ... + echo "\fsplit(\%s)" ; This would print "7". + echo "\fsplit(\%s,&w)" ; Ditto, and also assigns them to array \&w[]. + + echo "\&w[7]" ; This would print "words". + + If the line contained fields that were delimited by colon (:), + you would use \fsplit(\%s,&w,:). If the fields were delimited by + comma, then you would use \fsplit(\%s,&w,{,}); in this case the + literal comma must be enclosed in braces to distinguish it from + the comma that separates function arguments. To get a word count + without loading an array, but still specify break and/or include + lists, leave the array argument empty: + + echo "\fsplit(\%s,,:)" ; Use colon as the separator. + + WARNINGS: + + 1. If you use the same array repeatedly, \fsplit() leaves any + trailing members undisturbed. For example: + dcl \&w[10] + \fsplit(1 2 3 4 5,&w) ; Sets \&w[1] thru \&w[5]. + \fsplit(a b c,&w) ; Sets \&w[1]-[3] leaving [4]-[5] as they were. + + 2. If you allow \fsplit to create the array (by not declaring it + first), it is dimensioned to the number of elements it was + created with: + \fsplit(1 2 3,&x) ; Creates an array \&x[] with 3 elements. + \fsplit(a b c d e,&x) ; This overflows the array. + + Thus if you want to use \fsplit() repeatedly on the same array, + either dimension it in advance to the maximum expected size (and + then some -- more efficient), or else destroy it after each use + (to allow for unexpectedly large arguments). Example using a + dynamic array: + + fopen /read \%c some-file + if fail ... + set function error on ; See [582]Section 7.12 + while true { + dcl \&w[] ; Destroy \&[w] each time thru the loop + fread /line \%c \%a + if fail break + asg \%x \fsplit(\%a,&w) + if fail ... + ; (do what you want with \&w[] here...) + } + fclose \%c + + \frindex(s1,s2,n) + The "n" argument to \frindex() now works consistently (in mirror + image) with the corresponding \findex() argument. In each case, + the (n-1)-most characters of s2 are ignored in the search; for + findex, this means the starting position of the search is n (the + default n is 1, and 0 is treated like 1). For \frindex() it + means the default starting point is: + + length(s2) - length(s1) - n (with the same defaults for n). + + \fsearch(pattern,string[,position]) + Exactly like \findex(), except with a pattern (see [583]Section + 7.9) rather than a literal string. + + \frsearch(pattern,string[,position]) + Exactly like \frindex(), except with a pattern rather than a + literal string. + + File Functions: + + \ffiles(), \fnextfile() + It is no longer necessary to copy the file list to an array + before use, as shown on p.398 of [584]Using C-Kermit 2nd + Edition. \ffiles() and friends now make their own safe copies of + the file list. Thus constructions like the following are now + possible: + + for \%i 1 \ffiles(*.txt) 1 { send \fnextfile() } + + The same is true for the new function \frfiles(), + \fdirectories(), and \frdirectories(), described in [585]Section + 4.11.3. + + But note that each reference to \fnextfile() still gets you the + next file. So "if newer \fnextfile() foo.txt send \fnextfile()" + compares one file's age with that of foo.txt, and then sends an + entirely different file. If you're going to refer to the same + file more than once, assign it to a variable: + + asg \%f \fnextfile() + if newer \%f foo.txt send \%f + + (note: assign, not define). + + Also note that \ffiles(), \frfiles(), \fdirectories(), and + \frdirectories() all now accept on optional 2nd argument: the + name of an array to load with the resulting file or directory + list, explained in [586]Section 4.11.3. So you can also load an + array with the filelist when you need to refer to the same file + more than once: + + for \%i 1 \ffiles(*,&a) 1 { if newer \&a[\%i] foo.txt send \&a[\%i] } + + \fpermissions(file) + Returns the platform-specific permissions string for the file, + such as "-rw-rw-r--" in UNIX or "(RWE,RWE,RE,E)" in VMS. + + \fdirname(f) + Given a file specification f, this function returns the complete + pathname of directory the file is in. + + Array Functions: + + \fdimension(&a) + Returns the dimension declared for the array whose identifying + letter, a-z, or special character "_" or "@", is given after the + "&" in the argument. If the array is not declared, 0 is + returned. Note that when used with the macro argument vector + array, \&_[] (see [587]Section 7.5), the value of this function + is one less than \v(argc), and when used with the C-Kermit + command-line argument vector array, \&@[], it is equal to the + \v(args) variable. Examples: + + echo \fdimension(&a) ; Not declared. + 0 + declare \&a[12] ; Now it's declared. + echo \fdim(&a) + 12 + + \farraylook(pattern,arrayname) + Looks in the given array for the pattern and returns the index + of the first element that matches, if any, or -1 if none match. + The arrayname can include a range specifier to restrict to + search to a segment of the array, e.g. + \farraylook(*xyz*,&a[32:63]). For greater detail see + [588]Section 7.10.7. + + \ftablelook(keyword,arrayname[,delimiter]) + Looks in the given "table", which must be sorted, for the given + keyword. Returns the index of the table element that uniquely + matches the given keyword, or -1 if none match, or -2 if more + than 1 match. For greater detail see [589]Section 7.10.7. + + Other new functions: + + \fip2hex(s) + Converts a dotted decimal IP address to an 8-digit hexadecimal + number. \fip2hex(128.59.39.2) = 803b2702. + + \fhex2ip(x) + Converts an 8-digit hexadecimal IP address to dotted decimal + form, e.g. \fhex2ip(803b2702) = 128.59.39.2. The inverse of + \fip2hex(). + + \fcommand() + \frawcommand() + These run an external command and return its output; see + [590]Section 4.2.8.4. + + \fdialconvert(s) + s is a phone number in either literal or portable format (not a + dialing directory entry name). The function returns the dial + string that would actually be used when dialing from the current + location (after processing country code, area code, and other + SET DIAL values). + + \ferrstring(n) + Returns the system error message associated with the (numeric) + error code n. UNIX and VMS only. Use in conjunction with + \v(errno) or \v(pexitstat). See [591]Section 4.2.5 for a usage + example. Note: This function doesn't work in Windows because + there is not a consistent error-code-to-message mapping; error + code "x" means something completely different depending on + whether it comes from the C runtime library, Winsock, a + Windows-32 API, TAPI, etc, + + \fpattern(s) + Used in INPUT, REINPUT, and MINPUT commands to denote search + strings that are to be treated as patterns rather than + literally. + + Also see [592]Section 7.8 on built-in help for functions. + + 7.4. New IF Conditions + + IF AVAILABLE feature command + Executes the command if the given feature is available. + Presently used only to determine if specific authentication and + encryption options are available. Type "if available ?" to see + which features may be tested. + + IF FLOAT f1 command + Executes command if f1 is a legal floating point number (which + includes integers). Use this to preverify arguments for the + \ffp...() floating-point arithmetic functions, e.g. "if float + \%1 echo \ffpint(\%1)". + + IF == n1 n2 command + Synonym for "if =" (numeric equality). Note that as of C-Kermit + 7.0, this and all other numeric comparison operators also work + for floating-point numbers. + + IF != n1 n2 command + Executes the command if n1 and n2 are both numbers or variables + containing numbers and the value of n1 is not equal to the value + of n2. This is equivalent to "if not = n1 n2". + + IF <= n1 n2 command + Executes the command if n1 and n2 are both numbers or variables + containing numbers and the value of n1 is less than or equal to + the value of n2. This is equivalent to "if not > n1 n2". + + IF >= n1 n2 command + Executes the command if n1 and n2 are both numbers or variables + containing numbers and the value of n1 is greater than or equal + to the value of n2. Equivalent to "if not < n1 n2". + + IF COMMAND word command + Executes the command if word is a built-in C-Kermit command. + Example: + + if not command copy define { copy run copy \%1 \%2 }". + + This defines a COPY macro that runs an external COPY command if + COPY is not already a built-in command. + + IF LOCAL command + Executes the command if Kermit is in local mode, i.e. if it has + a SET LINE, SET PORT, or SET HOST (TELNET, RLOGIN, etc) device + or connection open. Does not execute the command if in remote + mode. + + IF MATCH string pattern command + Executes the command if the string matches the pattern. For a + description of the syntax for the pattern, see [593]Section + 4.9.1. If you want to test if the string contains pattern, use + IF \fsearch(pattern,string). + + IF OPEN { DEBUG-LOG, SESSION-LOG, TRANSACTION-LOG, ... } command + Executes the command if the given file is open, fails if it is + not open. Type IF OPEN ? for a complete list of files that can + be checked (all the files that can be opened with the OPEN or + LOG commands). + + IF QUIET command + Executes the command if SET QUIET is ON, and does not execute it + if SET QUIET is OFF. Example: IF NOT QUIET ECHO { This is a + message.}. + + IF READABLE name + Succeeds if name is the name of an existing file or directory + that is readable. + + IF WRITEABLE name + Succeeds if name is the name of an existing file or directory + that is writeable, e.g.: + + if not writeable \v(lockdir) echo Please read installation instructions! + + IF FLAG command + This tests a user-settable condition, which can mean anything + you like. SET FLAG ON causes subsequent IF FLAG commands to + succeed; SET FLAG OFF causes them to fail. One way to use it + would be for debugging your scripts; precede any debugging + statements with IF FLAG. Then SET FLAG on to debug your script, + SET FLAG OFF to run it without debugging. Another common use is + for causing an inner loop to cause an outer loop to exit. + + IF C-KERMIT command + C-Kermit, but not Kermit 95 or MS-DOS Kermit, executes the + command. + + IF K-95 command + Kermit 95, but not C-Kermit or MS-DOS Kermit, executes the + command. + + IF MS-KERMIT command + MS-DOS Kermit, but not C-Kermit or Kermit 95, executes the + command. + + 7.5. Using More than Ten Macro Arguments + + The \v(argc) variable now gives the actual number of arguments, even if + the number is greater than 9: + + C-Kermit> define xx echo \v(argc) + C-Kermit> xx a b c d e f g h i j k l m n o p q r s t u v w x y z + 27 + + Remember that \v(argc) includes the name of the macro itself, so it is + always at least 1, and is always 1 greater than the actual number of + arguments. As in versions 6.0 and earlier, if more than 9 arguments are + given, only the first nine are assigned to the variables \%1..\%9. + + The \&_[] array, discussed on page 353 of [594]Using C-Kermit, 2nd ed, + now holds all the arguments, up to some implementation-dependent limit + (64 or greater), rather than only the first 9. To illustrate: the + following macro tells the number of arguments it was called with and + then prints them: + + define show_all_args { + local \%i + echo \&_[0] - Number of arguments: \feval(\v(argc)-1) + for \%i 1 \v(argc)-1 1 { echo \flpad(\%i,3). "\&_[\%i]" } + } + + Within a macro \&_[0], like \%0, contains the name of the macro. + + At top level, the \&_[] array is filled as follows: + + * If the first argument on the C-Kermit command line was a filename, + or C-Kermit was invoked from a "Kerbang" script ([595]Section + 7.19), element 0 contains the filename, and elements 1 through + \v(argc)-1 hold the remaining command-line arguments. + * Otherwise the program name goes in element 0, and elements 1 + through \v(argc)-1 hold any arguments that were included after "--" + or "=" + + The new \%* variable, when used within a macro, is replaced by the text + that followed the macro name in the macro invocation. If no arguments + were given, \%* is replaced by the empty string. Examples: + + C-Kermit> define xx echo [\%*] + C-Kermit> define \%a oofa + C-Kermit> xx + [] + C-Kermit> xx \%a + [oofa] + C-Kermit> xx a + [a] + C-Kermit> xx a b + [a b] + C-Kermit> xx a b c + [a b c] + C-Kermit> xx a b c d e f g h i j k l m n o p q r s t u v w x y z + [a b c d e f g h i j k l m n o p q r s t u v w x y z] + + Note that \%* can not be used at top level, since Kermit does not have + access to the raw command line (only to its elements separately, after + they have been processed by the shell and the C library). + + C-Kermit 7.0 also adds a SHIFT command: + + SHIFT [ number ] + Shifts the macro arguments (except argument 0) the given number + of places to the left and adjusts \v(argc) accordingly. The + default number is 1. + + To illustrate, suppose macro XXX is invoked as follows: + + xxx arg1 arg2 arg3 + + Then inside XXX, \%1 is "arg1", \%2 is "arg2", and \%3 is "arg3". After + a SHIFT command is given inside XXX, then \%1 is "arg2", \%2 is "arg3", + and \%3 is empty. \%0 (the name of the macro) remains unchanged. + + If more than 9 arguments were given, then arguments are shifted into + the \%1..9 variables from the argument vector array. + + At top level, the SHIFT command operates on the \&_[] array and \%1..9 + variables; the \&@[] array is not affected. See [596]Section 7.16 for + details. + + The \%* variable is not affected by the SHIFT command. + + 7.6. Clarification of Function Call Syntax + + Spaces are normally stripped from the front and back of each function + argument; to prevent this enclose the argument in braces: + + \fsplit(\%a,&a,{ }) + + However, function calls that contain spaces can make trouble when the + function is to be used in a "word" field, since space separates words. + For example: + + for \%i 1 \fsplit(\%a,&a,{ }) 1 { + echo \%i. "\&a[\%i]" + } + + In most cases, the trouble can be averted by enclosing the function + reference in braces: + + for \%i 1 {\fsplit(\%a,&a,{ })} 1 { + echo \%i. "\&a[\%i]" + } + + or by replacing spaces with \32 (the ASCII code for space): + + for \%i 1 \fsplit(\%a,&a,\32) 1 { + echo \%i. "\&a[\%i]" + } + + Braces are also used in function calls to indicate grouping. For + example: + + \fsubstring(abcd,2,2) = "bc" + + But suppose "abcd" needed to contain a comma: + + \fsubstring(ab,cd,2,2) + + This would cause an error, since "cd" appears to be the second + argument, when really you want the first "2" to be the second argument. + Braces to the rescue: + + \fsubstring({ab,cd},2,2) = "b," + + Similarly, leading and trailing spaces are stripped from each argument, + so: + + \fsubstring( abcd ,2,2) = "bc" + + but braces preserve them: + + \fsubstring({ abcd },2,2) = "ab" + + Given these special uses for braces, there is no way to pass literal + braces to the function itself. For example: + + \fsubstring(ab{cd,2,2) + + causes an error. + + So if you need a function to include braces, define a variable + containing the string that has braces. Example: + + define \%a ab{cd + \fsubstring(\%a,2,2) = "b{" + + If the string is to start with a leading brace and end with a closing + brace, then double braces must appear around the string (which itself + is enclosed in braces): + + define \%a {{{foo}}} + \fsubstring(\%a) = "{foo}" + + This also works for any other kind of string: + + define \%a {{ab{cd}} + echo \fsubstring(\%a) = "ab{cd" + + 7.7. Autodownload during INPUT Command Execution + + As of 6.1 / 1.1.12, C-Kermit can be told to look for incoming Kermit + (or Zmodem) packets during execution of an INPUT command. By default + (for consistency with earlier releases), this is not done. You can + enable this feature with: + + SET INPUT AUTODOWNLOAD ON + + (and disable it again with OFF.) + + One possible use for this feature is as a server mode with a time + limit: + + INPUT 3600 secret-string-to-end-the-INPUT-command + + In this example, any GET, SEND, or REMOTE commands received within one + hour (3600 seconds) of when the INPUT command was issued will be + executed. Here's another example, in which we want to stay open until + 11:30pm, or until interrupted by seven consecutive Ctrl-C (\3) + characters: + + INPUT 23:30:00 \3\3\3\3\3\3\3 + + The INPUT AUTODOWNLOAD setting is displayed by SHOW SCRIPTS or SHOW + INPUT. + + 7.8. Built-in Help for Functions. + + Beginning in C-Kermit 7.0, you may obtain a description of the calling + conventions and return values of any built-in function, such as + \fsubstring(), with the new HELP FUNCTION command; give the function's + name without the leading "\f", e.g. "help func substring". You can use + ?, completion, and abbreviation in the normal manner. + + 7.9. Variable Assignments + + 7.9.1. Assignment Operators + + Programmers accustomed to languages such as C or Fortran might find + Kermit's method of assigning values to variables unnatural or awkward. + Beginning in C-Kermit 7.0, you can use the following alternative + notation: + + .name = value is equivalent to DEFINE name value + .name := value is equivalent to ASSIGN name value + .name ::= value is equivalent to ASSIGN name \feval(value) + + When the command begins with a period (.), this indicates an + assignment. The name can be a macro name, a \%{digit,letter} variable, + or an array element. There can be space(s) between "." and the name. + Examples: + + .\%a = This is a string ; Same as "define \%a This is a string" + echo \%a + This is a string + + .xxx = \%a ; Same as "define xxx \%a" + echo \m(xxx) + \%a + + .xxx := \%a ; Same as "assign xxx \%a" + echo \m(xxx) + This is a string + + declare \&a[2] ; Use with arrays... + define \%i 2 + .\&a[1] = first + .\&a[\%i] = second + + The following sequence illustrates the differences among three levels + of evaluation: + + .\%x = 2 ; Define a variable to have a numeric value + .\%y = (3 + \%x) ; Define another variable as an arithmetic expression + + .xxx = 4 * \%y ; "=" simply copies the right-hand side. + echo \m(xxx) + 4 * \%y + + .xxx := 4 * \%y ; ":=" evaluates the variables first, then copies. + echo \m(xxx) + 4 * (3 + 2) + + .xxx ::= 4 * \%y ; "::=" evaluates the expression, then copies. + echo \m(xxx) + 20 + + You can also use this syntax to clear (undefine) a variable: + + .\%a = oofa ; Define the variable + echo "\%a" + "oofa" + .\%a ; Clear the variable + echo "\%a" + "" + + Extra credit: Can you guess what happens below when the file "abc" does + not exist? + + fopen /read \%c abc + if fail ... + + 7.9.2. New Assignment Commands + + Recall the DEFINE and ASSIGN commands, and their hidden counterparts, + _DEFINE and _ASSIGN. The former take the variable name literally, the + latter evaluate the variable-name field to form the variable name + dynamically. Examples: + + DEFINE \%x foo ; Sets the value of the variable \%x to "foo". + DEFINE \%a \%x ; Sets the value of the variable \%a to "\%x". + _DEFINE x_\%a \%x ; Sets the value of the variable x_foo to "\%x". + ASSIGN \%a \%x ; Sets the value of the variable \%a to the "foo". + _ASSIGN x_\%a \%x ; Sets the value of the variable x_foo to "foo". + + This concept has been carried over to the remaining variable-assignment + commands: EVALUATE, INCREMENT, and DECREMENT: + + EVALUATE variablename expression + Evaluates the arithmetic expression and assigns its value to the + variable whose name is given. Example: "eval \%a 1+1" assigns + "2" to \%a. + + _EVALUATE metaname expression + Evaluates the arithmetic expression and assigns its value to the + variable whose name is computed from the given metaname. + Example: "eval foo<\%a>::\%1 \%2 * (\%3 + \%4)" assigns the + value of "\%2 * (\%3 + \%4)" to the variable whose name is + computed from "foo<\%a>::\%1". + + INCREMENT variablename [ expression ] + Evaluates the arithmetic expression and adds its value to the + value of the variable whose name is given. Example: "increment + \%a". + + _INCREMENT metaname [ expression ] + Evaluates the arithmetic expression and adds its value to the + value of the variable whose name is computed from the given + metaname. Example: "_increment Words::\%1.count[\%2]". + + DECREMENT variablename [ expression ] + Evaluates the arithmetic expression and subtracts its value from + the value of the variable whose name is given. + + _DECREMENT metaname [ expression ] + Evaluates the arithmetic expression and subtracts its value from + the value of the variable whose name is computed from the given + metaname. + + WARNING: The syntax of the EVALUATE command has changed since C-Kermit + 6.0 and K95 1.1.17. Previously, it did not include a variable name, + only an expression. To restore the old behavior, use SET EVALUATE OLD. + To return to the new behavior after restoring the old behavior, use SET + EVALUATE NEW. + + NOTE: There are no analogs to the "_" commands for the operators + described in [597]Section 7.9.1; those operators can not be used to + assign values to variables whose names must be computed. + + 7.10. Arrays + + C-Kermit 7.0 adds lots of new array-related features, and groups them + together under the NEW ARRAY command: + + ARRAY { CLEAR, COPY, DECLARE, DESTROY, RESIZE, SHOW, SORT } + + In each of the ARRAY commands, wherever an array name is expected, + "short forms" may be used. For example, all of the following are + acceptable: + + array show \&a[] (or SHOW ARRAY...) + array show &a[] + array show a[] + array show &a + array show a + + In addition, ranges are accepted in the ARRAY COPY, ARRAY CLEAR, ARRAY + SET, ARRAY SHOW, and ARRAY SORT commands: + + array clear \&a[16] ; Clears 16 thru end + array clear &a[16] ; Ditto + array clear a[16] ; Ditto + + array clear \&a[16:32] ; Clears 16 thru 32 + array clear &a[16:32] ; Ditto + array clear a[16:32] ; Ditto + + When using array names as function arguments, you must omit the "\" and + you must include the "&". You may optionally include empty brackets. + Examples: + + \fsplit(\%a,a) ; Bad + \fsplit(\%a,\&a) ; Bad + \fsplit(\%a,&a[3]) ; Bad + + \fsplit(\%a,&a) ; Good + \fsplit(\%a,&a[]) ; Good + + 7.10.1. Array Initializers + + Beginning in C-Kermit 7.0, you may initialize an array -- in whole or + in part -- in its declaration: + + [ ARRAY ] DECLARE array-name[size] [ = ] [ value1 [ value2 [...] ] ] + + For compatibility with versions 5A and 6.0, the ARRAY keyword is + optional. DECLARE can also be spelled DCL. + + Initializers are (a) optional, (b) start with element 1, (c) must be + enclosed in braces if they contain spaces, and (d) are evaluated + according to normal rules by the DECLARE command prior to assignment. + Thus the assignments made here are the same as those made by the ASSIGN + command. This allows you to initialize array elements from the values + of other variables. If you actually want to initialize an array element + to variable's name, as opposed to its value, use double backslashes (as + in "\\&a", "\\v(time)", etc). + + The size (dimension) of the array is optional. If the size is omitted, + as in "\&a[]", then the array sizes itself to the number of + initializers; if there are no initializers the array is not declared + or, if it was declared previously, it is destroyed. If a size is given, + any extra elements in the initialization list are discarded and + ignored. + + NOTE: Unlike in C, the list of initializers is NOT enclosed in braces. + Instead, braces are used to group multiple words together. So: + + ARRAY DECLARE \&a[] = { one two three } + + would create an array with two elements (0 and 1), with element 1 + having the value " one two three ". + + Examples: + + ARRAY DECLARE \&a[16] + Declares the array \&a with 17 elements (0 through 16), in which + all elements are initially empty. If the array \&a[] existed + before, the earlier copy is destroyed. + + ARRAY DECLARE &a[16] + ARRAY DECLARE a[16] + ARRAY DCL \&a[16] + ARRAY DCL &a[16] + ARRAY DCL a[16] + DECLARE \&a[16] + DECLARE &a[16] + DECLARE a[16] + DCL \&a[16] + DCL &a[16] + DCL a[16] + All of the above are the same as the first example. + + ARRAY DECLARE \&a[16] = alpha beta {gamma delta} + Declares the array \&a with 17 elements (0 through 16), + initializing \&a[1] to "alpha", \&a[2] to "beta", and \&a[3] to + "gamma delta". The remaining elements are empty. + + ARRAY DECLARE \&a[] = alpha beta {gamma delta} + Same as the previous example, but the array is automatically + dimensioned to 3. + + ARRAY DECLARE \&a[3] = alpha beta {gamma delta} epsilon zeta + Too many initializers; only the first three are kept. + + ARRAY DECLARE \&a[0] + ARRAY DECLARE \&a[] + ARRAY DECLARE &a[] + ARRAY DECLARE &a + ARRAY DECLARE a + DECLARE \&[0] + DECLARE a + DCL a + All of these are equivalent. Each destroys \&a[] if it exists. + Declaring an array with a dimension of 0 is the same as ARRAY + DESTROY arrayname. + + ARRAY DECLARE \&a[] = \%1 \%2 \%3 + Declares the array \&a with 3 elements (0 through 3), + initializing \&a[1] to the value of \%1, \&a[2] to the value of + \%2, and \&a[3] to the value of \%3. In this case, any reference + to one of these array elements is replaced by the value of the + corresponding \%n variable at the time the declaration was + executed (immediate evaluation; the array element's value does + not change if the initializer variable's value changes). + + ARRAY DECLARE \&a[] = \\%1 \\%2 \\%3 + Declares the array \&a with 3 elements (0 through 3), + initializing \&a[1] to the string "\%1", \&a[2] to "\%2", and + \&a[3] to "\%3". In this case any reference to one of these + array elements is replaced by the CURRENT value of the + corresponding \%n variable (deferred evaluation -- the array + element's value follows the value of the initializer variable). + + The equal sign (=) preceding the initializer list is optional, but is + recommended for clarity. If you need to initialize element 1 to a + literal equal sign, use two of them, separated by a space, as in this + example: + + ARRAY DECLARE \&a[] = = + - * / + + Remember, element 0 is not initialized by the DECLARE command. To + initialize element 0, use a regular DEFINE or ASSIGN command: + + ARRAY DECLARE \&a[] one two three four five six seven eight nine + DEFINE \&a[0] zero + + Finally, remember that every command level has its own local array, + \&_[], containing all the macro arguments (\%0, \%1, ...) for that + level. See [598]Section 7.5 for details. + + 7.10.2. Turning a String into an Array of Words + + The \fsplit(s1,&a,s2,s3) function assigns the words of string s1 to + successive elements of the array (beginning with element 1) whose + identifying letter, a-z, is given after the "&" in the second argument, + using break and include characters given in s2 and s3. See [599]Section + 7.3 for details. + + 7.10.3. Arrays of Filenames + + See [600]Section 4.11.3 for news about how \ffiles() and related + functions can assign a list of filenames to an array. To recapitulate + briefly here: + + \ffiles(*,&a) + + assigns all files that match the first argument to the array denoted by + the second argument. If the array has not been declared, it is declared + automatically, with exactly the number of elements needed to hold the + file list; if it was previously declared, it is destroyed and reused. + The filenames are assigned starting at array element 1. Element 0 holds + the number of files in the list. + + The DIRECTORY command ([601]Section 4.5.1) can also create filename + arrays if you give it the /ARRAY: switch; this allows selection + criteria beyond whether the filename matches the given pattern. + + All functions and commands that create filename arrays store the number + of filenames, n, as element 0 of the array, and the filenames as + elements 1 through n. + + 7.10.4. Automatic Arrays + + In a command file or macro, you can now have local (automatic) arrays. + Just give the name followed by empty subscript brackets (no spaces + inside the brackets please) in a LOCAL command, and then declare the + array: + + LOCAL \%a \&a[] oofa + ARRAY DECLARE \&a[32] = value1 value2 value3 ... + + This declares the scalar variable \%a, the array \&a[], and the macro + name "oofa" to be local, and then declares the new local copy of \&a[] + with 32 elements, perhaps assigning some initial values. When C-Kermit + exits from the command file or macro containing these command, the + previous \&a[] array is restored (and if there was no \&a[] at any + higher level, this will still be true). The process can be repeated to + any level. Thus it is now safe to write scripts or macros containing + arrays without danger of interfering with global arrays of the same + name. + + Just as scalars are inherited by lower command levels, so are arrays. + So, for example, if \&a[] is declared at top level, all lower levels + will see it unless they include a "local \&a[]" statement, in which + case all levels at and beneath the level where the LOCAL statement was + executed will see the local copy. This too can be repeated to any + level. + + On the other hand, if you DECLARE an array at a lower command level + without also making it LOCAL, this replaces the copy that was declared + at the lowest command level above this one. + + 7.10.5. Sorting Arrays + + Although arrays can be sorted using FOR loops as shown on page 383 of + Using C-Kermit, 2nd Ed., this involves quite a bit of repetitive + interpretation by the command parser, and so can be slow for large + arrays. For this reason, C-Kermit 7.0 adds a built-in SORT command: + + ARRAY SORT [ switches ] array [ array2 ] + Sorts the given array in place. Sorting is strictly lexical + (string based). The array name can be given fully, e.g. "\&a[]", + or the "\" and/or "&" and/or brackets can be omitted, e.g. + "array sort \&a[]", "sort &a", "sort a". Also, a range can be + indicated in the brackets as noted in [602]Section 7.10, to + restrict the sort to a range of elements (equivalent to the + /RANGE switch, described just below), e.g. "array sort + &a[20:30]". + + A second array may be specified. If it is, and if it is at least as big + as the first array, it is sorted according to the first array. For a + sample application, see [603]Section 7.10.10. + + See [604]Section 1.5 for an explanation of switches. The optional + switches are: + + /CASE:{ON,OFF} + /CASE:ON means that alphabetic case is significant in + comparisons; uppercase letters are sorted before lowercase ones. + /CASE:OFF means case is ignored, e.g. "A" is the same as "a". If + this switch is not given, sorting is according the current SET + CASE setting. + + /KEY:n + Comparison begins at position n(1-based) in each string. If no + key is given, the entire strings are compared. Only one key can + be given. If an array element is shorter than the key value, n, + that element is considered empty for comparison purposes, and + therefore lexically less than any element at least ncharacters + long. + + /NUMERIC + If this switch is included, it means sorting should be numeric, + rather than lexical. The sort key is the string starting at the + key position, skipping any leading blanks or tabs, and then as + much of the string from that point on that fits the definition + of "numeric", terminating at the first character that does not + qualify. A numeric string has an optional sign (+ or -) followed + by one or more digits, and (if your version of Kermit was built + with floating-point support; see [605]Section 7.23 ) zero or one + decimal point (period). If both /CASE and /NUMERIC are given, + /NUMERIC takes precedence. + + /RANGE:n[:m] + Sort elements nthrough m of the array. By default, the entire + array from element 1 to its dimensioned size is sorted, which + might produce surprising results if the array is not full; see + example in [606]Section 7.10.7. If ":m" is omitted from the + range, the dimensioned size is used. Thus, to sort an entire + array, \&a[], including its 0th element, use "sort /range:0 &a". + You can also sort any desired section of an array, e.g. "sort + /range:10:20 &a" or "sort /range:\%i:\%j-1 &b". As noted above, + you can also specify a range in the array-name brackets. If you + specify a range in the array-name brackets AND with a /RANGE + switch, the ones in the brackets take precedence. + + /REVERSE + Sort in reverse order. If this switch is not given, the array is + sorted in ascending order. + + Remember that numeric switch arguments can be numbers, arithmetic + expressions, or variables whose values are numbers or expressions, as + illustrated in the /RANGE examples above. + + A typical sorting application might be to list students' test scores in + descending order. Suppose you had the following records: + + olaf 65 + olga 98 + ivan 83 + xena 100 + + (and so on) stored in array \&s[] (e.g. by reading them from a file as + illustrated in [607]section 7.10.7). In these records, the student's + name is in columns 1-9 and the score in 10-12. So to rearrange the list + in descending order of score: + + sort /key:10 /reverse &s + + Then to list your top five students: + + for \%i 1 5 1 { echo \&s[\%i] } + + Or more simply (see next section): + + show array a[1:5] + + To illustrate the difference between a lexical and a numeric sort, + suppose you have the following records (the lines that are numbered, + starting at column 1) in array \&a[]: + + Column 1 2 + 12345678901234567890 + + 1. Ivan 10.0 2. Olaf 9.95 3. Olga 101.5 + + ARRAY SORT /KEY:10 &a[] would order them 3,1,2, but ARRAY SORT /KEY:10 + /NUMERIC &a[] would order them 2,1,3. + + 7.10.6. Displaying Arrays + + The SHOW ARRAY command (or ARRAY SHOW) now accepts an optional + array-name argument: + + SHOW ARRAY \&a[] + + (you can leave off the \, the \&, and/or the []'s if you like; "show + array a" is equivalent to "show array \&a[]"). When an array is + specified, its dimension is shown and all defined (non-empty) elements + are listed. + + Example: + + assign \%n \ffiles(*,&a) ; Fill an array with filenames ([608]Section 4.11.3) + show array \&a[] ; Show the array we just read + array show \&a[] ; Same as previous + array sort \&a[] ; Sort the array + array show \&a[] ; Show it after sorting + array show \&a ; Show it again + array show &a ; Show it again + array show a ; Show it again + + (The final four commands demonstrate the alternative forms that are + accepted for the array name.) + + If you SHOW ARRAY without giving an array name, all defined arrays are + listed by name and dimension, but their contents are not shown. + + You can also show a piece of an array by including a subscript or range + within the array brackets: + + array show \&a[5] ; Shows \&a[5] + array show &a[3:8] ; Shows \&a[3] through \&a[8] + array show a[:\%n-1] ; Shows \&a[0] through \&a[\%n-1] + + 7.10.7. Other Array Operations + + ARRAY DESTROY arrayname + Destroys and undeclares the named array. Subscripts or ranges + are not accepted in this command. + + ARRAY COPY array1 array2 + Copies the first array to the second array. If the target array + has not been declared, it is created automatically with the same + size as the first. If it has been declared, it will be used as + declared; if the source array is larger, only as much of it as + will fit is copied to the target array. Syntax for array1 and + array2 is as in ARRAY SHOW (SHOW ARRAY). Example: + + .\%n := \ffiles(*,&a) ; Create and load array A with a file list. + array copy &a &b ; Copy array A to array B. + + The ARRAY COPY command also lets you copy pieces of arrays by + including range specifiers, as in these examples: + + ARRAY COPY \&a[4:27] \&b + This copies \&a[] elements 4-27 to \&b[] elements 1-23, + creating \&b[] if necessary or, if \&b[] is already + declared, stopping early if its size is less than 23. + + ARRAY COPY \&a[4:27] \&b[12] + This copies \&a[] elements 4-27 to \&b[] elements 12-35, + creating \&b[] if necessary or, if \&b[] is already + declared, stopping early if its size is less than 35. + + ARRAY COPY \&a[4:27] \&b[12:14] + This copies \&a[] elements 4-6 to \&b[] elements 12-14, + creating \&b[] if necessary or, if \&b[] is already + declared, stopping early if its size is less than 14. + + ARRAY COPY \&a[17] \&b + This copies all the elements of \&a[] starting with 17 + until the last to \&b[], creating \&b[] if necessary or, + if \&b[] is already declared, stopping early if \&b[] is + not big enough. + + ARRAY CLEAR arrayname + Sets all the elements of the array to the empty value. You may + also include a range specifier to clear only a selected portion + of the array; for example "array clear \&a[37:214]". If the + range is out of bounds, only the part of the array that is in + bounds is cleared. + + ARRAY SET arrayname [ value ] + Sets all the elements of the array to the given value. If no + value is given, the array is cleared. You may also include a + range specifier to set only a selected portion of the array; for + example "array set \&a[1:9] -1". If the range is out of bounds, + only the part of the array that is in bounds is set. + + ARRAY RESIZE arrayname size + Resizes the given array. If the size is greater than the array's + current dimension, new empty elements are added to the end. If + the size is less than the current dimension, the extra elements + are discarded. Note: If you have stored the array size in + element 0, ARRAY RESIZE does not change this value. Alternative + notation: ARRAY RESIZE arrayname[size]. For a practical example, + see [609]Section 7.10.11. + + \farraylook(pattern,arrayname) + This function returns the index of the first element of the + given array that matches the given pattern (for details about + pattern syntax, see [610]section 4.9). The array name can + include a range specification to restrict the search to a given + segment of the array. If no elements match the pattern, -1 is + returned. + + \ftablelook(keyword,arrayname[,delimiter]) + Looks in the given "table", which must be sorted, for the given + keyword. The keyword need not be spelled out in full. + Pattern-matching characters should not be included as part of + the keyword. The function returns the index of the table element + that uniquely matches the given keyword, or -1 if none match, or + -2 if more than 1 match. + + A "table" is an array that is sorted in lexical order; each of its + elements may contain multiple fields, delimited by the given delimiter + character or, if no delimiter is specified, a colon (:). + + The \farraylook() function does exactly what you tell it. If you give + it a pattern that does not include wildcard characters (such as *, ?, + etc), it requires an exact match. For example: + + \farraylook(oofa,&a) + + searches for the first element of \&a[] whose value is "oofa". But: + + \farraylook(oofa*,&a) + + finds the first element whose value starts with "oofa", and; + + \farraylook(*oofa,&a) + + finds the first element whose value ends with "oofa", and; + + \farraylook(*oofa*,&a) + + finds the first element whose value contains "oofa". + + Here's a simple demonstration of looking up patterns in arrays: + + local \&a[] \%x \%n + declare \&a[] = zero one two three four five six seven eight nine ten + while true { + .\%x = 1 + .\%n = 0 + ask \%a { Pattern? } + if not def \%a exit 0 Done. + while <= \%x \fdim(&a) { + .\%x := \farraylook(\%a,&a[\%x]) + if ( < \%x 0 ) break + echo \flpad(\%x,3). \&a[\%x] + increment \%x + increment \%n + } + if ( < \%n 1 ) echo Pattern not found - "\%a" + } + + The array need not be sorted. When a pattern is given, a search is + performed; if there is a match, the matching element's index and the + element itself are printed, and the search begins again at the next + element. Thus each matching element is printed. If none match, the + "Pattern not found" message is printed. The process repeats for as many + patterns as the user wants to type, and terminates when the user types + an empty pattern. + + Now let's build a little command parser, consisting of a keyword table, + and a loop to look up the user's commands in it with \ftablelook(). In + this case the array elements have "fields" separated by colon (:) -- a + keyword and a value. Keyword tables must be sorted if \tablelook() is + to work right, so after declaring and initializing the table array, we + sort it. + + local \&k[] \%a \%i \%n + + array declare \&k[] = drive:9 do:8 discuss:7 live:6 spend:5 help:4 quit:0 + + array sort &k ; Make sure array is sorted + echo Type "help" for help. ; Print greeting & instructions + + while true { ; Loop to get commands + undefine \%a + while not defined \%a { ; Get a command + ask \%a { Command? } + } + .\%n := \ftablelook(\%a,&k) ; Look up the command + switch \%n { ; Handle errors + :-1, echo Not found - "\%a" ; Doesn't match + continue + :-2, echo Ambiguous - "\%a" ; Matches too many + continue + } + switch \fword(\&k[\%n],2) { ; Dispatch according to value + :9, echo Driving..., break + :8, echo Doing..., break + :7, echo Discussing..., break + :6, echo Living..., break + :5, echo Spending..., break + :4, echo { Commands (may be abbreviated):} + for \%i 1 \fdim(&k) 1 { + echo { \%i. \fword(\&k[\%i],1) } + } + break + :0, exit 0 Bye! + :default, stop 1 Internal error + } + } + + In this example, keywords are "drive", "do", "discuss", etc, and their + values are unique numbers (values need not be numbers, and there need + not be only one value -- there can be 0, 1, 2, or more of them). The + user types a command, which can be the whole word (like "help") or any + abbreviation (like "hel", "he", or just "h"). If this does not match + any keywords, \ftablelook() returns -1; if it matches more than one (as + would "d"), it returns -2. Otherwise the array index is returned, 1 or + higher. + + Given the array index \%n, we can get the table values as follows: + + \fword(\&k[\%n],1) is the keyword (first field) + \fword(\&k[\%n],2) is the value (second field, in this case a number) + + In our example, we use the value (number) as the SWITCH variable. As + noted, \fablelook() expects the array elements to contain multiple + fields separated by colon (:) (or other character that you specify, + e.g. \ftablelook(\%a,&a,^)) and when matching the keyword, ignores the + first delimiter and everything after it. + + 7.10.8. Hints for Using Arrays + + C programmers are accustomed to out-of-bounds array references causing + core dumps or worse. In C-Kermit: + + * A reference to an an out-of-bounds array element returns the empty + string. + * An attempt to set the value of an array element that is out of + bounds or that has not been declared simply fails. + + C programmers expect an array of size nto have elements 0 through n-1. + Fortran programmers expect the same array to have elements 1 through n. + C-Kermit accommodates both styles; when you declare an array of size n, + it has n=1 elements, 0 through n, and you can use the array in your + accustomed manner, 0-based or 1-based. + + However, note that C-Kermit has certain biases towards 1-based arrays: + + * Assignment of file lists starts with element 1 ([611]Section + 7.10.3). + * Assignment by \fsplit() starts with element 1 ([612]Section 7.3). + * Array initialization skips the 0th element. To initialize a 0-based + array, use something like this: + declare \&a[3] = one two three + .\&a[0] = zero + + * The ARRAY SORT command skips the 0th element unless you include + /RANGE:0 + * The SHIFT command ignores element 0 of the \&_[] array. + + The distinction between an array's dimensioned size and the number of + elements in the array is important when sorting. To illustrate: + + declare \&a[100] ; Declare array &a with 100 elements + fopen /read \%c oofa.txt ; Open a file + if fail... + for \%i 1 \fdim(&a) 1 { ; Read the file into the array + fread \%c \&a[\%i] + if fail break + } + fclose \%c + if > \%i \fdim(&a) end 1 File has too many lines for array. + .\%n ::= \%i - 1 + echo File has \%n line(s). + + Let's say the file had 95 lines. This leaves elements 96-100 of the + array empty. Now suppose you sort the array and write out the result: + + sort &a ; Sort the whole array + fopen /write \%o oofa.txt.sorted ; Open an output file + if fail ... + for \%i 1 \%n 1 { ; Write out 95 records + fwrite /line \%o \&a[\%i] + if fail end 1 Write error + } + close write + + You might be surprised at the contents of "oofa.txt.sorted" -- five + empty elements, 96-100, floated to the top of the array in the sort, + and since your write loop only had 95 iterations, the final 5 lines of + the sorted file are lost. + + Therefore, when dealing with partially filled arrays -- especially when + sorting them -- remember to specify the number of elements. A handy way + of recording an array's "true" size is to put it in the 0th element. + That way, it "travels with the array". To illustrate (continuing the + previous example at the "close read" statement): + + close read + if > \%i \fdim(&a) end 1 File has too many lines for array. + .\&a[0] ::= \%i - 1 ; Assign number of lines to \&a[0]. + echo File has \&a[0] line(s). + sort /range:1:\&a[0] &a + open write oofa.txt.sorted + if fail ... + for \%i 1 \&a[0] 1 { + writeln file \&a[\%j] + if fail end 1 Write error + } + close write + + Note the SORT switch, /RANGE:1:\&a[0]. This keeps the sort 1-based, and + uses element 0 of the array as its size indicator. + + Finally, note that even though some commands or functions might put a + size in array element 0, no built-in functions or commands depend on a + size actually being there. Thus you are perfectly free to replace the + size with something else and treat the array as 0-based. + + 7.10.9. Do-It-Yourself Arrays + + Kermit's \&x[] arrays are nice because of the accompanying built-in + functionality -- ARRAY commands, built-in functions that load and + search arrays, automatic evaluation of arithmetic expressions within + the subscript brackets, and so on. Yet they also have certain + limitations: + + 1. Except when created by dynamic loading (e.g. by \ffiles()) they + must be declared and dimensioned in advance. + 2. Indices must be numeric, positive, and in range. + 3. There can be only one dimension. Matrices or other + higher-dimensioned arrays are not available. + + But none of this is to say you can't invent any kind of data structure + you like. In [613]Section 7.9.2 you can see some examples. Here's + another (courtesy of Dat Thuc Nguyen), in which a pair of matrices is + created and then added: no dimensioning necessary. + + .row = 4 + .col = 9 + + ; MACRO TO PRINT A MATRIX + define PMATRIX { + echo Matrix \%1: + for \%r 1 \m(row) 1 { + for \%c 1 \m(col) 1 { + xecho \flpad(\m(\%1[\%r][\%c]),4) + } + echo + } + echo + } + ; CREATE MATRICES A AND B + for \%r 1 \m(row) 1 { + for \%c 1 \m(col) 1 { + _eval A[\%r][\%c] \%r + \%c + _eval B[\%r][\%c] \%r * \%c + } + } + ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B + for \%r 1 \m(row) 1 { + for \%c 1 \m(col) 1 { + _eval C[\%r][\%c] \m(A[\%r][\%c]) + \m(B[\%r][\%c]) + } + } + pmatrix A ; Print Matrix A + pmatrix B ; Print Matrix B + pmatrix C ; Print Matrix C + + In the example, we use matrix-like notation to create macros with names + like "A[1][1]", "B[3][7]", and so on. + + 7.10.10. Associative Arrays + + An associative array is a special kind of Do-It-Yourself array. It + differs from a regular array in that its indices need not be numbers -- + they can be anything at all -- words, filenames, names of months, any + character string at all, and that it doesn't have to be (and in fact + can't be) declared. An associative array element is simply a macro + whose name ends with an index enclosed in angle brackets, for example: + + file + + More formally: + + basename + + An associative array is a collection of all associative array elements + that have the same basename. Any number of associative arrays, each + with any number of elements, can exist at the same time. + + An associative array element can be assigned a value, such as "1", just + like any other macro: + + define file 1 ; Give "file" the value "1". + + or: + + assign file \%a ; Give it the value of the variable \%a. + + However, since an associative array element is a macro, it may not have + an empty (null) value, since assigning an empty value to a macro + undefines the macro. + + You can refer to the value of an associative array element using the + familiar notation for macro values: + + echo \m(file) ; Echo the value of "file". + + Associative arrays are most useful, however, when the value of the + index is a variable. In that case, you must use the "hidden" forms of + the DEFINE or ASSIGN commands that evaluate the macro name before + making the assignment (see [614]Using C-Kermit, page 457). Example: + + define \%f oofa.txt + _define file<\%f> 1 + echo file<\%f> = \m(file<\%f>) + + prints: + + file = 1 + + and then: + + _increment file<\%f> + echo file<\%f> = \m(file<\%f>) + + prints: + + file = 2 + + What are associative arrays good for? The classic example is "word + counts": finding the number of times each word is used in a text + without knowing in advance what the words are. Without associative + arrays, your program would have to build a table of some kind, and + every time a word was encountered, look it up in the table to find its + position and counter, or add it to the table if it wasn't found -- a + time-consuming and laborious process. Associative arrays, however, let + you use the word itself as the table index and therefore sidestep all + the table building and lookups. + + Let's work through a practical example. Suppose you have a + file-transfer log in which each line is composed of a number of + blank-separated fields, and the 9th field is a filename (which happens + to be the format of certain FTP server logs, as well as of C-Kermit's + new FTP-format transaction log, described in [615]Section 4.17.2), for + example: + + Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt .... + + and you want to find out how many times each file was transferred. The + following code builds an associative array, file<>, containing the + counts for each file: + + local name line max \%c \%n ; Declare local variables + fopen /read \%c /var/log/ftpd.log ; Open the log file ([616]Section 1.22) + if fail exit 1 Can't open log ; Check + while true { ; Loop for each record + fread /line \%c line ; Read a line + if fail break ; Check for end of file + .name := \fword(\m(line),9,{ }) ; Get 9th field = filename (Sec 7.3) + _increment file<\m(name)> ; Increment its counter (Sec 7.9.2) + } + fclose \%c ; Close file when done. + + Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty + (i.e. nonexistent) variable as having a value of 0, and therefore + creates the variable with a value of 1. + + At this point, if you told Kermit to "show macro file<", it would list + the associative array. But since you don't necessarily know the names + of the files in the array, or even how many elements are in the array, + how can you use it in a script program? + + The idea of creating macro names that include character-string indices + enclosed in angle brackets is perfectly arbitrary and doesn't depend on + any Kermit features that weren't already there -- we could just as + easily have used some other notation, such as "file[index]", + "file:index", or "file.index", and the code above would have worked + just as well (with the corresponding syntax adjustments). But to be + able to use an associative array in a program after the array is built, + we need a method of accessing all its elements without knowing in + advance what they are. That's where the chosen notation comes in. + + First of all, any macro name that ends with "" (where "xxx" is any + string) is case sensitive, unlike all other macro names, which are case + independent. To illustrate, "file" and "file" are + two distinct macros, whereas "OOFA", "Oofa", and "oofa", when used as + macro names, are all the same. + + Second, the new \faaconvert() function converts an associative array + (that is, all macros with names of the form "base" that have the + same "base" part) into a pair of regular arrays and returns the number + of elements: + + \faaconvert(name,&a[,&b]) + + "name" is the name of the associative array, without the angle brackets + or index ("file" in our example). + + The second argument is the name of a regular array in which to store + the indices of the associative array (filenames in our example); if an + array of this name already exists, it is destroyed unless the array is + LOCAL. The third argument is the name of another regular array in which + to store the values (the counts in our example), with the same rules + about array name collisions. If you care only about the indices and not + the values, you can omit the third argument to \faaconvert(). In any + case, the associative array is converted, not copied: its elements are + moved to the specified regular arrays, so after conversion the original + associative array is gone. + + As with other array-loading functions, \faaconvert() sets element 0 of + each array to the number of elements in the array. + + To continue our example: + + .max := 0 ; Maximum count + .\%n := \faaconvert(file,&a,&b) ; Convert + for \%i 1 \%n 1 { ; Loop through values + echo \flpad(\%i,3). \&a[\%i]: \&b[\%i] ; Echo this pair + if ( > \&b[\%i] \m(max) ) { ; Check for new maximum + .name := \&a[\%i] + .max := \&b[\%i] + } + } + echo Most popular file: \m(name), accesses: \m(max) + + This lists the files and counts and then announces which file has the + highest count. + + Now suppose you want to sort the array pair created from an associative + array. In our example, \&a[] contains filenames, and \&b[] contains the + associated counts. Here we take advantage of the ARRAY SORT command's + ability to sort a second array according to the first one: + + array sort /reverse /numeric &b &a ; Descending sort by count + + Now to see the top five files and their counts: + + echo The top 5 files are: + for \%i 1 5 1 { ; Loop through top 5 values + echo \flpad(\%i,3). \&a[\%i]: \&b[\%i] ; Echo this pair + } + + 7.10.11. Transferring Array Contents to Other Computers + + The SEND /ARRAY:arrayname command ([617]Section 4.7.1) allows you to + send the contents of any array, or any contiguous segment of it, in + either text or binary mode to another computer, using Kermit protocol. + When used in conjunction with C-Kermit's other features (the array + features described in this section; the file i/o package from + [618]Section 1.22; its decision-making, pattern-matching, and string + manipulation capabilities, and so on) the possibilities are endless: + extracts of large files, remote database queries, ..., all without + recourse to system-dependent mechanisms such UNIX pipes and filters, + thus ensuring cross-platform portability of scripts that use these + features. + + When sending an array in text mode, Kermit appends a line terminator to + each array element, even empty ones, and it also converts the character + set from your current FILE character-set to your current TRANSFER + character-set, if any. No conversions are made or line terminations + added in binary mode. For example, the following array: + + dcl \&a[] = One Two Three Four Five Six + + is sent as six lines, one word per line, in text mode, and as the bare + unterminated string "OneTwoThreeFourFiveSix" in binary mode. + + You should always include a /TEXT or /BINARY switch in any SEND /ARRAY + command to force the desired transfer mode, otherwise you're likely to + be surprised by the effects described in [619]Section 4.3. + + Here are some examples: + + send /text /array:\&a[] + Sends the entire contents of the array \&a[] in text mode. Since + an as-name is not included, the receiver is told the filename is + _array_a_. + + send /text /array:&a[] + send /text /array:a[] + send /text /array:&a + send /text /array:a + These are all equivalent to the previous example. + + send /text /array:&a /as-name:foo.bar + As above, but the array is sent under the name foo.bar. + + send /text /array:&a[100:199] /as:foo.bar + As above, but only the elements from 100 through 199 are sent. + + In text-mode transfers, character sets are translated according to your + current settings, just as for text files. In binary mode, of course, + there is no character-set translation or other conversion of any kind. + But remember that array elements can not contain the NUL (ASCII 0) + character, since they are implemented as NUL-terminated strings. + + Here's an example that shows how to send all the lines (up to 1000 of + them) from a file animals.txt that contain the words "cat", "dog", or + "hog" (see [620]Section 4.9 about pattern matching): + + declare \&a[1000] + fopen /read \%c animals.txt + if fail exit 1 + .\%i = 0 + while true { + fread \%c line + if fail break + if match {\m(line)} {*{cat,[dh]og}*} { + increment \%i + if ( > \%i \fdim(&a) ) break + .\&a[\%i] := \m(line) + } + } + fclose \%c + send /array:a[1:\%i] /text + + Note that we are careful to send only the part of the array that was + filled, not the entire array, because there are likely to be lots of + unused elements at the end, and these would be sent as blank lines + otherwise. + + This example raises an interesting question: what if we want to send + ALL the matching lines, even if there are more than 1000 of them, but + we don't know the number in advance? Clearly the problem is limited by + Kermit's (and the computer's) memory. If there are a thousand trillion + matching lines, they most likely will not fit in memory, and in this + case the only solution is to write them first to a temporary file on + mass storage and then send the temporary file and delete it afterwards. + + However, when the selection is likely to fit in memory, the + once-familiar technique of initial allocation with extents can be used: + + if match {\m(line)} {*{cat,[dh]og}*} { + increment \%i + if ( > \%i \fdim(&a) ) { + array resize a \fdim(&a)+100 + if fail stop 1 MEMORY FULL + echo NEW DIMENSION: \fdim(&a) + } + .\&a[\%i] := \m(line) + } + + This grows the array in chunks of 100 as needed. + + 7.11. OUTPUT Command Improvements + + LINEOUT [ text ] + This command is exactly like OUTPUT, except it supplies a + carriage return at the end of the text. "lineout exit" is + exactly the same as "output exit\13". + + SET OUTPUT SPECIAL-ESCAPES { ON, OFF } + This command lets you tell C-Kermit whether to process \N, \L, + and \B specially in an OUTPUT command, as distinct from other \ + sequences (such as \%a, \13, \v(time), etc). Normally the + special escapes are handled. Use SET OUTPUT SPECIAL-ESCAPES OFF + to disable them. + + Disabling special escapes is necessary in situations when you need to + transmit lines of data and you have no control over what is in the + lines. For example, a file oofa.txt that contains: + + This is a file + It has \%a variables in it + And it has \B in it. + And it has \L in it. + And it has \N in it. + And this is the last line. + + can be sent like this: + + local line + set output special-escapes off + fopen /read \%c oofa.txt + if fail stop 1 Can't open oofa.txt + while success { + fread \%c line + if fail break + ; Add filtering or processing commands here... + output \m(line)\13 + } + + 7.12. Function and Variable Diagnostics + + In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing + function call was an empty value, which (a) could not be distinguished + from an empty value returned by a successful function call; (b) did not + give any indication of the cause of failure; and (c) did not cause the + enclosing statement to fail. C-Kermit 7.0 corrects these deficiencies. + + SET FUNCTION DIAGNOSTICS { ON, OFF } + when ON, allows built-in functions to return diagnostic messages + when improperly referenced, instead of an empty string. FUNCTION + DIAGNOSTICS are ON by default. When OFF, improperly referenced + functions continue to return an empty string. This command also + affects built-in variables; in this case, an error message is + returned only if the variable does not exist. When FUNCTION + DIAGNOSTICS are ON, the error message is also printed. + + For variables, the only message is: + + + + where "name" is the name of the nonexistent variable. + + For functions, the diagnostic message is: + + + + where "message" is replaced by a message, and "name" is replaced by the + function name, e.g. . Messages include: + + ARG_BAD_ARRAY An argument contains a malformed array reference. + ARG_BAD_DATE An argument contains a malformed date and/or time. + ARG_BAD_PHONENUM An argument contains a malformed telephone number. + ARG_BAD_VARIABLE An argument contains a malformed \%x variable. + ARG_INCOMPLETE An argument is incomplete (e.g. a broken Base64 string). + ARG_EVAL_FAILURE An argument could not be evaluated (internal error). + ARG_NOT_ARRAY An argument references an array that is not declared. + ARG_NOT_NUMERIC An argument that must be integer contains non-digits. + ARG_NOT_FLOAT An argument has bad floating-point number format. + ARG_NOT_VARIABLE An argument that must be a variable is not a variable. + ARG_OUT_OF_RANGE An argument's numeric value is too big or too small, + or an argument contains illegal characters (e.g. a hex + or Base-64 string). + ARG_TOO_LONG An argument's value is too long. + ARRAY_FAILURE Failure to create an array. + DIVIDE_BY_ZERO Execution of the function would cause division by zero. + FLOATING_POINT_OP Execution error in a floating-point operation. + FILE_NOT_FOUND Filename argument names a file that can't be found. + FILE_NOT_READABLE Filename argument is not a regular file. + FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected. + FILE_ERROR Other error with filename argument. + FILE_NOT_OPEN A file function was given a channel that is not open. + FILE_ERROR_-n A file function got error -n ([621]Section 1.22). + LOOKUP_FAILURE Error looking up function (shouldn't happen). + MALLOC_FAILURE Failure to allocate needed memory (shouldn't happen). + NAME_AMBIGUOUS The function is not uniquely identified. + MISSING_ARG A required argument is missing. + NO_SUCH_FUNCTION An argument references a function that is not defined. + NO_SUCH_MACRO An argument references a macro that is not defined. + RESULT_TOO_LONG The result of a function is too long. + UNKNOWN_FUNCTION Internal error locating function (shouldn't happen). + + Examples: + + assign \%m \fmod() + ? + echo "\fcontents(\%m)" + "" + echo \fmod(3,x) + ? + echo \fmod(3,4-2*2) + ? + + Notice the use of \fcontents() in echoing the value of a variable that + contains a returned error message. That's because the error message + includes the name of the variable or function that failed, so you must + use \fcontents() to prevent it from being evaluated again -- otherwise + the same error will occur. + + The handling of function and variable errors is controlled by: + + SET FUNCTION ERROR { ON, OFF } + Tells whether invalid function calls or variable references + should cause command errors. FUNCTION ERROR is ON by default. + When ON, and an error is diagnosed in a built-in function or + variable, the command that includes the function call or + variable reference fails. The failing command can be handled in + the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or + SET MACRO ERROR. + + When FUNCTION DIAGNOSTICS is OFF, there is no error message. + + SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR + settings. + + 7.13. Return Value of Macros + + In C-Kermit 5A and 6.0, there are two ways to return one level from a + macro: RETURN value and END number text. When RETURN is used, the + value, which can be a number or a text string, is assigned to + \v(return). When END was used, however, \v(return) was not set. + SUCCESS/FAILURE was set according to whether the number was zero, and + the text was printed, but the actual value of the number was lost. + + In C-Kermit 7.0, the END number is available in the \v(return) + variable. + + 7.14. The ASSERT, FAIL, and SUCCEED Commands. + + The ASSERT command is just like the IF command, but without a command + to execute. It simply succeeds or fails, and this can be tested by a + subsequent IF SUCCESS or IF FAILURE command. Example: + + ASSERT = 1 1 + IF SUCCESS echo 1 = 1. + + The FAIL command does nothing, but always fails. The SUCCEED command + does nothing, but always succeeds. + + These commands are handy in debugging scripts when you want to induce a + failure (or success) that normally would not occur, e.g. for testing + blocks of code that normally are not executed. + + 7.15. Using Alarms + + Alarms may be set in two ways: + + SET ALARM number + Sets an alarm for the given number of seconds "from now", i.e. + in the future, relative to when the SET ALARM command was given. + Examples: + + set alarm 60 ; 60 seconds from now + set alarm +60 ; The same as "60" + set alarm -60 ; Not legal - you can't set an alarm in the past. + set alarm 60*60 ; 60 minutes from now. + set alarm \%a+10 ; You can use variables, etc. + + SET ALARM hh:mm:ss + Sets an alarm for the specified time. If the given time is + earlier than the current time, the alarm is set for the given + time in the next day. You may give the time in various formats: + + set alarm 15:00:00 ; 3:00:00pm + set alarm 3:00:00pm ; 3:00:00pm + set alarm 3:00pm ; 3:00:00pm + set alarm 3pm ; 3:00:00pm + + SHOW ALARM + Displays the current alarm, if any, in standard date-time format + (see [622]Section 1.6): yyyymmdd hh:mm:ss. + + IF ALARM command + Executes the command if an alarm has been set and the alarm time + has passed. + + IF ALARM { command-list } [ ELSE { command-list } ] + Executes the command-list if an alarm has been set and the alarm + time has passed. Otherwise, if an ELSE part is given, its + command-list is executed. + + CLEAR ALARM + Clears the alarm. + + Only one alarm may be set at a time. + + Example: Suppose you have a script that is always running, and that + transfers files periodically, and that keeps a transaction log. Suppose + you want to start a new transaction log each day: + + log transactions \v(date).log + set alarm 00:00:00 ; Set an alarm for midnight + while true { ; Main script loop + xif alarm { ; If the alarm time is past... + close transactions ; Close current log + log transactions \v(date).log ; Start new one + pause 1 ; To make sure 00:00:00 is past + set alarm 00:00:00 ; Set a new alarm + } + ; put the rest of the script here... + } + + Note that IF ALARM -- no matter whether it succeeds or fails -- does + NOT clear an expired alarm. Thus, once an alarm has expired, every IF + ALARM will succeed until the alarm is cleared (with the CLEAR ALARM + command) or reset with a new SET ALARM command. + + 7.16. Passing Arguments to Command Files + + Beginning in version 7.0, C-Kermit accepts arguments on the TAKE + command line, for example: + + C-Kermit> take oofa.ksc one two {this is three} four + + This automatically sets the variables \%1 through \%9 to the arguments, + and \%0 to the name of the file, in this case: + + \%0 = /usr/olga/oofa.ksc + \%1 = one + \%2 = two + \%3 = this is three + \%4 = four + + and \%5..\%9 are undefined (empty). Arguments past the ninth are + available in the \&_[] argument-vector array ( [623]Section 7.5). + + The variables are those at the current macro level. Thus, if the TAKE + command is executed from within a macro, the macro's arguments are + replaced by those given on the TAKE command line (but only if at least + one argument is given). The command shown above is exactly equivalent + to: + + assign \%0 /usr/olga/oofa.ksc + assign \%1 one + assign \%2 two + assign \%3 this is three + assign \%4 four + assign \%5 + assign \%6 + assign \%7 + assign \%8 + assign \%9 + take oofa.ksc + + Remember, the variables \%0..\%9 are on the macro call stack, and + command files are independent of the macro stack. Thus, if a command + file TAKEs another command file and passes arguments to it, the + variables are changed from that point on for both files, and so forth + for all levels of nested command files without intervening macro + invocations. + + It would have been possible to change C-Kermit to use the overall + command stack, rather than the macro stack, for arguments -- this would + have made TAKE work exactly like DO, which is "nicer", but it would + also have broken countless existing scripts. However, the new SHIFT + command ([624]Section 7.5) makes it possible to create an alternative + TAKE command that does indeed save and restore the argument variables + at its own level around execution of a command file: + + define mtake { + local \%f + assign \%f \fcontents(\%1) + shift + take \%f + } + + C-Kermit 7.0 also supports a new, easier way to pass arguments to + scripts from the system command line: + + kermit filename arg1 arg2 arg3 ... + + in which arg1, arg2, arg3 (etc) are arguments for the script (whose + filename is given), and are assigned to \%1, \%2, ... \%9. The filename + is assigned to \%0. This applies equally to "Kerbang" scripts in UNIX + ([625]Section 7.19). For example, suppose you have a file called + "showargs" containing the following lines: + + #!/usr/local/bin/kermit + + echo Hello from \%0 + show args + exit + + (except not indented, since the "#!" line must be on the left margin). + If you give this file execute permission: + + chmod +x showargs + + then you can run it exactly as you would run a UNIX shell script, e.g.: + + $ showargs one two three + Hello from /usr/olga/showargs + Top-level arguments (\v(argc) = 4): + \&_[0] = /usr/olga/showargs + \&_[1] = one + \&_[2] = two + \&_[3] = three + + Furthermore, the \&_[] array now contains the filename, if one was + given as the first command line argument, or it is a "Kerbang" script, + in element 0. + + Otherwise element 0 is program name, and elements 1 through \v(argc)-1 + contain the command-line arguments, if any, that appear after "--" or + "=", if any. This array is saved and restored around macro calls; + recall that inside macros it contains the macro argument vector + (allowing you to access arguments programmatically, and to have more + than 9 of them). + + At top level, notice the difference between the \&@[] and \&_[] arrays. + The former includes C-Kermit options; the latter omits them. + + 7.17. Dialogs with Timed Responses + + The ASK, ASKQ, GETOK, and GETC commands (let's call them the "ASK-class + commands") let you write scripts that carry on dialogs with the user, + asking them for text, a Yes/No answer, or a character, respectively. + Prior to C-Kermit 7.0, these questions would always wait forever for an + answer. In C-Kermit 7.0, you may specify a time limit for them with the + new command: + + SET ASK-TIMER number + Sets a time-limit on ASK-CLASS commands to the given number of + seconds. If the number is 0 or less, there is no time limit and + these commands wait forever for a response. Any timer that is + established by this command remains in effect for all future + ASK-class commands until another SET ASK-TIMER command is given + (e.g. with a value of 0 to disable ASK timeouts). + + IF ASKTIMEOUT command + An ASK-class command that times out returns a failure status. + You can test explicitly for a timeout with: + + 7.18. Increased Flexibility of SWITCH Case Labels + + Prior to C-Kermit 7.0 / K95 1.1.19, the case labels in SWITCH + statements were string constants. + + Now case labels can be variables, function calls, or any mixture of + these with each other and/or with regular characters. + + Furthermore, after the case label is evaluated, it is treated not as a + string constant, but as a pattern against which the SWITCH variable is + matched ([626]Section 4.9.1). + + This introduces a possible incompatibility with previous releases, + since the following characters in case labels are no longer taken + literally: + + \ * ? [ { + + Any scripts that previously included any of these characters in case + labels must now quote them with backslash (\). + + 7.19. "Kerbang" Scripts + + In UNIX only, Kermit scripts can be stored in files and run "directly", + without starting Kermit first (as noted on page 467 of the manual), + just as a shell script can be "run" as if it were a program. This + section amplifies on that idea a bit, and presents some new aspects of + version 7.0 that make it easier to write and run Kermit scripts + directly. + + NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang scripts + can be run as "kermit + scriptfilename arg1 arg2 arg3 ...". Windows + 95/98/NT file associations do not allow for the passing of + parameters. In VMS, however, you can achieve the Kerbang effect by + defining a symbol, as in this example: + + $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC" + + and then running the script like any other command: + + $ autotelnet xyzcorp.com myuserid + + See [627]Section 9.3 for an explanation of the "+" symbol. + + UNIX shell scripts can specify which shell should run them by including + a "shebang" line at the top, e.g.: + + #!/bin/sh + + (but not indented; the shebang line must be on the left margin). The + term "shebang" is a contraction of "shell" and "bang". "Bang" is a + slang word for the exclamation mark ("!"); "shebang" itself is an + American slang word used in in the phrase "the whole shebang". + + We can run Kermit scripts directly too, by including a "shebang" line + that names Kermit as the "shell"; thus we call these "Kerbang" scripts. + This mechanism has been considerably simplified in C-Kermit 7.0 to + facilitate C-Kermit's use a scripting tool just like any of the UNIX + shells or scripting languages. The rules are the same as for shell + scripts: + + 1. The first line of the Kermit script must begin with "#!" + immediately followed by the full pathname of the program that will + execute the script (in this case, C-Kermit rather than a UNIX + shell), followed by any Kermit command-line options. To suppress + execution of the C-Kermit initialization file and to make command + line arguments available to the script, the final option should be + "+": + #!/usr/local/bin/kermit + + + Some users have reported that in some circumstances a space might + be necessary after the plus sign; this depends on your shell -- it + has nothing to do with Kermit. In most cases, no space is needed. + 2. The file must have execute permission (granted via "chmod +x + filename"). + + When C-Kermit is invoked from a Kerbang script (or from the system + prompt with a "+" command-line argument, which amounts to the same + thing), the following special rules apply: + + 1. The C-Kermit initialization file is NOT executed automatically. If + you want it to be executed, include a TAKE command for it in the + script, e.g. "take \v(home).kermrc". (In previous releases, the + initialization file was always executed, with no way to prevent it + except for the user to include Kermit-specific command line options + which had nothing to do with the script). Many scripts have no need + for the standard Kermit initialization file, which is quite lengthy + and not only delays startup of the script, but also spews forth + numerous messages that are most likely unrelated to the script. + 2. If the initialization file is not executed, neither is your + customization file, since the initialization file is the command + file from which the customization file is TAKEn. Again, you can + include a TAKE command for the initialization file if desired, or + for the customization file by itself, or for any other file. + 3. C-Kermit does not process command-line arguments at all. Instead, + it passes all words on the command line after the "+" to the script + as \%0 (the script name), \%1..\%9 (the first nine arguments), as + well as in the argument vector array \&_[]. The variable \v(argc) + is set to the total number of "words" (as passed by the shell to + Kermit) including the script name. Quoting and grouping rules are + those of the shell. + 4. At any point where the script terminates, it must include an EXIT + command if you want it to exit back to the shell; otherwise + C-Kermit enters interactive prompting mode when the script + terminates. The EXIT command can include a numeric status to be + returned to the shell (0, 1, etc), plus an optional message. + + Here is a simple Kerbang script that prints its arguments: + + #/usr/local/bin/kermit + + echo Hello from \%0 + for \%i 0 \v(argc)-1 1 { + echo \%i. "\&_[\%i]" + } + exit 0 + + Save this file as (say) "showargs", then give it execute permission and + run it (the \&_[] array is the same as \%0..\%9, but allows you to + refer to argument variables programmatically; see [628]Section 7.5). + (Yes, you could substitute SHOW ARGUMENTS for the loop.) + + $ chmod +x showargs + $ ./showargs one "this is two" three + + The script displays its arguments: + + Hello from /usr/olga/showargs + 0. "/usr/olga/showargs" + 1. "one" + 2. "this is two" + 3. "three" + $ + + Notice that no banners or greetings are printed and that startup is + instantaneous, just like a shell script. Also notice that grouping of + arguments is determined by *shell* quoting rules, not Kermit ones, + since the command line is parsed by the shell before Kermit ever sees + it. + + Of course you can put any commands at all into a Kerbang script. It can + read and write files, make connections, transfer files, anything that + Kermit can do -- because it *is* Kermit. And of course, Kerbang scripts + can also be executed from the Kermit prompt (or from another script) + with a TAKE command; the Kerbang line is ignored since it starts with + "#", which is a comment introducer to Kermit just as it is to the UNIX + shell. In VMS and other non-UNIX platforms, the Kerbang line has no + effect and can be omitted. + + It might be desireable for a script to know whether it has been invoked + directly from the shell (as a Kerbang script) or by a TAKE command + given to the Kermit prompt or in a Kermit command file or macro. This + can be done as in this example: + + #!/usr/local/bin/kermit + + assign \%m \fbasename(\%0) + define usage { exit 1 {usage: \%m phonenumber message} } + define apage { (definition of APAGE...) } ; (See [629]book pp.454-456) + xif equal "\%0" "\v(cmdfil)" { + if not def \%1 usage + if not def \%2 usage + apage {\%1} {\%2} + exit \v(status) + } + + In a Kerbang script, \%0 and \v(cmdfile) are the same; both of them are + the name of the script. When a script is invoked by a Kermit TAKE + command, \%0 is the name of the Kermit program, but \v(cmdfile) is the + name of the script. In the example above, a macro called APAGE is + defined. If the script was invoked directly, the APAGE macro is also + executed. Otherwise, it is available for subsequent and perhaps + repeated use later in the Kermit session. + + An especially handy use for Kerbang scripts is to have the + initialization file itself be one. Since the standard initialization + file is rather long and time-consuming to execute, it is often overkill + if you want to start Kermit just to transfer a file. Of course there + are command-line switches to suppress initialization-file execution, + etc, but another approach is to "run" the initialization file when you + want its features (notably the services directory), and run C-Kermit + directly when you don't. A setup like this requires that (a) the + C-Kermit initialization file is configured as a Kerbang script (has + #!/path.../kermit as first line), has execute permission, and is in + your PATH; and (b) that you don't have a .kermrc file in your login + directory. + + 7.20. IF and XIF Statement Syntax + + The IF command has been improved in two significant ways in C-Kermit + 7.0, described in the following subsections. All changes are backwards + compatible. + + 7.20.1. The IF/XIF Distinction + + The distinction between IF and XIF is no longer important as of + C-Kermit 7.0. You should be able to use IF in all cases (and of course, + also XIF for backwards compatibility). In the past, IF was used for + single-command THEN parts, followed optionally by a separate ELSE + command: + + IF condition command1 ; THEN part + ELSE command2 ; ELSE part + + whereas XIF was required if either part had multiple commands: + + XIF condition { command, command, ... } ELSE { command, command, ... } + + The syntactic differences were primarily that IF / ELSE was two + commands on two separate lines, whereas XIF was one command on one + line, and that XIF allowed (and in fact required) braces around its + command lists, whereas IF did not allow them. + + Furthermore, the chaining or nesting of parts and conditions was + inconsistent. For example, the IF command could be used like this: + + IF condition command + ELSE IF condition command + ELSE IF condition command + ELSE IF condition command + ... + + but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it + the same as previous versions, but also accepts a new unified and more + convenient syntax: + + IF condition command-list [ ELSE command-list ] + + or: + +IF condition command-list +ELSE command-list + + in which the ELSE part is optional, and where command-list can be a + single command (with or without braces around it) or a list of commands + enclosed in braces. Examples: + + Example 1: + + IF condition { command1, command2 } ELSE { command3, command4 } + + Example 2 (same as Example 1): + + IF condition { + command1 + command2 + } ELSE { + command3 + command4 + } + + Example 3 (same as 1 and 2): + + IF condition { + command1 + command2 + } + ELSE { command3, command4 } + + Example 4 (same as 1-3): + + IF condition { + command1 + command2 + } + ELSE { + command3 + command4 + } + + Example 5 (ELSE can be followed by another command): + + IF condition1 { + command1 + command2 + } ELSE IF condition2 { + command3 + command4 + } ELSE { + command5 + command6 + } + + Example 5 suggests other possibilities: + + IF condition { + command1 + command2 + } ELSE FOR variable initial final increment { + command3 + command4 + } + + And this too is possible, except for some non-obvious quoting + considerations: + + dcl \&a[6] = one two three four five six + + IF < \%n 3 { + echo \\%n is too small: \%n + } ELSE FOR \\%i 1 \\%n 1 { + echo \\%i. \\&a[\\%i] + } + + (The loop variable must be quoted in this context to prevent premature + evaluation.) + + Many C programmers prefer to code IF-ELSE, WHILE, FOR, and SWITCH with + the block-open bracket on its own line. This does not work in Kermit: + + IF condition ; THIS FORMAT DOES NOT NOT WORK + { + command1 + command2 + } + ELSE + { + command3 + command4 + } + + Explanation: the Kermit command language is line oriented; each line is + a command, each command is a line. The first line above, having no hint + of continuation, is an incomplete command, yet syntactically correct -- + an IF statement with an empty THEN part. Interestingly enough, since + the next line begins with "{" it is a block that (in [630]C-Kermit 8.0 + and later) is a block that is executed unconditionally. Thus the + commands in the THEN part are executed regardless of whether the + condition is true -- not what you wanted! + + The new block syntax used in the IF, WHILE, FOR, and SWITCH commands + employs certain tricks to allow multiple lines to be treated as a + single line: + + * Any line ending with "{" (ignoring whitespace and comments) marks + the beginning of a block; + * Any line beginning with "}" (ignoring whitespace) marks the end of + a block; + * Line breaks within a block separate commands; the comma is implied + by the line end. + + Thus: + + IF condition { + command1 + command2 + } ELSE { + command3 + command4 + } + + is "assembled" into: + + IF condition { command1, command2 } ELSE { command3, command4 } + + Note the addition of commas to separate commands within blocks. As + always, if you need continue a command onto additional lines, you can + end the continued lines with the continuation character, "-". You can + also do this if you want to put opening brackets on their own line: + + IF condition - + { + command1 + command2 + } + ELSE - + { + command3 + command4 + } + + 7.20.2. Boolean Expressions (The IF/WHILE Condition) + + Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a single + Boolean ("true or false") assertion, e.g. "if > \%m 0 command" or "if + exist filename command". There was no way to form Boolean expressions + and, in particular, nothing that approached a Boolean OR function (AND + could be simulated by concatenating IF statements: "if condition1 if + condition2.."). + + C-Kermit 7.0 (and K95 1.1.19) allow grouping of Boolean assertions + using parentheses and combining them using AND (or &&) and OR (or ||). + Each of these operators -- including the parentheses -- is a field and + must be set off by spaces. AND has higher precedence than OR, NOT has + higher precedence than AND, but parentheses can be used to force any + desired order of evaluation. The old syntax is still accepted. + + Here are some examples: + + define \%z 0 ; Define some variables + define \%n 1 ; for use in the examples. + + if > \%n \%z echo \%n is greater. ; Original format - still accepted. + if ( > \%n \%z ) echo \%n is greater. ; Parentheses may be used in 7.0. + if ( > \%n \%z && not = \%z 0 ) ... ; Two assertions combined with AND. + if ( > \%n \%z and not = \%z 0 ) ... ; Same as previous ("and" = "&&"). + if ( > \%n \%z || not = \%z 0 ) ... ; Two assertions combined with OR. + if ( > \%n \%z or not = \%z 0 ) ... ; Same as previous ("or" = "||"). + if ( > \%n \%z || != \%z 0 ) ... ; Ditto ("!=" = "not ="). + while ( 1 ) { ... } ; Just like C. + + Notice the spaces around all operators including the parentheses -- + these are required. The following examples show how parentheses can be + used to alter the precedence of the AND and OR operators: + + if ( false || false && false || true ) ,.. ; True + if ( false || ( false && false ) || true ) ... ; Same as previous + if ( ( false || false ) && ( false || true ) ) ... ; False + + Similarly for NOT: + + if ( not true && false ) ... ; False (NOT binds to TRUE only) + if ( ( not true ) && false ) ... ; Same as previous + if ( not ( true && false ) ) ... ; True (NOT binds to (TRUE && FALSE)) + + Notes: + + 1. The syntax of the Boolean expression itself has not changed; each + expression begins with a keyword or token such as "EXIST", ">", or + "=", etc; operators such as "<", "=", and ">" do not go between + their operands but precede them as before; this might be called + "reverse reverse Polish notation"; it allows deterministic + on-the-fly parsing of these expressions at the C-Kermit> prompt as + well as in scripts, and allows ?-help to be given for each item + when IF or WHILE commands are typed at the prompt. + 2. Parentheses are required when there is more than one Boolean + assertion. + 3. Parentheses are not required, but are allowed, when there is only + one Boolean assertion. + 4. Evaluation of Boolean assertions occurs left to right, but the + resulting Boolean expression is evaluated afterwards according to + the rules of precedence. All Boolean assertions are always + evaluated; there is no "early stopping" property and therefore no + question about when or if side effects will occur -- if any Boolean + assertion has side effects, they will always occur. + + Constructions of arbitrary complexity are possible, within reason. + + Also see [631]Section 7.4 for new IF / WHILE conditions. + + 7.21. Screen Formatting and Cursor Control + + C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN + command: + + SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] } + Performs screen-formatting actions. Correct operation of these + commands depends on proper terminal setup on both ends of the + connection -- mainly that the host terminal type is set to agree + with the kind of terminal or the emulation you are viewing + C-Kermit through. The UNIX version uses terminfo or termcap (not + curses); the VMS version uses SMG; K-95 uses its built in screen + manager. + + SCREEN CLEAR + Moves the cursor to home position and clears the entire screen. + Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR + SCREEN. + + SCREEN CLEOL + Clears from the current cursor position to the end of the line. + Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only) + + SCREEN MOVE-TO row column + Moves the cursor to the indicated row and column. The row and + column numbers are 1-based, so on a 24x80 screen the home + position is 1 1 and the lower right corner is 24 80. If a row or + column number is given that too large for what Kermit or the + operating system thinks is your screen size, the appropriate + number is substituted. + + These escape sequences used by these commands depends on the platform. + In UNIX, your TERM environment variable is used to query the + terminfo/termcap database; if the query fails, ANSI/VT100 sequences are + used. In VMS, the SMG library is used, which sends sequences based on + your VMS terminal type. K95 does its own screen control. On other + platforms (such as AOS/VS, VOS, etc), screen formatting is not + supported, and the SCREEN command does nothing. + + The three SCREEN actions can be used in scripts to produce menus, + formatted screens, dynamic displays, etc. Related variables include: + + \v(terminal) The type terminal C-Kermit thinks you have. + \v(rows) The number of rows C-Kermit thinks your terminal has. + \v(columns) The number of columns C-Kermit thinks your terminal has. + + And functions: + + \fscrncurx() The current X coordinate of the cursor (K-95 only). + \fscrncury() The current Y coordinate of the cursor (K-95 only). + \fscrnstr(x,y,n) The string of length nat position (x,y) (K-95 only). + + And commands: + + ECHO string Writes string + CRLF at the current cursor position. + XECHO string Writes string at current cursor position; CRLF not supplied. + GETC v prompt Issues prompt, reads one character into variable v, no echo. + + And special characters: + + Ctrl-L At the C-Kermit> command prompt, or in a C-Kermit command, + works like Return or Enter, but also clears the screen + + Example 1: A macro that prints a message \%1 at cursor position + (\%2,\%3): + + define MSG { + if not def \%3 def \%3 0 ; Default column to 0 + if > \v(argc) 2 screen move \%2 \%3 ; Move to given row/col (if any) + screen cleol ; Clear to end of line + if def \%1 xecho \fcontents(\%1) ; Print message (if any) + } + + Example 2: A macro put the cursor on the bottom screen line, left + margin: + + define BOT { + screen move \v(rows) 0 + } + + Example 3: A macro to center message \%1 on line \%2. + + define CENTER { + if not def \%2 def \%2 1 + .\%x ::= (\v(cols)-\flen(\%1))/2 + msg {\%1} {\%2} {\%x} + } + + Example 4: A simple menu (building on Examples 1-3): + + def \%c 0 ; Menu choice variable + screen clear ; Clear the screen + center {Welcome to This Menu} 2 ; Display the menu + msg {Choices:} 4 + msg { 1. File} 6 + msg { 2. Edit} 7 + msg { 3. Exit} 8 + while ( != \%c 3 ) { ; Read and verify choice + while true { ; Keep trying till we get a good one + screen move 10 ; Move to line 10 + screen cleol ; Clear this line + getc \%c {Your choice: } ; Prompt and get and echo 1 character + xecho \%c + if ( not numeric \%c ) { msg {Not numeric - "\%c"} 12, continue } + if ( >= \%c 1 && <= \%c 3 ) break + msg {Out of range - "\%c"} 12 + } + switch \%c { ; Valid choice - execute it. + :1, msg {Filing... } 12, break + :2, msg {Editing...} 12, break + :3, msg {Exiting...} 12, break + } + } + echo Bye ; Exit chosen - say goodbye. + bot ; Leave cursor at screen bottom. + exit ; And exit. + + Similar scripts can work over the communication connection; substitute + INPUT and OUTPUT for GETC and ECHO/XECHO. + + 7.22. Evaluating Arithmetic Expressions + + A new arithmetic operator was added to the list recognized by the + EVALUATE command, the \feval() function, and which can also be used + anywhere else arithmetic expressions are accepted (numeric command + fields, array subscripts, etc): + + Prefix "!" + This operator inverts the "truth value" of the number or + arithmetic expression that follows. If the value of the operand + is 0, the result is 1. If the value is nonzero, the result is 0. + + Examples: + + set eval old + evaluate 0 + 0 + + evaluate !0 + 1 + + evaluate !3 + 0 + + evaluate !(-3) + 0 + + .\%a = 1 + .\%b = 0 + evaluate !(\%a|\%b) + 0 + + evaluate !(\%a&\%b) + 1 + + evaluate !(!(\%a&\%b)) + 0 + + Note the distinction between Prefix ! (invert truth value) and Suffix ! + (factorial). Also the distinction between Prefix ! and Prefix ~ (which + inverts all the bits in its operand). Also note that prefix operators + (!, -, and ~) can not be adjacent unless you use parentheses to + separate them, as shown in the final example above. + + 7.23. Floating-Point Arithmetic + + C-Kermit 7.0 adds limited support for floating-point numbers (numbers + that have fractional parts, like 3.141592653). This support is provided + through a small repertoire of functions and in Boolean expressions that + compare numbers, but does not apply to number parsing in general, or to + expression evaluation, array subscripts, the INCREMENT and DECREMENT + commands, or in any context other than those listed in this section. + + A floating point number has an optional sign (+ or -), followed by a + series of decimal digits containing either zero or one period (.) + character, which is the decimal point. The use of comma or any other + character besides period as a decimal point is not supported. + Scientific notation is not supported either. Examples of legal + floating-point numbers: + + 0 Integers can be used + 1 Ditto + 2. A decimal point without decimal digits + 3.0 A decimal point with decimal digits + 3.141592653 Ditto + -4.0 A negative sign can be included + +5.0 A positive sign can be included + + Examples of notations that are not accepted: + + 1,000,000 Separators can not be used + 1.000.000 Ditto (or multiple decimal points) + 6.022137E23 No scientific notation + 6.62606868e-34 Ditto + 12.5+6.25 No "bare" expressions + + You can use IF FLOAT test a string or variable to see if it's in + acceptable floating-point format. Example: + + ask \%f { Type a number: } + if not def \%f .\%f = 0.0 + if not float \%f stop 1 Invalid floating-point number: "\%f" + + C-Kermit's floating-point support, like its support for whole numbers + (integers), relies on the capabilities of the underlying computer. Your + computer has only a limited amount of precision for numbers, depending + on its architecture. Thus floating-point numbers that have too many + digits will not be accurate; adding a very small number to a very large + one might have no effect at all; and so on. For details, read a text on + numerical analysis. Example: + + .\%a = 11111111111111111111 ; A long number + .\%b = 22222222222222222222 ; Another one + echo \ffpadd(\%a,\%b) ; Add them - the result should be all 3's + 33333333333333330000.0 ; See the result + + In this example, the computer has 16 digits of precision; after that, + the (low-order) digits are set to 0, since the computer doesn't know + what they really are. In fact, the computer returns random digits, but + Kermit sets all digits beyond the computer's precision to 0. + + C-Kermit's floating-point functions have names of the form + "\ffpxxx(args)" ("\f" for function, "fp" for floating-point), where + "xxx" is replaced by the name of the function, such as "sqrt", and + "args" is the argument list, consisting of one or two floating-point + numbers (depending on the function), and an optional "d" argument that + says now many decimal places should be shown in the result. Example: + + \ffpdiv(10,3,1) returns "3.3" + \ffpdiv(10,3,2) returns "3.33" + \ffpdiv(10,3,3) returns "3.333" + + and so on, up to the precision of the computer. If the decimal-places + argument is less than zero, the fractional part of the result is + truncated: + + \ffpdiv(10,3,-1) returns "3". + + If the decimal-places argument is 0, or is omitted, C-Kermit returns as + many decimal places as are meaningful in the computer's floating-point + precision, truncating any extraneous trailing 0's: + + \ffpdiv(10,8) returns "1.25". + \ffpdiv(10,4) returns "2.5". + \ffpdiv(10,2) returns "5.0". + \ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision). + + There is no way to request that a floating-point function return a + decimal point but no decimal places. However, this is easy enough to + accomplish in other ways, for example by supplying it outside the + function call: + + echo \ffpadd(\%a,\%b,-1). + + Kermit's floating-point functions always round the result for the + requested number of decimal places when the "d" argument is given and + has a value greater than 0 (see the description of \ffpround() just + below). + + Floating-point arguments can be constants in floating-point format or + variables whose values are floating-point numbers. If a floating-point + argument is omitted, or is a variable with no value, 0.0 is supplied + automatically. Example: + + def \%x 999.999 + undef \%y + echo \ffpmin(\%x,\%y) + 0.0 + + Or equivalently: + + echo \ffpmin(999.999) + 0.0 + + The floating-point functions are: + + \ffpround(f1,d) + Returns f1 rounded to d decimal places. For this function only, + d = 0 (or d omitted) has a special meaning: return the integer + part of f1 rounded according to the fractional part. Examples: + + \ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding). + \ffpround(2.74653,0) returns "3" (integer part is rounded). + \ffpround(2.74653) returns "3" (d omitted same as d = 0). + \ffpround(2.74653,1) returns "2.7". + \ffpround(2.74653,2) returns "2.75". + \ffpround(2.74653,3) returns "2.747". + \ffpround(2.74653,4) returns "2.7465", etc. + + \ffpadd(f1,f2,d) + Returns the sum of f1 and f2. + + \ffpsubtract(f1,f2,d) + Subtracts f2 from f1 and returns the result. + + \ffpmultiply(f1,f2,d) + Returns the product of f1 and f2. + + \ffpdivide(f1,f2,d) + If f2 is not 0, divides f1 by f2 and returns the quotient. + If f2 is 0, a DIVIDE_BY_ZERO error occurs. + + \ffpraise(f1,f2,d) + If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional + part, an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to + the f2 power is returned. + + \ffpsqrt(f1,d) + If f1 >= 0, returns the square root of f1; otherwise + ARG_OUT_OF_RANGE. + + \ffpabsolute(f1,d) + Returns the absolute value of f1 (i.e. f1 without a sign). This + is the floating-point analog of \fabsolute(n1). + + \ffpint(f1) + Returns the integer part of f1. Equivalent to \ffpround(f1,-1). + + \ffpexp(f1,d) + The base of natural logarithms, e (2.718282...), raised to the + f1 power. + + \ffplogn(f1,d) + The natural logarithm of f1 (the power to which e must be raised + to obtain f1). + + \ffplog10(f1,d) + The base-10 logarithm of f1 (the power to which 10 must be + raised to obtain f1). + + \ffpmodulus(f1,f2,d) + If f2 is not 0, the remainder after dividing f1 by f2. + If f2 is 0, a DIVIDE_BY_ZERO error occurs. + This is the floating-point analog of \fmod(n1,n2). + + \ffpmaximum(f1,f2,d) + Returns the maximum of f1 and f2. This is the floating-point + analog of \fmax(n1,n2). + + \ffpminimum(f1,f2,d) + Returns the minimum of f1 and f2. This is the floating-point + analog of \fmin(n1,n2). + + \ffpsine(f1,d) + Returns the sine of f1 radians. + + \ffpcosine(f1,d) + Returns the cosine of f1 radians. + + \ffptangent(f1,d) + Returns the tangent of f1 radians. + + Note that all of these functions can be used with integer arguments. If + you want an integer result, specify d = -1 (to truncate) or feed the + result to \ffpround(xxx,0) (to round). + + Floating-point numbers (or variables or functions that return them) can + be used in Boolean expressions (see [632]Section 7.20.2) that compare + numbers: + + = x y + != x y + < x y + > x y + <= x y + >= x y + + In these examples, x and y can be either integers or floating-point + numbers in any combination. In an arithmetic comparison of an integer + and a floating-point number, the integer is converted to floating-point + before the comparison is made. Examples: + + .\%t = 3.000000000 + .\%f = 3.141592653 + .\%i = 3 + + if > \%f \%i echo Pi is greater. + if = \%t \%i echo "\%i" = "\%t". + + A floating-point number can also be used in: + + IF number command + + where the command is executed if the number is nonzero. If the number + is floating-point, the command is not executed if the number is 0.0, + and is executed otherwise. + + Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see + [633]Section 7.10.5 ). + + Two floating-point constants are provided: + + \v(math_pi) = Pi (3.141592653...) + \v(math_e) = e, the base of natural logarithms (2.71828...) + + These are given to the computer's precision, e.g. 16 digits. This + number itself is available in a variable: + + \v(math_precision) + How many significant digits in a floating-point number. + + 7.24. Tracing Script Execution + + The TRACE command is handy for debugging scripts. + + TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ] + Selects tracing of the given object. + + Optional switches are /ON and /OFF. If no switch is given, /ON is + implied. The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL. The + default object is ALL, meaning to select all trace objects (besides + ALL). Thus TRACE by itself selects tracing of everything, as does TRACE + /ON, and TRACE /OFF turns off all tracing. + + When tracing of ASSIGNMENTS is on, every time the value of any + user-defined variable or macro changes, C-Kermit prints one of the + following: + + >>> name: "value" + The name of the variable or macro followed by the new value in + quotes. This includes implicit macro-parameter assignments + during macro invocation. + + >>> name: (undef) + This indicates that the variable or macro has been undefined. + + <<< name: "value" + For RETURN statements: the name of the macro and the return + value. + + <<< name: (null) + For RETURN statements that include no value or an empty value. + + When tracing of COMMAND-LEVEL is on, C-Kermit prints: + + [n] +F: "name" + Whenever a command file is entered, where "n" is the command + level (0 = top); the name of the command file is shown in + quotes. + + [n] +M: "name" + Whenever a macro is entered; "n" is the command level. The name + of the macro is shown in quotes. + + [n] -F: "name" + Whenever a command file is reentered from below, when a macro or + command file that it has invoked has returned. + + [n] -M: "name" + Whenever a macro is reentered from below. + + For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET + MACRO, and of course, ECHO. + + 7.25. Compact Substring Notation + + It is often desirable to extract a substring from a string which is + stored in a variable, and for this we have the \fsubstring() function, + which is used like this: + + define \%a 1234567890 + echo \fsubstring(\%a,3,4) ; substring from 3rd character length 4 + 3456 + + or like this with macro-named variables: + + define string 1234567890 + echo \fsubstring(\m(string),3,4) + 3456 + + C-Kermit 7.0 adds a pair of alternative compact notations: + +\:(variablename[start:length]) <-- Substring of variable's value +\s(macroname[start:length]) <-- Substring of macro's definition + + These are exactly equivalent to using \fsubstring(), except more + compact to write and also faster since evaluation is in one step + instead of two. + + The "\:()" notation can be used with any Kermit variable, that is, + almost anything that starts with a backslash: + + \:(\%a[2:6]) <-- equivalent to \fsubstring(\%a,2,6) + \:(\&x[1][2:6]) <-- equivalent to \fsubstring(\&x[1],2,6) + \:(\m(foo)[2:6]) <-- equivalent to \fsubstring(\m(foo),2,6) + \:(\v(time)[2:6]) <-- equivalent to \fsubstring(\v(time),2,6) + \:(\$(TERM)[2:6]) <-- equivalent to \fsubstring(\$(TERM),2,6) + \:(ABCDEFGH[2:6]) <-- equivalent to \fsubstring(ABCDEFGH,2,6) + + Whatever appears between the left parenthesis and the left bracket is + evaluated and then the indicated substring of the result is returned. + + The "\s()" notation is the same, except after evaluating the variable, + the result is treated as a macro name and is looked up in the macro + table. Then the indicated substring of the macro definition is + returned. Example: + + define testing abcdefghijklmnopqrstuvwxyz + define \%a testing + + \s(testing[2:6]) --> bcdefg + \:(testing[2:6]) --> esting + \:(\%a[2:6]) --> esting + \s(\%a[2:6]) --> bcdefg + + Note that the following two examples are equivalent: + + \:(\m(foo)[2:6]) + \s(foo[2:6]) + + The first number in the brackets is the 1-based starting position. If + it is omitted, or less than 1, it is treated as 1. If it is greater + than the length of the string, an empty string is returned. + + The second number is the length of the desired substring. If the second + number is omitted, is less than 0, or would be past the end of the + string, then "through the end of the string" is assumed. If it is 0, + the empty string is returned. + + If the brackets are empty or omitted, the original string is returned. + + The starting position and length need not be literal numbers; they can + also be variables, functions, arithmetic expressions, or even other + \s() or \:() quantities; anything that evaluates to a number, for + example: + + \s(block[1025:\fhex2n(\s(block[\%b:\%n+4]))/2]) + + Syntactically, \m(name) and \s(name) differ only in that the sequence + [*] at the end of the name (where * is any sequence of 0 or more + characters) is treated as substring notation in \s(name), but is + considered part of the name in \m(name) (to see why, see [634]Section + 7.10.9). + + 7.26. New WAIT Command Options + + The WAIT command has been extended to allow waiting for different kinds + of things (formerly it only waited for modem signals). Now it also can + wait for file events. + + 7.26.1. Waiting for Modem Signals + + The previous syntax: + + WAIT time { CD, DSR, RTS, RI, ... } + + has changed to: + + WAIT time MODEM-SIGNALS { CD, DSR, RTS, RI, ... } + + However, the previous syntax is still accepted. The behavior is the + same in either case. + + 7.26.2. Waiting for File Events + + The new WAIT option: + + WAIT time FILE { CREATION, DELETION, MODIFICATION } filename + + lets you tell Kermit to wait the given amount of time (or until the + given time of day) for a file whose name is filename to be created, + deleted, or modified, respectively. The filename may not contain + wildcards. If the specified event does not occur within the time limit, + or if WAIT CANCELLATION is ON and you interrupt from the keyboard + before the time is up, the WAIT command fails. If the event is + MODIFICATION and the file does not exist, the command fails. Otherwise, + if the given event occurs within the time limit, the command succeeds. + Examples: + + WAIT 600 FILE DELETION oofa.tmp + Wait up to 10 minutes for file oofa.tmp to disappear. + + WAIT 23:59:59 FILE MOD orders.db + Wait until just before midnight for the orders.db file to be + changed. + + Example: Suppose you want to have the current copy of /etc/motd on your + screen at all times, and you want to hear a bell whenever it changes: + + def \%f /etc/motd ; The file of interest. + while 1 { ; Loop forever... + cls ; Clear the screen. + echo \%f: \v(date) \v(time)... ; Print 2-line heading... + echo + if ( not exist \%f ) { ; If file doesn't exist, + echo \%f does not exist... ; print message, + wait 600 file creat \%f ; and wait for it to appear. + continue + } + beep ; Something new - beep. + type /head:\v(rows-2) \%f ; Display the file + if fail exit 1 \%f: \ferrstring() ; (checking for errors). + wait 999 file mod \%f ; Wait for it to change. + } + + This notices when the file is created, deleted, or modified, and acts + only then (or when you interrupt it with); the time shown in the + heading is the time of the most recent event (including when the + program started). + + See [635]Section 1.10, where the \v(kbchar) variable is explained. This + lets you modify a loop like the one above to also accept + single-character commands, which interrupt the WAIT, and dispatch + accordingly. For example: + + wait 999 file mod \%f ; Wait for the file to change. + if defined \v(kbchar) { ; Interrupted from keyboard? + switch \v(kbchar) { ; Handle the keystroke... + :q, exit ; Q to Quit + :h, echo blah blah, break ; H for Help + :default, beep, continue ; Anything else beep and ignore + } + } + + This lets you write event-driven applications that wait for up to three + events at once: a file or modem event, a timeout, and a keystroke. + + 7.27. Relaxed FOR and SWITCH Syntax + + For consistency with the extended IF and WHILE syntax, the FOR and + SWITCH control lists may (but need not be) enclosed in parentheses: + + FOR ( \%i 1 \%n 1 ) { command-list... } + SWITCH ( \%c ) { command-list... } + + In the FOR command, the increment item can be omitted if the control + list is enclosed in parentheses, in which case the increment defaults + appropriately to 1 or -1, depending on the values of the first two + variables. + + As with IF, the parentheses around the FOR-command control list must be + set off by spaces (in the SWITCH command, the spaces are not required + since the SWITCH expression is a single arithmetic expression). + + Also, outer braces around the command list are supplied automatically + if you omit them, e.g.: + + FOR ( \%i 1 %n 1 ) echo \%i + + 8. USING OTHER FILE TRANSFER PROTOCOLS + + In C-Kermit 7.0, alternative protocols can be selected using switches. + Switches are described in [636]Section 1.5; the use of + protocol-selection switches is described in [637]Section 4.7.1. + Example: + + send /binary /protocol:zmodem x.tar.gz + + Note that file transfer recovery works only with Kermit and Zmodem + protocols. With Zmodem, recovery can be initiated only by the sender. + + Only pre-1988 versions of the publicly-distributed sz/rz programs use + Standard I/O; those released later than that do not use Standard I/O + and therefore do not work with REDIRECT. However, Omen Technology does + offer an up-to-date redirectable version called crzsz, which must be + licensed for use: + + "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers when + called by dial-out programs such as Kermit and certain versions of + cu(1). They are clients designed for this use. + + "Crz and Csz are Copyrighted shareware programs. Use of these + programs beyond a brief evaluation period requires registration. + Please print the "mailer.rz" file, fill out the form and return same + with your registration." + + To use the crzsz programs as your external XYZMODEM programs in + C-Kermit, follow the instructions in the book, but put a "c" before + each command, e.g.: + + set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz + + To use Zmodem protocol over Telnet or other non-transparent + connections, you might need to add the -e (Escape) option: + + set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz + + 9. COMMAND-LINE OPTIONS + + 9.0. Extended-Format Command-Line Options + + Standard UNIX command line options are a single letter. C-Kermit has + run out of letters, so new options are in a new extended format: + + --word[:arg] + + where a keyword (rather than a single letter) specifies the function, + and if an argument is to be included, it is separated by a colon (or + equal sign). Most of the new extended-format command-line options are + only for use with the Internet Kermit Service Daemon; see the [638]IKSD + Administration Guide for details. However, several of them are also + general in nature: + + --nointerrupts + Disables keyboard interrupts that are normally enabled, which + are usually Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX + only, to suspend C-Kermit). + + --help + Lists the extended command-line options that are available in + your version of C-Kermit. If any options seem to be missing, + that is because your copy of C-Kermit was built with + compile-time options to deselect them. + + --helpfile:filename + Specifies the name of a file to be displayed if the user types + HELP (not followed by a specific command or topic), in place of + the built-in top-level help text. The file need not fit on one + screen; more-prompting is used if the file is more than one + screen long if COMMAND MORE-PROMPTING is ON, as it is by + default. + + --bannerfile:filename + The name of a file containing a message to be printed after the + user logs in, in place of the normal message (Copyright notice, + "Type HELP or ? for help", "Default transfer mode is...", etc). + + --cdmessage:{on,off,0,1,2} + For use in the Server-Side Server configuration; whenever the + client tells the server to change directory, the server sends + the contents of a "read me" file to the client's screen. This + feature is On by default, and operates only in client/server + mode when ON or 1. If set to 2 or higher, it also operates when + the CD command is given at the IKSD> prompt. Synonym: --cdmsg. + + --cdfile:filename + When cdmessage is on, this is the name of the "read me" file to + be sent. Normally you would specify a relative (not absolute) + name, since the file is opened using the literal name you + specified, after changing to the new directory. Example: + + --cdfile:READ.ME + + You can also give a list of up to 8 filenames by (a) enclosing + each filename in braces, and (b) enclosing the entire list in + braces. Example: + --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this- + first}} When a list is given, it is searched from left to right + and the first file found is displayed. The default list for UNIX + is: + + {{./.readme}{README.TXT}{READ.ME}} + + 9.1. Command Line Personalities + + Beginning in version 7.0, if the C-Kermit binary is renamed to "telnet" + (or TELNET.EXE, telnet.pr, etc, depending on the platform), it accepts + the Telnet command line: + + telnet [ host [ port ] ] + + In Unix, you can achieve the same effect with a symlink: + + cd /usr/bin + mv telnet oldtelnet + ln -ls /usr/local/bin/kermit telnet + + When installed in this manner, C-Kermit always reads its initialization + file. If no host (and therefore no port) is given, C-Kermit starts in + interactive prompting mode. If a host is given as the first + command-line argument, C-Kermit makes a connection to it. The host + argument can be an IP host name or address, or the name of a TCP/IP + entry in your C-Kermit network directory. + + If a port is given, it is used. If a port is not given, then if the + hostname was found in your network directory and port was also listed + there, then that port is used. Otherwise port 23 (the Telnet port) is + used. + + When C-Kermit is called "telnet" and it is invoked with a hostname on + the command line, it exits automatically when the connection is closed. + While the connection is open, however, you may escape back and forth as + many times as you like, transfer files, etc. + + An rlogin personality is also available, but it is less useful, at + least in UNIX and VMS, where the Rlogin TCP port is privileged. + + The new variable \v(name) indicates the name with which C-Kermit was + invoked ("kermit", "wermit", "k95", "telnet", etc). + + 9.2. Built-in Help for Command Line Options + + "kermit -h", given from the system prompt, lists as many command-line + options as will fit on a standard 24x80 screen. For more comprehensive + help, use the interactive HELP OPTIONS command that was added in + C-Kermit 7.0: + + HELP OPTIONS + Explains how command-line options work, their syntax, etc. + + HELP OPTIONS ALL + Lists all command-line options and gives brief help about each one. + + HELP OPTION x + Gives brief help about option "x". + + HELP EXTENDED-OPTIONS + Lists the available extended-format command-line options. + + HELP EXTENDED-OPTION xxx + Gives help for the specified extended option. + + 9.3. New Command-Line Options + + Command-line options added since C-Kermit 6.0 are: + + + + (plus sign by itself): The next argument is the name of a script + to execute; all subsequent arguments are ignored by C-Kermit + itself, but passed to the script as top-level copies of \%1, + \%2, etc; the \&_[] is also set accordingly. \%0 and \&_[0] + become the name of the script file, rather than the pathname of + the C-Kermit program, which is its normal value. Primarily for + use in the top line of "Kerbang" scripts in UNIX (see + [639]Section 7.19). Example from UNIX command line: + + $ kermit [ regular kermit args ] + filename + + Sample first line of Kerbang script: + + #!/usr/local/bin/kermit + + + -- + (two hyphens surrounded by whitespace) Equivalent to "=", for + compatibility with UNIX getopt(1,3). + + -G + GET (like -g), but send the incoming file to standard output. + Example: "kermit -G oofa.txt | lpr" retrieves a file from your + local computer (providing it is running a Kermit program that + supports the autodownload feature and has it enabled) and prints + it. + + -O + equivalent to -x (start up in server mode), but exits after the + first client command has been executed (mnemonic: O = Only One). + This one is handy replacing "kermit -x" in the "automatically + start Kermit on the other end" string: + + set protocol kermit {kermit -ir} {kermit -r} {kermit -x} + + since -x leaves the remote Kermit in server mode after the + transfer, which can be confusing, whereas -O makes it go away + automatically after the transfer. + + -L + Recursive, when used in combination with -s (mnemonic: L = + Levels). In UNIX or other environments where the shell expands + wildcards itself, the -s argument, if it contains wildcards, + must be quoted to prevent this, e.g.: + + kermit -L -s "*.c" + + In UNIX only, "kermit -L -s ." means to send the current + directory tree. See [640]Sections 4.10 and [641]4.11 about + recursive file transfer. + + -V + Equivalent to SET FILE PATTERNS OFF ([642]Section 4.3) and SET + TRANSFER MODE MANUAL. In other words, take the FILE TYPE setting + literally. For example, "kermit -VT oofa.bin" means send the + file in Text mode, no matter what its name is and no matter + whether a kindred spirit is recognized at the other end of the + connection. + + -0 + (digit zero) means "be 100% transparent in CONNECT mode". This + is equivalent to the following series of commands: SET PARITY + NONE, SET COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW + NONE, SET TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET + TERM AUTODOWNLOAD OFF, SET TERM APC OFF, SET TELOPT KERMIT + REFUSE REFUSE. + + 10. C-KERMIT AND G-KERMIT + + Every multifunctioned and long-lived software program grows in + complexity and size over time to meet the needs and requests of its + users and the demands of the underlying technology as it changes. + + Eventually users begin to notice how big the application has grown, how + much disk space it occupies, how long it takes to load, and they start + to long for the good old days when it was lean and mean. Not long after + that they begin asking for a "light" version that only does the basics + with no frills. + + And so it is with C-Kermit. A "light" version of Kermit was released + (for UNIX only) in December 1999 under the GNU General Public License; + thus it is called G-Kermit (for GNU Kermit). All it does is send and + receive files, period. You can find it at: + + [643]http://www.columbia.edu/kermit/gkermit.html + + Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million + bytes in size, the G-Kermit binary ranges from 30K to 100K, depending + on the underlying architecture (RISC vs CISC, etc). + + G-Kermit and C-Kermit may reside side-by-side on the same computer. + G-Kermit does not make connections; it does not have a script language; + it does not translate character sets. G-Kermit may be used instead of + C-Kermit when: + + * It is on the remote end. + * Files are to be transferred in binary mode or in text mode without + character-set translation. + * File timestamps don't need to be preserved. + + In such cases G-Kermit might be preferred since it generally starts up + faster, and yet transfers files just as fast on most (but not + necessarily all) kinds of connections; for example, it supports + streaming ([644]Section 4.20). + + G-Kermit is also handy for bootstrapping. It is easier to load on a new + computer than C-Kermit -- it fits on a floppy diskette with plenty of + room to spare. Thus if you have (say) an old PC running (say) SCO Xenix + and no network connection, you can download the Xenix version of + G-Kermit to (say) a DOS or Windows PC, copy it to diskette, read the + diskette on Xenix with "dosread", and then use G-Kermit to receive + C-Kermit (which does not fit on a diskette). If diskettes aren't an + option, other bootstrapping methods are possible too -- see the + [645]G-Kermit web page for details. + +III. APPENDICES + + III.1. Character Set Tables + + III.1.1. The Hewlett Packard Roman8 Character Set + +dec col/row oct hex description +160 10/00 240 A0 (Undefined) +161 10/01 241 A1 A grave +162 10/02 242 A2 A circumflex +163 10/03 243 A3 E grave +164 10/04 244 A4 E circumflex +165 10/05 245 A5 E diaeresis +166 10/06 246 A6 I circumflex +167 10/07 247 A7 I diaeresis +168 10/08 250 A8 Acute accent +169 10/09 251 A9 Grave accent +170 10/10 252 AA Circumflex accent +171 10/11 253 AB Diaeresis +172 10/12 254 AC Tilde accent +173 10/13 255 AD U grave +174 10/14 256 AE U circumflex +175 10/15 257 AF Lira symbol +176 11/00 260 B0 Top bar (macron) +177 11/01 261 B1 Y acute +178 11/02 262 B2 y acute +179 11/03 263 B3 Degree Sign +180 11/04 264 B4 C cedilla +181 11/05 265 B5 c cedilla +182 11/06 266 B6 N tilde +183 11/07 267 B7 n tilde +184 11/08 270 B8 Inverted exclamation mark +185 11/09 271 B9 Inverted question mark +186 11/10 272 BA Currency symbol +187 11/11 273 BB Pound sterling symbol +188 11/12 274 BC Yen symbol +189 11/13 275 BD Paragraph +190 11/14 276 BE Florin (Guilder) symbol +191 11/15 277 BF Cent symbol +192 12/00 300 C0 a circumflex +193 12/01 301 C1 e circumflex +194 12/02 302 C2 o circumflex +195 12/03 303 C3 u circumflex +196 12/04 304 C4 a acute +197 12/05 305 C5 e acute +198 12/06 306 C6 o acute +199 12/07 307 C7 u acute +200 12/08 310 C8 a grave +201 12/09 311 C9 e grave +202 12/10 312 CA o grave +203 12/11 313 CB u grave +204 12/12 314 CC a diaeresis +205 12/13 315 CD e diaeresis +206 12/14 316 CE o diaeresis +207 12/15 317 CF u diaeresis +208 13/00 320 D0 A ring +209 13/01 321 D1 i circumflex +210 13/02 322 D2 O with stroke +211 13/03 323 D3 AE digraph +212 13/04 324 D4 a ring +213 13/05 325 D5 i acute +214 13/06 326 D6 o with stroke +215 13/07 327 D7 ae digraph +216 13/08 330 D8 A diaeresis +217 13/09 331 D9 i grave +218 13/10 332 DA O diaeresis +219 13/11 333 DB U diaeresis +220 13/12 334 DC E acute +221 13/13 335 DD i diaeresis +222 13/14 336 DE German sharp s +223 13/15 337 DF O circumflex +224 14/00 340 E0 A acute +225 14/01 341 E1 A tilde +226 14/02 342 E2 a tilde +227 14/03 343 E3 Icelandic Eth +228 14/04 344 E4 Icelandic eth +229 14/05 345 E5 I acute +230 14/06 346 E6 I grave +231 14/07 347 E7 O acute +232 14/08 350 E8 O grave +233 14/09 351 E9 O tilde +234 14/10 352 EA o tilde +235 14/11 353 EB S caron +236 14/12 354 EC s caron +237 14/13 355 ED U acute +238 14/14 356 EE Y diaeresis +239 14/15 357 EF y diaeresis +240 15/00 360 F0 Icelandic Thorn +241 15/01 361 F1 Icelandic thorn +242 15/02 362 F2 Middle dot +243 15/03 363 F3 Greek mu +244 15/04 364 F4 Pilcrow sign +245 15/05 365 F5 Fraction 3/4 +246 15/06 366 F6 Long dash, horizontal bar +247 15/07 367 F7 Fraction 1/4 +248 15/08 370 F8 Fraction 1/2 +249 15/09 371 F9 Feminine ordinal +250 15/10 372 FA Masculine ordinal +251 15/11 373 FB Left guillemot +252 15/12 374 FC Solid box +253 15/13 375 FD Right guillemot +254 15/14 376 FE Plus or minus sign +255 15/15 377 FF (Undefined) + + III.1.2. Greek Character Sets + + III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928 + +dec col/row oct hex description +160 10/00 240 A0 No-break space +161 10/01 241 A1 Left single quotation mark +162 10/02 242 A2 right single quotation mark +163 10/03 243 A3 Pound sign +164 10/04 244 A4 (UNUSED) +165 10/05 245 A5 (UNUSED) +166 10/06 246 A6 Broken bar +167 10/07 247 A7 Paragraph sign +168 10/08 250 A8 Diaeresis (Dialytika) +169 10/09 251 A9 Copyright sign +170 10/10 252 AA (UNUSED) +171 10/11 253 AB Left angle quotation +172 10/12 254 AC Not sign +173 10/13 255 AD Soft hyphen +174 10/14 256 AE (UNUSED) +175 10/15 257 AF Horizontal bar (Parenthetiki pavla) +176 11/00 260 B0 Degree sign +177 11/01 261 B1 Plus-minus sign +178 11/02 262 B2 Superscript two +179 11/03 263 B3 Superscript three +180 11/04 264 B4 Accent (tonos) +181 11/05 265 B5 Diaeresis and accent (Dialytika and Tonos) +182 11/06 266 B6 Alpha with accent +183 11/07 267 B7 Middle dot (Ano Teleia) +184 11/08 270 B8 Epsilon with accent +185 11/09 271 B9 Eta with accent +186 11/10 272 BA Iota with accent +187 11/11 273 BB Right angle quotation +188 11/12 274 BC Omicron with accent +189 11/13 275 BD One half +190 11/14 276 BE Upsilon with accent +191 11/15 277 BF Omega with accent +192 12/00 300 C0 iota with diaeresis and accent +193 12/01 301 C1 Alpha +194 12/02 302 C2 Beta +195 12/03 303 C3 Gamma +196 12/04 304 C4 Delta +197 12/05 305 C5 Epsilon +198 12/06 306 C6 Zeta +199 12/07 307 C7 Eta +200 12/08 310 C8 Theta +201 12/09 311 C9 Iota +202 12/10 312 CA Kappa +203 12/11 313 CB Lamda +204 12/12 314 CC Mu +205 12/13 315 CD Nu +206 12/14 316 CE Ksi +207 12/15 317 CF Omicron +208 13/00 320 D0 Pi +209 13/01 321 D1 Rho +210 13/02 322 D2 (UNUSED) +211 13/03 323 D3 Sigma +212 13/04 324 D4 Tau +213 13/05 325 D5 Upsilon +214 13/06 326 D6 Phi +215 13/07 327 D7 Khi +216 13/08 330 D8 Psi +217 13/09 331 D9 Omega +218 13/10 332 DA Iota with diaeresis +219 13/11 333 DB Upsilon with diaeresis +220 13/12 334 DC alpha with accent +221 13/13 335 DD epsilon with accent +222 13/14 336 DE eta with accent +223 13/15 337 DF iota with accent +224 14/00 340 E0 upsilon with diaeresis and accent +225 14/01 341 E1 alpha +226 14/02 342 E2 beta +227 14/03 343 E3 gamma +228 14/04 344 E4 delta +229 14/05 345 E5 epsilon +230 14/06 346 E6 zeta +231 14/07 347 E7 eta +232 14/08 350 E8 theta +233 14/09 351 E9 iota +234 14/10 352 EA kappa +235 14/11 353 EB lamda +236 14/12 354 EC mu +237 14/13 355 ED nu +238 14/14 356 EE ksi +239 14/15 357 EF omicron +240 15/00 360 F0 pi +241 15/01 361 F1 rho +242 15/02 362 F2 terminal sigma +243 15/03 363 F3 sigma +244 15/04 364 F4 tau +245 15/05 365 F5 upsilon +246 15/06 366 F6 phi +247 15/07 367 F7 khi +248 15/08 370 F8 psi +249 15/09 371 F9 omega +250 15/10 372 FA iota with diaeresis +251 15/11 373 FB upsilon with diaeresis +252 15/12 374 FC omicron with diaeresis +253 15/13 375 FD upsilon with accent +254 15/14 376 FE omega with accent +255 15/15 377 FF (UNUSED) + + III.1.2.2. The ELOT 927 Character Set + +dec col/row oct hex description + 32 02/00 40 20 SPACE + 33 02/01 41 21 EXCLAMATION MARK + 34 02/02 42 22 QUOTATION MARK + 35 02/03 43 23 NUMBER SIGN + 36 02/04 44 24 DOLLAR SIGN + 37 02/05 45 25 PERCENT SIGN + 38 02/06 46 26 AMPERSAND + 39 02/07 47 27 APOSTROPHE + 40 02/08 50 28 LEFT PARENTHESIS + 41 02/09 51 29 RIGHT PARENTHESIS + 42 02/10 52 2A ASTERISK + 43 02/11 53 2B PLUS SIGN + 44 02/12 54 2C COMMA + 45 02/13 55 2D HYPHEN, MINUS SIGN + 46 02/14 56 2E PERIOD, FULL STOP + 47 02/15 57 2F SOLIDUS, SLASH + 48 03/00 60 30 DIGIT ZERO + 49 03/01 61 31 DIGIT ONE + 50 03/02 62 32 DIGIT TWO + 51 03/03 63 33 DIGIT THREE + 52 03/04 64 34 DIGIT FOUR + 53 03/05 65 35 DIGIT FIVE + 54 03/06 66 36 DIGIT SIX + 55 03/07 67 37 DIGIT SEVEN + 56 03/08 70 38 DIGIT EIGHT + 57 03/09 71 39 DIGIT NINE + 58 03/10 72 3A COLON + 59 03/11 73 3B SEMICOLON + 60 03/12 74 3C LESS-THAN SIGN, LEFT ANGLE BRACKET + 61 03/13 75 3D EQUALS SIGN + 62 03/14 76 3E GREATER-THAN SIGN, RIGHT ANGLE BRACKET + 63 03/15 77 3F QUESTION MARK + 64 04/00 100 40 COMMERCIAL AT SIGN + 65 04/01 101 41 CAPITAL LETTER A + 66 04/02 102 42 CAPITAL LETTER B + 67 04/03 103 43 CAPITAL LETTER C + 68 04/04 104 44 CAPITAL LETTER D + 69 04/05 105 45 CAPITAL LETTER E + 70 04/06 106 46 CAPITAL LETTER F + 71 04/07 107 47 CAPITAL LETTER G + 72 04/08 110 48 CAPITAL LETTER H + 73 04/09 111 49 CAPITAL LETTER I + 74 04/10 112 4A CAPITAL LETTER J + 75 04/11 113 4B CAPITAL LETTER K + 76 04/12 114 4C CAPITAL LETTER L + 77 04/13 115 4D CAPITAL LETTER M + 78 04/14 116 4E CAPITAL LETTER N + 79 04/15 117 4F CAPITAL LETTER O + 80 05/00 120 50 CAPITAL LETTER P + 81 05/01 121 51 CAPITAL LETTER Q + 82 05/02 122 52 CAPITAL LETTER R + 83 05/03 123 53 CAPITAL LETTER S + 84 05/04 124 54 CAPITAL LETTER T + 85 05/05 125 55 CAPITAL LETTER U + 86 05/06 126 56 CAPITAL LETTER V + 87 05/07 127 57 CAPITAL LETTER W + 88 05/08 130 58 CAPITAL LETTER X + 89 05/09 131 59 CAPITAL LETTER Y + 90 05/10 132 5A CAPITAL LETTER Z + 91 05/11 133 5B LEFT SQUARE BRACKET + 92 05/12 134 5C REVERSE SOLIDUS, BACKSLASH + 93 05/13 135 5D RIGHT SQUARE BRACKET + 94 05/14 136 5E CIRCUMFLEX ACCENT + 95 05/15 137 5F UNDERSCORE + 96 06/00 140 60 ACCENT GRAVE + 97 06/01 141 61 GREEK LETTER ALPHA + 98 06/02 142 62 GREEK LETTER BETA + 99 06/03 143 63 GREEK LETTER GAMMA +100 06/04 144 64 GREEK LETTER DELTA +101 06/05 145 65 GREEK LETTER EPSILON +102 06/06 146 66 GREEK LETTER ZETA +103 06/07 147 67 GREEK LETTER ETA +104 06/08 150 68 GREEK LETTER THETA +105 06/09 151 69 GREEK LETTER IOTA +106 06/10 152 6A GREEK LETTER KAPPA +107 06/11 153 6B GREEK LETTER LAMDA +108 06/12 154 6C GREEK LETTER MU +109 06/13 155 6D GREEK LETTER NU +110 06/14 156 6E GREEK LETTER KSI +111 06/15 157 6F GREEK LETTER OMICRON +112 07/00 160 70 GREEK LETTER PI +113 07/01 161 71 GREEK LETTER RHO +114 07/02 162 72 GREEK LETTER SIGMA +115 07/03 163 73 GREEK LETTER TAU +116 07/04 164 74 GREEK LETTER UPSILON +117 07/05 165 75 GREEK LETTER FI +118 07/06 166 76 GREEK LETTER XI +119 07/07 167 77 GREEK LETTER PSI +120 07/08 170 78 GREEK LETTER OMEGA +121 07/09 171 79 SPACE +122 07/10 172 7A SPACE +123 07/11 173 7B LEFT CURLY BRACKET, LEFT BRACE +124 07/12 174 7C VERTICAL LINE, VERTICAL BAR +125 07/13 175 7D RIGHT CURLY BRACKET, RIGHT BRACE +126 07/14 176 7E TILDE +127 07/15 177 7F RUBOUT, DELETE + + III.1.2.3. PC Code Page 869 + + (to be filled in...) + + III.2. Updated Country Codes + + Date: Mon, 7 Apr 1997 23:23:49 EDT + From: Dave Leibold + Newsgroups: comp.dcom.telecom + Subject: Ex-USSR Country Codes Profile + Organization: TELECOM Digest + + Ex-USSR Country Codes Profile + 4 April 1997 + + Below is a summary of the country codes that have formed in the wake of + the USSR dissolution, along with some updated findings and reports. + Additional or corrected information on any of these nations would be + welcome (c/o dleibold@else.net). + * Kyrgyz Republic country code 996 will take effect, at least in + Canada, effective 1 May 1997, according to CRTC Telecom Order + 97-464, based on Stentor Tariff Notice 433. There is no indication + whether there will be a permissive dialing period involved or for + how long such a permissive operation would remain. + * Country code 992 was reported as a recent assignment for + Tajikistan, which will be moving from country code 7 at some + unknown time. + * Uzbekistan has its own country code assignment, but I have no + information if this is in service yet or what implementation dates + have been set. + * Kazakstan does not have a known separate country code assignment at + present. It remains in country code 7 for the time being. + * Russia seems destined to keep country code 7. + * Recent news reports speak of some agreements forming between Russia + and Belarus. While there is no outright reunification yet, there is + expected to be much closer ties between the two nations. Whether + this will lead to a reunification of telephone codes remains to be + seen. + + In the table, "Effective" means the date at which the country code + began service (which could vary according to the nation). "Mandatory" + means the date at which the country code 7 is invalid for calls to that + nation. There are a number of question marks since exact dates have not + been collected in all cases. + +CC Nation Effective Mandatory Notes + +370 Lithuania 1993? ??? Announced Jan 1993 +371 Latvia 1993? ??? +372 Estonia 1 Feb 1993? March 1993? +373 Moldova 1993? ??? Announced Jan 1993 +374 Armenia 1 May 1995 1 July 1995 Announced Jan 1995 (ITU) +375 Belarus 16 Apr 1995 1997? +380 Ukraine 16 Apr 1995 Oct 1995? +7 Kazakstan (no known changes) +7 Russia (presumably not changing) +992 Tajikistan ??? ??? Announced 1996-7? +993 Turkmenistan 3 Jan 1997 3 Apr 1997 Canada as of 29 Nov 1996 +994 Azerbaijan Sept 1994? ??? Announced 1992 +995 Georgia 1994? ??? ref: Telecom Digest Oct 1994 +996 Kyrgyz Republic 1 May 1997 ??? ref: Stentor Canada/CRTC +998 Uzbekistan ??? ??? Announced 1996? (ITU) + + Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada), + TELECOM Digest (including information collected for the country code + listings). + +IV. ERRATA & CORRIGENDA + + The following errors in [646]Using C-Kermit, Second Edition, first + printing, have been noted. + + First, some missing acknowledgements for C-Kermit 6.0: JE Jones of + Microware for help with OS-9, Nigel Roles for his help with Plan 9, + Lucas Hart for help with VMS and Digital UNIX, Igor Kovalenko for his + help with QNX. And later, to Susan Kleinmann for her help with Debian + Linux packaging; Patrick Volkerding for his help with Slackware Linux + packaging; Jim Knoble for his help with Red Hat Linux packaging; and to + dozens of others for sending individual C-Kermit binaries for varied + and diverse platforms. + + Thanks to James Spath for both binaries and reporting many of the typos + noted below. Also to Dat Thuc Nguyen for spotting several typos. + +PAGE REMARKS +COVER "COS" is a misprint. There is no COS. Pretend it says "SCO" or "VOS". + (This is fixed in the second printing.) + xxi Second line: Fred Smith's affiliation should be Computrition. + 83 Change "commands other" to "commands as other" (1st paragraph) + 87 Change "The the" to "The" (2nd paragraph) + 92 "set modem-type user-defined supra" should be "set modem type ..." + 95 Change "VI" to "vi" (1st paragraph) + 96 Change "it it" to "it is" (1st paragraph) + 97 Change "advantage a literal" to "advantage of a literal" (2nd + paragraph) +102 The call-waiting example would be better as SET DIAL PREFIX *70W + (rather than "*70,") because the former will not cause an incorrect + call to be placed with pulse dialing. +123 Third paragraph from bottom: "..otherwise if a your local username.." + should be "..otherwise your local username..". +160 Delete the "it" between "and" and "to" (2nd paragraph) +185 In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...", + "OFF" should be "NONE". +187 The last paragraph says the "A command" is ignored, should be "S". +194 Change "it known" to "it is known" (4th paragraph). +235 In C-Kermit 7.0, the syntax of the GET command changed. MGET now + must be used to get a list of files and there is no more multiline + GET command. +268 Last paragraph: "effect" should be "affect". +275 In the SET PROTOCOL KERMIT description, the following sentence is + incorrect and should be removed: 'If you omit the commands, the + default ones are restored: "kermit -ir" and "kermit -r" respectively". + The correct information is given at the bottom of page 281. +279 9th line. The decimal value of ST is 156, not 155. +295 In the stepping stones, skip ahead to Chapter 17 on p. 327. +298 Table 16-2, Portuguese entry. Column 4/00 should show section sign, + not acute accent. +316 Other languages written in the Hebrew alphabet include Karaim (a Turkic + language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo- + Georgian. +332 UNDEFINE definition, change "This just" to "This is just". +344 It might be necessary to set the modem's pulse generation rate when + sending numeric pages; most Hayes compatible modems use the S11 + register for this. +350 Delete "is" from between "It" and "ceases" (4th paragraph) +351 Top - both occurrences of "print \%a" should be "echo \%a". +364 \v(input) and \v(query) out of alphabetical order. +378 In the MYSEND macro, "if not \m(rc) goto bad" should be: + "if \m(rc) goto bad" (remove the "not"). +382-383 It should be stated that the loop control variable must be of the \%a + type, or else an array element; macro names can not be used for this. +383 In line 3, "\%f[\%i]" should be "\&f[\%i]". +383 In the sort example, it should be stated that the array is 1-based. +387 Change "You can list" to "You can get a list" (5th paragraph) +393 \Fverify() description. The 3rd sentence could be stated more clearly + as "If all characters in string2 are also in string1, 0 is returned." +398 Copying \ffiles() results to an array before is not required as of + C-Kermit 7.0 (see [647]Section 7.3). +403 In "(\%a + 3) * (\%b 5)", a minus sign is missing between b and 5. +407 C-Kermit 7.0 no longer supports multiline GET. Change + "get, \%1, \%2" to "get {\%1} {\%2}" or "get /as:{\%2} {\%1}". +409 READ example while loop should be: + while success { echo \m(line), read line } +409 "WRITE file" should be "WRITE keyword" (you can't put a filename there) + (The same applies to WRITE-LINE / WRITELN). +414 \Funhexify() missing from Table 18-3. +425 MINPUT definition, change 2nd "text2" to "text3". +436 Several lines are missing from the UNIXLOGIN macro listing. + After the "xif fail" block, insert: + + out \%1\13 ; Send username, carriage return + inp 5 Password: ; Wait 5 sec for this prompt + if fail end 1 No password prompt + pause ; Wait a sec + out \%2\13 ; Send password + +440 Change "set terminal byteszie" to "set terminal bytesize". + Change "input Password:" to "input 10 Password". +448 Franchise script: "access line" should be "access \m(line)". +453 There are two incorrectly coded IF statements in the DELIVER macro + definition. Replace both occurrences of "if > \%1 \%3 {" with + "xif > \%i \%3 {" (replace "if" by "xif" and "\%1" with "\%i"). +453 "the the" (last paragraph) should be "the". +454 EOT (last paragraph) is End of Transmission, not End of Text. +457 _DEFINE definition: "name constructed" should be "name is constructed". +457 "macro for and" (last paragraph) should be "macro and". +459 Should explain that \v(user) is a legal abbreviation of \v(userid). +480 Figure II-2 is backwards; the least-significant bit is transmitted + first, then up to the highest, and the parity bit last. +534 The VMS Appendix section on Odd Record Lengths no longer applies; + C-Kermit 7.0 handles odd record lengths as well as even ones. +559 Table VIII-3, Portuguese entry. Column 4/00 should show section sign, + not acute accent. +560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in. + It is listed in section II(6). +565 "d stroke" in Table VII-5 has the wrong appearance; the stem should + be upright. The letter shown in the table is actually a lowercase + Icelandic eth, which has a curved stem. +601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks. +604 The words "SCRIBE TEXT FORMATTER" appear at the end of the last + sentence of the first paragraph of the Colophon. They should have + been in the Index. +Index: Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ... + \F() Page 605, add also 413-414 + \Fbreak 389 + \Fcapitalize 390 + \Fchecksum 414 + \Fcrc16 414 + \Fexecute 414 + \Fhexify 390 + \Fltrim 391 + \Frepeat 392 + \Fspawn 392 + \Ftod2secs 399 + \v() built_in Page 606, add also 361-364 + \v(_line) 354, 361 + \v(apcactive) 361 + \v(charset) 362 + \v(cpu) 362 + \v(crc16) 357, 362 + \v(d$xxx) add page 362 + \v(dialnumber) 362 + \v(dialresult) 362 + \v(errno) 362 + \v(errstring) 362 + \v(exedir) 362 + \v(inidir) 363 + \v(ipaddress) 363 + \v(keyboard) 363 + \v(macro) 363 + \v(minput) 363 + \v(m_xxx) 94, 363 + \v(password) 364 + \v(query) 364 + \v(prompt) 364 + \v(speed) 356, 364 + \v(startup) 364 + \v(status) 364 + \v(sysid) 364 + \v(system) 364 + \v(fsize) at lower half page 606 should read \v(tfsize) + \v(xversion) 364 + BEEP Command 40 + SET FLOW 62, 212 + + Figure II-5 on page 493. The pin assignments of the Mini Din-8 + connector are not described anywhere. As noted in the text, these tend + to vary from vendor to vendor. One common arrangement is: + + 1. HSKout (Handshake out -- definition depends on software) + 2. HSKin (Handshake in or external clock) + 3. TxD- + 4. Not used + 5. RxD- + 6. TxD+ + 7. Not used + 8. RxD+ + + Note the "balanced pairs" for Receive Data (RxD) and Transmit Data + (TxD), and the utter lack of modem signals. These connectors follow the + RS-423 standard, rather than RS-232. In some arrangements, Pin 1 is + used for DTR and Pin 2 for CD; in others Pin 1 is RTS and Pin 2 is CTS. + + Please send reports of other errors to the authors, as well as + suggestions for improvements, additional index entries, and any other + comments: + + [648]kermit@columbia.edu + +APPENDIX V. ADDITIONAL COPYRIGHT NOTICES + + The following copyrights cover some of the source code used in the + development of C-Kermit, Kermit 95, or Kermit 95 support libraries. + +/*****************************************************************************/ +/* */ +/* Copyright (c) 1995 by Oy Online Solutions Ltd. */ +/* */ +/* Distribution of this source code is strictly forbbidden. Use of this */ +/* source code is granted to the University of Columbia C-Kermit project */ +/* to be distributed in binary format only. Please familiarize yourself */ +/* with the accompanying LICENSE.P file. */ +/* */ +/*****************************************************************************/ + + used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll, + p2.dll) + + Copyright (c) 1997 Stanford University + + The use of this software for revenue-generating purposes may require a + license from the owners of the underlying intellectual property. + Specifically, the SRP-3 protocol may not be used for revenue-generating + purposes without a license. + + Within that constraint, permission to use, copy, modify, and distribute + this software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notices and this + permission notice appear in all copies of the software and related + documentation. + + THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT + ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit, Kermit + 95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll) + + Copyright 1990 by the Massachusetts Institute of Technology. All Rights + Reserved. + + Export of this software from the United States of America may require a + specific license from the United States Government. It is the + responsibility of any person or organization contemplating export to + obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute + this software and its documentation for any purpose and without fee is + hereby granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission notice + appear in supporting documentation, and that the name of M.I.T. not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. M.I.T. makes no + representations about the suitability of this software for any purpose. + It is provided "as is" without express or implied warranty. + + Used for Telnet Authentication Option, Telnet Encryption Option, and + Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe, + k95crypt.dll, k2crypt.dll) + + Copyright (c) 1991, 1993 The Regents of the University of California. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgement: + + This product includes software developed by the University of + California, Berkeley and its contributors. + 4. Neither the name of the University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Used for Telnet Authentication Option, Telnet Encryption Option, and + Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe, + k95crypt.dll, k2crypt.dll) + + Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) All rights + reserved. + + This package is an DES implementation written by Eric Young + (eay@cryptsoft.com). The implementation was written so as to conform + with MIT's libdes. + + This library is free for commercial and non-commercial use as long as + the following conditions are aheared to. The following conditions apply + to all code found in this distribution. + + Copyright remains Eric Young's, and as such any Copyright notices in + the code are not to be removed. If this package is used in a product, + Eric Young should be given attribution as the author of that the SSL + library. This can be in the form of a textual message at program + startup or in documentation (online or textual) provided with the + package. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + 1. Redistributions of source code must retain the copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgement: This product + includes software developed by Eric Young (eay@cryptsoft.com) + + THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + The license and distribution terms for any publically available version + or derivative of this code cannot be changed. i.e. this code cannot + simply be copied and put under another distrubution license [including + the GNU Public License.] + + The reason behind this being stated in this direct manner is past + experience in code simply being copied and the attribution removed from + it and then being distributed as part of other packages. This + implementation was a non-trivial and unpaid effort. + + Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll) + __________________________________________________________________ + + * This is version 1.1 of CryptoLib + * + * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze + * Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T. + * Permission to use, copy, and modify this software without fee + * is hereby granted, provided that this entire notice is included in + * all copies of any software which is or includes a copy or + * modification of this software and in all copies of the supporting + * documentation for such software. + * + * NOTE: + * Some of the algorithms in cryptolib may be covered by patents. + * It is the responsibility of the user to ensure that any required + * licenses are obtained. + * + * + * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT + * REGULATIONS. + * + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + + Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll). + + [ [649]Top ] [ [650]C-Kermit ] [ [651]Kermit Home ] + __________________________________________________________________ + __________________________________________________________________ + + CKERMIT70.HTM / The Kermit Project / Columbia University / 8 Feb 2000 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641 + 12. mailto:kermit-support@columbia.edu + 13. http://www.columbia.edu/kermit/ + 14. http://www.kermit-project.org/ + 15. http://www.columbia.nyc.ny.us/kermit/ + 16. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT + 17. ftp://kermit.columbia.edu/kermit/f/ckcmai.c + 18. http://www.columbia.edu/kermit/ckermit70.html#xv + 19. http://www.columbia.edu/kermit/ckb2.htm + 20. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt + 21. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt + 22. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt + 23. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt + 24. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt + 25. ftp://kermit.columbia.edu/kermit/f/security.txt + 26. http://www.columbia.edu/kermit/security.htm + 27. ftp://kermit.columbia.edu/kermit/f/iksd.txt + 28. http://www.columbia.edu/kermit/iksd.htm + 29. http://www.columbia.edu/kermit/cuiksd.htm + 30. ftp://kermit.columbia.edu/kermit/f/telnet.txt + 31. http://www.columbia.edu/kermit/telnet.htm + 32. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT + 33. http://www.columbia.edu/kermit/k95.html + 34. http://www.opensource.org/ + 35. http://www.columbia.edu/kermit/ckb2.htm + 36. http://www.columbia.edu/kermit/ckermit70.html#xi + 37. http://www.columbia.edu/kermit/ckermit70.html#xii + 38. http://www.columbia.edu/kermit/ckermit70.html#x0 + 39. http://www.columbia.edu/kermit/ckermit70.html#x1 + 40. http://www.columbia.edu/kermit/ckermit70.html#x1.0 + 41. http://www.columbia.edu/kermit/ckermit70.html#x1.1 + 42. http://www.columbia.edu/kermit/ckermit70.html#x1.2 + 43. http://www.columbia.edu/kermit/ckermit70.html#x1.3 + 44. http://www.columbia.edu/kermit/ckermit70.html#x1.4 + 45. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 46. http://www.columbia.edu/kermit/ckermit70.html#x1.5.1 + 47. http://www.columbia.edu/kermit/ckermit70.html#x1.5.2 + 48. http://www.columbia.edu/kermit/ckermit70.html#x1.5.3 + 49. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4 + 50. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5 + 51. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 52. http://www.columbia.edu/kermit/ckermit70.html#x1.7 + 53. http://www.columbia.edu/kermit/ckermit70.html#x1.8 + 54. http://www.columbia.edu/kermit/ckermit70.html#x1.9 + 55. http://www.columbia.edu/kermit/ckermit70.html#x1.10 + 56. http://www.columbia.edu/kermit/ckermit70.html#x1.11 + 57. http://www.columbia.edu/kermit/ckermit70.html#x1.11.1 + 58. http://www.columbia.edu/kermit/ckermit70.html#x1.11.2 + 59. http://www.columbia.edu/kermit/ckermit70.html#x1.11.3 + 60. http://www.columbia.edu/kermit/ckermit70.html#x1.11.4 + 61. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5 + 62. http://www.columbia.edu/kermit/ckermit70.html#x1.11.6 + 63. http://www.columbia.edu/kermit/ckermit70.html#x1.11.7 + 64. http://www.columbia.edu/kermit/ckermit70.html#x1.12 + 65. http://www.columbia.edu/kermit/ckermit70.html#x1.13 + 66. http://www.columbia.edu/kermit/ckermit70.html#x1.14 + 67. http://www.columbia.edu/kermit/ckermit70.html#x1.15 + 68. http://www.columbia.edu/kermit/ckermit70.html#x1.16 + 69. http://www.columbia.edu/kermit/ckermit70.html#x1.17 + 70. http://www.columbia.edu/kermit/ckermit70.html#x1.18 + 71. http://www.columbia.edu/kermit/ckermit70.html#x1.19 + 72. http://www.columbia.edu/kermit/ckermit70.html#x1.20 + 73. http://www.columbia.edu/kermit/ckermit70.html#x1.21 + 74. http://www.columbia.edu/kermit/ckermit70.html#x1.22 + 75. http://www.columbia.edu/kermit/ckermit70.html#x1.22.1 + 76. http://www.columbia.edu/kermit/ckermit70.html#x1.22.2 + 77. http://www.columbia.edu/kermit/ckermit70.html#x1.22.3 + 78. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4 + 79. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5 + 80. http://www.columbia.edu/kermit/ckermit70.html#x1.22.6 + 81. http://www.columbia.edu/kermit/ckermit70.html#x1.22.7 + 82. http://www.columbia.edu/kermit/ckermit70.html#x1.22.8 + 83. http://www.columbia.edu/kermit/ckermit70.html#x1.23 + 84. http://www.columbia.edu/kermit/ckermit70.html#x1.24 + 85. http://www.columbia.edu/kermit/ckermit70.html#x2 + 86. http://www.columbia.edu/kermit/ckermit70.html#x2.0 + 87. http://www.columbia.edu/kermit/ckermit70.html#x2.1 + 88. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1 + 89. http://www.columbia.edu/kermit/ckermit70.html#x2.1.2 + 90. http://www.columbia.edu/kermit/ckermit70.html#x2.1.3 + 91. http://www.columbia.edu/kermit/ckermit70.html#x2.1.4 + 92. http://www.columbia.edu/kermit/ckermit70.html#x2.1.5 + 93. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6 + 94. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7 + 95. http://www.columbia.edu/kermit/ckermit70.html#x2.1.8 + 96. http://www.columbia.edu/kermit/ckermit70.html#x2.1.9 + 97. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10 + 98. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11 + 99. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12 + 100. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13 + 101. http://www.columbia.edu/kermit/ckermit70.html#x2.1.14 + 102. http://www.columbia.edu/kermit/ckermit70.html#x2.1.15 + 103. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16 + 104. http://www.columbia.edu/kermit/ckermit70.html#x2.2 + 105. http://www.columbia.edu/kermit/ckermit70.html#x2.2.1 + 106. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2 + 107. http://www.columbia.edu/kermit/ckermit70.html#x2.3 + 108. http://www.columbia.edu/kermit/ckermit70.html#x2.3.0 + 109. http://www.columbia.edu/kermit/ckermit70.html#x2.3.1 + 110. http://www.columbia.edu/kermit/ckermit70.html#x2.3.2 + 111. http://www.columbia.edu/kermit/ckermit70.html#x2.3.3 + 112. http://www.columbia.edu/kermit/ckermit70.html#x2.3.4 + 113. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5 + 114. http://www.columbia.edu/kermit/ckermit70.html#x2.3.6 + 115. http://www.columbia.edu/kermit/ckermit70.html#x2.4 + 116. http://www.columbia.edu/kermit/ckermit70.html#x2.5 + 117. http://www.columbia.edu/kermit/ckermit70.html#x2.6 + 118. http://www.columbia.edu/kermit/ckermit70.html#x2.7 + 119. http://www.columbia.edu/kermit/ckermit70.html#x2.7.0 + 120. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1 + 121. http://www.columbia.edu/kermit/ckermit70.html#x2.7.2 + 122. http://www.columbia.edu/kermit/ckermit70.html#x2.7.3 + 123. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4 + 124. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.1 + 125. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.2 + 126. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.3 + 127. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.4 + 128. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.5 + 129. http://www.columbia.edu/kermit/ckermit70.html#x2.8 + 130. http://www.columbia.edu/kermit/ckermit70.html#x2.9 + 131. http://www.columbia.edu/kermit/ckermit70.html#x2.9.1 + 132. http://www.columbia.edu/kermit/ckermit70.html#x2.9.2 + 133. http://www.columbia.edu/kermit/ckermit70.html#x2.10 + 134. http://www.columbia.edu/kermit/ckermit70.html#x2.11 + 135. http://www.columbia.edu/kermit/ckermit70.html#x2.12 + 136. http://www.columbia.edu/kermit/ckermit70.html#x2.13 + 137. http://www.columbia.edu/kermit/ckermit70.html#x2.14 + 138. http://www.columbia.edu/kermit/ckermit70.html#x2.15 + 139. http://www.columbia.edu/kermit/ckermit70.html#x3 + 140. http://www.columbia.edu/kermit/ckermit70.html#x3.1 + 141. http://www.columbia.edu/kermit/ckermit70.html#x3.2 + 142. http://www.columbia.edu/kermit/ckermit70.html#x3.3 + 143. http://www.columbia.edu/kermit/ckermit70.html#x3.4 + 144. http://www.columbia.edu/kermit/ckermit70.html#x4 + 145. http://www.columbia.edu/kermit/ckermit70.html#x4.0 + 146. http://www.columbia.edu/kermit/ckermit70.html#x4.1 + 147. http://www.columbia.edu/kermit/ckermit70.html#x4.1.1 + 148. http://www.columbia.edu/kermit/ckermit70.html#x4.1.2 + 149. http://www.columbia.edu/kermit/ckermit70.html#x4.1.3 + 150. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 151. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1 + 152. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.1 + 153. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.2 + 154. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3 + 155. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2 + 156. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.1 + 157. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.2 + 158. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3 + 159. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.1 + 160. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.2 + 161. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4 + 162. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5 + 163. http://www.columbia.edu/kermit/ckermit70.html#x4.2.6 + 164. http://www.columbia.edu/kermit/ckermit70.html#x4.2.7 + 165. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8 + 166. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1 + 167. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2 + 168. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.3 + 169. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4 + 170. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 171. http://www.columbia.edu/kermit/ckermit70.html#x4.3.1 + 172. http://www.columbia.edu/kermit/ckermit70.html#x4.3.2 + 173. http://www.columbia.edu/kermit/ckermit70.html#x4.3.3 + 174. http://www.columbia.edu/kermit/ckermit70.html#x4.3.4 + 175. http://www.columbia.edu/kermit/ckermit70.html#x4.4 + 176. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1 + 177. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.1 + 178. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.2 + 179. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2 + 180. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1 + 181. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.1 + 182. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.2 + 183. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.2 + 184. http://www.columbia.edu/kermit/ckermit70.html#x4.5 + 185. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1 + 186. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2 + 187. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.1 + 188. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.2 + 189. http://www.columbia.edu/kermit/ckermit70.html#x4.5.3 + 190. http://www.columbia.edu/kermit/ckermit70.html#x4.5.4 + 191. http://www.columbia.edu/kermit/ckermit70.html#x4.6 + 192. http://www.columbia.edu/kermit/ckermit70.html#x4.7 + 193. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 194. http://www.columbia.edu/kermit/ckermit70.html#x4.7.2 + 195. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3 + 196. http://www.columbia.edu/kermit/ckermit70.html#x4.8 + 197. http://www.columbia.edu/kermit/ckermit70.html#x4.8.1 + 198. http://www.columbia.edu/kermit/ckermit70.html#x4.8.2 + 199. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 200. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 201. http://www.columbia.edu/kermit/ckermit70.html#x4.9.2 + 202. http://www.columbia.edu/kermit/ckermit70.html#x4.9.3 + 203. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 204. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 205. http://www.columbia.edu/kermit/ckermit70.html#x4.11.1 + 206. http://www.columbia.edu/kermit/ckermit70.html#x4.11.2 + 207. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 208. http://www.columbia.edu/kermit/ckermit70.html#x4.11.4 + 209. http://www.columbia.edu/kermit/ckermit70.html#x4.11.5 + 210. http://www.columbia.edu/kermit/ckermit70.html#x4.11.6 + 211. http://www.columbia.edu/kermit/ckermit70.html#x4.12 + 212. http://www.columbia.edu/kermit/ckermit70.html#x4.13 + 213. http://www.columbia.edu/kermit/ckermit70.html#x4.14 + 214. http://www.columbia.edu/kermit/ckermit70.html#x4.15 + 215. http://www.columbia.edu/kermit/ckermit70.html#x4.16 + 216. http://www.columbia.edu/kermit/ckermit70.html#x4.17 + 217. http://www.columbia.edu/kermit/ckermit70.html#x4.17.1 + 218. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2 + 219. http://www.columbia.edu/kermit/ckermit70.html#x4.18 + 220. http://www.columbia.edu/kermit/ckermit70.html#x4.19 + 221. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 222. http://www.columbia.edu/kermit/ckermit70.html#x4.20.1 + 223. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2 + 224. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.1 + 225. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.2 + 226. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3 + 227. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.4 + 228. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.5 + 229. http://www.columbia.edu/kermit/ckermit70.html#x4.20.3 + 230. http://www.columbia.edu/kermit/ckermit70.html#x4.21 + 231. http://www.columbia.edu/kermit/ckermit70.html#x4.22 + 232. http://www.columbia.edu/kermit/ckermit70.html#x4.22.1 + 233. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2 + 234. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3 + 235. http://www.columbia.edu/kermit/ckermit70.html#x4.22.4 + 236. http://www.columbia.edu/kermit/ckermit70.html#x4.22.5 + 237. http://www.columbia.edu/kermit/ckermit70.html#x4.22.6 + 238. http://www.columbia.edu/kermit/ckermit70.html#x4.22.7 + 239. http://www.columbia.edu/kermit/ckermit70.html#x4.22.8 + 240. http://www.columbia.edu/kermit/ckermit70.html#x4.23 + 241. http://www.columbia.edu/kermit/ckermit70.html#x4.24 + 242. http://www.columbia.edu/kermit/ckermit70.html#x4.25 + 243. http://www.columbia.edu/kermit/ckermit70.html#x5 + 244. http://www.columbia.edu/kermit/ckermit70.html#x5.0 + 245. http://www.columbia.edu/kermit/ckermit70.html#x5.1 + 246. http://www.columbia.edu/kermit/ckermit70.html#x5.2 + 247. http://www.columbia.edu/kermit/ckermit70.html#x5.3 + 248. http://www.columbia.edu/kermit/ckermit70.html#x5.3.1 + 249. http://www.columbia.edu/kermit/ckermit70.html#x5.3.2 + 250. http://www.columbia.edu/kermit/ckermit70.html#x5.4 + 251. http://www.columbia.edu/kermit/ckermit70.html#x5.5 + 252. http://www.columbia.edu/kermit/ckermit70.html#x5.6 + 253. http://www.columbia.edu/kermit/ckermit70.html#x5.7 + 254. http://www.columbia.edu/kermit/ckermit70.html#x6 + 255. http://www.columbia.edu/kermit/ckermit70.html#x6.0 + 256. http://www.columbia.edu/kermit/ckermit70.html#x6.1 + 257. http://www.columbia.edu/kermit/ckermit70.html#x6.2 + 258. http://www.columbia.edu/kermit/ckermit70.html#x6.3 + 259. http://www.columbia.edu/kermit/ckermit70.html#x6.4 + 260. http://www.columbia.edu/kermit/ckermit70.html#x6.5 + 261. http://www.columbia.edu/kermit/ckermit70.html#x6.6 + 262. http://www.columbia.edu/kermit/ckermit70.html#x6.6.1 + 263. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2 + 264. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2 + 265. http://www.columbia.edu/kermit/ckermit70.html#x6.6.3 + 266. http://www.columbia.edu/kermit/ckermit70.html#x6.6.4 + 267. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5 + 268. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1 + 269. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.2 + 270. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.3 + 271. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4 + 272. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.5 + 273. http://www.columbia.edu/kermit/ckermit70.html#x6.7 + 274. http://www.columbia.edu/kermit/ckermit70.html#x7 + 275. http://www.columbia.edu/kermit/ckermit70.html#x7.0 + 276. http://www.columbia.edu/kermit/ckermit70.html#x7.1 + 277. http://www.columbia.edu/kermit/ckermit70.html#x7.1.1 + 278. http://www.columbia.edu/kermit/ckermit70.html#x7.1.2 + 279. http://www.columbia.edu/kermit/ckermit70.html#x7.1.3 + 280. http://www.columbia.edu/kermit/ckermit70.html#x7.1.4 + 281. http://www.columbia.edu/kermit/ckermit70.html#x7.2 + 282. http://www.columbia.edu/kermit/ckermit70.html#x7.3 + 283. http://www.columbia.edu/kermit/ckermit70.html#x7.4 + 284. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 285. http://www.columbia.edu/kermit/ckermit70.html#x7.6 + 286. http://www.columbia.edu/kermit/ckermit70.html#x7.7 + 287. http://www.columbia.edu/kermit/ckermit70.html#x7.8 + 288. http://www.columbia.edu/kermit/ckermit70.html#x7.9 + 289. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1 + 290. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2 + 291. http://www.columbia.edu/kermit/ckermit70.html#x7.10 + 292. http://www.columbia.edu/kermit/ckermit70.html#x7.10.1 + 293. http://www.columbia.edu/kermit/ckermit70.html#x7.10.2 + 294. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3 + 295. http://www.columbia.edu/kermit/ckermit70.html#x7.10.4 + 296. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5 + 297. http://www.columbia.edu/kermit/ckermit70.html#x7.10.6 + 298. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 299. http://www.columbia.edu/kermit/ckermit70.html#x7.10.8 + 300. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9 + 301. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10 + 302. http://www.columbia.edu/kermit/ckermit70.html#x7.11 + 303. http://www.columbia.edu/kermit/ckermit70.html#x7.12 + 304. http://www.columbia.edu/kermit/ckermit70.html#x7.13 + 305. http://www.columbia.edu/kermit/ckermit70.html#x7.14 + 306. http://www.columbia.edu/kermit/ckermit70.html#x7.15 + 307. http://www.columbia.edu/kermit/ckermit70.html#x7.16 + 308. http://www.columbia.edu/kermit/ckermit70.html#x7.17 + 309. http://www.columbia.edu/kermit/ckermit70.html#x7.18 + 310. http://www.columbia.edu/kermit/ckermit70.html#x7.19 + 311. http://www.columbia.edu/kermit/ckermit70.html#x7.20 + 312. http://www.columbia.edu/kermit/ckermit70.html#x7.20.1 + 313. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2 + 314. http://www.columbia.edu/kermit/ckermit70.html#x7.21 + 315. http://www.columbia.edu/kermit/ckermit70.html#x7.22 + 316. http://www.columbia.edu/kermit/ckermit70.html#x7.23 + 317. http://www.columbia.edu/kermit/ckermit70.html#x7.24 + 318. http://www.columbia.edu/kermit/ckermit70.html#x7.25 + 319. http://www.columbia.edu/kermit/ckermit70.html#x7.26 + 320. http://www.columbia.edu/kermit/ckermit70.html#x7.26.1 + 321. http://www.columbia.edu/kermit/ckermit70.html#x7.26.2 + 322. http://www.columbia.edu/kermit/ckermit70.html#x7.27 + 323. http://www.columbia.edu/kermit/ckermit70.html#x8 + 324. http://www.columbia.edu/kermit/ckermit70.html#x9 + 325. http://www.columbia.edu/kermit/ckermit70.html#x9.0 + 326. http://www.columbia.edu/kermit/ckermit70.html#x9.1 + 327. http://www.columbia.edu/kermit/ckermit70.html#x9.2 + 328. http://www.columbia.edu/kermit/ckermit70.html#x9.3 + 329. http://www.columbia.edu/kermit/ckermit70.html#x10 + 330. http://www.columbia.edu/kermit/ckermit70.html#xiii + 331. http://www.columbia.edu/kermit/ckermit70.html#xiii.1 + 332. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.1 + 333. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2 + 334. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.1 + 335. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.2 + 336. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.3 + 337. http://www.columbia.edu/kermit/ckermit70.html#xiii.2 + 338. http://www.columbia.edu/kermit/ckermit70.html#xiv + 339. http://www.columbia.edu/kermit/ckermit70.html#xv + 340. http://www.columbia.edu/kermit/ckb2.htm + 341. http://www.columbia.edu/kermit/ckbreviews.html + 342. http://www.bhusa.com/ + 343. http://www.columbia.edu/kermit/manuals.html#ckde + 344. http://www.columbia.edu/kermit/manuals.html#ktb + 345. http://www.columbia.edu/kermit/news.html + 346. news:comp.protocols.kermit.announce + 347. news:comp.protocols.kermit.misc + 348. http://www.columbia.edu/kermit/ckb2.htm + 349. http://www.columbia.edu/kermit/ckermit70.html#x4 + 350. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 351. http://www.columbia.edu/kermit/ckermit70.html#x4.23 + 352. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1 + 353. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 354. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 355. http://www.columbia.edu/kermit/ckermit70.html#x4.9. + 356. http://www.columbia.edu/kermit/ckb2.htm + 357. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2 + 358. http://www.columbia.edu/kermit/ckermit70.html#x2.15 + 359. http://www.columbia.edu/kermit/ckermit70.html#x9.1 + 360. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 361. http://www.columbia.edu/kermit/ckermit70.html#x7.4 + 362. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 363. http://www.columbia.edu/kermit/ckermit70.html#mjd + 364. http://www.columbia.edu/kermit/ckermit70.html#mjd + 365. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 366. http://www.columbia.edu/kermit/ckb2.htm + 367. http://www.columbia.edu/kermit/ckb2.htm + 368. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 369. http://www.columbia.edu/kermit/ckermit70.html#x2.12 + 370. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 371. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 372. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5 + 373. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 374. http://www.columbia.edu/kermit/ckermit70.html#x7.18 + 375. http://www.columbia.edu/kermit/ckermit70.html#x7.4 + 376. http://www.columbia.edu/kermit/ckermit70.html#x1.15 + 377. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 378. http://www.columbia.edu/kermit/ckermit70.html#x7.3 + 379. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 380. http://www.columbia.edu/kermit/ckermit70.html#x7.1 + 381. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 382. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt + 383. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt + 384. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4 + 385. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5 + 386. http://www.columbia.edu/kermit/ckb2.htm + 387. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5 + 388. http://www.columbia.edu/kermit/ckermit70.html#x7.12 + 389. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16 + 390. http://www.columbia.edu/kermit/ckermit70.html#x2.7 + 391. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5 + 392. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 393. http://www.telefonica.es/cambiodenumeracion/ + 394. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 395. http://www.columbia.edu/kermit/ckb2.htm + 396. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2 + 397. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11 + 398. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13 + 399. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12 + 400. http://www.columbia.edu/kermit/ckb2.htm + 401. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1 + 402. http://www.columbia.edu/kermit/ckb2.htm + 403. http://www.columbia.edu/kermit/ckb2.htm + 404. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7 + 405. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6 + 406. http://www.columbia.edu/kermit/ckb2.htm + 407. ftp://kermit.columbia.edu/kermit/f/telnet.txt + 408. http://www.columbia.edu/kermit/telnet.htm + 409. ftp://kermit.columbia.edu/kermit/f/telnet.txt + 410. http://www.columbia.edu/kermit/telnet.htm + 411. ftp://ftp.isi.edu/in-notes/rfc1572.txt + 412. ftp://ftp.isi.edu/in-notes/rfc779.txt + 413. http://www.columbia.edu/kermit/ckb2.htm + 414. http://www.columbia.edu/kermit/ckermit70.html#x2.10 + 415. http://www.columbia.edu/kermit/ckermit70.html#x2.8 + 416. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 417. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 418. http://www.psy.uq.oz.au/~ftp/Crypto/ + 419. http://www.columbia.edu/kermit/security.htm + 420. http://srp.stanford.edu/srp/ + 421. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1, + 422. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt + 423. http://www.columbia.edu/kermit/security.htm + 424. http://www.columbia.edu/kermit/ckb2.htm + 425. http://www.columbia.edu/kermit/ckermit70.html#x2.7 + 426. http://www.columbia.edu/kermit/ckermit70.html#x2.0 + 427. ftp://kermit.columbia.edu/kermit/f/ckuins.txt + 428. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt + 429. ftp://kermit.columbia.edu/kermit/f/ckuins.txt + 430. http://www.columbia.edu/kermit/iksd.html#x4.2 + 431. http://www.columbia.edu/kermit/iksd.html + 432. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1 + 433. ftp://ftp.isi.edu/in-notes/rfc1945.txt + 434. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 435. http://www.columbia.edu/kermit/ckermit70.html#x3.2 + 436. http://www.columbia.edu/kermit/ckermit70.html#x3.2 + 437. http://www.columbia.edu/kermit/ckb2.htm + 438. http://www.columbia.edu/kermit/ckb2.htm + 439. http://www.columbia.edu/kermit/ckermit70.html#x5.4 + 440. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt + 441. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 442. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 443. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3 + 444. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 445. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 446. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 447. http://www.columbia.edu/kermit/ckermit70.html#x4.15 + 448. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4 + 449. http://www.columbia.edu/kermit/ckermit70.html#x4.7 + 450. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3 + 451. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3 + 452. http://www.columbia.edu/kermit/ckb2.htm + 453. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2 + 454. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 455. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2 + 456. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 457. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 458. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 459. http://www.columbia.edu/kermit/ckermit70.html#x4.15 + 460. http://www.telstra.com.au/docs/PGP/ + 461. http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html + 462. http://www.columbia.edu/kermit/security.htm + 463. http://www.columbia.edu/kermit/ckermit70.html#x2.7 + 464. http://www.columbia.edu/kermit/ckb2.htm + 465. http://www.columbia.edu/kermit/ckermit70.html#x2.14 + 466. http://www.columbia.edu/kermit/ckermit70.html#x1.23 + 467. http://www.columbia.edu/kermit/ckermit70.html#x4.7 + 468. http://www.columbia.edu/kermit/ckb2.htm + 469. http://www.columbia.edu/kermit/ckb2.htm + 470. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 471. http://www.columbia.edu/kermit/ckb2.htm + 472. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4 + 473. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 474. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5 + 475. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 476. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 477. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4 + 478. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 479. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4 + 480. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5 + 481. http://www.columbia.edu/kermit/ckb2.htm + 482. http://www.columbia.edu/kermit/ckb2.htm + 483. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 484. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 485. http://www.columbia.edu/kermit/ckermit70.html#x7.10 + 486. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11 + 487. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 488. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2 + 489. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 490. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4 + 491. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 492. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6 + 493. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 494. http://www.columbia.edu/kermit/ckermit70.html#x4.1 + 495. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 496. http://www.columbia.edu/kermit/ckb2.htm + 497. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 498. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2 + 499. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 500. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 501. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 502. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2 + 503. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 504. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 505. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 506. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5 + 507. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6 + 508. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 509. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 510. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 511. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 512. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 513. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1 + 514. http://www.columbia.edu/kermit/ckermit70.html#x7.10 + 515. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5 + 516. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3 + 517. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5 + 518. http://www.columbia.edu/kermit/ckb2.htm + 519. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 520. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 521. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 522. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 523. http://www.columbia.edu/kermit/ckermit70.html#x4.15 + 524. http://www.columbia.edu/kermit/ckermit70.html#x4.18 + 525. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 526. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 527. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 528. http://www.columbia.edu/kermit/ckermit70.html#x4.19 + 529. http://www.columbia.edu/kermit/ckermit70.html#x4.16 + 530. http://www.columbia.edu/kermit/ckermit70.html#x4.19 + 531. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3 + 532. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 533. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4 + 534. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2 + 535. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3 + 536. http://www.columbia.edu/kermit/ckb2.htm + 537. http://www.columbia.edu/kermit/ckb2.htm + 538. http://www.columbia.edu/kermit/ckermit70.html#x9.3 + 539. http://www.columbia.edu/kermit/ckermit70.html#x5.2.1 + 540. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1 + 541. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2 + 542. http://www.columbia.edu/kermit/ckermit70.html#x6.6 + 543. http://www.columbia.edu/kermit/ckermit70.html#xiii + 544. http://www.columbia.edu/kermit/ckermit70.html#xiii + 545. ftp://ftp.isi.edu/in-notes/rfc1489.txt + 546. ftp://ftp.isi.edu/in-notes/rfc2319.txt + 547. http://www.unicode.org/ + 548. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2 + 549. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1 + 550. ftp://ftp.isi.edu/in-notes/rfc2640.txt + 551. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2 + 552. http://www.columbia.edu/kermit/ckermit70.html#x6.0 + 553. http://www.columbia.edu/kermit/ckermit70.html#x6.5 + 554. http://www.columbia.edu/kermit/ckermit70.html#x6.4 + 555. http://www.columbia.edu/kermit/ckb2.htm + 556. http://www.columbia.edu/kermit/ckermit70.html#x4.21 + 557. http://www.columbia.edu/kermit/ckermit70.html#x6.5 + 558. http://www.columbia.edu/kermit/ckermit70.html#x2.8 + 559. http://www.columbia.edu/kermit/ckermit70.html#x7.7 + 560. http://www.columbia.edu/kermit/ckermit70.html#x7.2 + 561. http://www.columbia.edu/kermit/ckermit70.html#x1.19 + 562. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 563. http://www.columbia.edu/kermit/ckermit70.html#x4.1 + 564. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 565. http://www.columbia.edu/kermit/ckermit70.html#x4.1 + 566. http://www.columbia.edu/kermit/ckermit70.html#x4.2 + 567. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11 + 568. http://www.columbia.edu/kermit/ckermit70.html#x2.10 + 569. http://www.columbia.edu/kermit/ckermit70.html#ferrstring + 570. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5 + 571. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10 + 572. http://www.columbia.edu/kermit/ckermit70.html#x9.1 + 573. http://www.columbia.edu/kermit/ckermit70.html#x7.23 + 574. http://www.columbia.edu/kermit/ckermit70.html#x7.23 + 575. http://www.columbia.edu/kermit/ckermit70.html#x1.22 + 576. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 577. http://www.columbia.edu/kermit/ckermit70.html#x7.23 + 578. http://www.columbia.edu/kermit/ckermit70.html#x7.24 + 579. http://www.columbia.edu/kermit/ckermit70.html#x7.24 + 580. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3 + 581. http://www.columbia.edu/kermit/ck90.html + 582. http://www.columbia.edu/kermit/ckermit70.html#x7.12 + 583. http://www.columbia.edu/kermit/ckermit70.html#x7.9 + 584. http://www.columbia.edu/kermit/ckb2.htm + 585. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 586. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 587. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 588. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 589. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 590. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4 + 591. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5 + 592. http://www.columbia.edu/kermit/ckermit70.html#x7.8 + 593. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 594. http://www.columbia.edu/kermit/ckb2.htm + 595. http://www.columbia.edu/kermit/ckermit70.html#x7.19 + 596. http://www.columbia.edu/kermit/ckermit70.html#x7.16 + 597. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1 + 598. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 599. http://www.columbia.edu/kermit/ckermit70.html#x7.3 + 600. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 601. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1 + 602. http://www.columbia.edu/kermit/ckermit70.html#x7.10 + 603. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10 + 604. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 605. http://www.columbia.edu/kermit/ckermit70.html#x7.23 + 606. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 607. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7 + 608. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3 + 609. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11 + 610. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 611. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3 + 612. http://www.columbia.edu/kermit/ckermit70.html#x7.3 + 613. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2 + 614. http://www.columbia.edu/kermit/ckb2.htm + 615. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2 + 616. http://www.columbia.edu/kermit/ckermit70.html#x1.22 + 617. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 618. http://www.columbia.edu/kermit/ckermit70.html#x1.22 + 619. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 620. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 621. http://www.columbia.edu/kermit/ckermit70.html#x1.22 + 622. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 623. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 624. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 625. http://www.columbia.edu/kermit/ckermit70.html#x7.19 + 626. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1 + 627. http://www.columbia.edu/kermit/ckermit70.html#x9.3 + 628. http://www.columbia.edu/kermit/ckermit70.html#x7.5 + 629. http://www.columbia.edu/kermit/ckb2.htm + 630. http://www.columbia.edu/kermit/ckermit80.html + 631. http://www.columbia.edu/kermit/ckermit70.html#x7.4 + 632. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2 + 633. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5 + 634. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9 + 635. http://www.columbia.edu/kermit/ckermit70.html#x1.10 + 636. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 637. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1 + 638. http://www.columbia.edu/kermit/iksd.html + 639. http://www.columbia.edu/kermit/ckermit70.html#x7.19 + 640. http://www.columbia.edu/kermit/ckermit70.html#x4.10 + 641. http://www.columbia.edu/kermit/ckermit70.html#x4.11 + 642. http://www.columbia.edu/kermit/ckermit70.html#x4.3 + 643. http://www.columbia.edu/kermit/gkermit.html + 644. http://www.columbia.edu/kermit/ckermit70.html#x4.20 + 645. http://www.columbia.edu/kermit/gkermit.html + 646. http://www.columbia.edu/kermit/ckb2.htm + 647. http://www.columbia.edu/kermit/ckermit70.html#x7.3 + 648. mailto:kermit@columbia.edu + 649. http://www.columbia.edu/kermit/ckermit70.html#top + 650. http://www.columbia.edu/kermit/ckermit.html + 651. http://www.columbia.edu/kermit/index.html diff --git a/ckermit80.txt b/ckermit80.txt new file mode 100644 index 0000000..38c6fdd --- /dev/null +++ b/ckermit80.txt @@ -0,0 +1,10258 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +C-Kermit 8.0 Update Notes + + [ [11]Contents ] [ [12]C-Kermit ] [ [13]Kermit Home ] + +Second Supplement to [14]Using C-Kermit, 2nd Edition + +For C-Kermit 8.0 + + As of C-Kermit version: 8.0.211 + Date of C-Kermit release: 10 April 2003 + This file last updated: Mon Sep 13 08:52:36 2010 + + * IF YOU ARE READING A PLAIN-TEXT version of this document, note that + it is a plain-text dump of a Web page. You can visit the original + (and possibly more up-to-date) Web page here: + [15]http://www.columbia.edu/kermit/ckermit80.html + + * If you are reading the HTML version of this file with a GUI Web + browser, the features added since C-Kermit 8.0.201 are shown in red + if your browser and monitor permit. Features that were new to + versions 8.0.200 and 201 are in black. + +Authors: Frank da Cruz and Christine M. Gianone +Address: The Kermit Project + Columbia University + 612 West 115th Street + New York NY 10025-7799 + USA +Fax: +1 (212) 662-6442 +E-Mail: [16]kermit-support@columbia.edu +Web: [17]http://www.columbia.edu/kermit/ +Or: [18]http://www.kermit-project.org/ +Or: [19]http://www.columbia.nyc.ny.us/kermit/ + +NOTICES + + This document: + Copyright © 1997, 2002, Frank da Cruz and Christine M. Gianone. + All rights reserved. + + Kermit 95: + Copyright © 1995, 2002, Trustees of Columbia University in the + City of New York. All rights reserved. + + C-Kermit: + Copyright © 1985, 2002, + Trustees of Columbia University in the City of New York. All + rights reserved. See the C-Kermit [20]COPYING.TXT file or the + copyright text in the [21]ckcmai.c module for disclaimer and + permissions. + + When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or + SSL/TLS protocol are included: + Portions Copyright © 1990, Massachusetts Institute of + Technology. + Portions Copyright © 1991, 1993 Regents of the University of + California. + Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T. + Portions Copyright © 1997, Stanford University. + Portions Copyright © 1995-1997, Eric Young . + + For the full text of the third-party copyright notices, see + [22]Appendix V. + +WHAT IS IN THIS FILE + + This file lists changes made to C-Kermit since version 7.0 was released + in January 2000. Use this file as a supplement to: + + * The second edition of [23]Using C-Kermit; and: + * The [24]C-Kermit 7.0 Update Notes. Also available in plain-text + form as [25]ckermit70.txt. + + until the third edition of Using C-Kermit is published. We apologize + for the scattered documentation and will consolidate it when we are + able. + +ADDITIONAL FILES + + Several other files accompany this new Kermit release: + + [26]ckututor.html + C-Kermit Tutorial (for Unix). Also distributed in Nroff form as + [27]ckuker.nr, the Unix C-Kermit manual page. + + [28]security.htm + Discussion of Kermit's new authentication and encryption + features, updated for C-Kermit 8.0. + + [29]telnet.htm + Detailed documentation of Kermit's Telnet client, updated for + C-Kermit 8.0. + + [30]ftpscripts.html + Tutorial: Writing FTP automation scripts + + [31]ckcbwr.html + Platform-independent C-Kermit hints and tips. Also distributed + in plain text form as [32]ckcbwr.txt + + [33]ckubwr.html + Unix-specific C-Kermit hints and tips. Also distributed in plain + text form as [34]ckubwr.txt. + + [35]ckvbwr.html + VMS-specific C-Kermit hints and tips. Also distributed in plain + text form as [36]ckvbwr.txt. + + [37]ckuins.html + Unix C-Kermit installation instructions. Also distributed in + plain text form as [38]ckuins.txt. + + [39]ckvins.html + VMS C-Kermit installation instructions. Also distributed in + plain text form as [40]ckvins.txt. + + [41]ckccfg.html + Compile-time configuration options. Also distributed in plain + text form as [42]ckccfg.txt. + + [43]ckcplm.html + C-Kermit Program Logic Manual. Also distributed in plain text + form as [44]ckcplm.txt. + + [45]iksd.html + Internet Kermit Service Aministrators Guide for Unix. + + [46]skermit.html + C-Kermit as an SSH Subsystem (SFTP server replacement). + + [ [47]Top ] [ [48]C-Kermit ] [ [49]Kermit Home ] + +CONTENTS + + [50]0. WHAT'S NEW + [51]1. FIXES SINCE VERSION 7.0.196 + [52]2. SSH AND HTTP + [53]2.1. SSH Connections + [54]2.2. HTTP Connections + [55]2.2.1. HTTP Command Switches + [56]2.2.2. HTTP Action Commands + [57]2.2.3. HTTP Headers + [58]2.2.4. Secure HTTP Connections + [59]2.2.5. HTTP Variables + [60]2.2.6. The HTTP Command-Line Personality + [61]3. THE BUILT-IN FTP CLIENT + [62]3.1. Making and Managing FTP Connections + [63]3.1.1. Kermit Command-Line Options for FTP + [64]3.1.2. The FTP Command-Line Personality + [65]3.1.3. The FTP URL Interpreter + [66]3.1.4. Interactive FTP Session Establishment + [67]3.2. Making Secure FTP Connections + [68]3.3. Setting FTP Preferences + [69]3.4. Managing Directories and Files + [70]3.5. Uploading Files With FTP + [71]3.5.1. FTP PUT Switches + [72]3.5.2. Update Mode + [73]3.5.3. Recovery + [74]3.6. Downloading Files With FTP + [75]3.6.1. FTP GET Switches + [76]3.6.2. Filename Collisions + [77]3.6.3. Recovery + [78]3.7. Translating Character Sets + [79]3.7.1. Character Sets and Uploading + [80]3.7.2. Character Sets and Downloading + [81]3.8. FTP Command Shortcuts + [82]3.9. Dual Sessions + [83]3.10. Automating FTP Sessions + [84]3.10.1. FTP-Specific Variables and Functions + [85]3.10.2. Examples + [86]3.10.3. Automating Secure FTP Connections + [87]3.11. Advanced FTP Protocol Features [88]4. FILE SCANNING + [89]5. FILE AND DIRECTORY NAMES CONTAINING SPACES + [90]6. OTHER COMMAND PARSING IMPROVEMENTS + [91]6.1. Grouping Macro Arguments + [92]6.2. Directory and File Name Completion + [93]6.3. Passing Arguments to Command Files + [94]6.4. More-Prompting + [95]6.5. Commas in Macro Definitions + [96]6.6. Arrow Keys + [97]7. NEW COMMANDS AND SWITCHES + [98]8. SCRIPTING IMPROVEMENTS + [99]8.1. Performance and Debugging + [100]8.2. Using Macros as Numeric Variables + [101]8.3. New IF Conditions + [102]8.4. The ON_UNKNOWN_COMMAND and ON_CD Macros + [103]8.5. The SHOW MACRO Command + [104]8.6. Arrays + [105]8.7. New or Improved Built-in Variables and Functions + [106]8.8. The RETURN and END Commands + [107]8.9. UNDEFINing Groups of Variables + [108]8.10. The INPUT and MINPUT Commands + [109]8.11. Learned Scripts + [110]8.12. Pattern Matching + [111]8.13. Dates and Times + [112]8.14. Trapping Keyboard Interruption + [113]9. S-EXPRESSIONS + [114]9.1. What is an S-Expression? + [115]9.2. Integer and Floating-Point-Arithmetic + [116]9.3. How to Use S-Expressions + [117]9.4. Summary of Built-in Constants and Operators + [118]9.5. Variables + [119]9.6. Assignments and Scope + [120]9.7. Conditional Expressions + [121]9.8. Extensibility + [122]9.9. Examples + [123]9.10. Differences from Algebraic Notation + [124]9.11.Differences from Lisp + [125]10. FILE TRANSFER + [126]11. MODEMS AND DIALING + [127]12. TERMINAL CONNECTION + [128]13. CHARACTER SETS + [129]14. DIALOUT FROM TELNET TERMINAL SERVERS + [130]15. COPING WITH BROKEN KERMIT PARTNERS + [131]16. NEW COMMAND-LINE OPTIONS + [132]17. LOGS + + [ [133]Top ] [ [134]C-Kermit ] [ [135]Kermit Home ] + +0. WHAT'S NEW + + The Initialization and Customization Files + C-Kermit 8.0 now supports specification of the initialization + file name (path) in an environment variable, CKERMIT_INI. It + also relies far less than before on the initialization for + functioning. See [136]Section 5 of the Unix C-Kermit + [137]installation instructions for details. As of version + 8.0.201, C-Kermit also executes your customization file (if you + have one) even if the initialization file was not found. + Previously, the customization file was executed by a TAKE + command in the initialization file (and it still is, if an + initialization is found). + + Incompatible Changes + As always, we do our best to avoid changes that break existing + scripts. However, C-Kermit 8.0 does include a rather pervasive + syntax change that might alter the behavior of scripts that + depend on the previous behavior. As described in [138]Section 5, + C-Kermit now accepts doublequotes in most contexts where you + previously had to use braces to group multiple words into a + single field, or to force inclusion of leading or trailing + blanks. Most noticeably, in C-Kermit 7.0 and earlier: + + echo {this is a string} + + would print: + + this is a string + + whereas: + + echo "this is a string" + + printed: + + "this is a string" + + In C-Kermit 8.0, both print: + + this is a string + + To force the doublequotes to be treated as part of the string, + use either of the following forms: + + echo {"this is a string"} + echo ""this is a string"" + + Similarly, to force braces to be treated as part of the string: + + echo "{this is a string}" + echo {{this is a string}} + + Other incompatibilities: + + 1. Using the SET HOST command to make HTTP connections is no + longer supported. Instead, use the new HTTP OPEN command, + described in [139]Section 2.2. + + C-Kermit 7.1 Alpha.01 (8 December 2000) + + Its major new features are those listed in the [140]Table of + Contents: the FTP client, file scanning, command parsing and + scripting improvements, S-Expressions, and support for the + Telnet Com Port Option, plus wider availability of the Kerberos, + SSL/TLS, and SRP security options for secure Internet + connections. + + C-Kermit 7.1.199 Alpha.02 (4 January 2001) + + + C-Kermit now accepts [141]FTP, TELNET, and IKSD URLs as its + first command-line argument. + + Character-set translation added to the FTP client for + [142]filenames. + + Optional [143]setting of date of incoming files by FTP [M]GET + from the server date. + + [144]FTP CHECK filename added to let FTP client check the + existence of a file on the server. + + [145]FTP GET /NAMELIST:filename added to get list of server + filenames into a local file. + + [146]FTP [M]PUT /SERVER-RENAME:template added to make server + rename a file as indicated by the template after it has + arrived completely. + + FTP [M]GET /SERVER-RENAME:template added to make server rename + a file as indicated by the template after it has been sent + completely. + + FTP [147]VDIRECTORY added for getting verbose directory + listings from TOPS-20. + + [148]FTP TYPE TENEX added for transferring 8-bit binary files + with PDP-10s. + + Added [149]automatic text/binary mode switching for FTP + [M]GET, based on filename patterns (e.g. *.zip, *.gz, *.exe + are binary; *.txt, *.c are text). + + [150]SET SEND I-PACKETS OFF added for coping with Kermit + servers that do not support I packets. + + A new option was added to [151]\fword() and \fsplit() for + parsing comma-separated lists that might contain empty + elements. + + Bug fixes including: + o {} or "" could not be used as expected to represent the + empty string. + o ,- on a line by itself in a macro definition caused + subsequent statements to be skipped. + o FTP [M]GET didn't work right if path segments were + included in the filespec. + o FTP MGET, if interrupted, did not clear its file list. + o Various problems with FTP PUT /AS-NAME that nobody + noticed. + o Some FTP messages and displays interfered with each + other. + o Parsing of YESTERDAY, TODAY, and TOMORROW in date-time + fields was broken. + o Automatic old-to-new dialing directory format conversion + was broken on VMS. + o Various source-code portability problems fixed. + + Improvement of various HELP and SHOW messages. + + C-Kermit 7.1.199 Alpha.04 (1 April 2001) + + + Big changes: + o Changed default modem type from NONE to GENERIC. + o Generic dialing now sends no init string at all. + o Changed default terminal bytesize from 7 to 8. + + New features: + o SET SESSION-LOG TIMESTAMPED-TEXT for timestamped session + log. + + New modem types: + o Conexant modem family + o Lucent VENUS chipset + o PCTel V.90 chipset + o Zoom V.90 + o Zoom V.92 + + FTP client: + o FTP OPEN /PASSIVE and /ACTIVE switches added. + o Now works with servers that that don't include path in + NLST response. + o Fixed SEND /RECURSIVE not to follow symlinks (UNIX). + o SET FTP VERBOSE-MODE default is now OFF instead of ON. + + Kermit protocol: + o Fixed what I hope is the last "Receive window full" + error. + o SET PREFIXING or SET CONTROL PREFIX now automatically + sets CLEARCHANNEL OFF. + o Fixed incorrect report of number of files transferred at + end of transfer. + o Fixed SEND /RECURSIVE not to follow symlinks (UNIX). + + UNIX: + o HTTP and shadow passwords enabled for SCO 5.0.6. + o Even with SET FILENAMES CONVERTED, spaces were still + accepted in incoming filenames; now they are converted to + underscores. + o Added support for compile-time mktemp()/mkstemp() + selection. + + VMS: + o Session-log format for scripted sessions fixed. + + Scripting: + o Fixed \frdir() not to follow symlinks (UNIX). + o Fixed \fday() not to dump core for dates prior to 17 Mar + 1858. + + General: + o "Closing blah..." message upon exit could not be + surpressed. + o Added /PAGE and /NOPAGE to DELETE switches. + o Added GO response for DELETE /ASK (delete all the rest + without asking). + o Added GO response to "more?" prompt (for multi-page + screen output). + o Updated HELP texts. + + C-Kermit 7.1.199 Beta.01 (10 May 2001) + + + FTP client verbosity adjustments. + + Bug with generic modem dialing pausing several secs fixed. + + SET HOST /USER:, SET LOGIN USERID, etc, fixed when given no + user ID. + + A couple \v(dm_blah) dial modifier variables added. + + "--version" command-line switch added. + + Fixed NetBSD serial-port DTR handling. + + Lots of syntax cleanups for Flexelint and gcc -Wall. + + Fixed modem-type aliases to not take precedence over real + names. + + Fixed funny treatment of doublequotes by ECHO command. + + Enabled SET SESSION-LOG for VMS and other non-UNIX platorms. + + Fixed changing direction in command history buffer. + + Fixed handling of IKSD URLs. + + Made sure DELETE prints a message if it got any errors. + + C-Kermit 8.0.200 Beta.02 (28 June 2001) + + + Major version number increased from 7 to 8. + + [152]SSH command. + + More-consistent Kermit protocol defaults. + + CONNECT idle timeout and action selection. + + CONNECT status variable. + + A way to allocate more space for filename lists. + + Pseudoterminal handler fixed for late-model Linuxes. + + Command-line option -dd for timestamped debug log. + + Download directory now works for external protocols too. + + GREP /COUNT:variable. + + SET ATTRIBUTE RECORD-FORMAT { OFF, ON }. + + Bug fixes. + + C-Kermit 8.0.200 Beta.03 (9 Sep 2001) + + + [153]HTTP 1.1 connections and scripting + + [154]ON_CTRLC macro for trapping Ctrl-C in scripts + + [155]Date-time parsing improvements, timezones, comparison, + arithmetic + + [156]Pattern-matching improvements + + FTP improvements + + SET EXIT HANGUP { ON, OFF } + + SET FILE EOF { CTRL-Z, LENGTH } + + ASK[Q] /TIMEOUT + + Bug fixes + + New platforms + + C-Kermit 8.0.200 Beta.04 (16 Nov 2001) + + + [157]New Unix man page + + [158]New Unix installation instructions + + SET TELOPT policies are now enforced on non-Telnet ports if + the server begins Telnet negotiations. + + SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }. + + UUCP lockfile creation race condition fixed. + + Dialout, modem signals, hangup, hardware flow control, etc, + tested extensively on many platforms, numerous problems fixed. + + Improved hints when dialing fails. + + SET STOP-BITS 2 can now be given without SET FLOW HARDWARE. + + Major improvements in RFC 2217 Telnet Com-Port Control. + + Improved ability to REDIAL a modem server port. + + kermit -h now shows the command name in the usage usage + string. + + kermit -h now shows ALL command-line options. + + kermit -s blah, where blah is a symlink, now works. + + --noperms command-line option = SET ATTRIBUTE PERMISSIONS OFF. + + HTTP and HTTPS URLs now supported on the command line. + + An http command-line personality is now available. + + Initialization file streamlined to load faster, anachronisms + removed. + + Updated NEWS, INTRO, HELP text, SHOW commands. In particular, + see SHOW COMM, HELP SET LINE, HELP WAIT. + + Date/time arithmetic routines converted from floating-point to + integer arithmetic (internally) for greater accuracy and + portability. + + Quoted strings containing commas no longer break macro + execution. + + Dynamic Kermit file-transfer timeouts are now much more + aggressive. + + New "hot keys" to turn debug.log on/off during file transfer. + + Improved hints when file transfer fails. + + FTP CD orientation messages are now printed. + + -R now accepted on the FTP command line to request Recursion. + + -m allows Active or Passive mode to be chosen on the FTP + command line. + + -dd on the FTP command line creates a timestamped debug.log. + + FTP command-line security options filled in. + + Improved automatic text/binary mode switching for MGET. + + Removed spurious error messages that sometimes occur during + MGET. + + DIRECTORY, GREP, TYPE, HEAD, and TAIL now have a /OUTPUT:file + option. + + TYPE /NUMBER adds line numbers. + + CAT = TYPE /NOPAGE; MORE = TYPE /PAGE. + + GETOK ?-help fixed. + + \v(timestamp) (= "\v(ndate) \v(time)") + + \v(hour) (hour of the day, 0-23) + + \funix2dospath() converts a UNIX path (/) to a DOS one (\). + + \fdos2unixpath() converts a DOS (Windows, OS/2) path to a UNIX + one. + + \fkeywordval() parses name=value pair, allows macro keyword + parameters. + + We now make every attempt to not write passwords to the + debug.log. + + New Certficate Authority certificates file, includes the + Kermit Project at Columbia University so you can access our + IKSD securely. + + Secure targets improved and better documented in Unix + makefile. + + All Linux (libc and glibc) builds consolidated under "make + linux". + + HP-UX makefile targets now have consistent names. + + New aix50 and aix51 targets added. + + C-Kermit 8.0.200 Final (12 Dec 2001) + + + Remote/local-mode confusion on some platforms introduced in + Beta.04, fixed. + + Many of the makefile targets adjusted, new ones added. + + New "make install" target should please most people. + + New command: SHOW IKSD. + + FTP over TLS. + + Last-minute touchups to text messages, HELP text, etc. + + Enable modem-signal reading for SCO OSR5 and Unixware 7. + + Special superfast TRANSMIT /BINARY /NOECHO /NOWAIT mode added. + + Fixed PBX dialing in unmarked-area-code case. + + Improved SHOW COMMUNICATIONS tells lockfile directory, typical + dialout device name. + + Some FTP OPEN command parsing problems fixed. + + Some errors in date arithmetic fixed. + + New command: SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP, + CONTINUE } } + + New command: HELP FIREWALL. + + SET MODEM HANGUP-METHOD DTR added as synomym for RS232-SIGNAL + + Support for secure URL protocols added: telnets:, ftps:, + https:. + + C-Kermit 8.0.201 (8 Feb 2002) + + + Installability as an [159]SSH v2 Subsystem. + + [160]SET LOCUS command. + + [161]L-versions of CD, DIR, DELETE, MKDIR, etc, to force local + execution. + + [162]USER and ACCOUNT added as synonyms for FTP USER and FTP + ACCOUNT. + + [163]SHOW VARIABLES now accepts a list of variables. + + Rudimentary support for [164]Caller ID when receiving phone + calls. + + Up/Down [165]Arrow-key navigation of command history buffer. + + [166]Automatic execution of customization file if init file is + missing. + + C-Kermit 8.0.206 Beta.01 (11 Oct 2002) + + New commands: + + o ORIENTATION lists location-related variables and their + values. + o KCD changes to special directories by their symbolic + names ("kcd ?" for a list). + o SET CD HOME path to specify home directory for CD and KCD + commands. + o CONTINUE given at top level is equivalent to END -- handy + when PROMPT'ed out of a script, to continue the script. + + New switches or operands for existing commands: + + o GETOK /TIMEOUT + o ASK, ASKQ, GETOK /QUIET (suppresses error message on + timeout) + o COPY /APPEND now allows concatenating multiple source + files into one dest file. + o SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER, /PASSWORD. + o DIRECTORY command now accepts multiple filespecs, e.g. + "dir a b c". + + SET QUIET ON now also applies to: + + o SET HOST connection progress messages. + o "Press the X or E key to cancel" file-transfer message. + o REMOTE CD response. + o REMOTE LOGIN response. + + Improvements and new features: + + o Numerous FTP client fixes and new features, listed below. + o C-Kermit, when in remote mode at the end of a file + transfer, now prints a one-line "where" message. Control + with SET TRANSFER REPORT. + o Unix makefile "install" target now creates an UNINSTALL + script. + o Improved operation and performance on RFC 2217 Telnet + connections. + o Improved CONNECT (interactive terminal connection) + performance. + o HELP text updated for many commands. + + New or fixed makefile targets: + + o Solaris 9 (several variations) + o Concurrent PowerMAX + o Mac OS X 10.2 + o FreeBSD 1.0 + o FreeBSD 4.6, 5.0 + o AIX 5.2, 5.3 + + Bugs fixed (general): + + o Failure to run in VMS Batch fixed. + o LDIRECTORY fixed to run Kermit's built-in DIRECTORY + command rather than an external one. + o Fixed Solaris and other SVORPOSIX builds to find out + their full hostnames rather than just the "uname -n" + name. + o Fixed some problems matching strings that start with ".". + o Fixed some problems matching pattern that contain {a,b,c} + lists. + o Fixed erroneous reporting of text-mode reception as + binary when sender did not report the file size (cosmetic + only). + o Many problems with SWITCH statements fixed. + o Fixed SET OPTIONS DIRECTORY /DOTFILES to work for server + too. + o Fixed DELETE to print an error message if the file was + not found. + o Fixed SET CONTROL UNPREFIX ALL and SET PREFIXING NONE to + do the same thing. + o Fixed bugs executing macros from within the ON_EXIT + macro. + o \fday() and \fnday() fixed for dates prior to 17 Nov + 1858. + o Serial speed-changing bug in Linux fixed. + o "Unbalanced braces" script parsing errors when using + \{number} fixed. + o "if defined \v(name)" fixed to behave as described in the + book. + o Fixed Problems caused by LOCAL variables whose names are + left substrings of macro names. + o The INPUT command was fixed to honor the PARITY setting. + o Fixed bug with COPY to existing file that is longer than + source file. + o REINPUT command failed to strip braces/quotes around its + target string. + o Network directory lookups didn't work for SSH + connections. + o REMOTE SET { FILE, TRANSFER } CHARACTER-SET fixed. + o Closed some holes whereby an incompletely received file + was not deleted when SET FILE INCOMPLETE is DISCARD, e.g. + when the Kermit is hung up upon. + o SET XFER CHARACTER-SET TRANSPARENT fixed to do the same + as SET XFER TRANSLATION OFF. + o SET HOST PTY (e.g. SSH) connection fixed to pass along + window-size changes. + o C-Kermit search path for TAKE files was accidentally + disabled. + + FTP client bugs fixed: + + o Character set translation was broken on little-endian + (e.g. PC) architectures. + o FTP PUT /SERVER-RENAME:, /RENAME-TO:, /MOVE-TO: switches + were sticky. + o Make SET TRANSFER MODE MANUAL apply to FTP. + o Make SET FILE INCOMPLETE { KEEP, DISCARD } apply to FTP. + o FTP MGET /UPDATE handled equal times incorrectly. + o FTP MGET /RECOVER fixed to ignore file dates, use only + size. + o FTP MGET /RECOVER sometimes downloaded files it didn't + need to. + o FTP downloads with TRANSFER DISPLAY BRIEF could give + misleading error messages. + o FTP MGET temp file not deleted if FTP DEBUG set to OFF + after it was ON. + o LOCUS not switched back when FTP connection is lost. + o Set incoming file date even if it was not completely + received. + o FTP MGET sent SIZE and MDTM commands even when it didn't + have to. + o FTP MGET sent SIZE and MDTM commands even when it knew + they wouldn't work. + o FTP MGET failed if no files were selected for download. + o FTP MGET a* b* c* would fail to get any c*'s if no b*'s + existed. + o Big problems canceling MGET with Ctrl-C. + o Some extraneous LOCUS dialogs squelched. + o Some inconsistencies in SET FTP FILENAMES AUTO fixed. + o Fixed file-descriptor pileup after multiple MGETs when + using mkstemp(). + o Fixed "mget foo", where foo is a directory name. + + FTP improvements: + + o New [167]FTP protocol features added (FEAT, MLSD). + o FTP MGET /RECURSIVE now works as expected if server + supports MLSD. + o FTP MGET /DATES-DIFFER to download if local and remote + file dates differ. + o FTP DATES default changed to ON. + o FTP MPUT, MGET /EXCEPT now allows up to 64 patterns (up + from 8). + o Top-level SITE and PASSIVE commands added for + convenience. + o MGET /COLLISION:APPEND /AS-NAME:newfile *.* puts all + remote files into one local file. + o SET FTP SERVER-TIME-OFFSET for when server has wrong + timezone set. + o Allow for alternative server interpretations of [M]MPUT + /UNIQUE. + o SET FTP ANONOMOUS-PASSWORD lets you specify the default + anonymous password. + o Allow "GET /RECURSIVE path/file" to force local + subdirectory creation. + o SET FTP DISPLAY is like SET TRANSFER DISPLAY but applies + only to FTP. + o FTP { ENABLE, DISABLE } new-protocol-feature-name. + o FTP MGET /NODOTFILES. + o Debug log now records FTP commands and responses in + grep-able format. + + [ [168]Top ] [ [169]Contents ] [ [170]C-Kermit ] [ [171]Kermit Home ] + +1. FIXES SINCE VERSION 7.0.196 First, the changes from 7.0.196 to 7.0.197... +Source and makefile tweaks to get successful builds on platforms that were +not available in time for the 7.0 release: + + * 4.2BSD + * 4.3BSD + * AIX 4.3 + * AT&T 3B2 and 3B20 + * BeOS 4.5 + * CLIX + * Interactive UNIX System V/386 R3.2 V4.1.1 + * OS-9/68000 + * OSF/1 1.3. + * PS/2 AIX 1.2.1 + * SCO OSR5.0.x + * SCO Xenix 2.3.4 + * SINIX 5.41/Intel + * Stratus FTX + * Stratus VOS + * SunOS 4.1 with X.25 + * Ultrix 4.2 + * Unixware 2.0 + + There were no functional changes from 196 to 197. + + Fixes applied after C-Kermit 7.0.197 was released: + + Source code: Big flexelint and "gcc -Wall" audit and cleanup. + + Configuration: + * Solaris RTS/CTS (hardware flow control) didn't work. + * BSDI RTS/CTS worked only in one direction. + * FreeBSD 4.0 with ncurses 5.0 broke interactive command parsing. + * QNX-32 build lacked -DBIGBUFOK so couldn't execute big macros. + + Connections: + * SET HOST /PTY didn't work on some platforms. + * Broken SET HOST /USER:xxx /PASSWORD:yyy /ACCOUNT:zzz switches + fixed. + * Transparent printing was broken in Unix. + * ANSWER 0 (wait forever) didn't work. + * Some problems in Multitech modem command strings. + * Spurious "?Sorry, can't condition console terminal" errors. + * Disabling modem command strings by setting them to nothing broke + dialing. + * SET DIAL TIMEOUT value was usually ignored. + * SET DIAL METHOD PULSE didn't work. + * Certain modem commands, if changed, not refreshed if modem type + changed. + * SET SESSION-LOG command was missing from VMS. + * VMS session log format fixed for scripts. + * HANGUP by dropping DTR didn't work in NetBSD. + * SET FLOW /AUTO versus SET FLOW confusion fixed. + * Spurious secondary Solaris lockfile removed. + * SCO OSR5 DTR On/Off hangup. + * UUCP lockfile race condition. + + Commands and scripts: + * Missing CAUTIOUS and FAST commands restored. + * Broken PTY command in late-model Linuxes fixed (API changed). + * Fixed off-by-one error in command recall when switching direction. + * Fixed recall of commands that contain '?'. + * COPY /SWAP-BYTES didn't work on some architectures. + * Various combinations of COPY switches didn't work. + * Various problems with COPY or RENAME with a directory name as + target. + * SHIFT didn't decrement \v(argc) if used within IF, ELSE, or SWITCH + block. + * SHIFT didn't affect the \%* variable. + * Divide by zero improperly handled in some \function()s. + * Problems with RETURN from right-recursive functions. + * FSEEK /LINE \%c LAST didn't work if already at end. + * Some buffer vulnerabilities and potential memory leaks were + discovered and fixed. + * \frdirectory() fixed not to follow symbolic links. + * SET EXIT WARNING OFF fixed to work when EXIT given in a script. + * Missing DELETE and MKDIR error message fixed. + * \fday() core dump for ancient dates fixed. + + File transfer: + * SEND /COMMAND was broken. + * CRECEIVE was broken (but RECEIVE /COMMAND was OK). + * Quoting wildcard chars in filenames didn't work. + * Problems canceling streaming file transfers with X or Z. + * Problems shifting between streaming and windowing file transfer. + * Non-FULL file-transfer displays erroneously said STREAMING when + not. + * An active SEND-LIST prevented GET from working. + * SET SERVER GET-PATH interpretation of relative names like "." was + wrong. + * The MAIL command was broken. + * "kermit -s *" might have skipped some files. + * Transaction log entries were not made for external protocol + transfers. + * File count report fixed to show number of files actually + transferred. + * Fixed filename conversion to convert spaces to underscores. + * Made SET PREFIXING / SET CONTROL PREFIX also adjust CLEARCHANNEL. + * More "Receive window full" errors fixed. + * Broken terminal buffering after curses display in Solaris fixed. + * SET FILE INCOMPLETE DISCARD did not work in all cases. + * Packet log changed to reformat the start-of-packet character + printably. + * Dynamic timeouts could grow ridiculously large. + + Character sets: + * Hebrew-7 translations missed the letter Tav. + * C1 area of CP1252 was ignored. + * SET TRANSFER CHARACTER-SET TRANSPARENT could give garbage + translations. + * TRANSLATE might not work on Little Endian architectures. + * Insufficient range checking in certain TRANSLATE operations. + + The following bugs in C-Kermit 8.0.200 were fixed in 8.0.201: + + * An obscure path through the code could cause the Unix version of + C-Kermit to dump core during its startup sequence. This happened to + only one person, but now it's fixed. + * When C-Kermit 8.0 is in Kermit server mode and the client says "get + blah", where blah (on the server) is a symlink rather than a real + file, the server unreasonably refused to send the linked-to file. + * When C-Kermit is an FTP client and says "get foo/bar" (i.e. a + filename that includes one or more path segments), it failed to + accept the incoming file (this happened only with GET, not MGET). + * Array references should be case insensitive but only lowercase + array letters were accepted. + * SHOW VARIABLES dumped core on \v(sexpression) and \v(svalue). + * Spurious refusals of remote directory listings if the remote + server's date was set in the past. + * In AIX, and maybe elsewhere too, Kermit's COPY command always + failed with "Source and destination are the same file" when the + destination file didn't exist. + * The VMS version of C-Kermit did not work in Batch or when SPAWN'd. + To compound the problem, it also pretty much ignored the -B and -z + command-line options, whose purpose is to work around such + problems. + * C-Kermit 8.0 could not be built on IRIX 5.x. + * The C-Kermit 8.0 build for QNX6 said it was an "(unknown version)". + + Other fixes are listed in the [172]previous section. + + [ [173]Top ] [ [174]Contents ] [ [175]C-Kermit ] [ [176]Kermit Home ] + +2. SSH AND HTTP + +2.1. SSH Connections + + This section does not apply to [177]Kermit 95 2.0, which has its own + built-in SSH client, which is documented [178]SEPARATELY. + + On most UNIX platforms, C-Kermit can make SSH (Secure SHell) connection + by running the external SSH command or program through its + pseudoterminal interface. The command is: + + SSH text + Tells Kermit to start the external SSH client, passing the given + text to it on the command line. Normally the text is just the + hostname, but it can be anything else that is acceptable to the + ssh client. If the command succeeds, the connection is made and + Kermit automatically enters CONNECT (terminal) mode. You can use + the SSH command to make a connection to any host that has an SSH + server. + + Kermit's SSH command gives you all the features of Kermit on an SSH + connection: command language, file transfer, character-set translation, + scripting, and all the rest. By default, C-Kermit invokes SSH with "-e + none", which disables the ssh escape character and makes the connection + transparent for purposes of file transfer. You can, however, change the + SSH invocation to whatever else you might need (an explicit path, + additional command-line arguments, etc) with: + + SET SSH COMMAND text + Specifies the system command that Kermit's SSH command should + use to invoke the external SSH client. Use this command to + supply a specific path or alternative name, or to include + different or more command-line options. + + In most cases, these connections work quite well. They can be scripted + like any other connection, and file transfer goes as fast as, or faster + than, on a regular Telnet connection. In some cases, however, the + underlying pseudoterminal driver is a limiting factor, resulting in + slow or failed file transfers. Sometimes you can work around such + problems by reducing the Kermit packet length. Note that Kermit does + not consider SSH connections to be reliable, so it does not offer to + use streaming in Kermit protocol transfers (but you can force it with + SET RELIABLE or SET STREAMING if you wish). + + The SSH command is like the TELNET command: it enters CONNECT mode + automatically when the connection is made. Therefore, to script an SSH + connection, use: + + set host /pty ssh -e none [ other-options ] host + if fail ... + + to make the connection. + + Here's a sequence that can be used to make a connection to a given host + using Telnet if the host accepts it, otherwise SSH: + + if not defined \%1 exit 1 Usage: \%0 host + set quiet on + set host \%1 23 /telnet + if fail { + set host /pty ssh -l \m(user) -e none \%1 + if fail exit 1 \%1: Telnet and SSH both fail + echo SSH connection to \%1 successful + } else { + echo Telnet connection to \%1 successful + } + + In SSH v2, it is possible to make an SSH connection direct to a Kermit + server system if the host administrator has configured the SSH server + to allow this; [179]CLICK HERE for details. + + Since Kermit uses external ssh client software, and since there are + different ssh clients (and different releases of each one), the exact + command to be used to make an SSH/Kermit connection can vary. Here is + the command for the OpenSSH 3.0.2p1 client: + +set host /pipe ssh -e none [ -l username ] -T -s hostname kermit + + Example: + +set host /pipe ssh -e none -l olga -T -s hq.xyzcorp.com kermit + + The SSH client might or might not prompt you for a password or other + information before it makes the connection; this depends on your SSH + configuration (your public and private keys, your authorized hosts + file, etc). Here's a brief synopsis of the OpenSSH client command + syntax ("man ssh" for details): + + -e none + This tells the SSH client to use no escape character. Since we + will be transferring files across the connection, we don't want + the connection to suddenly block because some character in the + data. + + -l username + This is the username on the remote host. You can omit the -l + option and its argument if your local and remote usernames are + the same. If they are different, you must supply the remote + username. + + -T + This tells the SSH client to tell the SSH server not to allocate + a pseudoterminal. We are not making a terminal connection, we + don't need a terminal, and in fact if a terminal were allocated + on the remote end, the connection would not work. + + -s ... kermit + This tells the SSH client to tell the SSH server to start the + specified subsystem ("kermit") once the connection is made. The + subsystem name comes after the hostname. + + hostname + The IP host name or address of the desired host. + + You might want to include other or additional ssh command-line options; + "man ssh" explains what they are. Here are some examples for the + OpenSSH 3.0.2p1 client: + + -oClearAllForwardings yes + -oForwardAgent no + -oForwardX11 no + -oFallbackToRsh no + These ensure that a secure connection is used and that the + connection used for file transfer is not also used for + forwarding other things that might be specified in the + ssh_config file. + + -oProtocol 2 + (i.e. SSH v2) Ensures that the negotiated protocol supports + subsystems. + + Once you have an SSH connection to a Kermit server, it's just like any + other connection to a Kermit server (and very similar to a connection + to an FTP server). You give the client file transfer and management + commands for the server, and the server executes them. Of course you + can also give the client any other commands you wish. + + [ [180]SSH Kermit Server Subsystem ] [ [181]Kermit 95 Built-in SSH + Client ] + +2.2. HTTP Connections + + Hypertext Transfer Protocol, or HTTP, is the application protocol of + the World Wide Web (WWW), used between Web browsers (clients) and Web + servers. It allows a client to get files from websites, upload files to + websites, delete files from websites, get information about website + directories and files, and interact with server-side CGI scripts. + C-Kermit includes an HTTP client capable of both clear-text and secure + HTTP connections, that can do all these tasks and can be automated + through the Kermit scripting language. + + Although C-Kermit 7.0 could make HTTP connections to Web servers, it + could do so only when no other connection was open, and the procedure + was somewhat awkward. C-Kermit 8.0 improves matters by: + + * Allowing an HTTP connection to be open at the same time as a + regular SET LINE or SET HOST connection, and also at the same time + as an FTP connection ([182]Section 3); + * Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing + for persistent connections, in which a series of commands can be + sent on the same connection, rather than only one as in HTTP 1.0 + (and C-Kermit 7.0); + * Providing for "one-shot" URL-driven HTTP operations such as GET or + PUT. + * Providing a distinct HTTP command-line personality. + + Persistent HTTP connections are managed with the following commands: + + HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ] + Opens a persistent connection to the specified host (IP host + name or address) on the specified port. If any switches + (options, listed in the next section) are included, their values + are saved and used for all subsequent HTTP action commands on + the same connection. If no port is specified, HTTP (80) is used. + A Uniform Resource Locator (URL, [183]RFC 1738) can be given + instead of a hostname (or address) and port (but the URL can not + include a directory/file path). The security options are + explained [184]below. The HTTP OPEN command replaces the + C-Kermit 7.0 SET HOST hostname HTTP command, which no longer + works with HTTP GET and related commands. + + HTTP CLOSE + Closes any open HTTP connection and clears any saved switch + values. + + A URL starts with a protocol name, which must be http or https in this + case; optionally includes a username and password; and must contain a + host name or address: + + protocol://[user[.password]]@host[:port][URI] + + HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS) + version of HTTP. The TCP service port is derived from the protocol + prefix (so normally the ":port" field is omitted). Thus the URL + protocol name specifies a default TCP service port and the URL user and + password fields can take the place of the /USER and /PASSWORD switches + ([185]Section 2.2.1). The optional URI is a "compact string of + characters for identifying an abstract or physical resource" ([186]RFC + 2396), such as a file. It must begin with a slash (/); if the URI is + omitted, "/" is supplied. Examples: + + http open http://www.columbia.edu/ + Equivalent to http open www.columbia.edu or http open + www.columbia.edu http. + + http open https://olga.secret@www1.xyzcorp.com/ + Equivalent to http /user:olga /pass:secret open www1.xyzcorp.com + https. + + Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0 + server closes the connection after each action. Although HTTP 1.1 + allows multiple actions on the same connection, an HTTP 1.1 server + tends to close the connection if it is idle for more than a few + seconds, to defend itself against denial-of-service attacks. But when + you use Kermit's HTTP OPEN command to create a connection, Kermit + reopens it automatically (if necessary) for each HTTP action until you + close it with HTTP CLOSE, regardless of the server's HTTP protocol + version, or how many times it closes the connection. + + Firewalls can be negotiated through proxies with the following + commands: + + SET TCP HTTP-PROXY [ host[:port] ] + If a host (by hostname or IP address) is specified, Kermit uses + it as a proxy server when attempting outgoing TCP connections -- + not only HTTP connections, but all TCP/IP connections, Telnet + and FTP included. This allows Kermit to adapt to the HTTP + firewall penetration method (as opposed to other methods such as + SOCKS4). If no hostname or ip-address is specified, any + previously specified Proxy server is removed. If no port number + is specified, the "http" service is used. This command must be + given before the HTTP OPEN command if a proxy is to be used or + canceled. + + HTTP [ switches ] CONNECT host[:port] + Instructs the HTTP server to act as a proxy, establishing a + connection to the specified host (IP hostname or address) on the + given port (80 = HTTP by default) and to redirect all data + transmitted between Kermit and itself to the given host for the + life of the connection. This command is to be used only for + debugging HTTP proxy connections. If a proxy connection is + required, instruct Kermit to use the proxy with the SET TCP + HTTP-PROXY command. + +2.2.1. HTTP Command Switches + + HTTP switches, like all other switches, are optional. When HTTP + switches are included with the HTTP OPEN command, they apply + automatically to this and all subsequent HTTP actions (GET, PUT, ...) + on the same connection until an HTTP CLOSE command is given. So if you + include switches (or the equivalent URL fields, such as user and + password) in the HTTP OPEN command, you can omit them from subsequent + commands on the same connection. If the connection has closed since + your last command, it is automatically reopened with the same options. + + If you include switches with an HTTP action command (such as GET or + PUT), they apply only to that command. + + /USER:name + To be used in case a page requires a username for access. The + username is sent with page requests. If it is given with the + OPEN command it is saved until needed. If a username is included + in a URL, it overrides the username given in the switch. + CAUTION: Username and password (and all other information, + including credit card numbers and other material that you might + prefer to protect from public view) are sent across the network + in clear text on regular HTTP connections, but authentication is + performed securely on HTTPS connections. + + /PASSWORD:text + To be used in case a web page requires a password for access. + The password is sent with page requests. If it is given with the + OPEN command it is saved until needed. If a password is given in + a URL, it overrides the one given here. CAUTION: (same as for + /USER:). + + /AGENT:user-agent + Identifies the client to the server. Overrides the default agent + string, which is "C-Kermit" (for C-Kermit) or "Kermit-95" (for + Kermit 95). + + /ARRAY:array-designator + Tells Kermit to store the response headers in the given array, + one line per element. The array need not be declared in advance. + Example: /array:&a. + + /TOSCREEN + Tells Kermit to display any response text on the screen. It + applies independently of the output file specification; thus it + is possible to have the server response go to the screen, a + file, both, or neither. + + /HEADER:header-item(s) + Used for specifying any optional headers to be sent with HTTP + requests. + + /HEADER:tag:value + + To send more than one header, use braces for grouping: + + /HEADER:{{tag:value}{tag:value}...} + + For a list of valid tags and value formats see [187]RFC 2616, + "Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight + headers may be specified. + +2.2.2. HTTP Action Commands + + HTTP actions can occur within a persistent connection, or they can be + self-contained ("connectionless"). A persistent HTTP connection begins + with an HTTP OPEN command, followed by zero or more HTTP action + commands, and is terminated with an HTTP CLOSE command: + + http open www.columbia.edu + if failure stop 1 HTTP OPEN failed: \v(http_message) + http get kermit/index.html + if failure stop 1 HTTP GET failed: \v(http_message) + (more actions possible here...) + http close + + A self-contained HTTP action occurs when a URL is given instead of a + remote file name to an HTTP action command. In this case, Kermit makes + the HTTP connection, takes the action, and then closes the connection. + If an HTTP connection was already open, it is closed silently and + automatically. + + http get http://www.columbia.edu/kermit/index.html + + Kermit's HTTP action commands are as follows. Switches may be included + with any of these to override switch (or default) values given in the + HTTP OPEN command. + + HTTP [ switches ] GET remote-filename [ local-filename ] + Retrieves the named file from the server specified in the most + recent HTTP OPEN command for which a corresponding HTTP CLOSE + command has not been given. The filename may not include + wildcards (HTTP protocol does not support them). If no HTTP OPEN + command is in effect, this form of the HTTP GET command fails. + The default local filename is the same as the remote name, but + with any pathname stripped. For example, the command http get + kermit/index.html stores the file in the current local directory + as index.html. If the /HEADERS: switch is included, information + about the file is also stored in the specified array (explained + in [188]Section 2.2.3). All files are transferred in binary + mode. HTTP does not provide for record-format or character-set + conversion. + + HTTP [ switches ] GET url [ local-filename ] + When HTTP GET is given a URL rather than a filename, Kermit + opens a connection to the designated server (closing any + previously open HTTP connection), gets the file, and then closes + the connection. If the URL does not include a filename, + index.html is supplied. This is the self-contained one-step + "connectionless" method for getting a file from a Web server. + The data is not interpreted; HTTP GET is like "lynx -source" + rather than "lynx -dump". + + In the remaining HTTP action commands, the distinction between a remote + filename and a URL are the same as in the HTTP GET command. + + HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ] + Like GET except without actually getting the file; instead it + retrieves only the headers. If the /ARRAY: or /TOSCREEN switch + is included, there is no default local output filename but you + can still specify one. If neither of these switches is included, + the default local filename is the same as the remote filename, + but with any path stripped and with ".head" appended. The HEAD + command can be used in a script with the /ARRAY: switch to + retrieve information about the requested resource to determine + whether the resource should actually be retrieved with a + subsequent GET request. + + HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ] + Asks the server to send a listing of the files in the given + server directory. This command is not supported by most Web + servers. Even when it is supported, there is no standard format + for the listing. + + HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file + remote-path-or-url [ result-file ] + Sends data to a process running on the remote host; the result + is usually an HTML file but could be anything. The data to be + posted must be read from a local file (the source-file). If a + result file is specified, Kermit stores the server's response in + it. + + HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [ + remote-file-or-url [ result-file ] ] + Uploads a local file to the server. Only the name of a single + file can be given; wildcards (and group transfers) are not + supported by HTTP protocol. If no remote filename is given, the + file is sent with the same name as the local file, but with any + pathname stripped. + + HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ] + Asks the server to delete the specified single file. If a result + file is specified, it will contain any response data returned by + the server. + + Note the limitations of HTTP protocol compared to (say) FTP or Kermit. + There is no command for changing directories, no standard way to get + file or directory lists, no way to transfer file groups by using + wildcard notation, etc, and therefore no good way to (say) fetch all + pages, descend through subdirectories, perform automatic updates, etc. + There is no assurrance a connection will stay open and, as noted, there + is no provision for data conversion between unlike platforms. The + data's MIME headers can be used for postprocessing. + +2.2.3. HTTP Headers + + Each HTTP request and response contains a set of name/value pairs + called headers. HTTP headers are specified in [189]RFC 2616. For + example, an HTTP GET request for /index.html on www.columbia.edu + contains the following headers: + + GET /index.html HTTP/1.1 + Host: www.columbia.edu:80 + User-agent: C-Kermit 8.0 + Authorization: Basic base64-encoded-username-password + + These might be followed by any others specified with a /HEADERS: + switch: + + Accept: image/gif, image/x-xbitmap, image/jpeg, *.* + Accept-Encoding: gzip + Accept-Language: en + Accept-Charset: iso-8859-1,utf-8 + Cookie: cookie-data + + The server sends back a short report about the file prior to sending + the file contents. Example: + + HTTP/1.1 200 OK + Date: Fri, 24 Aug 2001 21:09:39 GMT + Server: Apache/1.3.4 (Unix) + Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT + ETag: "1fa137-10d7-3b6f091d" + Accept-Ranges: bytes + Content-Length: 4311 + Content-Type: text/html + + If you want to have this information available to a Kermit script you + can use the /ARRAY switch to have Kermit put it in array, one line per + array element. Example: + + set exit warning off + http open www.columbia.edu + if fail exit 1 Can't reach server + http /array:&a get /index.html + if fail exit 1 Can't get file + echo Header lines: \fdim(&a) + for \%i 1 \fdim(&a) 1 { + echo \%i. \&a[\%i] + } + + Note that the "Date:" item is the current date and time; the + "Last-Modifed:" item is the file's modification date and time. An + example showing how to use this information is presented in + [190]Section 8.13.7. + +2.2.4. Secure HTTP Connections + + SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the + protocol used to secure HTTP, SMTP, and other Internet applications. + See the [191]C-Kermit Reference Section 5.4 for an introduction to + SSL/TLS. To make a secure HTTP connection, you need: + + 1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS + security built in). Type "check ssl" at the Kermit prompt to make + sure you have it. + 2. A secure server to connect to. + 3. The CA Root Certificate used to authenticate the server to the + client. (see [192]Section 15 of the security reference for an + introduction to certificates). + + And you must make a connection to the secure HTTP port: service name + HTTPS, port number 443 (as opposed to service HTTP, port 80). You can + also make secure connections to other ports by including the /TLS or + /SSL switch with the HTTP OPEN command, if the host supports SSL/TLS on + the given port: + + The quality of the SSL/TLS connection depends on the cipher suite. + There are several possibilities: + + Anonymous cipher suite: + If an anonymous cipher suite is negotiated, the connection is + encrypted but there is no authentication. This connection is + subject to a Man-In-The-Middle (MITM) attack. + + X.509 certificate on the server: + When you connect to certain secure servers, an X.509 certificate + is returned. This certificate is issued to a special hostname, + something like www1.xyzcorp.com or wwws.xyzcorp.com (rather than + the normal www.xyzcorp.com). It is signed by the host's + Certificate Authority (CA). If the host certificate is + configured on the client, it can be used to verify the + certificate received from the server. If the certificate it + verified as authentic, a check is made to ensure it has not + expired and it was issued to the host you were attempting to + connect to. If you had asked to connect to (say) www.xyzcorp.com + but were given a certificate for www1.xyzcorp.com, you would be + prompted for permission to continue. + + If the verification succeeded, the connection would be encrypted + with one-way (server-to-client) authentication. This connection + is not subject to a MITM attack. + + If a username and password are transmitted over this connection, + they are not subject to interception. However, the standard + risks associated with passing the password to the host for + verification apply; for example, if the host has been + compromised, the password will be compromised. + + X.509 client certificate: + If a connection has been established with an X.509 server + certificate, the server can ask the client to send a certificate + of its own. This certificate must be verified against a CA Root + certificate. The certificate itself (or subject info from the + certificate) is used to determine the authorization for the + client, and if successful, the username and password need not be + sent to the server. + + Kerberos 5: + Instead of using X.509 certifcates, Kerberos 5 can be used to + perform the authentication and key exchange. In this situation, + there is mutual authentication between the client and server. + The Kerberos 5 principal is used by the server to look up the + appropriate authorization data. There is no need to send + username and password. + + An HTTP connection is made with the HTTP OPEN command: + + HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ] + If /SSL or /TLS switches are included (these are synonyms), or + if the service is HTTPS or the port is 443, a secure connection + is attempted using the current authentication settings; see HELP + SET AUTHENTICATION for details ([193]Section 6.2 of the security + reference). If the no /SSL or /TLS switch is included but the + port is 443 or the service is HTTPS, a secure connection is + attempted. If an /SSL or /TLS switch is included but a port is + not specified, an SSL/TLS connection is attempted on the default + port (80). + + Certificates are covered in the separate [194]Kermit Security Reference + for C-Kermit 8.0. You should let Kermit know to verify certificates + with the SET AUTHENTICATION TLS command. For example: + + SET AUTHENTICATION TLS CRL-DIR directory + Specifies a directory that contains certificate revocation files + where each file is named by the hash of the certificate that has + been revoked. + + SET AUTHENTICATION TLS CRL-FILE filename + Specifies a file that contains a list of certificate + revocations. + + SET AUTHENTICATION TLS VERIFY-DIR directory + Specifies a directory that contains root CA certificate files + used to verify the certificate chains presented by the peer. + Each file is named by a hash of the certificate. + + SET AUTHENTICATION TLS VERIFY-FILE filename + Specifies a file that contains root CA certificates to be used + for verifying certificate chains. + + SET AUTHENTICATION TLS VERIFY OFF + Tells Kermit not to require a certificate and accept any + certificate that is presented regardless of whether it is valid. + + There are many other options; see the security document for details. + + Now suppose you need need to fetch the file denoted by the following + URL: + + https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html + + Once you have set up the handling of certificates as desired, you can + use the following Kermit commands: + + http /user:myuserid /password:mypassword open www1.xyzcorp.com https + if success { + http get /clients/info/secret.html + http close + } + + As another example, let's say that you have a web form you need to + populate with three fields: red,white and blue. + +
+ + + +
+ + You can handle this with the HTTP POST command. The data to be posted + is stored in the local file data.txt. + + Red=seven stripes&White=six stripes&Blue=fifty stars + + and the response from the server will be stored into response.txt. + + http open www.xyzcorp.com http + if success { + http /array:c post data.txt /cgi-bin/form.cgi response.txt + http close + } + + In this scenario, the Common Gateway Interface (CGI) sends a response + whether it succeeds or fails in a script-dependent manner. The script + can either report success and enclose the response data; or it might + send a 302 Found error which indicates that the "Location:" header + should be used to determine the URL at which the data can be found. + +2.2.5. HTTP Variables + + \v(http_code) + The HTTP protocol code number of the most recent server reply, + e.g. 404 for "not found". + + \v(http_connected) + 1 when an HTTP connection is open, 0 when there is no HTTP + connection. + + \v(http_host) + If an HTTP connection is open, the hostname:port, e.g. + www.columbia.edu:80; otherwise, empty. + + \v(http_message) + Server error message, if any, from most recent HTTP command. + + \v(http_security) + A list of the security parameters and values for the current + connection, if any. Empty if the connection is not to a secure + server, or there is no connection. + + To display all the HTTP variables at once, type SHOW VAR HTTP: + + C-Kermit> http open www.columbia.edu + C-Kermit> http get lkjlkjlkjlkj + C-Kermit> sho var http + \v(http_code) = 404 + \v(http_connected) = 1 + \v(http_host) = www.columbia.edu:80 + \v(http_message) = Not Found + \v(http_security) = NULL + C-Kermit> + +2.2.6. The HTTP Command-Line Personality + + If you invoke C-Kermit with the name "http" or "https", you can use a + special set of HTTP-specific command-line options. You can do this by + creating a symbolic linke "http" or "https" to the C-Kermit 8.0 + executable, or by having a separate copy of it called "http" or + "https". Here's the usage message ("http -h"): + + Usage: ./http host [ options... ] + -h This message. + -d Debug to debug.log. + -S Stay (issue command prompt when done). + -Y Do not execute Kermit initialization file. + -q Quiet (suppress most messages). + -u name Username. + -P password Password. + -g pathname Get remote pathname. + -p pathname Put remote pathname. + -H pathname Head remote pathname. + -l pathname Local path for -g, -p, and -H. + -z opt[=value] Security options... + cert=file Client certificate file + certsok Accept all certificates + key=file Client private key file + secure Use SSL + verify=n 0 = none, 1 = peer , 2 = certificate required + + The "host" argument is the name of a Web host, e.g. www.columbia.edu. + The action options are -p, -g, and -H. If you give an action option, + Kermit does the action and then exits. If you give a host without an + action option, Kermit makes an HTTP connection to the host and then + gives you the C-Kermit prompt. Here's a simple example that fetches a + publicly readable Web page: + + http www.columbia.edu -g kermit/index.html + + If you need to access a website for which a username and password are + required, you can supply them on the command line with -u and -P. If + you include a username but omit the password, Kermit prompts you for + it: + + http www.columbia.edu -u olga -p kermit/index.html -l index.html + Password: + + Note that when PUT'ing files to websites, you have to supply both the + -p (remote pathname) and -l (local path) options. + + If your version of Kermit is built with SSL/TLS security, you can also + use the -z option to make secure HTTP (https) connections. + + Finally, as noted in [195]Section 16, you can also give a URL instead + of a host name and options. + + [ [196]Top ] [ [197]Contents ] [ [198]C-Kermit Home ] [ [199]Kermit + Home ] + +3. KERMIT'S BUILT-IN FTP CLIENT + + 3.1. [200]Making and Managing FTP Connections + 3.2. [201]Making Secure FTP Connections + 3.3. [202]Setting FTP Preferences + 3.4. [203]Managing Directories and Files + 3.5. [204]Uploading Files With FTP + 3.6. [205]Downloading Files With FTP + 3.7. [206]Translating Character Sets + 3.8. [207]FTP Command Shortcuts + 3.9. [208]Dual Sessions + 3.10. [209]Automating FTP Sessions + 3.11. [210]Advanced FTP Protocol Features + + Earlier versions of C-Kermit and K95 included an FTP command, but it + simply invoked an external FTP client. Now, by popular demand, Kermit + includes its own built-in FTP client that offers the following + advantages over traditional FTP clients (and its previous interface to + them): + + * Any of Kermit's built-in [211]security methods can be used to + establish and conduct secure FTP sessions with [212]FTP servers + that support these methods. (Security modules can be subject to + export restrictions.) + * Kermit's FTP client uses "passive mode" by default to avoid + blockage by firewalls and network address translators. Of course + active mode can be chosen too when needed. + * [213]Character sets can be translated as part of the transfer + process even when the FTP server does not support character-set + translation, including to/from the new Internet standard + international character set, [214]Unicode UTF-8. This includes both + the file's name and (for text files only) its contents. + * All of C-Kermit's [215]file-selection mechanisms are available: + size, date, name patterns and lists, exception lists, etc. + * [216]Atomic file movement capabilities are provided (delete, move, + or rename files automatically after successful transfer). + * The correct file type, "ascii" (i.e. text) or binary, is chosen + automatically for each file (explained in [217]Section 4), and any + mixture of text and binary files can be sent in a single operation, + even across platforms. + * Update mode ("don't bother transferring files that didn't change + since last time") and recovery (resumption of an interrupted + transfer from the point of failure) are available in both + directions. + * When uploading files from UNIX to UNIX, the file's permissions can + be preserved if desired. + * Recursive directory-tree PUTs are supported between any two + platforms that have tree-structured file systems. Recursive GETs + are supported between like platforms if the server cooperates and + between like or unlike platforms if the server supports MLSD + ([218]Section 3.11). + * When receiving files, all of Kermit's file collision actions are + available: backup, update, refuse, rename, etc. + * Multi-file transfers can be interrupted on a per-file basis, + automatically skipping to the next file. + * FTP sessions are [219]fully scriptable. + * An entire FTP session (connect, login, CD, upload or download, + logout) can be specified on the command line without using a + script. + * All of Kermit's logging options and formats are available to keep + an accurate and complete record of each connection and file + transfer, and to aid in troubleshooting. + * All of Kermit's file-transfer display options are available + (fullscreen, brief, CRT, serial, none). + + And best of all: + * Kermit doesn't give you those annoying per-file prompts every time + you start a multi-file transfer without remembering to give a + "prompt" command first :-). + + [ [220]Top ] [ [221]FTP Top ] [ [222]FTP Client Overview ] [ [223]FTP + Script Tutorial ] [ [224]C-Kermit Home ] [ [225]Kermit Home ] + +3.1. Making and Managing FTP Connections + + Each copy of Kermit can have one FTP connection open at a time. FTP + connections are independent of regular terminal connections; a terminal + connection (serial or network via SET LINE, DIAL, SET HOST, TELNET, + etc) may be, but need not be, open at the same time as an FTP + connection, and terminal connections can also be closed, and new + connections opened, without interfering with the FTP connection (and + vice versa). Thus, for example, Kermit can have an FTP connection and a + TELNET connection open to the same host simultaneously, using the + TELNET connection (e.g.) to send mail or take other desired actions as + various FTP actions complete. Of course, each copy of Kermit can do + only one thing at a time, so it can't (for example) transfer a file + with FTP and another file with Kermit protocol simultaneously. + + A Kermit FTP session can be established by [226]command-line options, + by [227]URL, or by [228]interactive commands. + +3.1.1. Kermit Command-Line Options for FTP + + The new command-line option '-9' (sorry, we're out of letters) can be + used when starting C-Kermit, telling it to make an FTP connection: + + kermit -9 hostname + + or if a non-default FTP port is needed: + + kermit -9 hostname:port + + You can also specify the username on the command line with the -M ("My + User ID") option that was already there for other connection types: + + kermit -9 hostname -M olga + + If you specify the username on the command line, Kermit uses it when + making the connection and does not prompt you for it (but it does + prompt you for the password if one is required). + + Once the connection is made, you get the regular Kermit prompt, and can + give interactive commands such as the ones described below. When you + give a BYE command, Kermit closes the session and exits, just as a + regular FTP client would do. If you don't want Kermit to exit when you + give a BYE command, include the -S ("Stay") option on the command line. + + Other Kermit command-line options that are not specific to non-FTP + connections should affect the FTP session in the expected ways; for + example, -i and -T force binary and text mode transfers, respectively. + + File transfers can not be initiated on the "kermit -9" command line; + for that you need to use Kermit's FTP personality (next section) or you + can use URLs ([229]Section 3.1.3). + +3.1.2. The FTP Command-Line Personality + + If you want to replace your regular FTP client with C-Kermit, you can + make a link called "ftp" to the C-Kermit binary (or you can store a + copy of the C-Kermit binary under the name "ftp"). When C-Kermit is + invoked with a program name of "ftp" (or "FTP", case doesn't matter), + it assumes the command-line personality of the regular FTP client: + + ftp [ options ] hostname [ port ] + + In this case the options are like those of a regular FTP client: + + -d Debug: enables debug messages and creates a debug.log file. + -n No autologin: Kermit should not send your user ID automatically. + -t Packet trace: accepted but is treated the same as -d. + -v Verbose: accepted but ignored (operation is verbose by default). + -i Not interactive: accepted but ignored. + + and the hostname can also be a URL (explained in [230]Section 3.1.3). + To specify a non-default TCP port for the FTP server, include the port + number or name after the hostname. + + There are also some bonus options that allow you to execute an entire + FTP session from the shell command line, as long as you don't include + the -n option. These are not available with regular FTP clients, and at + least one of these options (-g) conflicts with UNIX ftp (where -g means + "no globbing", which does not apply to Kermit), and some of them (like + the options above) also conflict with regular Kermit command-line + options: + + -m mode = "passive" (default) or "active" + -Y Don't execute the Kermit initialization file [1] + -q Quiet, suppresses all but error messages [1] + -S Stay, don't exit automatically [1] + -A Autologin anonymously [2] + -u name Username for autologin [2] (synonym: -M [1]) + -P password Password for autologin (see cautions below) [2] + -D directory cd after autologin [2] + -b Binary mode [2] + -a Text ("ascii") mode [2] (synonym: -T [1]) + -R Recursive (works with -p) [4] + -p files Files to put (upload) after autologin [2] (synonym: -s [1]) + -g files Files to get (download) after autologin [3] + + [1] Same as Kermit, not available in regular FTP clients. + [2] Conflicts with Kermit, not available in regular FTP clients. + [3] Same as Kermit, conflicts with regular FTP clients. + [4] Conflicts with Kermit, available in some FTP clients. + + Fancier options such as restart, character-set translation, filename + collision selection, automatic move/rename/delete, etc, are not + available from the command line; for these you can use the commands + described in the following sections. The -R option might also work with + -g (GET) but that depends on the server. + + The following security options are also available, explained in + [231]Section 3.2: + + -k realm Kerberos 4 realm [4] + -f Kerberos 5 credentials forwarding [4] + -x autoencryption mode [4] + -c cipher SRP cipher type [4] + -H hash SRP encryption hash [4] + -z option Security options [4] + + If you include -A or specify a name of "anonymous" or "ftp", you are + logged in anonymously and, in the absence of -P, Kermit automatically + supplies a password of "user@host", where "user" is your local user ID, + and "host" is the hostname of the computer where Kermit is running. If + you do not include -p or -g, Kermit enters command mode so you can type + commands or execute them from a script. + + If you include -p or -g, Kermit attempts to transfer the specified + files and then exits automatically at the end of the transfer unless + you also included -S (Stay). It uses the "brief" file transfer display + (one line per file) unless you include the -q option to suppress it. + + When uploading files with -p, Kermit switches automatically between + text and binary mode for each file. + + When downloading, you can either specify a particular mode (text or + binary) to be used for all the files, or you can let Kermit select the + type for each file automatically, based on its name (see [232]Sections + 3.5 and [233]3.6 for greater detail). In UNIX be sure to quote any + wildcard characters to prevent the shell from expanding them, as shown + in the examples just below. Filename collisions are handled according + Kermit's FILE COLLISION setting (if specified in your Kermit + customization file; otherwise the default, which is BACKUP). + + It should go without saying that the -P option should be used with + caution. In addition to the well-known risks of transmitting plaintext + passwords over the Internet, in this case the password also echos to + the screen if you type it, and can be seen in ps and w listings that + show the user's currently active command and command-line arguments. + Thus command-line FTP sessions are most appropriate for secure or + anonymous connections (those that do not require passwords). + + Here's an example in which you download the latest C-Kermit "tarball" + from the Columbia University FTP archive: + + ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz + + This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in + anonymously and gets the ckermit.tar.gz file in binary mode from the + kermit/archives directory. + + Here's a slightly more ambitious example that illustrates CD'ing to the + desired server directory to get a group of files in text mode (in this + case the C-Kermit source files): + + ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile + + In this case we CD to the kermit/f directory so we don't have to + include it in each file specification, and we quote the ck[cuw]*.[cwh] + specification so the shell doesn't expand it, since we have to pass it + as-is to the server. Note also that the quotes don't go around the + entire file list; only around each file specification that needs to be + quoted. + + Here's one more example, that uploads a debug log file in binary mode + to the Kermit incoming directory (as we might ask you to do when + following up on a problem report): + + ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log + + In this case the -D option is required to tell the server where to put + the incoming file. + + Unless the -Y option is included, your Kermit initialization file + (.mykermrc in UNIX, K95.INI in Windows) is executed before the command + line options, so you can set any FTP-related preferences there, as + described in the subsequent sections. + +3.1.3. The FTP URL Interpreter + + If Kermit is invoked with either its regular personality (as "kermit") + or its FTP personality (as "ftp"), you can also give a URL + (Universal Resource Locator) instead of a hostname and options, + with or without a username and password: + ftp ftp://user:password@host/path + ftp ftp://user@host/path + ftp ftp://@host/path (or ftp://:@host/path) + ftp ftp://host/path + kermit ftp://host/path + + If the FTP personality is used, the service must be "ftp". In all + cases, a hostname or address must be included. If a user is included + but no password, you are prompted for the password. If a path + (filename) is included: + * If "@" is included without a user, Kermit prompts for the username + and password. + * If no user and no "@" are included, "anonymous" is used. + * GET is assumed. + + If no path (and no action options) are included, an interactive FTP + session is started, as in this example: + ftp ftp://kermit.columbia.edu + + If a path is included, but a username is not included, "anonymous" is + used and an appropriate user@host password is supplied automatically. + If authentication is successful, Kermit attempts to GET the file + indicated by the path or, if the path is the name of a directory, it + asks the server for a directory listing. In both cases, Kermit + disconnects from the server and exits after the operation is complete + (unless you have included the -S option on the command line). + + Here's an example that gets a listing of the Kermit directory at the + Kermit ftp site: + ftp ftp://kermit.columbia.edu/kermit/ + + This example gets the top-level READ.ME file from the same directory: + ftp ftp://kermit.columbia.edu/kermit/READ.ME + + Here's the same example, but requesting a text-mode transfer: + ftp -T ftp://kermit.columbia.edu/kermit/READ.ME + This illustrates that you can mix command-line options and URLs + if you desire. + + Here's an example that logs in as a (fictitious) real user to get a + file: + ftp ftp://olga@ftp.xyzcorp.com/resume.txt + The password is not included, so Kermit prompts for it. + + This scheme allows Kermit to be used as the FTP helper of other + applications, such as Web browsers, with all its advantages over other + FTP clients (especially the ones that are built in to most Web + browsers), e.g. that it can be given wildcards, and it can pick text + and binary mode automatically for each file. + + HINT: suppose somebody sends you an FTP URL in email, or you see it in + some text. If your terminal screen supports copy/paste, copy the url, + and then at the shell prompt type "kermit", a space, and then paste the + URL, e.g.: + + $ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O + + "$ is the shell prompt; the part you type is underlined, the rest is + pasted in. Kermit does the rest. + +3.1.4. Interactive FTP Session Establishment + + As you read this and the following sections, bear in mind that any + command that can be given at the prompt can also be used in a script + program. Kermit's script programming language is the same as its + interactive command language. [234]CLICK HERE if you would like to + learn a bit more about script writing. + + An FTP session is established with the FTP OPEN command: + + FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ] + Opens an FTP connection to the given host on the given port and, + if FTP AUTOLOGIN is ON, also logs you in to the server, + prompting for username and password if necessary. If no port is + specified, the regular FTP protocol port (21) is used. The OPEN + keyword is optional (unless the hostname conflicts with one of + the FTP command keywords, which you can list by typing "ftp ?"). + + The hostname can be an IP host name, numeric IP address, or if you have + a network directory active (SET NETWORK DIRECTORY; see Chapter 6 of + [235]Using C-Kermit), an entry name in the directory. In the latter + case, if the given hostname matches exactly one entry, the associated + name or address is used; if it matches more than one, Kermit cycles + through them until one is found that can be opened; if it matches none, + then the hostname is used as-is. If a directory is active but you want + to bypass directory lookup, include an "=" sign at the beginning of the + hostname, and/or use a numeric IP address. + + When an FTP connection is opened, the default file-transfer mode is set + to binary if the client and server platforms are alike (e.g. both of + them are some kind of UNIX), and to text ("ascii") if they are not + alike. This has no particular effect for uploading since Kermit + automatically switches between text and binary mode for each file, but + might be important for downloading. The connection is also set to + Stream mode and File structure. Record- or page-oriented file transfers + are not supported by C-Kermit's FTP client. + + The optional FTP OPEN switches are: + + /ANONYMOUS + Logs you in anonymously, automatically supplying username + "anonymous" and user@host as the password, based on your local + user and host names. + + /NOLOGIN + + Overrides SET FTP AUTOLOGIN ON for this connection only. + + /USER:name + Uses the given username to log you in, thus avoiding the Name: + prompt. + Overrides SET FTP AUTOLOGIN OFF for this connection only. + + /PASSWORD:text + Uses the given text as your password, thus avoiding the + Password: prompt. This switch is not recommended for use in + script files, which would be a security risk. + + /ACCOUNT:text + Uses the given text as your account (or secondary password, + depending on the requirements of the server; most servers do not + require or accept an account name). If an account is not + supplied, you are not prompted for one. + + /PASSIVE + Opens the connection in passive mode. Passive mode is the + default in Kermit's FTP client, unlike in most others, since it + works better through firewalls. The /PASSIVE and /ACTIVE + switches apply only to the connection that is being opened, and + do not affect the global FTP PASSIVE-MODE setting. + + /ACTIVE + Opens the connection in active mode. Use this switch if the + server does not support passive mode, or use the command SET FTP + PASSIVE-MODE OFF. + + /NOINIT + Added in C-Kermit 8.0.201. Tells C-Kermit not to send REST, + STRU, FEAT, and MODE commands to the server when the connection + is opened, since these have been reported to cause confusion in + certain servers. + + When a username or password is missing, a prompt is issued at the + controlling terminal and you must type the response; the response can + not be scripted. Use the switches to avoid prompts, or one of the + secure authentication methods described in the next section, or see + [236]SET FTP AUTOLOGIN and the [237]FTP USER and similar commands + described later in this section. + + Examples: + + ftp open kermit.columbia.edu /anonymous ; Open and log in anonymously + ftp kermit.columbia.edu /anonymous ; The OPEN keyword can be omitted + ftp xyzcorp.com ; Open and maybe prompt for username + ftp xyzcorp.com /user:olga ; Open and log in as olga + ftp testing.abccorp.com 449 ; Specify a special TCP port number + ftp testing.abccorp.com /user:olaf /password:secret 449 + + The FTP OPEN command succeeds if a connection was opened to the server + (even if the given username and password were not valid) and fails + otherwise (see [238]Section 3.8 for details). + + When your FTP session is complete, you can terminate it as follows: + + FTP BYE + Closes the FTP connection if one was open. The FTP prefix can be + omitted if no other connection is open at the same time (see + [239]Section 3.8 for details). If a connection log is active, an + FTP record is written to it. If Kermit was started with the -9 + command-line option or with its FTP command-line personality, + and the -S (Stay) option was not given, AND there is no other + active connection, the FTP BYE command also exits, just as it + does on a regular FTP client. Synonyms: FTP CLOSE, FTP QUIT (but + if the FTP prefix is omitted from QUIT, this becomes the regular + Kermit QUIT command, which is equivalent to EXIT; i.e. it closes + the connection and exits from Kermit). + + The following commands can be used to achieve greater control over the + connection and login process: + + SET FTP ANONYMOUS-PASSWORD text + Allows you to choose the password text to be sent automatically + by Kermit when you open an FTP connection with the /ANONYMOUS + switch. + + SET FTP AUTOLOGIN { ON, OFF } + If you give this command prior to opening an FTP connection, it + controls whether Kermit tries to log you in automatically as + part of the connection process. Normally ON, which means the + username and password are sent automatically (and prompted for + if they are not yet known). When OFF, FTP OPEN connects to the + server without logging in. OFF is equivalent to the -n + command-line option when using Kermit's FTP command-line + personality. + + FTP USER name [ password [ account ] ] + Used to log in to an FTP server to which a connection has been + made without autologin, or when autologin failed. If the + password is furnished on the command line, it is used; otherwise + you are prompted for a password. An account may also be + furnished if required by the server; it is not required by + Kermit and is not prompted for if omitted. Synonyms: USER, FTP + LOGIN. + + FTP ACCOUNT text + Sends an account name to a server that supports accounts. If the + server does not support accounts, an error response occurs. If + the server does support accounts, the account is accepted if it + is valid and rejected if it is not. The account might be used + for charging purposes or it might be a secondary password, or it + might be used for any other purpose, such as an access password + for a particular disk. Servers that support accounts might or + might not allow or require the account to be sent prior to + login; usually it is sent after login, if at all. Synonym: + ACCOUNT. + + Example: + +set ftp autologin off ; One thing at a time please +ftp xyzcorp.com ; Try to make the connection +if fail exit 1 FTP connection failed ; Check that it was made +ftp user olga secret ; Now log in to the server +if fail exit 1 FTP login failed ; Check that it worked +ftp account 103896854 ; Login OK - send account +if fail echo WARNING - FTP ACCT failed ; Warn if problem +... ; (have session here) +bye ; Log out and disconnect + + The following commands are used to control or get information about the + FTP connection. Any particular FTP server does not necessarily support + all of them. + + FTP RESET + Terminates a user session but leaves the connection open, + allowing a new login via FTP USER. + + FTP IDLE [ number ] + Most FTP servers automatically log you out and and disconnect + your session if there has been no activity for a certain amount + of time. Use this command to ask the server to set its idle + limit to the given number of seconds. Omit the number to ask the + server to inform you of its current idle limit. + + FTP STATUS [ filename ] + Asks the FTP server to send information about the current + session. The result is a free-format report that might include + server identification, username and login time, FTP protocol + settings, and file-transfer statistics. If a filename is given, + the server is supposed to send detailed information about the + file. + + FTP SYSTEM + Asks the FTP server to identify its operating system (Listed in + Internet Assigned Numbers, Operating System Names). Examples: + UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations are + allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc, + instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51, + WINDOWS-NT-4, etc). The report might also include other + information like "Type L8", "Type I", or "Type A", indicating + the file-transfer mode. + + FTP HELP [ keyword [ keyword [ ... ] ] + Asks the server to list the commands it supports. The response + is usually cryptic, listing FTP command mnemonics, not the + commands used by the client (since the server has no way of + knowing anything about the client's user interface). For + example, the PUT command is STOR in FTP protocol. If a keyword + is given, which should be an FTP protocol command, + slightly-more- detailed help is given about the corresponding + command (if the FTP server supports this feature). Examples: + "ftp help", "ftp help stor". + + FTP SITE text + (Advanced) Sends an FTP SITE (site-specific) command. Usually + this means that the FTP server is asked to run an external + command with the given arguments. You might be able to find out + what SITE commands are available by sending "ftp help site" to + the server, but in general the availability of and response to + SITE commands is (not surprisingly) site specific. + + FTP QUOTE text + (Advanced) Sends an FTP command in FTP protocol format. Use this + command to send commands to the server that the FTP client might + not know about. + + SHOW FTP + Lists client (Kermit) FTP settings and information. Also SHOW + CONNECTION, SHOW COMMUNICATIONS. + + HELP FTP [ keyword ] + Asks Kermit to list and describe its built-in FTP commands. + + HELP SET FTP [ keyword ] + Asks Kermit to list and describe its built-in SET FTP commands. + + [ [240]Top ] [ [241]FTP Top ] [ [242]C-Kermit Home ] [ [243]Kermit Home + ] + +3.2. Making Secure FTP Connections + + Also see: [244]Accessing IBM Information Exchange with Kermit. + + In the previous section, you can see several examples of traditional + insecure authentication: username and password sent across the network + in clear text. Of course this is bad practice on at least two counts: + (1) storing passwords in files (such as script files) gives access to + the target systems to anybody who can obtain read access to your + scripts; and (2) sending this information over the network leaves it + open to interception by network sniffers or compromised hosts. + + Because of the increasing need for security on the Internet, FTP + servers are beginning to appear that offer secure forms of + authentication, in which no information is sent over the network that + would allow anyone who intercepts it to usurp your identity and gain + your access rights. + + Kermit provides an equivalent form of FTP security for each type of + IETF standard security implemented in Telnet. These include + GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and + Transport Layer Security (SSL and TLS). It does not presently include + SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with + the necessary libraries, secure FTP connections are attempted by + default, in which all connections are authenticated and the command and + data channels are private. + + The use of authentication and encryption for FTP connections can be + adjusted with the commands listed below, which are available only if + your version of Kermit was built with the corresponding security + options and libraries: + + SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS } + Specifies an ordered list of authentication methods to be + attempted when AUTOAUTHENTICATION is ON. The default list is: + GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the selected + methods are supported by the server, an insecure login is used + as a fallback. Note, by the way, that SSL or TLS can be used to + secure an anonymous connection. + + SET FTP AUTOAUTHENTICATION { ON, OFF } + Tells whether authentication should be negotiated by the FTP + OPEN command. Default is ON. Use SET FTP AUTOAUTHENTICATION OFF + to force a clear-text, unencrypted connection to FTP servers + (such as the one at the Kermit FTP site) that normally would try + to negotiate secure authentication and encryption. + + SET FTP AUTOENCRYPTION { ON, OFF } + Tells whether encryption (privacy) should be negotiated by the + FTP OPEN command, which can happen only if secure authentication + is also negotiated. Default is ON. + + SET FTP AUTOLOGIN { ON, OFF } + Tells Kermit whether to try logging in automatically when you + make an FTP connection, as opposed to letting you do it "by + hand" with the FTP USER command. + + SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE } + Determines the level of protection applied to the command + channel: + + CLEAR Data is sent in plaintext and not protected against tampering. + CONFIDENTIAL Data is encrypted but not protected against tampering. + PRIVATE Data is encrypted and is protected against tampering. + SAFE Data is sent in plaintext but protected against tampering. + + The default is PRIVATE. + + SET FTP CREDENTIAL-FORWARDING { ON, OFF } + Tells whether end-user credentials are to be forwarded to the + server if supported by the authentication method (GSSAPI-KRB5 + only). This is often required to allow access to distributed + file systems (e.g. AFS.) + + SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE } + Tells what level of protection is applied to subsequent data + channels. The meanings of the protection-level keywords are the + same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is + PRIVATE. + + SET FTP SRP CIPHER name + Specifies the cipher to be used for encryption when SRP + authentication is in use. The list of possible choices is + computed based on the capabilities of the local SRP library and + includes NONE plus zero or more of the following: + + BLOWFISH_ECB CAST5_ECB DES_ECB DES3_ECB + BLOWFISH_CBC CAST5_CBC DES_CBC DES3_CBC + BLOWFISH_CFB64 CAST5_CFB64 DES_CFB64 DES3_CFB64 + BLOWFISH_OFB64 CAST5_OFB64 DES_OFB64 DES3_OFB64 + + The default is DES3_ECB. + + SET FTP SRP HASH name + Specifies the hash to be used for data protection when SRP + authentication is in use. The choices are MD5 and SHA. The + default is SHA. + + Command-line options: + + -k name + Specifies the realm to be used with Kerberos 4 authentication (= + SET AUTH K4 REALM name). + + -f + Enables forwarding of Kerberos 5 credentials to the host when + using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON). + + -x + Enables autoencryption (= SET FTP AUTOENCRYPTION ON). + + -c cipher + Specifies the kind of cipher to be used for encryption with SRP + authentication. Equivalent to SET FTP SRP CIPHER, with the same + choices. If this option is not given, CAST5_CBC is used. + + -H hash + Specifies the hash to be used for encryption with SRP + authentication. Equivalent to SET FTP SRP HASH, with the same + choices. If this option is not given, SHA is used. + + -z debug + Turns on SSL/TLS debugging. + + -z secure + Requires secure connection. + + -z certsok + Says to accept all certificates without checking validity. + + -z verify=n + Sets certificate verification mode to the given number, n: + 0 = no verification + 1 = verify certificate if presented + 2 = require verification of certificate + + -z cert=filename + Specifies a file containing a client certificate to be presented + to the FTP server. + + -z key=filename + Specifies a file containing a private key matching the client + certificate. + + -z !krb4 + (nokrb4) Disables the use of Kerberos 4. + + -z !gss + -z nogss + Disables the use of GSSAPI - Kerberos 5. + + -z !srp + -z nosrp + Disables use of SRP. + + -z !ssl + -z nossl + Disables the use of SSL. + + -z !tls + -z notls + Disables the use of TLS. + + Caution: If your FTP connection is secured via AUTH TLS, it is not + possible to interrupt a file transfer. This is a limitation of all + known FTP servers that support AUTH TLS. + + Note that when using certain security methods, such as SSL or TLS, you + may be prompted to confirm or verify certain actions or conditions, for + example, whether to accept self-signed certificates. This can interfere + with unattended operation of scripts; see [245]Section 3.10. + + [ [246]Top ] [ [247]FTP Top ] [ [248]C-Kermit Home ] [ [249]Kermit Home + ] + +3.3. Setting FTP Preferences + + FTP preferences can be set globally and persistently with the commands + in the following sections; many of these can also be overridden on a + per-command basis with switches that have the same name. + +3.3.1. Logs, Messages, and Other Feedback + + You can control the amount of feedback received from your FTP session + with the commands in this section. First, you can create a log of your + FTP transfers with the following commands: + + SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF } + Selects the log format. VERBOSE is the default, and is described + in [250]the manual. FTP chooses a WU-FTPD format, the same as is + used by the popular FTP server. BRIEF creates per-file records + in comma-separated-list format. For greater detail, see + [251]Section 4.17 of the [252]C-Kermit 7.0 Update Notes. + + LOG TRANSACTIONS filename + Records FTP (or Kermit, or any other protocol) uploads and + downloads in the given file using the format selected by the + most recent SET TRANSACTION-LOG command, if any, or else the + default format. + + FTP screen messages and displays are controlled by the following + commands: + + SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF } + FTP transfers use Kermit's normal file-transfer display styles. + Use this command to choose the desired format; the default on + most platforms is FULLSCREEN. The display is automatically + disabled if Kermit is running in the background or in batch. + BRIEF is always used for command-line initiated transfers + (unless suppressed by -q). While a file-transfer is in progress, + you can interrupt it in the normal Kermit way by typing one of + the following keys or key combinations: + X - Cancel current file but go on to the next one (if any). + Z - Cancel the entire transfer. Ctrl-L or Ctrl-W - Refresh + the file-transfer display (if any). + + SET FTP DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF } + Like SET TRANSFER DISPLAY, but applies only to FTP connections, + and does not affect Kermit- or other protocol file transfers. + + SET QUIET { ON, OFF } + This command applies to Kermit in general, not just FTP. OFF by + default; when ON, it surpresses most messages from most commands + as well as the file-transfer display. + + SET FTP PROGRESS-MESSAGES { ON, OFF } + Tells whether Kermit should print locally-generated feedback + messages for each non-file-transfer command. ON by default. + + SET FTP VERBOSE-MODE { ON, OFF } + Tells whether to display all responses from the FTP server. OFF + by default. This shows all responses to all commands, except + when the file-transfer display is active, and unless you have + SET QUIET ON. When OFF, responses are shown only for commands + such as FTP PWD whose purpose is to display a response. + + SET FTP DEBUG { ON, OFF } + Tells whether local client debugging information should be + displayed. OFF by default. When ON, the commands that are sent + to the server are shown, as well as its responses (even if + VERBOSE-MODE is OFF), plus additional informational messages are + printed regarding the progress of secure operations. Also, the + temporary file created by the [253]MGET command is not deleted + so you can see what's in it. + + Set all of these to OFF when silent running is desired. + +3.3.2. Operational Preferences + + FTP DISABLE new-protocol-feature-name + FTP ENABLE new-protocol-feature-name + Explained in [254]Section 3.11. + + SET FTP AUTOLOGIN { ON, OFF } + If you give this command prior to opening an FTP connection, it + controls whether Kermit tries to log you in automatically as + part of the connection process. Normally ON, which means the + username and password are sent automatically (and prompted for + if they are not yet known). When OFF, FTP OPEN connects to the + server without logging in. OFF is equivalent to the -n + command-line option when using Kermit's FTP command-line + personality. See [255]Section 3.1.4 for usage. + + SET FTP PASSIVE-MODE { ON, OFF } + ON by default, to avoid random TCP port assignment for data + connections, which can prevent FTP protocol from working through + firewalls and network address translators (for more on these + topics, see the [256]Kermit security reference. Set to OFF in + case the FTP server does not support passive mode, or in case + the client has problems with it (it has been observed, for + example, that when using passive mode, the SCO XENIX 2.3.4 + TCP/IP stack hangs in the connect() call forever). Synonyms: + PASSIVE [ ON ], PASSIVE OFF, PASV [ ON ], PASV OFF. + + SET FTP SEND-PORT-COMMANDS { ON, OFF } + This command determines whether the FTP client sends a new PORT + command to the server when accepting incoming data connections + (as when not using passive mode.) When PASSIVE-MODE is OFF and + SET SEND-PORT is OFF, the port that was originally specified is + reused. This is the default behavior for normal FTP clients but + it is not compatible with many firewalls. + + SET FTP CHARACTER-SET-TRANSLATION { ON, OFF } + Whether to translate character sets when transferring files with + FTP (explained in [257]Section 3.7). OFF by default. + + SET FTP SERVER-CHARACTER-SET name + Tells Kermit the character set used by the FTP server, UTF-8 by + default ([258]Section 3.7). + + SET FTP SERVER-TIME-OFFSET delta-time + Tells Kermit to apply the given [259]delta time to file + timestamps provided by the server for its files; for use when + (for example) the server does not have its timezone set + correctly. + + SET FTP ERROR-ACTION { PROCEED, QUIT } + When transferring a group of files with FTP, and an error occurs + with one of the files, Kermit normally goes on the next file. + Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the + transfer immediately and fail if an error occurs with any single + file in the group. Example: you have given Kermit a list of + files to send, and one of the files can not be found, or read + permission is denied. Note that cancelling a file by typing 'X' + during transfer is not considered an error (if you want to + cancel the entire transfer, type 'Z' or Ctrl-C). + + SET FTP PERMISSIONS { AUTO, ON, OFF } + When uploading files with PUT or MPUT, this tells whether Kermit + should send each file's permissions. The default is OFF, which + means not to send permissions, in which case the uploaded file's + permissions are set by the FTP server according to its own + criteria. ON means to send them, AUTO means to send them only if + the client (Kermit) and server are on like platforms (e.g. both + UNIX). This command has no effect when downloading, since the + FTP protocol does not include a way for the server to inform the + client of a file's permissions. Also see [260]FTP PUT + /PERMISSIONS. Note that setting permissions after uploading is + likely to work (correctly or at all) only when the client and + server platforms are alike (e.g. both of them are some form of + UNIX). Also note that Windows files don't have permissions. Also + see [261]FTP CHMOD. + + SET FTP DATES { ON, OFF } + When downloading files with GET or MGET, this tells whether + Kermit should try to set the received file's date from the + server's date. FTP DATES is ON by default. Note, however, that + FTP protocol does not allow date preservation when uploading. So + at best, SET FTP DATES ON can work only when downloading, and + then only when the server agrees to furnish file dates. + + SET FTP FILENAMES { AUTO, CONVERTED, LITERAL } + When uploading (sending) files, this tells whether to convert + outbound filenames to "common form". This means allowing only + one period in a name, uppercasing any lowercase letters, + replacing spaces by underscores, etc. AUTOMATIC is the default, + meaning LITERAL when client and server are the same type of + system (e.g. UNIX) and CONVERTED otherwise. Special case: if the + setting is AUTOMATIC and the client is not UNIX and the server + identifies itself as UNIX, Kermit uses a less-strict form of + conversion, in which lowercase letters are not uppercased and + the filename can contain any number of periods, but spaces are + still converted to underscore. When receiving, conversion + generally means to change all-uppercase names to lowercase and + spaces to underscore. + + SET FTP UNIQUE-SERVER-NAMES { ON, OFF } + Applies only to uploads. Tells the server to create new, unique + names for incoming files that have the same names as existing + files. OFF by default, in which case the server overwrites + existing files with new files of the same name. When ON, the + server uses its own built-in method for creating new names for + incoming files; for example, appending a period (.) and a number + to the name. CAUTION: Use this option only if you do not need to + refer to the file after it is uploaded, since FTP protocol + provides no mechanism for the client to find out what name was + assigned by the server. + + SET FTP COLLISION { ... } + When downloading, what to do if an incoming file has the same + name as an existing file. Options are the same as for SET FILE + COLLISION. If this command is not given, Kermit's regular FILE + COLLISION setting is used. If this command is given, it + overrides the FILE COLLISION setting for FTP transfers only. See + [262]Section 3.6.2 for details. + + SET FTP TYPE { TEXT, BINARY, TENEX } + Changes the default transfer mode. When sending (uploading) + files, this command has no effect unless you disable automatic + text/binary mode switching ([263]Section 4) with SET FILE SCAN + OFF or SET TRANSFER MODE MANUAL. When receiving (downloading) + files, this command establishes the transfer mode to be used + when a filename does not match any of Kermit's text or binary + filename patterns, unless you use SET FTP GET-FILETYPE-SWITCHING + or SET TRANSFER MODE MANUAL to disable automatic switching, in + which case, this command establishes the transfer mode for all + downloaded files. In all cases, however, the FTP TYPE can be + overridden in any GET or PUT command by including a /TEXT + (/ASCII), /BINARY, or /TENEX switch. The FTP TYPE is independent + of the Kermit FILE TYPE setting. TENEX is used for sending 8-bit + binary files to 36-bit platforms such as TOPS-10, TOPS-20, and + TENEX, and getting them back again. Synonym: ASCII = TEXT. Note: + there is also an FTP TYPE command, which does what SET FTP TYPE + does but also sends a TYPE command to the server immediately if + the given type is different from the current one. + + If you want want specific FTP preference settings to be in effect for + all your Kermit FTP sessions, put the desired SET FTP commands in your + Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in + Windows). + + [ [264]Top ] [ [265]FTP Top ] [ [266]C-Kermit Home ] [ [267]Kermit Home + ] + +3.4. Managing Directories and Files + + In Kermit, commands for directory and file management can refer to: + + * The local computer + * A remote computer when you have a connection to a Kermit server or + IKSD. + * A remote computer when you have a connection to an FTP server. + + (There can also be an HTTP connection, but the commands in this section + don't apply to HTTP connections.) + + Thus in general, each such command comes in three forms: + + 1. With no prefix in C-Kermit 8.0.200, it refers to the local computer + (CD, DIR, etc). In C-Kermit 8.0.201 and later, however, the "locus" + switches to automatically to the remote FTP server when you make an + FTP connection (see the SET LOCUS description [268]Section 7); thus + C-Kermit 8.0.201 acts almost exactly like a regular FTP client when + it has an FTP connection, yet still acts like itself on other kinds + of connections. + 2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD, + REMOTE DIR). + 3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR). + 4. Also see [269]Section 3.8, which explains "R-commands" and + "L-commands". + + Kermit's FTP file and directory management commands are as follows. + When an R-command is included in the Synonyms list, be sure to read + [270]Section 3.8 about rules for use of R-commands. + + FTP CD [ directory ] + Tells the FTP server to change its default (working) directory + to the one given, which usually must be expressed in the syntax + of the server platform (UNIX, VMS, etc). If the directory is not + specified, the result depends on the FTP server -- it might + complain that the command is illegal, or it might change to your + original login directory. Synonyms: FTP CWD (Change Wording + Directory); RCD. + + FTP CDUP + Tells the FTP server to change its default (working) directory + to the parent directory of its current one (equivalent to + "cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP. + + FTP PWD + Asks the FTP server to report ("print") its current working + directory. Synonym: RPWD. + + FTP MKDIR directory + Asks the FTP server to create the directory whose name is given. + In general, the name must be in the syntax of the server's file + system, and it must be either absolute (a full pathname) or + relative to the server's current (working) directory. This + command fails if the directory can't be created for any reason, + including that it exists already. Synonym: RMKDIR. + + FTP RMDIR directory + Asks the FTP server to remove the directory whose name is given. + The rules are the same as for MKDIR, plus in most cases, the + server will not remove any directory unless it is empty. + Synonym: RRMDIR. + + FTP DIRECTORY [ filespec ] [ redirectors ] + Tells the FTP server to send a directory listing of the + specified files. If no filespec is given, the server lists all + files in its current working directory. The results are in + whatever format the server chooses to send them. You can use + UNIX-like redirectors to send the listing to a file or a + pipeline, exactly as with the regular Kermit client/server + REMOTE DIRECTORY command ([271]Using C-Kermit, Chapter 11). + Synonym: RDIRECTORY. Examples: + + ftp dir ; Show listing of all files on screen + ftp dir *.txt ; List *.txt files on screen + ftp dir *.txt > somefile ; Put listing in somefile + ftp dir *.txt >> somefile ; Append listing to somefile + ftp dir *.txt | sort > somefile ; Put sorted listing in somefile + ftp dir | more ; Runs list through "more" + ftp dir | sort | more ; Runs list through "sort" and "more" + + FTP VDIRECTORY [ filespec ] [ redirectors ] + "Verbose" directory. This is an alternative FTP DIRECTORY + command primarily for use with DECSYSTEM-20 (TOPS-20) FTP + servers, which send only filenames when given a DIRECTORY + command; the VDIRECTORY command makes them also send file sizes, + dates, and attributes. + + FTP CHECK filespec + Asks the FTP server whether the given file exists or, if the + filespec contains wildcards, if any files match, and this + command succeeds or fails accordingly. + + FTP MODTIME filename + Asks the FTP server, via the not-yet-standard FTP MDTM command, + to send the modification date and time of the given file. The + response should be a numeric string in the format: + yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month, + dd is the day, hh is the hour (0-23), mm is the minute, ss is + the second, and xxx... is the optional fraction of the second (0 + or more digits). The date and time is expressed in UTC (GMT, + Zulu, Zero-Meridian). The result is available programmatically + in the [272]\v(ftp_message) variable, and is understandable by + Kermit's date-time switches and functions. For example, suppose + we want to upload all local files that are newer than a + particular file on the server: + + C-Kermit> ftp modtime signpost + C-Kermit> echo \v(ftp_message) + 20010807113542.014 + C-Kermit> ftp mput /after:\v(ftp_message)GMT * + + Note that we must append "GMT" to the date-time string to let + the /AFTER switch know the time is GMT rather than local. + + FTP SIZE filename + Asks the FTP server to send the size (in bytes) of the given + file. The result might vary depending on whether the current FTP + TYPE is binary or text ("ascii"). For a reliable byte count, do + FTP TYPE BINARY first. The result is available programmatically + in the [273]\v(ftp_message) variable. + + FTP CHMOD permissions filename + Tells the FTP server to set the permissions (protection) of the + given file to the ones given. The permissions and filename must + be given in whatever syntax is required by the server. Example + (for a UNIX-based FTP server): + + ftp chmod 664 oofa.txt + + Not all servers support this command. For non-UNIX-based + servers, you might need to use FTP QUOTE or FTP SITE and the + appropriate platform-specific FTP server command. + + FTP UMASK [ number ] + This command is probably specific to UNIX-based servers; it sets + the UNIX "umask", which is the default permissions mask for new + (in this case, incoming) files. Crudely put, the UNIX umask is + an octal representation of a binary number in in which a 1 bit + stands for a permission bit that must be 0, and a 0 bit stands + for a permission bit that can be 0 or 1 depending on other + factors, such as the permissions of the parent directory. + Example: "umask 007" requires that new files are created without + read/write/execute world permission. If the number is not + specified, the server's current umask is reported. + + FTP RENAME filename newname + Asks the FTP server to rename the file whose name is "filename" + to "newname". Works only for one file; can not be used with + wildcards. The server's interpretation of "newname" can vary (in + some cases it must be a filename, in others perhaps it can also + be a directory name, in which case if the filename denote a + regular file, the file might be moved to the given directory). + Some servers might allow files to be renamed ("moved") between + physical disks or partitions, others might not. Synonym: + RRENAME. + + FTP DELETE [ switches ] filespec [ filespec [ ... ] ] + Tells the FTP server to delete the file or files listed. Each + file specification may, but need not, contain wildcard + characters to match multiple files. File specifications and + wildcard syntax must be those of the server. Any file + specifications that contain spaces must be enclosed in braces or + doublequotes. FTP DELETE switches are: + + /ERROR-ACTION: /FILENAMES: /NOBACKUPFILES /QUIET + /EXCEPT: /LARGER-THAN: /NODOTFILES /NOPAGE + /PAGE /RECURSIVE /SMALLER-THAN: + + When used with FTP DELETE, the /RECURSIVE switch deletes files + but not directories, and furthermore depends on the server + providing recursive file lists, which is not the normal + behavior. For further details, see the decriptions of these + switches in [274]Section 3.6. Synonyms: FTP MDELETE (Kermit + makes no distinction between DELETE and MDELETE); RDELETE. + + FTP TYPE { TEXT, BINARY, TENEX } + Tells the FTP server to change its file-transfer type to the one + given, immediately. See [275]SET FTP TYPE for details. + + [ [276]Top ] [ [277]FTP Top ] [ [278]C-Kermit Home ] [ [279]Kermit Home + ] + +3.5. Uploading Files With FTP + + Uploading means sending files from the client (Kermit) to the FTP + server. The basic command for uploading files with FTP is PUT: + + FTP PUT [ switches ] [ filespec [ as-name ] ] + Uploads (sends) the file or files that match the file + specification, which may include wildcards, to the server. If no + filespec is given, the names of files to send are taken from the + /LISTFILE: file, if any, otherwise from the SEND-LIST, if any. + Unless you go out of your way to prevent it, Kermit determines + the transfer mode (text or binary) for each file automatically, + and switches automatically on a per-file basis. If an as-name is + given, the file is sent under that name instead of its own (if + an as-name is given with a wildcard filespec, the result is a + bit more complicated, and is explained later in this section). + + Unlike normal FTP clients, Kermit does not prompt you by default (or at + all) for each file; it just sends them, just as it does with Kermit + protocol. The filespec can be a literal filename or a Kermit pattern, + described in: + + [280]http://www.columbia.edu/kermit/ckermit70.html#x4.9 + + Kermit patterns are equivalent to C-Shell patterns and provide a fair + amount of flexibility in selecting which files to send, which is + augmented by the file-selection switches presented in [281]Section + 3.5.1. + + FTP MPUT [ switches ] filespec [ filespec [ ... ] ] + FTP MPUT is just like FTP PUT except it allows you to give more + than one file specification, and it does not allow an as-name in + the file list. However, as-names can be given to either PUT or + MPUT with the /AS-NAME: switch. + + If a PUT or MPUT command results in one file being uploaded, it + succeeds if the file is uploaded completely and fails otherwise. If + more than one file is selected for upload, success or failure depends + on the [282]FTP ERROR-ACTION setting; if it is PROCEED (the default + setting), then the [M]PUT command succeeds if at least one of the files + was completely uploaded, and fails otherwise, If FTP ERROR-ACTION is + QUIT, the [M]PUT command succeeds if all selected files were uploaded + successfully, and fails if any file failed. + + FTP uploads may be interrupted just like Kermit uploads. While the + transfer is in progress, type: + + X to interrupt the current file and go on to the next file. + Z to cancel the current file and all remaining files. + ^C (Control-C): Like Z, but might act more quickly. + + MPUT may be used as in regular FTP clients, but it is not required to + send multiple files; in Kermit it is required only if you want to give + multiple file specifications. Examples: + + ftp put oofa.txt ; Send a single file oofa.txt + ftp put oofa.txt budget.txt ; Send single file oofa.txt as budget.txt + ftp put *.txt ; Send all *.txt files + ftp mput *.txt ; Send all *.txt files (same as "put *.txt") + ftp mput *.txt foo.bar ; Send all *.txt files plus foo.bar + + The distinction between PUT and MPUT is important only when more than + one filespec is given, just like the distinction between Kermit SEND + and MSEND: + + ftp put oofa.txt budget.txt ; Send oofa.txt AS budget.txt + ftp mput oofa.txt budget.txt ; Send oofa.txt AND budget.txt + + If the source file specification includes any path segments, for + example: + + put /tmp/oofa.txt + put subdir/another/andanother/oofa.txt + + the path portion is stripped from the filename that is sent to the + server. However, if an as-name contains a path, it is retained. + Examples: + + ftp put /usr/doc/oofa.txt ; Send as "oofa.txt". + ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt" + + The latter example sends the file oofa.txt from your current local + directory to the server's /tmp directory. This works only if the server + uses the same directory notation that you used in the as-name AND the + given directory already exists on the server AND if you have write + access to it. + + Use caution when uploading from a case-sensitive file system, such as + UNIX, to a file system that is not case sensitive, such as Windows or + VMS. If you have two files in UNIX, AA and aa and upload both of them, + the second one will overwrite the first. The only way around this + provided by FTP protocol is its "unique server names" feature (SET FTP + UNIQUE-SERVER-NAMES or the /UNIQUE switch described below). + +3.5.1. FTP PUT Switches + + FTP PUT and MPUT are similar in format and behavior to the regular + Kermit SEND and MSEND commands, and they allow most of the same + optional switches: + +C-Kermit>ftp put ? Filename, or switch, one of the following: + /after: /larger-than: /rename-to: + /array: /listfile: /server-character-set: + /as-name: /local-character-set: /server-rename-to: + /before: /move-to: /simulate + /binary /nobackupfiles /smaller-than: + /command /nodotfiles /tenex + /delete /nofollowlinks /text + /dotfiles /not-after: /transparent + /error-action: /not-before: /type: + /except: /permissions: /update + /filenames: /quiet /unique-server-names + /filter: /recover + /followlinks /recursive + + Since most of these switches are common to Kermit's SEND and MSEND + commands, they described only briefly here. For greater detail see: + + [283]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation + of switches) + [284]http://www.columbia.edu/kermit/ckermit70.html#x4.7 + (file-transfer switches) + + First the file-selection switches: + + /AFTER:date-time + /BEFORE:date-time + /NOT-AFTER:date-time + /NOT-BEFORE:date-time + Only send those files modified on or after or before the given + date and time. These switches can be combined to select files + modified between two date/times. Various date-time formats are + accepted; if the date-time contains spaces, it must be enclosed + in braces or doublequotes. See + [285]http://www.columbia.edu/kermit/ckermit70.html#x1.6 and + [286]Section 8.13 of this document for details about date-time + formats. Examples: + + ftp put /after:{1 jan 2000 0:00:00} * + ftp put /after:-5days * + + /LARGER-THAN:number + /SMALLER-THAN:number + Only send files larger (smaller) than the given number of bytes + (octets). These switches can be combined to select files in a + certain size range. + + /TYPE:{TEXT,BINARY} + Only send files that are the given type, which is determined for + each file just before sending it by file scanning. BINARY + includes TENEX; if you have included a /TENEX switch, or + previously given a [SET] FTP TYPE TENEX command, binary files + are sent in TENEX, rather than BINARY mode. + + /[NO]DOTFILES + [Don't] include files whose names begin with dot (.). By + default, such files are not included unless your filespec + explicitly mentions them. + + /NOBACKUPFILES + Don't include files whose names end with .~nnn~, where nnn is a + number, e.g. oofa.txt.~27~. These are backup files created by + Kermit, EMACS, and other applications. By default, backup files + are included. + + /NOFOLLOWLINKS + (UNIX only) Skip over symbolic links rather than following them + (default). This applies to wildcard and/or recursive [M]PUTs; if + a single filename is given, and it happens to be a symbolic + link, the file it points to is sent. + + /FOLLOWLINKS + (UNIX only) Always follow (resolve) symbolic links, even in + wildcard or recursive [M]PUTs. Use with caution. Watch out for + circular links, endless loops, etc. + + /EXCEPT:pattern + Exception list -- don't send files whose names match the given + pattern. See [287]Section 1.5.4 of the [288]C-Kermit 7.0 Update + Notes for details. If you want to exclude a directory from a + recursive [M]PUT, use /EXCEPT:{dirname/*}. + + /RECURSIVE + Sends the desired files from the current (or given) directory, + plus all directories beneath it, including empty directories, + replicating the directory structure on the server. No special + capabilities are required in the server, but of course your + login ID on the server must have the appropriate access and + permission to create directories. Recursive PUTs work not only + between like platforms (e.g. UNIX to UNIX) but also between + unlike ones (e.g. UNIX to VMS or Windows), in which case + text-file format differences are handled by Kermit's automatic + text/binary mode switching ([289]Section 4) and character-set + translation ([290]Section 3.7). Synonym: /SUBDIRECTORIES. + + /UPDATE + Send only files that have changed since last time ([291]Section + 3.5.2). + + /ARRAY:arrayname + The "file" to be sent is an array, or a segment of one, rather + than a real file. In this case the other selection switches + don't apply. The array contents are sent in text mode, and each + array element is treated as a line. Example: + + ftp put /as-name:array.txt /array:&a + + (or, to send a segment of the array, /array:&a[100:199]). If you + don't include an /AS-NAME, a name of "_array_x_" is used (where + x is the array letter). If you include this switch, most other + switches are meaningless and ignored. + + /COMMAND + The "file" to be sent is the standard output of a command, + rather than a real file. It is sent in text or binary mode + according to the prevailing FTP TYPE, which can be overridden + with a /TEXT or /BINARY switch. Example: Example: + + ftp put /command /as-name:{userlist} {finger | sort -r} + + /LISTFILE:filename + Tells Kermit to obtain the list of files to be sent from the + file whose name is given. This file must contain one file + specification (which may be wild) per line. If the list includes + files from different directories, such as a recursive listing of + a directory tree, the paths are recreated on the server (if + possible) if you include the /RECURSIVE switch; otherwise all + the files are sent to the current directory on the server. + + Now the other switches: + + /AS-NAME:text + If a single file is being sent, send it with the given text as + its name. If multiple files are being sent, the text must be a + template that includes variables such as \v(filename), + \v(filenumber), \v(ntime), to allow dynamic creation of each + name. The same applies to the as-name field of the FTP PUT + command. If this switch is not included (and an as-name is not + included as the second filename to PUT), each file is sent with + its own name. + + /BINARY + /TEXT + /TENEX + Forces this upload to take place in the given mode, regardless + of the current FTP TYPE setting, and without automatic + text/binary switching. /ASCII is a synonym for /TEXT. + + /FILTER:command + Specifies that the file(s) is/are to be passed through the given + command or pipeline on their way to the server. Example: + + ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz * + + /TRANSPARENT + /LOCAL-CHARACTER-SET:name + /SERVER-CHARACTER-SET:name + Character-set translation for text files, explained in + [292]Section 3.7. + + /ERROR-ACTION:{PROCEED,QUIT} + Overrides the prevailing [293]FTP ERROR-ACTION for the duration + of this PUT or MPUT command only. + + /RECOVER + Resume an interrupted transfer where from the point of + interruption (explained in [294]Section 3.5.2). Synonym: + /RESTART. + + /DELETE + Tells Kermit to delete each source file immediately after, and + only if, it has been uploaded completely and successfully. This, + in effect, moves the file from the client to the server. + + /MOVE-TO:directory + Tells Kermit to move each source file to the named local + directory after, and only if, it has been uploaded completely + and successfully. + + /RENAME-TO:template + Tells Kermit to rename each (local) source file according to the + given template after, and only if, it has been uploaded + completely and successfully. The template works as in /AS-NAME. + + /SERVER-RENAME-TO:template + Tells Kermit to ask the server to rename each file according to + the given template as soon as, and only if, it has been received + completely and successfully. The template works as in /AS-NAME. + Requires write and rename access on the server, so doesn't + usually work with (e.g.) anonymous uploads to public incoming + areas where the permissions don't allow renaming. Examples: + + ftp mput /server-rename:\v(filename).ok * + Appends ".ok" to each filename on the server when it's + finished uploading. + + ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) * + This is the reverse of the previous example; it uses a + temporary name while uploading is in progress and reverts + the file to its real name when uploading is complete. + + ftp mput /as-name:\v(filename) + /server-rename:../final/\v(filename) * + Moves the file from the working directory to a final + directory when the upload is complete, but in this case + you have to know the pathname syntax of the server. If the + rename fails, the [M]PUT command fails according to the + [295]FTP ERROR-ACTION selection. + + /FILENAMES:{AUTOMATIC,CONVERTED,LITERAL} + Overrides the [296]FTP FILENAMES setting for this upload only. + + /PERMISSIONS:{ON,OFF} + Overrides the [297]FTP PERMISSIONS setting for this upload only. + + /UNIQUE + Tells Kermit to tell the server to give [298]unique names to + incoming files that would otherwise overwrite existing files + that have the same name. This switch conflicts with /UPDATE, + /RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has + no way of knowing the name assigned by the server. + + /QUIET + Don't display file-transfer progress or statistics. + + /SIMULATE + Shows which files would be sent without actually sending them. + Useful (for example) with /UPDATE (next section). The results + are shown in the file-transfer display (if it is not disabled) + and in the transaction log (if one is active). Hint: use SET + TRANSFER DISPLAY BRIEF. + +3.5.2. Update Mode + + When you include the /UPDATE switch, this means to skip sending any + file that already exists on the server if the local file's modification + date/time is not later than that of the corresponding file on the + server. Here is a typical application for update mode: Suppose that on + Computer A, you maintain a large set of files (say, a collection of Web + pages and graphics images, or the source files for a software + application), and you need to keep a parallel copy on another Computer, + B. Of course you could upload the entire collection every day: + + cd source-directory + ftp computerb.xyzcorp.com + ( authentication details... ) + ftp cd target-directory + ftp put [ switches ] * + + But if the total size is large or the network slow, this would be + unnecessarily time-consuming. Worse, if other users or sites had to + update whenever new files appeared in B's directory, this would cause + them unnecessary work. By including the /UPDATE switch: + + ftp put /update [ other-switches ] * + + only those files that changed since last time are uploaded. Here's how + it works. For each local file that is selected for uploading: + + * The remote filename is determined in the normal way, according to + the [299]FTP FILENAMES setting, /FILENAMES switch, or the as-name, + if any. + * Kermit sends an MDTM (modification time) command for the + corresponding remote filename to the server. + * If the server does not understand the MDTM command, the file is + sent. + * If the server can't find a file with the given name, the file is + sent. + * If the local file's modification time is later than that of the + remote file, the file is sent. + * Otherwise -- the remote file exists but its modification time is + equal to or earlier than that of the local file -- the file is + skipped. + + All time comparisons take place in Coordinated Universal Time + (UTC)([300]1), also known as GMT or Zulu time: Timezone 0; standard + time, without daylight savings. + + WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or + misimplement the FTP specification and send local time rather than + UTC. + + Update mode is useful only when always used in the same direction. When + you upload (PUT) a file with FTP, the destination file receives the + current timestamp on the server's computer, not the original file's + timestamp ([301]2). If you try to FTP PUT /UPDATE the same file again, + it will be skipped (as expected) since the remote copy is newer. + However, if you try to FTP GET /UPDATE the same file ([302]Section + 3.6), it will be transferred for the same reason. + + To check the availability of PUT /UPDATE on a particular connection, + issue an FTP MODTIME command for a file that is known to exist on the + server. If it succeeds, PUT /UPDATE should work and in that case, you + can run a procedure like the one above every day: the first time, it + sends all the files; after that, it sends only the ones that changed. + If a transaction log is active, a notation is included for any files + that are skipped. + + Notes: + 1. Why is Coordinated Universal Time abbreviated UTC? From the + [303]National Institute of Standards and Technology FAQ: "In 1970 + the Coordinated Universal Time system was devised by an + international advisory group of technical experts within the + International Telecommunication Union (ITU). The ITU felt it was + best to designate a single abbreviation for use in all languages in + order to minimize confusion. Since unanimous agreement could not be + achieved on using either the English word order, CUT, or the French + word order, TUC, the acronym UTC was chosen as a compromise." + 2. The Kermit FTP client is unusual in that, when downloading only, it + can set the received file's date from the file's date on the + server, but this should not affect the update feature. When + uploading to an FTP server, however, there is no mechanism for the + client to set the date of the uploaded file on the server. + +3.5.3 Recovery + + Suppose that while you are uploading a large file over a slow + connection, the connection is lost before the entire file is + transferred. With most FTP clients, you would have to start over, thus + resending the portion of the file that was sent already, and that is + already on the server. But Kermit's /RECOVER switch (Synonym: /RESTART) + lets you continue an interrupted transfer from the point of failure, + thus transferring only the part that wasn't sent already. The + prerequisites for recovery are: + + * The transfer must be in BINARY mode, or else the client and server + must reside on like systems (e.g. both on some form of UNIX). + * The FTP server must support the SIZE command. + + Here's how it works. When you include the /RECOVER switch: + + * Kermit checks for conflicting switches, such as /UPDATE and + /UNIQUE; if /RECOVER is given with these switches an error occurs. + If /RECOVER is given in other circumstances where it could serve no + useful purpose (e.g. with arrays, pipes, or filters), it is + ignored. + + If the switch is accepted, then for each selected file: + + * If it is not binary (determined by scanning) and the client and + server are not on like platforms, recovery is canceled (the entire + file is sent). Otherwise: + * A SIZE command is sent for the file (using its remote name). If the + reply indicates the file was not found, or the SIZE command was not + understood, or any other kind of error, recovery is canceled. + Otherwise: + * A MDTM (modification time) command is sent for the file. If a valid + reply is received, and the modification time of the local file is + later than that of the remote file, recovery is canceled. + Otherwise: + * If the sizes of the two files are identical, the file is not sent. + Otherwise: + * Kermit seeks to the recovery spot in the local file, tells the + server to APPEND the data which is about to arrive to the remote + file, and then sends the data starting at the recovery point. + + To safeguard file integrity, recovery is not attempted unless all the + preconditions are met. For the widest possible usefulness, APPEND is + used rather than RESTART. For stream transfers (the only kind that + Kermit supports) the results are the same. + + By design, the /RECOVER switch can be included with any FTP PUT or MPUT + command, even if it specifies a group of files. This allows you to + resume an interrupted batch transfer from where it left off. The files + that were already completely sent are skipped, the file that was + interrupted is recovered, and the remaining files are uploaded. + + By the way, it doesn't matter how the original partial file was + uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are + met, it can be recovered with FTP PUT /RECOVER, or for that matter also + using Kermit protocol and SEND /RECOVER. + + A word of caution, however, when the original upload was in text mode + with character-set translation ([304]Section 3.7): + + * If the original upload involved a translation from one single-byte + character set to another (e.g. Code Page 850 to Latin-1), recovery + is safe if you specify the same translations for the recovery. If + you don't, the resulting file will contain a mixture of character + sets. + * If the original upload involved a translation that changed the size + of the file (e.g. from an alphabetic Code Page or Latin Alphabet to + Unicode, or vice versa), recovery is NOT safe, even if you specify + the same translations. + + Kermit has no way of knowing anything about the previous upload. As a + safeguard, an error occurs if you include /RECOVER and also specify a + character-set of UCS2 or UTF8, since recovery can't possibly work in + that situation. Otherwise, it's up to you to avoid unsafe recovery + operations. + + [ [305]Top ] [ [306]FTP Top ] [ [307]C-Kermit Home ] [ [308]Kermit Home + ] + +3.6. Downloading Files With FTP + + Although uploading files with Kermit's FTP client is just as easy and + flexible as sending files with Kermit protocol, the same is not always + true for downloading because FTP servers lack some of the capabilities + of a Kermit server: + + * If you want to get more than one file, you have to use MGET, not + GET, since the underlying FTP protocol is different in the two + cases. Kermit can't "autodetect" which one you mean, as it can with + PUT and MPUT, since it can't be expected to know the wildcard + syntax of the remote platform and/or FTP server (the same is true + for all other FTP clients). To complicate matters, FTP protocol now + includes two underlying mechanisms (NLST and MLSD) for + accomplishing MGET operations and, as explained in [309]Section + 3.11, the two behave differently. + * Automatic text-binary mode switching is not done by the server. It + can be done by the client (Kermit), but in this case it is not + based on a file scan (since there is no way for Kermit prescan a + server file), but rather on the filename, using C-Kermit 7.0 + [310]filename patterns. + * Some options that are available with FTP PUT can not be used with + FTP [M]GET or don't work the same way: + /PERMISSIONS (FTP protocol has no mechanism for this). + /[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem). + /RECOVER works only in binary mode. /RECURSIVE has limited + utility. + + The commands for downloading are: + + SET FILE DOWNLOAD-DIRECTORY [ directory ] + As with Kermit transfers, this command, if given, tells C-Kermit + where to store incoming files in the absence of a specific + as-name. If not given, incoming files are stored as indicated by + the as-name, if any, otherwise in the current directory, just as + with Kermit transfers. The more verbose transfer display formats + give the full pathname of each received file, and, in case you + have trouble finding a downloaded file afterwards, its full path + is also listed in the transaction log (if you kept one), and you + can also ask Kermit where it went with the [311]WHERE command. + + SET FTP GET-FILETYPE-SWITCHING { ON, OFF } + ON by default, causing Kermit to switch automatically into text + or binary mode for each file based on whether its name matches a + text pattern or binary pattern. Set this OFF, or use a /TEXT, + /BINARY, or /TENEX switch to defeat this feature. Use SHOW + PATTERNS to see the current pattern list. + + [ FTP ] GET [ switches ] filename [ as-name ] + Asks the server to send the given file, and if it comes, stores + it locally under the given as-name, if any, otherwise under its + original name (modified according to the selected filename + conversion option), in your download directory, if you have + specified one, otherwise in the directory indicated in the + as-name, if any, otherwise in your current directory. If you + accidentally use a wildcard in the filename ("get *.txt") the + server will reply with a message like "File not found" (unless + there is a file whose name actually is "*.txt"). If FTP + GET-FILETYPE-SWITCHING is ON, and in the absence of any GET + switches to override it, the file is transferred in binary mode + if it matches any of Kermit's binary name patterns, and in text + mode if it matches any of Kermit's text name patterns, and in + the prevailing FTP TYPE if it matches none of these patterns. + + [ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ] + Like GET, but for multiple files. One or more file + specifications can be given, and any or all (or none) of them + can contain wildcards or can be directory names. The file list + may not include an as-name, but you can still give one with the + /AS-NAME: switch. + + In both the FTP GET and MGET commands, any filenames that contain + spaces must be enclosed in braces or doublequotes (see [312]Section 5 + for details). + + FTP downloads may be interrupted just like Kermit transfers. While the + transfer is in progress, type: + + * X to interrupt the current file and go on to the next file. + * Z (or Control-C) to cancel the current file and all remaining + files. + + Before proceeding, a brief word about temporary files. In FTP protocol, + the MGET command works by requesting a file list from the server, and + then (internally) issuing a GET command (FTP RETR protocol directive) + for each file. The file list returned by the server can be any size at + all, so in case it is huge, we don't store it in memory; instead we put + it in a temporary file. For troubleshooting purposes, you should be + aware of two points: + + 1. The location of the temporary file is chosen according the TMP or + TEMP environment variables. If neither of these variables is + defined, you might need to define it. In case there is not enough + space on the indicated disk or partition for the server's file + list, you might need to either clean up the temporary area, or + redefine the environment variable to indicate a different area that + has sufficient space. + 2. If you want to look at the list yourself, use SET FTP DEBUG ON. + This tells Kermit to (a) give you the full pathname of the + temporary file at the end of each MGET command, and (b) not to + delete it, as it normally does. + +3.6.1. FTP GET Switches + + The following switches are available with FTP GET and MGET: + + /TEXT + Specifies a text-mode transfer. Overrides the global FTP TYPE + setting and filename pattern-matching for the duration of the + current command only, All files are downloaded in text mode. + Synonym: /ASCII. + + /BINARY + Specifies a binary-mode transfer. Overrides the global FTP TYPE + setting and filename pattern-matching for the duration of the + current command only. All files are downloaded in binary mode. + + /TENEX + Like /BINARY but specifies a special binary transfer mode to be + used when getting 8-bit binary files from a 36-bit platform such + as TOPS-10, TOPS-20, or TENEX. All files are downloaded in the + special binary mode. + + /RECOVER + This instructs Kermit to try to recover an incomplete download + from the point of failure. Works only in binary mode, and only + if the server supports the (not-yet-standard) FTP "REST" + directive. See [313]Section 3.6.3 for details. Synonym: + /RESTART. + + /FILENAMES:{CONVERTED,LITERAL} + Overrides the [314]FTP FILENAMES (filename conversion) setting + for this download only, forcing incoming filenames to be either + converted or taken literally. + + /AS-NAME:text + For GET, this is equivalent to giving an as-name after the + filename. For MGET, this is the only way to specify alternative + names for the incoming files. With MGET, the /AS-NAME text + should (must) contain a Kermit variable, usually \v(filename) or + \v(filenumber). Example: + + mget /text /as-name:\v(filename).new *.c + + This gets all ".c" files and stores them with " + + .new" appended to their names. See the [315]C-Kermit 7.0 Update + Notes for details. + + /COMMAND + This specifies that the incoming file is to be written to the + standard input of a command, rather than to a file. The command + name is the as-name from the GET command or the /AS-NAME + argument. If you need to refer to the incoming file's name in + the command, use \v(filename). See the description of the + regular Kermit [316]GET /COMMAND command for details and + examples. + + /QUIET + Transfers the files quietly; don't put up a file-transfer + display. + + /ERROR-ACTION:{QUIT,PROCEED} + This switch affects only MGET. If an error occurs with a + particular file, this tells whether to go on to the next file + (PROCEED) or to stop right away and fail (QUIT). The default is + PROCEED. + + The file selection switches are: + + /EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}} + Exception list for MGET; skip downloading any file whose name + matches any of the given patterns (when using the second format, + up to 64 patterns may be specified). [317]CLICK HERE for syntax + details. + + /SMALLER-THAN:number + Download only files whose size is smaller than the given number + of bytes (octets). Requires that the FTP server support the SIZE + or MLSD directive. + + /LARGER-THAN:number + Download only files whose size is greater than the given number + of bytes. Requires that the FTP server support the SIZE or MLSD + directive. + + /NOBACKUPFILES + During MGET, don't download any files whose names end with + backup suffixes (.~n~ where n is a number). + + /NODOTFILES + During MGET, don't download any files whose names begin with + period (.). Equivalent to /EXCEPT:{.*}. + + /LISTFILE:local-filename + The given file contains a list of files to GET, one per line. + Filenames in the listfile can contain wildcard characters in the + syntax of the server. There is no limit on the number of lines + in the listfile. + + /NAMELIST:local-filename + If this switch is given, then instead of actually retrieving the + selected files, the GET command retrieves a list of the names of + the files that would be retrieved, and places it in the + specified file. The resulting file is an ordinary text file, + with one filename per line, suitable for reading by a person, or + processing by a computer program, including Kermit itself (FOPEN + / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If the + filename is omitted or given as "-" (dash, hyphen), the list + goes to the screen. NOTE: if you want a copy of the complete + list sent by the server, use SET FTP DEBUG ON, perform an MGET, + and the temporary file containing the list will be kept rather + than deleted (and Kermit tells you its name). + + /UPDATE, /COLLISION:keyword + Explained in [318]Section 3.6.2. + + /RECURSIVE + This means to try to download an entire directory tree, rather + than just files from a particular directory. In fact, FTP + protocol does not provide a method to request a recursive + download (unless the server supports MLSD; see [319]Section + 3.11), so this works only if the FTP server does it anyway, + without being asked, as some do. In this case, Kermit detects + that names in the returned file list contain directory + separators, and therefore attempts to create the needed + directories as the files arrive. But this can work only if the + server is on the same kind of platform as the client, so the + pathname syntax can be recognized, and also because the server + does not switch between text and binary mode, which would be + vital for cross-platform transfers. Use with caution. Synonym: + /SUBDIRECTORIES. + + Even when the server does not provide recursive file lists, + [M]GET /RECURSIVE forces Kermit to replicate any directory + structure implied or expressed by the server's file list. For + example: + + get somepath/somefile + + Gets the file named somefile from the server's somepath + directory and puts it Kermit's current (or download) directory, + whereas: + + get /recursive somepath/somefile + + creates the path locally and then puts the file in it. Similarly + for MGET: + + mget */data/* + + downloads all the files in all the data subdirectories of all + the subdirectories of the server's current directory and stores + them locally in Kermit's current (or download) directory, + whereas: + + mget /recursive */data/* + + re-creates the server's directory structure locally. + + The FTP protocol does not include explicit mechanisms for recursion, so + Kermit builds upon what is available. Although an Internet draft + describes a mechanism ("MLSD") that would allow protocol-driven + recursion, similar to Kermit's File Attribute packets (circa 1984), it + has not yet attained RFC or standard status, and servers are not yet + widely available that offer this feature. In the meantime, the + effectiveness of MGET /RECURSIVE depends on the FTP server + implementation. If the server returns a recursive list in response to + the standard NLST command (whose behavior is ill-defined), Kermit's FTP + MGET /RECURSIVE command uses it to re-create the remote directory tree + locally. If the server supports MLSD, C-Kermit 8.0.206 and Kermit 95 + 2.1 and later are able to sense it automatically and use it, as + described below in [320]Section 3.11. + + The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not + available for downloading because of the confusion with timezones. + Would the given times be in the local timezone, the server's timezone, + or GMT? The FTP server's directory listings show its own local times + but since we don't know what timezone the server is in, there's no way + to reconcile our local times with the server's. Similarly, /PERMISSIONS + can't be preserved in downloads because FTP protocol provides no means + of querying the server for a file's permission. + + Source-file disposition switches: + + /DELETE + Each file that is downloaded successfully is to be deleted from + the server. Requires the appropriate file access rights on the + server. + + /SERVER-RENAME-TO:template + Asks the server to rename each (remote) source file immediately + after, and only if, it is sent correctly. See [321]PUT + /SERVER-RENAME-TO: for details. + + Destination-file disposition switches: + + /TO-SCREEN + Displays the incoming file on the screen rather than storing it + on disk. If this switch is given, the /RENAME-TO and /MOVE-TO + switches are ignored, the file-transfer display is suppressed, + and the given file(s) is/are shown on the screen. Can be used + with /FILTER, e.g. + + get /text /to-screen /filter:more oofa.txt + + In fact, you should always use /TO-SCREEN with /FILTER or + /COMMAND when the command would result in displaying the + incoming file on the screen; otherwise C-Kermit would have no + way of knowing to suppress its file transfer display (since it + can't be expected to know what the command or filter does). + + /RENAME-TO:template + Each file that is downloaded is to be renamed as indicated if + and only if it was received completely and without error. The + template can be literal text or can contain variables that are + evaluated for each file. For MGET, the text must contain + variables; for GET it can be a literal string. The \v(filename) + variable contains the name of the current file, so: + + ftp mget /rename-to:\v(filename).ok * + + causes each file that is successfully downloaded to have ".ok" + appended to its name. For details see [322]Section 4.1 of the + [323]C-Kermit 7.0 Update Notes. + + /MOVE-TO:text + Just like /RENAME-TO:, except the text denotes the name of a + directory to which successfully downloaded files are to be + moved. If the directory does not exist, it is created. + + The file transfer display does not show the /MOVE-TO or /RENAME-TO + value, since the incoming file has not yet been moved or renamed. + +3.6.2. Filename Collisions + + What should happen if an incoming file has the same name as an existing + file in the same directory? By default, Kermit's FILE COLLISION setting + applies: BACKUP, RENAME, UPDATE, DISCARD, etc, as described in + [324]Using C-Kermit. Kermit's default FILE COLLISION setting is BACKUP + (rename the existing file and store the incoming file under its own + name) and therefore this is also the default FTP collision action. + + The name under which an incoming file is to be stored is determined as + follows: + + * If an as-name was given, the as-name is used. Otherwise: + * If the client and server platforms are alike or [325]FTP FILENAMES + is set to LITERAL (or the /FILENAMES:LITERAL switch was given for + this download), the incoming filename is used literally. Otherwise: + * The incoming filename is converted to a form that is friendly to + the local platform. For UNIX, for example, incoming filenames that + are all uppercase (as they might be from, say, VMS or an IBM + mainframe) are converted to lowercase. + + If the resulting name coincides with the name of a local file that + already exists, we have a filename collision. Collisions are handled + according to the currently selected collision action: + + SET FTP COLLISION { BACKUP, RENAME, UPDATE, DISCARD, APPEND, OVERWRITE + } + This establishes a filename collision for FTP, separate from the + Kermit one. The initial FTP collision setting is inherited from + Kermit's FILE COLLISION setting when the first FTP command is + given, but subsequent changes to Kermit's FILE COLLISION setting + do not affect the FTP COLLISION setting. SHOW FTP tells the + current FTP COLLISION setting. + + FTP GET /COLLISION:{BACKUP,RENAME,UPDATE,DISCARD,APPEND,OVERWRITE} + Overrides the current FTP COLLISION action for this download + only. + + FTP GET /UPDATE + This is equivalent to GET /COLLISION:UPDATE, and is included for + symmetry with PUT /UPDATE + + FTP GET /UPDATE and /COLLISION:UPDATE mean to download only those files + whose modification dates on the server are later than those on the + client. Date-time comparisons are done in Coordinated Universal Time + (UTC, GMT, ZULU). The command: + + FTP MGET /COLLISION:APPEND /AS-NAME:newfilename *.* + + Downloads all matching remote files into a single local file (in + whatever order the server sends them). + +3.6.3. Recovery + + Recovery is available for downloads too, but there are some differences + from the uploading case described in [326]Section 3.5.3: + + * The transfer must be in BINARY mode. It can not be in text mode, + even if the FTP server is on the same kind of platform as Kermit, + and even if there is no character-set translation. The original + download must also have been in binary mode. + * The FTP server must support the REST ("restart") directive. + Unfortunately, this is not a standard command; at this writing, it + is described only in an Internet Draft, not an RFC or Internet + Standard, but nevertheless it is found in several popular FTP + servers, such as [327]ProFTPD. + + Here's how download recovery works: + + * Kermit checks for conflicting switches, such as /UPDATE, /COMMAND, + or /FILTER. If /RECOVER is given with these switches an error + occurs. + * The prevailing transfer mode (SET FTP TYPE) must be BINARY. If it + is not, the /BINARY switch must have been included with the FTP + [M]GET command. + + If the /RECOVER switch is accepted, then for each selected file: + + * A SIZE command is sent for the file (using its remote name). If the + reply indicates the file was not found, or the SIZE command was not + understood, or any other kind of error, recovery is canceled (i.e. + the entire file is downloaded). + * If the sizes of the two files are identical, the file is not sent. + Otherwise: + * Kermit sends the REST directive to the server, indicating the size + of the local file. If the server responds affirmatively, Kermit + opens the local file in append mode and appends the incoming data + to it. Otherwise, recovery is canceled and the entire file is + downloaded. + + The /RECOVER switch can be included with any FTP GET or MGET command, + even if it specifies a group of files. This lets you resume an + interrupted batch transfer from where it left off. The files that were + already completely sent are skipped, the file that was interrupted is + recovered, and the remaining files are uploaded. BUT... unlike with + uploading, where this can be done with any mixture of text and binary + files, when downloading, it can only be done if all the files are + binary. + + It doesn't matter how the original partial file was downloaded -- FTP, + Kermit, HTTP, Zmodem, etc: as long as the preconditions are met, it can + be recovered with FTP [M]GET /RECOVER, or for that matter also with GET + /RECOVER (using Kermit protocol). + + [ [328]Top ] [ [329]FTP Top ] [ [330]C-Kermit Home ] [ [331]Kermit Home + ] + +3.7. Translating Character Sets + + A possibly unique feature of Kermit's FTP client is its ability to + convert character sets when transferring files in text mode, + independent of the capabilites of the FTP server, as well as to + translate the character sets of filenames regardless of transfer mode. + For compatibility with existing FTP clients, and because there is a + certain performance penalty, Kermit won't do this unless you ask for + it. If you enable this feature, you need to inform Kermit of the + character set (to be) used on the server and in some cases (explained + below) also the local file character set. This discussion assumes you + know a bit about character sets (as you must if you have to use them); + see Chapter 16 of [332]Using C-Kermit for a detailed treatment. The + Kermit commands for FTP character-set conversion are: + + SET FTP CHARACTER-SET-TRANSLATION { ON, OFF } + Whether to translate character sets when transferring text files + with FTP. OFF by default. Set this to ON to enable character-set + translation for subsequent FTP uploads and downloads. + + SET FTP SERVER-CHARACTER-SET [333]name + Text character set (to be) used by the server. Most FTP servers + are ignorant of character sets, so all translations are done + unilaterally by Kermit's FTP client. This means that when + downloading files, you must know in advance the character-set + used in the files you are downloading (and in their names). When + uploading, you must specify the character-set to which local + filenames and text-file contents are to be translated for + transmission to the server. If you SET FTP + CHARACTER-SET-TRANSLATION ON but do not specify an FTP + SERVER-CHARACTER-SET, [334]UTF8 is used, since this is the new + Internet standard international character set; it is upwards + compatible with ASCII and it encompasses most written languages + and therefore does not favor any particular group of people, as + any other default would do. If you SET FTP SERVER-CHARACTER-SET + to something (anything) when FTP CHARACTER-SET TRANSLATION is + OFF, this also sets the latter ON. + + SET FILE CHARACTER-SET [335]name + This is the regular Kermit (non-FTP-specific) command for + identifying the character set (to be) used in local text files + and filenames. + + TO REITERATE: If you SET FTP CHARACTER-SET TRANSLATION ON but do not + specify an FTP SERVER-CHARACTER-SET, outbound text files are converted + to UTF-8 and inbound text files are assumed to be UTF-8. If this is not + appropriate, be sure to also specify the desired FTP + SERVER-CHARACTER-SET. + + You can use "special" (non-ASCII) characters in filenames in all the + client / server file management commands (FTP MKDIR, RMDIR, DIRECTORY, + VDIRECTORY, DELETE, etc), and also in file-transfer commands. When + giving commands such as FTP DIR (RDIR) and FTP PWD (RPWD), the reply is + translated too, so you can read it. In this example, the client and + server use entirely different codes to represent the special characters + of German: + + C-Kermit> ftp xyzcorp.de /anonymous + C-Kermit> set ftp server-character-set latin1 + C-Kermit> set file character-set german + C-Kermit> rcd Städte + C-Kermit> rpwd + "/pub/ftp/Städte is current directory" + C-Kermit> rdir + -rw-rw---- 1 olaf 54018 Jan 6 17:58 Adenbüttel.txt + -rw-rw---- 1 ursula 373 Jan 5 15:19 Aßlar.txt + -rw-rw---- 1 gisbert 482 Jan 5 15:20 Blowatz.txt + -rw-rw---- 1 gudrun 124 Jan 5 15:19 Böblingen.txt + -rw-rw---- 1 olga 14348 Jan 7 14:23 Köln.txt + + When the client and server file systems use different character sets, + you should take care to use only those characters that the two sets + share in common when creating filenames or text-file contents. For + example, PC code pages contain a lot line- and box-drawing characters, + and sometimes "smart quotes", etc, that are not found in ISO standard + 8-bit character sets. You should be especially careful to avoid using + such characters in filenames. + + [ [336]C-Kermit Character Sets ] + +3.7.1. Character Sets and Uploading + + Kermit's PUT and MPUT commands include full file-scanning capabilities, + as described in [337]Section 4. Thus if FTP CHARACTER-SET-TRANSLATION + is ON and your character-set associations are set up appropriately, + Kermit automatically switches on a per-file basis between text and + binary mode, and for each text file between your chosen 7-bit text + character set (e.g. ASCII or ISO 646 German), 8-bit text (e.g. Latin-1 + or Japanese EUC), UCS-2, and UTF-8, and converts each of these + automatically to the server character-set, and furthermore + automatically differentiates between the Little and Big Endian forms of + UCS-2, always sending in Big Endian form. + + WARNING: It is not advisable to use UCS-2 (or any Unicode + transformation other than UTF-8) "on the wire", i.e. as a server + character set. Most FTP servers are not able to cope with it, since + it contains lots of 0 (NUL) characters. If you do use it, Kermit + does not translate filenames to or from UCS-2, for reasons well + known to C programmers (for example, UNIX APIs assume filename + strings are NUL-terminated). [338]UTF-8 is the preferred (and + standard) Unicode format for the Internet. + + FTP character-set translations differ from the regular Kermit ones by + not restricting translations to a file-character-set / + transfer-character-set pair. You can have Kermit's FTP client translate + between any pair of character sets it knows about. You can see the list + of supported character sets by typing either of the following: + + set ftp server-character-set ? + set file character-set ? + + A typical list looks like this ([339]CLICK HERE for an explanation of + the names): + + C-Kermit>set file char ? One of the following: + ascii cp869-greek hebrew-7 mazovia-pc + british cyrillic-iso hebrew-iso next-multinational + bulgaria-pc danish hp-roman8 norwegian + canadian-french dec-kanji hungarian portuguese + cp1250 dec-multinational iso2022jp-kanji shift-jis-kanji + cp1251-cyrillic dg-international italian short-koi + cp1252 dutch jis7-kanji spanish + cp437 elot927-greek koi8 swedish + cp850 elot928-greek koi8r swiss + cp852 euc-jp koi8u ucs2 + cp855-cyrillic finnish latin1-iso utf8 + cp858 french latin2-iso + cp862-hebrew german latin9-iso + cp866-cyrillic greek-iso macintosh-latin + C-Kermit> + + Thus you can translate not only between private sets (like PC code + pages) and standard ones (like Latin-1) as in Kermit protocol, but also + between any given pair of private sets (e.g. CP852 and Mazovia). All + conversions go through Unicode as the intermediate character set, + resulting in a minimum of character loss, since Unicode is a superset + of all other character sets known to Kermit. + + In addition to the SET commands listed above, the FTP PUT and MPUT + commands include switches that apply only to the current command: + + /LOCAL-CHARACTER-SET:name + /SERVER-CHARACTER-SET:name + Use these switches to force a particular translation. These + switches override the global FTP CHARACTER-SET-TRANSLATION and + SERVER-CHARACTER-SET settings and also character-set + differentiation by file scanning for the duration of the PUT or + MPUT command. The file scan is still performed, however, to + determine whether the file is text or binary; thus these + switches do not affect binary files unless you also include the + /TEXT switch to force all files to be treated as text. + + In other words, if you include one or both of these switches with a PUT + or MPUT command, they are used. Similarly, the /TRANSPARENT switch + disables character-set translation for the PUT or MPUT command despite + the prevailing FTP CHARACTER-SET-TRANSLATION and SERVER-CHARACTER-SET + settings. + + When uploading, the FILE CHARACTER-SET setting is ignored unless you + have forced Kermit not to [340]scan local files by including a /TEXT or + /BINARY switch with your [M]PUT command, or by disabling automatic + text/binary switching in some other way. + + Examples: + + 1. Suppose you have a CP852 (East European) text file that you want to + upload and store in ISO Latin Alphabet 2 encoding: + ftp put /local-char:cp852 /server-char:latin2 magyar.txt + + 2. Suppose you always want your text files converted to Latin-2 when + uploading with FTP. Then put: + set ftp server-character-set latin2 + + in your Kermit customization file, and then you can omit the + /SERVER-CHARACTER-SET: switch from your FTP PUT commands: + ftp put /local-char:cp852 magyar.txt + + 3. Now suppose that all the text files on your PC are written in + Hungarian, but they have a variety of encodings, and you don't want + to have to include the /LOCAL-CHARACTER-SET: switch on every FTP + PUT command, or (more to the point) you want to be able to send a + mixture of these files all at once. Put these commands in your + Kermit customization file: + set ftp server-character-set latin2 ; ISO 8859-2 + set file default 7-bit-character-set hungarian ; ISO 646 Hungarian + set file default 8-bit-character-set cp852 ; PC East European Code Page + + and now PUT and MPUT will automatically detect and switch among ISO + 646 Hungarian, Code Page 852, UTF-8, and UCS-2 encodings, + translating each one to Latin-2 for uploading: + ftp put *.txt + + And since binary files are also detected automatically, the latter can + be simplified to: + + ftp put * + + even when "*" matches a diverse collection of binary and text files, + because translations are skipped automatically for binary files. + +3.7.2. Character Sets and Downloading + + The commands and switches are the same as for uploading, but automatic + character-set switching works differently, since Kermit can't scan the + server files in advance. Instead, the transfer mode (text or binary) is + based on the filenames; each name is compared with Kermit's list of + text name patterns and binary name patterns. If the name matches a + binary pattern (for example, if the filename is oofa.tar.gz and one of + the filename patterns is "*.gz"), the file is downloaded in binary + mode; otherwise if it matches a text pattern (e.g. oofa.txt matches + "*.txt"), it is transferred in text ("ascii") mode. Otherwise, it is + transferred in the prevailing FTP TYPE. + + In C-Kermit 8.0, the pattern lists used with FTP GET are not the same + lists used with Kermit transfers, and can not be viewed with SHOW + PATTERNS, nor adjusted with ADD and REMOVE TEXT-PATTERNS and + BINARY-PATTERNS, or SET FILE TEXT-PATTERNS and BINARY-PATTERNS. + Configuration of the FTP patterns list will be added in a future + release. + + Examples: + + get /server-char:latin1 /local-char:cp850 Grüße.txt + In this command, the filename contains special characters, which + you enter using whatever character set your local computer uses, + in this case PC Code Page 850 (cp850). The command tells Kermit + (in case it didn't know already from its FILE CHARACTER-SET + setting) that the local character set is cp850 and the server's + character-set is ISO 8859-1 Latin Alphabet 1 (latin1). Kermit + translates the filename from cp850 to latin1 and sends the + latin1 name to the server. Since it's a text file (matches + "*.txt"), its contents are translated to cp850 on arrival, and + it is saved with a cp850 name. + + mget /text /server:latin1 /local:utf8 *.txt + This command: + + + Tells C-Kermit that the server's files are encoded in ISO + 8859-1 Latin Alphabet 1. + + Tells C-Kermit to translate the incoming files into Unicode + UTF-8 for storage. + + Asks the server to send all ".txt" files in text mode. + + mget /server:latin1 /local:utf8 * + Tells Kermit to get all files from the server's directory, + switching between text and binary mode based on the filename. + The names of all the files are translated (to UTF-8 in this + case), but contents are translated (also to UTF-8) only for text + files. + + Note that any pair of 8-bit character sets is likely to have some + incompatibilities. Any characters in the source file that do not have + equivalents in the destination file's character set are converted to + question marks. This applies to both filenames and to text file + contents. + + Also note that the server's ability to accept special characters in + filenames depends on the particular server. For example: + + get Grüße.txt + + works with WU-FTPD, but: + + mget Grüß*.txt + + does not. + +3.7.3. RFC2640 + + [341]RFC2640, July 1999, specifies a method by which the FTP client and + server can negotiate the use of UTF8. However, RFC2640-capable servers + are rare to nonexistent at this writing, and in any case you don't need + them to be able to transfer text in UTF8. C-Kermit lets you upload and + download text files in any character set it knows about, converting to + or from any other character set it knows about, without the knowledge, + permission, or cooperation of the server, and regardless of its + capabilities. + + [ [342]Top ] [ [343]FTP Top ] [ [344]C-Kermit Home ] [ [345]Kermit Home + ] + +3.8. FTP Command Shortcuts + + C-Kermit's FTP client coexists with other C-Kermit functions by + requiring the "ftp" prefix for each FTP-related command: FTP OPEN, FTP + GET, FTP BYE, and so on. For interactive use, however, this can be + rather awkward and sometimes surprising, for example when a GET command + starts a Kermit GET rather than an FTP GET. In fact, many Kermit + commands might just as easily apply to an FTP connection: GET, PUT + (SEND), BYE, and CLOSE. The following command lets you choose how these + commands are interpreted: + + SET GET-PUT-REMOTE { AUTO, KERMIT, FTP } + Controls the orientation of GET, PUT, REMOTE and other + file-transfer and client/server commands that might apply to + either Kermit or FTP. The default setting is AUTO, meaning that + these commands apply to FTP if an FTP connection is open, and to + Kermit otherwise. KERMIT means they always apply to Kermit, FTP + means they always apply to FTP. + + Here is a complete list of affected commands: + + Kermit Command FTP Equivalent + (none) FTP [ OPEN ] + LOGIN FTP USER + LOGOUT FTP RESET + BYE FTP BYE + FINISH FTP BYE + CLOSE FTP BYE + HANGUP FTP BYE + BINARY FTP TYPE BINARY + TEXT (or ASCII) FTP TYPE ASCII + SEND (or PUT) FTP PUT + MSEND (or MPUT) FTP MPUT + RESEND FTP PUT /RECOVER + CSEND FTP PUT /COMMAND + GET FTP GET + MGET FTP MGET + REGET FTP GET /RECOVER + REMOTE HELP (RHELP) FTP HELP + REMOTE CD (RCD) FTP CD (CWD) + REMOTE PWD (RPWD) FTP PWD + REMOTE DIRECTORY (RDIR) FTP DIRECTORY + REMOTE DELETE (RDEL) FTP DELETE + REMOTE MKDIR (RMKDIR) FTP MKDIR + REMOTE RMDIR (RRMDIR) FTP RMDIR + REMOTE RENAME (RRENAME) FTP RENAME + REMOTE TYPE (RTYPE) FTP TYPE + REMOTE EXIT (REXIT) FTP BYE + + The commands in the right-hand column always access FTP. The commands + in the left column can access either Kermit protocol or FTP: + + * When GET-PUT-REMOTE is set to KERMIT, or to AUTO when there is no + FTP connection, the commands in the left-hand column access Kermit + protocol, and those right-hand column are required for FTP. + * When GET-PUT-REMOTE is set to FTP, or to AUTO when there is an + active FTP connection, the commands in the left-hand column access + the FTP connection and can not be used to access Kermit protocol. + In this case, if you want to be able to use both Kermit protocol + and the FTP connection, you must SET GET-PUT-REMOTE KERMIT, and + then use the FTP commands in the right-hand column to access the + FTP connection. + + Note that file-management commands such as DIRECTORY, DELETE, CD, PWD, + MKDIR, RMDIR, HELP, RENAME, COPY, TYPE, and so on, always apply + locally, no matter what kind of connection you have. This is the + opposite of most FTP clients, where these commands are intended for the + server, and require an "L" prefix for local execution (e.g. "dir" gets + a directory listing from the server, "ldir" gets a local directory + listing). To illustrate with the CD command and a typical UNIX FTP + client: + + Client Server Change Local Directory Change Remote Directory + FTP FTP lcd cd (cwd) + Kermit Kermit cd rcd, remote cd + Kermit FTP cd ftp cd, rcd, remote cd + + Also note that not all REMOTE commands are useful with FTP, since FTP + servers do not offer the corresponding functions. These include: + + * REMOTE ASSIGN - FTP servers don't have variables + * REMOTE COPY - FTP servers don't copy files + * REMOTE HOST - FTP servers don't execute host (shell) commands + * REMOTE KERMIT - FTP servers don't execute Kermit commands + * REMOTE PRINT - FTP servers don't print files + * REMOTE QUERY - FTP servers don't have variables + * REMOTE SET - FTP servers don't have Kermit settings + * REMOTE WHO - FTP servers don't send user lists + + Finally note that command shortcuts do not apply to the HELP command. + For help about an FTP command, use (for example) "help ftp delete", not + "help delete" or "help rdelete". + + [ [346]Top ] [ [347]FTP Top ] [ [348]C-Kermit Home ] [ [349]Kermit Home + ] + +3.9. Dual Sessions + + You can have an FTP session open at the same time as a regular Kermit + SET LINE or SET HOST (terminal) session. In this case, the default SET + GET-PUT-REMOTE AUTO setting should ensure that all "two-faced" commands + like GET, PUT, REMOTE, HANGUP, BYE, etc, apply to the Kermit session, + and all commands for the FTP session must include the FTP prefix. To be + absolutely certain, you can use SET GET-PUT-REMOTE KERMIT. + + ftp foo.bar.baz.com + if fail ... + (log in) + set host foo.bar.baz.com + if fail ... + (log in) + + Now you have both an FTP and Telnet connection to the same host (of + course they could also be to different hosts, and you could also have a + direct or dialed serial connection instead of a Telnet connection). Now + assuming you have a Kermit server on the far end of the Kermit + connection: + + rcd incoming ; Changes Kermit server's directory (= REMOTE CD) + ftp cd incoming ; Changes FTP server's directory + put oofa.txt ; Sends a file on the Kermit connection + ftp put oofa.txt ; Sends a file on the FTP connection + bye ; Shuts down the Kermit connection + ftp bye ; Shuts down the FTP connection + + Note that PUT and SEND are synonyms for both FTP and Kermit + connections. + + You can also establish dual sessions on the Kermit command line: + + kermit -j host1 -9 host2 + + This makes a Telnet connection to host1 and an FTP connection to host2. + + [ [350]Top ] [ [351]FTP Top ] [ [352]C-Kermit Home ] [ [353]Kermit Home + ] + +3.10. Automating FTP Sessions + + Most of Kermit's scripting features can be used to make and control FTP + sessions: FOR and WHILE loops, IF-ELSE and SWITCH constructions, + variables, arrays, built-in functions, and all the rest. You can't use + INPUT, MINPUT, OUTPUT, CLEAR, or SCRIPT on an FTP session, but these + are not needed since the FTP protocol is well defined. + + [354]CLICK HERE for an FTP scripting tutorial. + +3.10.1. FTP-Specific Variables and Functions + + The following variable tells whether an FTP connection is open: + + \v(ftp_connected) + 1 if there is an active FTP connection, 0 if there isn't. + + The FTP OPEN command sets: + + \v(ftp_host) + The host to which the most recent FTP connection was made. + + \v(ftp_security) + The security method negotiated for the current FTP session. The + value is "NULL" when no security is used. Other possibilities + are GSSAPI, KERBEROS_V4, SSL, TLS, and SRP. Also see + \v(authname), \v(authstate), and \v(authtype). See [355]3.2. + Making Secure FTP Connections. + + \v(ftp_server) + The OS type (UNIX, VMS, etc) of the FTP server host. + + The FTP USER command (or FTP OPEN /USER:, or FTP with automatic login) + sets: + + \v(ftp_loggedin) + 1 if you are logged in to an FTP server, 0 if you are not. + + The current COMMAND-PROTECTION-LEVEL and DATA-PROTECTION-LEVEL values + are reflected in: + + \v(ftp_cpl) + \v(ftp_dpl) + The values are "clear", "confidential", "safe" or "private". See + [356]3.2. Making Secure FTP Connections. + + The FTP GET-PUT-REMOTE setting is reflected in: + + \v(ftp_getputremote) + The values are "auto", "ftp", or "kermit". + + Every FTP command sets the \v(success) variable, as well as the + following two FTP-specific variables: + + \v(ftp_code) + The standardized numeric FTP protocol code from the server's + response to the last client command, a 3-digit decimal number + defined in [357]RFC959. Briefly: + + 1xx = Positive Preliminary Reply + 2xx = Positive Completion Reply + 3xx = Positive Intermediate Reply + 4xx = Transient Negative Completion Reply + 5xx = Permanent Negative Completion Reply + + \v(ftp_message) + The text message, if any, from the server's response to the last + client command. If the most recent response had multiple lines, + this variable has only the final line. These messages are not + standardized and vary in format and content from server to + server. Synonym: \v(ftp_msg). + + FTP file transfers set the regular Kermit transfer status variables: + + \v(cps) Characters per second of most recent transfer. + \v(filespec) File specification used in most recent transfer. + \v(fsize) Size of file most recently transferred. + \v(tfsize) Total size of file group most recently transferred. + \v(xferstatus) Status of most recent transfer (0 = success, 1 = failure). + \v(tftime) Elapsed time of most recent transfer, in seconds. + + During an FTP transfer, the per-file variables are: + + \v(filename) Name of current file. + \v(filenumber) Ordinal file number in group (1, 2, 3, ...) + +3.10.2. Examples + + Let's begin with a simple example showing how to log in, send some + files, and log out: + + define error if fail { ftp bye, stop 1 Error: \%1 } + set transact brief + log t + ftp ftp.xyzcorp.com /anonymous + if fail stop 1 Connection failed + if not \v(ftp_loggedin) stop 1 Login failed + ftp cd incoming + error {ftp cd} + cd upload + error {local cd} + ftp put /delete * + error {put} + ftp bye + + First we define an error handling macro to be used after the connection + is made. Then we set up a brief-format transaction log to keep a record + of our file transfers. Then we make a connection to the host and log in + anonymously. The "if fail" command checks whether the connection was + made. The "if not" command checks whether login was successful. + Obviously the script should not continue unless both tests succeed. + + Next we change to the server's 'incoming' directory and to our own + 'upload' directory, and send all the files that are in it (they can be + any mixture of text and binary files), deleting each source file + automatically after it is successfully uploaded. Each of these + operations is checked with the ERROR macro, which prevents the script + from continuing past a failure. + + Finally we close the FTP session with the "bye" command. + + Just like any other Kermit script, this one can be used in many ways: + + * It can be stored in a file, and Kermit can be told to TAKE the + file. + * In UNIX, it can be a "[358]kerbang" script and therefore run + directly from the shell prompt or as a cron job. + + We could have used command shortcuts like "rcd", "put", and "bye", but + since they can be ambiguous under certain circumstances, it is better + to avoid them in scripts; they are intended mainly for convenience + during interactive use. However, if you wish to use the shortcuts in a + script, you can do it this way (error handling omitted for brevity): + + local \%t ; Declare a local temporary veriable + assign \%t \v(ftp_getputremote) ; Save current FTP GET-PUT-REMOTE setting + set ftp get-put-remote ftp ; Choose FTP orientation + ftp xyzcorp.com /anonymous ; Open an FTP connection + get oofa.txt ; GET a file + put foo.bar ; PUT a file + rdel yesterday.log ; Delete a file on the server + bye ; Log out and disconnect from server. + set ftp get-put-remote \%t ; Restore previous GET-PUT-REMOTE setting + + Of course, FTP scripts can also be written as macros. This lets you + pass parameters such as hostnames, usernames, and filenames to them: + + define doftpget { + if < \v(argc) 4 end 1 Usage: \%0 host user remotefile [ localfile ] + ftp \%1 /user:\%2 + if fail end 1 FTP OPEN \%1 failed + if not \v(ftp_loggedin) end 1 FTP LOGIN failed + ftp get {\%3} {\%4} + if fail end 1 FTP GET \%3 failed + ftp bye + } + + Add this definition to your Kermit customization file, and it will + always be available when you start Kermit. This macro lets you download + a file with FTP by giving a single command, e.g.: + + doftpget xyzcorp.com anonymous oofa.txt + +3.10.3. Automating Secure FTP Sessions + + Often when making secure connections, you are prompted interactively + for certain information or permission to proceed. These prompts can + stop an automated procedure. To avoid them, you must give the + appropriate commands to disable them, and/or supply the prompted-for + information beforehand. Here are a few hints: + + * Make sure that SET TAKE ERROR and SET MACRO ERROR are both OFF. + This is the default, but in case you have set either one of these + ON in your script or initialization file, this makes the script + halt on any kind of error. Normally you would want to check each + operation for success or failure and take appropriate action. + * On SSL and TLS connections, you may be asked whether it is OK to + proceed with a connection to server that presents a self-signed + certificate. You can use the SET AUTHENTICATION SSL (or TLS) VERIFY + or SET AUTH SSL (or TLS) CERTS-OK commands to avoid this prompt by + not requesting a certificate from the peer. + * (More to be added...) + + [ [359]Top ] [ [360]FTP Top ] [ [361]FTP Script Tutorial ] [ + [362]C-Kermit Home ] [ [363]Kermit Home ] + +3.11. Advanced FTP Protocol Features + + The remainder of the FTP documention (through the end of Section 3) is + new to C-Kermit 8.0.206, but we leave it in black to prevent headaches. + Except for titles. + * [364]TERMINOLOGY + * [365]FEATURE NEGOTIATION + * [366]USING MGET: NLST VERSUS MLSD + * [367]EXAMPLES + * [368]REFERENCES + + The new releases of [369]C-Kermit (8.0.206) and [370]Kermit 95 (2.1) + support new FTP protocol features from RFC 2389 as well as most of + what's in the Elz and Hethmon Extensions to FTP Internet Draft (see + [371]References). Some of these features, such as SIZE (request a + file's size), MDTM (request file's modification time), and REST + (restart interrupted transfer) have been widely implemented in FTP + clients and servers for years (as well as in the initial release of the + Kermit FTP clients). Others such as FEAT and MLSD are rarely seen and + are new to the upcoming Kermit releases. TVFS (Trivial Virtual File + Store) is supported implicitly, and the UTF-8 character-set is already + fully supported at the protocol and data-interchange level. + + For Kermit users, the main benefit of the new FTP protocol extensions + is the ability to do recursive downloads. But the extensions also + introduce complications and tradeoffs that you should be aware of. Of + course Kermit tries to "do the right thing" automatically in every case + for backwards compatibility. But (as noted later) some cases are + inherently ambiguous and/or can result in nasty surprises, and for + those situations new commands and switches are available to give you + precise control over Kermit's behavior, in case the defaults don't + produce the desired results. + +3.11.1. Terminology + + Command-line FTP clients such as Kermit (as well as the traditional FTP + programs found on Unix, VMS, ..., even Windows) have commands like PUT, + MPUT, GET, MGET, and BYE, which they convert into zero or more FTP + protocol commands, such as NLST, RETR, QUIT. For clarity, we'll use + "command" to refer to commands given by the user to the FTP client, and + "directive" for FTP protocol commands sent by the FTP client to the FTP + server. + +3.11.2. Feature Negotiation + + New FTP protocol features are negotiated by the client sending a FEAT + directive and the server responding with a list of (new) features it + supports, or else with an error indication if it does not support the + FEAT directive at all, in which case the client has to guess which new + features it supports (Kermit guesses that it supports SIZE and MDTM but + not MLST). Note that the MLST feature includes MLSD, which is not + listed separately as a feature. + + Guessing is nice when it works, but sometimes it doesn't, and some FTP + servers become confused when you send them a directive they don't + understand, or they do something you didn't want, sometimes to the + point of closing the connection. For this reason, Kermit lets you + override default or negotiated features with the following new + commands: + + FTP { ENABLE, DISABLE } FEAT + Enables or disables the automatic sending of a FEAT directive + upon connection to an FTP server. Note that FTP [ OPEN ] /NOINIT + also inhibits sending the FEAT directive (and several others) + for the connection being OPEN'd, but without necessarily + disabling FEAT for subsequent connections in the same Kermit + instance. FEAT is ENABLED by default, in which case many FTP + servers are likely to reply: + +500 'FEAT': command not understood + + which is normally harmless (but you never know). (In C-Kermit + 8.0.208, this error message is suppressed unless you SET FTP + DEBUG ON.) + + FTP ENABLE { MDTM, MLST, SIZE } + Enables the given directive for implicit use by the FTP GET and + MGET commands in case it has been disabled or erroneously + omitted by the server in its FEAT response. Note: MLSD can be + used in the FTP ENABLE and DISABLE commands as a synonym for + MLST. YOU MUST GIVE THIS COMMAND AFTER MAKING THE FTP + CONNECTION. + + FTP DISABLE { MDTM, MLST, SIZE } + Disables implicit use of the given directive by GET or MGET in + case it causes problems; for example, because it makes multifile + downloads take too long or the server announces it erroneously + or misimplements it. Use DISABLE FEAT before making a connection + to prevent Kermit from sending the FEAT directive as part of its + initial sequence. Note that disabling FEAT, SIZE, or MDTM does + not prevent you from executing explicit FTP FEATURES, FTP SIZE, + or FTP MODTIME commands. Also note that disabling SIZE prevents + PUT /RESTART (recovery of interrupted uploads) from working. YOU + MUST GIVE THIS COMMAND AFTER MAKING THE FTP CONNECTION. + + To enable or disable more than one feature, use multiple FTP ENABLE or + FTP DISABLE commands. The SHOW FTP command shows which features are + currently enabled and disabled. + + FTP FEATURES + This command sends a FEAT directive to the server. In case you + have been disabling and enabling different features, this + resynchronizes Kermit's feature list with the server's. If the + server does not support the FEAT directive, Kermit's feature + list is not changed. + + FTP OPTIONS directive + Informational only: the server tells what options, if any, it + supports for the given directive, e.g. MLST. Fails if the server + does not support the OPTS directive or if the directive for + which options are requested is not valid. The directive is + case-insensitive. + + FTP SIZE filename + Sends a SIZE directive to the server for the given file. The + filename must not contain wildcards. The server responds with an + error if the file can't be found, is not accessible, or the SIZE + directive is not supported, otherwise with the length of the + file in bytes, which Kermit displays and also makes available to + you in its \v(ftp_message) variable. If the directive is + successful, Kermit (re-)enables it for internal use by the GET + and MGET directives on this connection. + + FTP MODTIME filename + Works just like the SIZE directive except it sends an MDTM + directive. Upon success, the server sends modification date-time + string, which Kermit interprets for you and also makes available + in its \v(ftp_message) variable. + + Whenever a SIZE or MDTM directive is sent implicitly and rejected by + the server because it is unknown, Kermit automatically disables it. + +3.11.3. Using MGET: NLST versus MLSD + + When you give an MGET command to an FTP client, it sends a request to + the FTP server for a list of files, and then upon successful receipt of + the list, goes through it and issues a RETR (retrieve) directive for + each file on the list (or possibly only for selected files). + + With the new FTP protocol extensions, now there are two ways to get the + list of files: the NLST directive, which has been part of FTP protocol + since the beginning, and the new MLSD directive, which is new and not + yet widely implemented. When NLST is used and you give a command like + "mget *.txt", the FTP client sends: + +NLST *.txt + + and the server sends back a list of the files whose names match, e.g. + +foo.txt +bar.txt +baz.txt + + Then when downloading each file, the client sends SIZE (if it wants + have a percent-done display) and MDTM (if it wants to set the + downloaded file's timestamp to match that of the original), as well as + RETR (to retrieve the file). + + But when MLSD is used, the client is not supposed to send the filename + or wildcard to the server; instead it sends an MLSD directive with no + argument (or the name of a directory), and the server sends back a list + of all the files in the current or given directory; then the client + goes through the list and checks each file to see if it matches the + given pattern, the rationale being that the user knows only the local + conventions for wildcards and not necessarily the server's conventions. + So with NLST the server interprets wildcards; with MLSD the client + does. + + The interpretation of NLST wildcards by the server is not + necessarily required or even envisioned by the FTP protocol + definition (RFC 959), but in practice most clients and servers work + this way. + + The principal advantage of MLSD is that instead of sending back a + simple list of filenames, it sends back a kind of database in which + each entry contains a filename together with information about the + file: type, size, timestamp, and so on; for example: + +size=0;type=dir;perm=el;modify=20020409191530; bin +size=3919312;type=file;perm=r;modify=20000310140400; bar.txt +size=6686176;type=file;perm=r;modify=20001215181000; baz.txt +size=3820092;type=file;perm=r;modify=20000310140300; foo.txt +size=27439;type=file;perm=r;modify=20020923151312; foo.zip +(etc etc...) + + (If the format of the file list were the only difference between NLST + and MLSD, the discussion would be finished: it would always be better + to use MLSD when available, and the MGET user interface would need no + changes. But there's a lot more to MLSD than the file-list format; read + on...) + + The client learns whether the server supports MLSD in FEAT exchange. + But the fact that the server supports MLSD doesn't mean the client + should always use it. It is better to use MLSD: + + * On connections where the server imposes a time penalty for every + command, e.g. the Red Hat Rawhide server. With MLSD, the client + needs to send only one command (RETR) per file, whereas NLST + requires three (SIZE, RETR, and MDTM). Suppose there is a 30-second + delay for each command and 1000 files are to be fetched; in that + case, MLSD saves 60,000 seconds = 1000 minutes = 16 hours and 40 + minutes. + * For recursive downloads since there is no dependable way to + download directory trees with NLST. + + But it is better to use NLST: + + * If you want only a couple short files out of a large directory. In + this case, NLST is the better choice since the server sends a list + of only the files you want, not a list of (say) a million files, + which can make a big difference on slow connections. For example, + suppose your wildcard matches three files of 1K each, but the + million-file listing is 80MB long, and your connection is through a + modem. The overhead of using MLSD is practically infinite. + * If the server supports wildcarding features not known to the + client, but that can be used to achieve desirable effects otherwise + unobtainable, such as "[dir...]*.txt" in VMS or AOS/VS "except" + clauses. + * If you have been given a wildcard string by an FTP site + administrator for fetching a specific group of files out of a + larger directory, e.g. "mget ck[cuw]*.[cwh] makefile", that is + expected to work with any client (an FTP site administrator can't + be expected to know the wildcard syntax of every FTP client). + + But when using MLSD there are complications: + + * MLSD wants either a blank argument (meaning the current directory) + or else the name of a specific directory. The client must not send + it a wildcard or a filename. + * But if the user's command is "mget xxx", how does the client know + whether to send "xxx" in the MLSD directive? It might be the name + of a directory on on the server, in which case it should be sent, + or it might be the name of a file on the server (or a wildcard), in + which case it must not be sent. Since the client knows its own + wildcard syntax, then in most cases it would be right to send + "MLSD" with no argument if xxx is wild, and to send "MLSD xxx" if + it is not. + * But suppose the server's file system allows filename characters + that correspond with the client's wildcard syntax? For example: + "[abc]" could be either a valid VMS directory name or a wildcard + pattern used by the FTP client. What should the client do with + "mget [abc]"? In this case there must be a way for the user to + force sending the MGET argument as the MLSD argument. + * If "xxx" is a regular file in the server's current directory, "mget + xxx" works with NLST but not with MLSD. + + To further complicate matters, NLST can (in theory) work just like + MLSD: if sent with a blank argument or a directory name, it is supposed + to return a complete list of files in the current or given directory, + which the client can match locally against some pattern. It is not + known if any FTP server or client does this but nevertheless, it should + be possible since this behavior can be inferred from RFC 959. + + In view of these considerations, and given the need to preserve the + traditional FTP client command structure and behavior so the software + will be usable by most people: + + 1. The MGET command should produce the expected result in the common + cases, regardless of whether NLST or MLSD is used underneath. + 2. For anomalous cases, the user needs a way to control whether the + MGET argument is sent to the server or kept for local use. + 3. At the same time, the user might need a way to send a directory + name to the server, independent of any wildcard pattern. + 4. The user needs a way to force NLST or MLSD for a given MGET + command. + + By default, Kermit's MGET command uses MLSD if MLST is reported by the + server in its FEAT list. When MLSD is used, the filespec is sent to the + server if it is not wild (according to Kermit's own definition of + "wild" since it can't possibly know the server's definition). If the + filespec is wild it is held for local use to select files from the list + returned by the server. If MLST is not reported by the server or is + disabled, Kermit sends the MGET filespec with the NLST directive. + + The default behavior can be overridden globally with FTP DISABLE MLST, + which forces Kermit to use NLST to get file lists. And then for + situations in which MLSD is enabled, the following MGET switches can be + used to override the defaults for a specific MGET operation: + + /NLST + Forces the client to send NLST. Example: + +mget /nlst foo.* + + /MLSD + Forces the client to send MLSD (even if MLST is disabled). + Example: + +mget /mlsd foo.* + + /MATCH:pattern + When this switch is given, it forces the client to hold the + pattern for local use against the returned file list. If a + remote filespec is also given (e.g. the "blah" in "mget + /match:*.txt blah"), then it is sent as the NLST or MLSD + argument, presumably to specify the directory whose files are to + be listed. When the /MATCH switch is not given, the MGET + filespec is sent to the server if the directive is NLST or if + the filespec is not wild. Examples: + + Command: With NLST: With MLSD: + mget NLST MLSD + mget *.txt NLST *.txt MLSD + mget foo NLST foo MLSD foo + mget /match:*.txt NLST MLSD + mget /match:*.txt foo NLST foo MLSD foo + + In other words, the pattern is always intepreted locally unless MGET + uses NLST and no /MATCH switch was given. + +3.11.4. Examples + +3.11.4.1. Downloading a Single File + + There are no choices here, just use the FTP GET command. Kermit always + sends the RETR directive, and possibly SIZE and/or MDTM. The small + advantage of using MLST in this case is outweighed by the risk and + effort of coding a special case. + +3.11.4.2. Downloading a Group of Files from a Single Directory + + This case presents tradeoffs, especially on slow connections: + + * For downloading all or most of the files in a directory, MLSD is + better because it eliminates the need to send SIZE and MDTM for + each file. No special actions are required in this case; Kermit + uses MLSD automatically if the server supports it (unless you have + disabled it). + * For a small number of files from a large directory, NLST is better + because it bypasses downloading of a potentially huge file list + prior to the files themselves. If you have a connection to a server + that supports MLSD, use the /NLST switch to force NLST: + +mget /nlst t[1234].h + + * If the server supports MLSD but does not support separate SIZE or + MDTM directives, and you need the size and/or timestamp + information, MLSD is better; no special actions required. + * If the server supports MLSD but does not support the "size" and + "modify" facts, but it does support the SIZE or MDTM directives, + and you need the size and/or timestamp information, NLST is better. + +3.11.4.3. Downloading a Directory Tree + + MLSD is the only choice for recursive downloads; they rarely, if ever, + work with NLST (the few cases where they do work rely on extra-protocol + "secret" notations for the NLST argument). No special actions are + required to force MLSD when the server supports it, unless you have + disabled it. Examples: + + MGET /RECURSIVE + This tells the server to send all files and directories in the + tree rooted at its current directory. + + MGET /RECURSIVE *.txt + This tells the server to send all *.txt files in the tree rooted + at its current directory. + + MGET /MLSD /RECURSIVE *.txt + Same as the previous example but forces Kermit to send MLSD in + case it was disabled, or in case the server is known to support + it even though it did not announce it in its FEAT listing. + + MGET /RECURSIVE /MATCH:*.zip archives + Tells the server to send all ZIP files in the tree rooted at its + "archives" directory. + + MGET /RECURSIVE /MATCH:* [abc] + The server is running on VMS and you want it to send all the + files in the directory tree rooted at [ABC]. But since "[abc]" + looks just like a wildcard, you have to include a /MATCH: switch + to force Kermit to send "[abc]" as the MLSD argument. + + In all cases in which the /RECURSIVE switch is included, the server's + tree is duplicated locally. + + Although MLSD allows recursion and NLST does not, the MLSD + specification places a heavy burden on the client; the obvious, + straightforward, and elegant implementation (depth-first, the one + that Kermit currently uses) requires as many open temporary files as + the server's directory tree is deep, and therefore client resource + exhaustion -- e.g. exceeding the maximum number of open files -- is + a danger. Unfortunately MLSD was not designed with recursion in + mind. (Breadth-first traversal could be problematic due to lack of + sufficient navigation information.) + + Of course all of Kermit's other MGET switches can be used too, e.g. for + finer-grained file selection (by date, size, etc), for moving or + renaming files as they arrive, to override Kermit's automatic per-file + text/binary mode switching, to pass the incoming files through a + filter, to convert text-file character sets, and so on. + +3.11.4.4. NLST/MLSD Summary Table + + Here's a table summarizing MGET behavior when the server supports both + NLST and MLSD. /NLST and /MLSD switches are included for clarity to + indicate which protocol is being used, and the expected effects. In + practice you can omit the /NLST and /MLSD switches and the Kermit + client chooses the appropriate or desired protocol as described above. + Sample commands presume a Unix file system on the server, but of course + the server can have any file system or syntax at all. + + User's Command FTP Sends Remarks + mget /nlst NLST Gets a list of all the files in the server's current + and downloads each file. The list includes names only, so Kermit also + must send SIZE and MDTM directives if size and timestamp information is + required (this is always true of NLST). Sending NLST without an + argument is allowed by the RFC959 NLST definition and by the Kermit FTP + client, but might not work with other clients, and also might not work + with every server. + mget /nlst foo NLST foo If "foo" is a directory, this gets a list of + all the files from the server's "foo" directory and downloads each + file; otherwise this downloads the file named "foo" (if any) from the + server's current directory. + mget /nlst *.txt NLST *.txt Gets a list of the files in the server's + current directory whose names match the pattern *.txt, and then + downloads each file from the list. Because we are using NLST, we send + the filespec (*.txt) to the server and the server interprets any + wildcards. + mget /nlst foo/*.txt NLST foo/*.txt Gets a list of the files in the + server's "foo" directory whose names match the pattern *.txt, and then + downloads each file from the list (server interprets wildcards). + mget /nlst /match:*.txt NLST Gets a list of all the files in the + server's current directory and then downloads each one whose name + matches the pattern *.txt (client interprets wildcards). + mget /nlst /match:*.txt foo NLST foo Gets a list of all the files in + the server's "foo" directory and then downloads each one whose name + matches the pattern *.txt (client interprets wildcards). + mget /mlsd MLSD Gets a list of all the files from the server's current + directory and then downloads each one. The list might include size and + timestamp information, in which case Kermit does not need to send SIZE + and MDTM directives for each file (this is always true of MLSD). + mget /mlsd foo MLSD foo Gets a list of all the files from the server's + "foo" directory (where the string "foo" does not contain wildcards) and + then downloads each one. If "foo" is a regular file and not a + directory, this command is supposed to fail, but some servers have been + observed that send the file. + mget /mlsd *.txt MLSD Gets a list of all the files from the server's + current directory and then downloads only the ones whose names match + the pattern "*.txt". Because we are using MLSD and the MGET filespec is + wild, we do not send the filespec to the server, but treat it as though + it had been given in a /MATCH: switch and use it locally to match the + names in the list. + mget /mlsd foo/*.txt MLSD This one won't work because MLSD requires + that the notions of server directory and filename-matching pattern be + separated. However, the client, which can't be expected to know the + server's file-system syntax, winds up sending a request that the server + will (or should) reject. + mget /mlsd /match:*.txt MLSD Gets a list of all the files from the + server's current directory and then downloads only the ones whose names + match the pattern "*.txt" (client interprets wildcards). + mget /mlsd /match:*.txt foo MLSD foo If "foo" is a directory on the + server, this gets a list of all the files from the server's "foo" + directory and then downloads only the ones whose names match the + pattern "*.txt" (client interprets wildcards). This leaves the server + CD'd to the "foo" directory; there's no way the client can restore the + server's original directory because MLSD doesn't give that information, + and since the client can not be expected to know the server's + file-system syntax, it would not be safe to guess. If "foo" is a + regular file, MLSD fails. + mget /mlsd foo bar MLSD This one is problematic. You're supposed to be + able to give MGET a list a filespecs; in this case we name two + directories. The client must change the server's directory to "foo" to + get the list of files, and then the files themselves. But then it has + no way to return to the server's previous directory in order to do the + same for "bar", as explained in the previous example. + mget /mlsd /match:* [abc] MLSD [abc] Including a /MATCH: switch forces + [abc] to be sent to the server even though the client would normally + think it was a wildcard and hold it for local interpretation. In this + example, [abc] might be a VMS directory name. + mget /mlsd /match:* t*.h MLSD t*.h Contrary to the MLSD specification, + some MLSD-capable FTP servers do interpret wildcards. This form of the + MGET command can be used to force a wildcard to be sent to the server + for interpretation. + + When MLSD is used implicitly (that is, without an /MLSD switch given to + force the use of MLSD) and an MGET command such as "mget foo/*.txt" + fails, Kermit automatically falls back to NLST and tries again. + +3.11.5. References + + 1. Postel, J., and J. Reynolds, File Transfer Protocol (FTP), RFC 959, + October 1985: [372]ftp://ftp.isi.edu/in-notes/rfc959.txt. + 2. Hethmon, P, and R. Elz, Feature negotiation mechanism for the File + Transfer Protocol, RFC 2389, August 1998: + [373]ftp://ftp.isi.edu/in-notes/rfc2389.txt. + 3. Elz, R, and P. Hethmon, Extensions to FTP, Internet Draft + draft-ietf-ftpext-mlst-16.txt, September 2002: + [374]http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16. + txt. + 4. [375]The Kermit FTP Client (overview). + + [ [376]Top ] [ [377]FTP Top ] [ [378]C-Kermit Home ] [ [379]Kermit Home + ] + +4. FILE SCANNING + + A new feature called file scanning is used in various contexts to + determine if a file is text or binary, and if it is text, what kind of + text. The overhead of file scanning is surprisingly tolerable, usually + about a quarter second per file. File scanning is now used instead of + filename patterns unless you SET FILE SCAN OFF, which restores the + previous behavior. + + The primary benefit of file scanning is in file transfer. For all + practical purposes, now you can stop worrying about whether a file + should be sent in binary or text mode, or about sending mixtures of + text and binary files in a single operation, or configuring and + fine-tuning your lists of binary-file and text-file name patterns: now + it all just works. + + File scanning is done by the file sender, which determines the type of + each file before it sends it and informs the receiver (Kermit or FTP + server) of the type. File scanning is NOT done by the receiver, because + it is the sender's responsibility to determine each file's type, send + the file in the right mode, and inform the receiver of the mode. If + both transfer partners are capable of this (or any other) form of + automatic text/binary mode switching, then files can be sent in both + directions with no worries about corruption due to inappropriate + transfer mode. (As noted in [380]Section 3, FTP servers don't do this, + so this discussion does not apply when using Kermit to download from an + FTP server.) + + The rest of this section is mainly for the curious. If you don't read + it and simply accept all defaults, every file you send should go in the + appropriate mode automatically. As always, however, for character-set + translation to work for 7- and 8-bit character-set files, the + appropriate SET FILE CHARACTER-SET command(s) must have been executed + to identify their encoding (Kermit's default file character-set is + neutral ASCII except on platforms like HP-UX or DG/UX, where the + default file character-set is known). And of course, receiving is + another matter -- obviously the other Kermit must also send each file + in the appropriate mode. + + Scanning is more reliable than filename patterns simply because + filenames are not reliable indicators of the file's contents. Classic + examples include ".doc" files, which are binary if Microsoft Word + documents but text on most other platforms, and ".com" files, which are + binary on DOS and Windows but text on VMS. Anyway, nobody knows the + naming conventions (if any) of all the applications (and persons!) on + your computer. Scanning, on the other hand, determines each file's type + by inspecting its contents rather than just looking at its name. + + Also, file patterns -- even when they work as intended -- categorize + each file only as text or binary, whereas file scanning can make finer + distinctions: + + BINARY + Binary data, not to be converted in any way. Examples include + binary machine code (executable programs), graphics images (GIF, + JPG, etc), compressed files (Z, GZ, etc), archives and packages + (ZIP, TAR, RPM, etc), object files and libraries (OBJ, DLL, + etc). + + 7-BIT TEXT + Text encoded in a 7-bit character set such as ASCII or one of + the ISO 646 national versions. Kermit has no way to tell which + character is used, only that it's 7-bit text. Typical examples + include program source code, README files, Perl or Kermit + scripts, plain-text email, HTML, TeX, and various textual + encodings of binary files: Hex, Base64, etc. When sending such + files, the FILE DEFAULT 7BIT-CHARACTER-SET is used as the file + character-set, and then the appropriate transfer character set + is chosen from the associations list (ASSOCIATE, SHOW + ASSOCIATIONS). + + 8-BIT TEXT + Text encoded in an 8-bit character set such as Latin-1, Latin-2, + Latin/Hebrew, Latin/Cyrillic, KOI8, HP-Roman8, JIS X 0208, Code + Page 437, or Code Page 1252. Again, Kermit has no way of knowing + which particular set is in use, only that it's 8-bit text. When + sending such files, the FILE DEFAULT 8BIT-CHARACTER-SET is used + as the file character-set, and then the appropriate transfer + character set is chosen from the associations list. + + UCS2 TEXT + Unicode in its basic form, 16 bits (2 octets) per character. + When sending such files, UCS2 is the file character-set and the + byte order is identified automatically; the appropriate transfer + character set is chosen from the associations list. Normally + this would be UTF8. UTF-16 is not supported yet; Kermit's + Unicode translations are restricted to Plane 0, the Base + Multilingual Plane (BMP). + + UTF8 TEXT + Unicode in its 8-bit transformation format. When sending such + files, UTF8 is the file character-set; the appropriate transfer + character set is chosen from the associations list, normally + UCS2 or UTF8. + + File scanning is available in UNIX C-Kermit, in K-95, and to a limited + extent, in VMS C-Kermit (full scanning is problematic in VMS because + even plain-text files might contain binary record-format information). + The relevant commands are: + + SET TRANSFER MODE { AUTOMATIC, MANUAL } + Tells whether the file-transfer mode (text or binary) should be + set by automatic or "manual" means. AUTOMATIC is the default, + which allows any of the automatic methods that are enabled to do + their jobs: FILE SCAN, FILE PATTERNS, peer recognition, etc. + MANUAL lets you control the transfer mode with the SET FILE TYPE + commands. As always, /TEXT and /BINARY switches on your + file-transfer commands override all other methods; if you give + one of these switches, scanning is not done. SHOW TRANSFER + displays the current TRANSFER MODE setting. + + SET FILE SCAN { ON [ number ], OFF } + Turns this feature on and off. It's ON by default. When OFF, the + previous rules apply (SET FILE PATTERNS, etc). When ON is given, + you can also specify a number of bytes to be scanned. The + default is 49152 (= 48K). If a negative number is given, the + entire file is scanned, no matter how big, for maximum certainty + (for example, a PostScript file that appears to be plain text + might include an embedded graphic past the normal scanning + limit). SHOW FILE displays the current FILE SCAN setting. + + SET FILE DEFAULT 7BIT-CHARACTER-SET name + Tells the 7-bit character-set to use if scanning identifies a + 7-bit text file, e.g. GERMAN. SHOW FILE displays the current SET + FILE DEFAULT settings. So does SHOW CHARACTER-SETS. + + SET FILE DEFAULT 8BIT-CHARACTER-SET name + Tells the 8-bit character-set to use if scanning identifies an + 8-bit text file, e.g. LATIN1. SHOW FILE and SHOW CHARACTER-SET + display this. + + ASSOCIATE FILE-CHARACTER-SET fcs tcs + When sending files and a file character-set (fcs) is identified + by scanning, this tells C-Kermit which transfer character-set + (tcs) to translate it to. It also allows C-Kermit to set the + appropriate transfer character-set automatically whenever you + give a SET FILE CHARACTER-SET command. + + ASSOCIATE TRANSFER-CHARACTER-SET tcs fcs + When receiving files and a file arrives whose transfer + character-set (tcs) is announced by the sender, this command + tells C-Kermit which file character-set (fcs) to translate it + to. It also allows C-Kermit to set the appropriate file + character-set whenever you give a SET TRANSFER CHARACTER-SET + command. + + SET FILE CHARACTER-SET name + When given for a 7-bit set, also sets FILE DEFAULT + 7BIT-CHARACTER-SET to the same set. When given for an 8-bit set, + also sets FILE DEFAULT 8BIT-CHARACTER-SET to the same set. If an + ASSOCIATE FILE-CHARACTER-SET command has been given for this + set, also sets the corresponding transfer character-set. + + DIRECTORY /XFERMODE [ filespec ] + Performs a file scan of the given files, listing the result for + each file. If FILE SCAN is OFF but PATTERNS are ON, the result + shown according to the current FILE TEXT-PATTERNS and + BINARY-PATTERNS, and are restricted to (B) and (T). When FILE + SCAN is ON, the results are: + + (B) Binary + (T)(7BIT) Text: 7-bit + (T)(8BIT) Text: 8-bit + (T)(UTF8) Text: Unicode UTF8 + (T)(UCS2BE) Text: Unicode UCS2 Big Endian + (T)(UCS2LE) Text: Unicode UCS2 Little Endian + + So you can use DIR /XFER to get a preview of how each file in a + selected group will be transferred. Everything to the right of + the (B) or (T) is new. If FILE SCAN is OFF, you only get the (B) + or (T) as before. + + Note: Big and Little Endian refer to the ordering of bytes + within a computer word. Big Endian architecture is standard and + is used on most non-PC computers. Little Endian architecture is + used on PCs. + + To illustrate file-transfer with scanning, suppose you have a directory + containing a mixture of text and binary files, and each text file can + be 7-bit German ISO 646, 8-bit Latin-1, or Unicode in any of the + following forms: UCS2 Little Endian, UCS2 Big Endian, or UTF8 + ([381]UTF-16 is not supported yet). Assuming all the built-in defaults + are in effect, the following three commands do the job: + + set file char german ; This sets the default for 7-bit text files + set file char latin1 ; This sets the default for 8-bit text files + send * + + Each file is sent in the appropriate mode (text or binary), with text + files converted to the appropriate transfer character-set and labeled + so the receiver can convert them according to its own local + conventions. + + By the way, what if you want to inhibit character-set translation but + still allow automatic text/binary mode switching? Previously, you could + simply SET TRANSFER CHARACTER-SET TRANSPARENT. But now with file + scanning, the file and transfer character-sets are set automatically + per file. A new command was added for this purpose: + + SET TRANSFER TRANSLATION { ON, OFF } + Enables and disables file-transfer character-set translation. It + is enabled by default. + + When TRANSFER TRANSLATION is OFF but FILE SCAN is ON, files are still + scanned to see if they are text or binary, but no character-set + translation is done when they text: only the normal record-format + conversion. + + Like all SET commands, SET TRANSFER TRANSLATION is global and + persistent. You can also force a particular file-transfer command + (SEND, MSEND, GET, RECEIVE, TRANSMIT, etc) to not translate without + affecting the global translation settings by including the new + /TRANSPARENT switch, e.g. + + send /transparent oofa.txt + + As of C-Kermit 8.0.206, SET TRANSFER CHARACTER-SET TRANSPARENT implies + SET TRANSFER TRANSLATION OFF. + + File scanning is also used in the TYPE command. The source file type + and character set are determined as above, and then the file is + automatically converted to your display character-set, line by line. In + Kermit 95, the display character-set is Unicode, perhaps converted to + your current console code page; in other versions of C-Kermit, it is + your current file character-set. Thus if you have the following set + appriately: + + SET FILE CHARACTER-SET (necessary in Unix but not K95) + SET FILE DEFAULT 7BIT CHARACTER-SET + SET FILE DEFAULT 8BIT CHARACTER-SET + + then you should be able to TYPE any text file and see something + reasonable. For example, in Unix, if your DEFAULT 7BIT-CHARACTER-SET is + ITALIAN and your DEFAULT 8BIT-CHARACTER-SET is LATIN1, and your FILE + CHARACTER-SET is LATIN1, you can TYPE an Italian ISO 646 file, a + Latin-1 file, or any kind of Unicode file, and have it translated + automatically to Latin-1 for your display. + + In the GUI version of Kermit 95, you can see mixtures of many different + scripts if the file is UTF8 or UCS2: Roman, Cyrillic, Hebrew, Greek, + Armenian, Georgian, etc, all on the same screen at once. + + File scanning also adds a new criterion for file selection, i.e. to + select only text (or binary) files. Several commands now include a new + switch, /TYPE:{BINARY,TEXT,ALL}. BINARY means select only binary + regular files (not directories). TEXT means select only text files. ALL + means don't scan; select all files. Examples: + + SEND /TYPE:BINARY *.* + Sends only binary files, skipping over text files. + + NOTE: File scanning is NOT done when using external protocols (because + the external protocol programs, such as sz, are processing each file, + not Kermit). + + DIRECTORY /TYPE:TEXT + Lists only text files but not binary files. + + DELETE /TYPE:BINARY foo.* + Deletes all foo.* files that are regular binary files but does + not delete any text files. + + CHMOD /TYPE:BINARY 775 * + (UNIX) Changes the permissions of all binary files to 775. + + When FILE SCAN is OFF and FILE PATTERNS are ON, behavior is as before + with PATTERNS ON, but with some improvements: + + * Pathnames are now stripped prior to pattern matching. + * Backup suffixes (like .~3~) are stripped prior to pattern matching. + + [ [382]Top ] [ [383]Contents ] [ [384]C-Kermit Home ] [ [385]Kermit + Home ] + +5. FILE AND DIRECTORY NAMES CONTAINING SPACES + + Prior to the introduction of the graphical user interface (GUI), it was + inconceivable that file or directory names could contain spaces, + because space is a field delimiter in all command languages. GUIs, + however, use dialog boxes for filenames, so there is never any question + of distinguishing a filename from adjacent fields -- because there are + no adjacent fields -- and therefore it has become quite common on + computers that have GUIs to have file and directory names composed of + multiple words. Of course this poses problems for command shells and + other text-oriented programs. + + Most command shells address these problems by allowing such names to be + enclosed in doublequotes, e.g.: + + cd "c:\Program Files" + + C-Kermit previously used braces for this: + + cd {c:\Program Files} + + which was not what most people expected. And even when braces were + used, Kermit had difficulties with completion, file menus, and so + forth, within braced fields. + + C-Kermit 8.0 allows either doublequotes or braces to be used for + grouping: + + send "this file" + send {this file} + rename "this file" "that file" + rename {this file} "that file" + rename "this file" {that file} + cd {Program Files} + cd "Program Files" + + Note that the doublequotes or brackets must enclose the whole file or + directory specification: + + "c:\My Directory" + + not: + + c:\"My Directory" + + In C-Kermit 8.0, you can also use completion on these filenames, in + which case Kermit supplies the quotes (or braces) automatically. + Example (in which the current directory contains only one file whose + name starts with "th" and its full name is "this file" (without the + quotes, but with the space)): + + cat th + + Kermit repaints the filename field like this: + + cat "this file" + + That is, it backspaces over the original "th" and then writes the + filename in doublequotes. + + If completion is only partial, Kermit still supplies the quotes, but in + this case also beeps. To continue the filename, you must first + backspace over the closing quote. The closing quote is supplied in this + case to make sure that you can see the spaces, especially if they are + trailing. For example, if the current directory contains two files + whose names start with "th", and their fill names are "this file" and + "this other file": + + cat th + + Kermit prints: + + cat "this " + + If it didn't print the closing quote, you would probably wonder why it + was beeping. + + Also, if you begin a filename field with a doublequote or opening + brace, now you can use completion or get ?-help; this was never + possible before. + + C-Kermit>type "thi? Input file specification, one of the following: + this file this other file + C-Kermit>type "thi_ + + [ [386]Top ] [ [387]Contents ] [ [388]C-Kermit Home ] [ [389]Kermit + Home ] + +6. OTHER COMMAND PARSING IMPROVEMENTS + +6.1. Grouping Macro Arguments + + Doublequotes now can be used in macro invocations to group arguments + containing spaces, where previously only braces could be used: + + define xx show args + xx one "this is two" three + + Result: + + Macro arguments at level 0 (\v(argc) = 4): + \%0 = xx + \%1 = one + \%2 = this is two + \%3 = three + + Also, you can now quote braces and quotes in macro args (this didn't + work before). Examples: + + xx "{" ; The argument is a single left brace + xx {"} ; The argument is a doublequote character + + In case this new behavior interferes with your scripts, you can restore + the previous behavior with: + + SET COMMAND DOUBLEQUOTING OFF + +6.2. Directory and File Name Completion + + C-Kermit 8.0 also includes better completion for directory names, e.g. + in the CD command. If the name typed so far uniquely matches a + directory name, it is completed (as before), but now if the directory + contains any subdirectories, completion is partial (allowing you to + supply additional path segments without backspacing); otherwise it is + complete. + + Completion has also been improved for file and directory names that + contain not only spaces (as described above) but also "metacharacters" + such as asterisk (*) and tilde (~): now the field is repainted if + necessary. For example, if the current directory contains only one file + whose name contains "blah", then in: + + type *blah + + "*blah" is replaced by the filename. In earlier releases, the part + typed so far was left on the command line (and in the history buffer), + so even when the original command worked, the recalled version would + not. Similarly for ~ (the nearly-universal Unix notation for username): + + type ~olga/x + + is repainted as (e.g.): + + type /users/home/olga/x(Beep) + + Speaking of command history, the new SHOW HISTORY command shows your + command history and recall buffer. SAVE COMMAND HISTORY saves it into a + file of your choice. + +6.3. Passing Arguments to Command Files + + The method for passing arguments to command files has been improved. + Prior to C-Kermit 7.0 there was no provision for doing this. In + C-Kermit 7.0, the TAKE command was changed to allow arguments to be + given after the filename: + + take commandfile arg1 arg2 ... + + This was accomplished by replacing the current \%1, \%2, etc, with the + given arguments, since a new set of macro argument variables is created + only when a macro is executed, not a command file. It is much more + intuitive, however, if arguments to command files worked like those to + macros: the command file sees the arguments as its own \%1, \%2, etc, + but the caller's variables are not disturbed. C-Kermit 8.0 accomplishes + this by automatically creating an intermediate temporary macro to start + the command file (if any arguments were given), thus creating a new + level of arguments as expected. + +6.4. More-Prompting + + The familiar --more?-- prompt that appears at the end of each screenful + of command-response output now accepts a new answer: G (Go) meaning + "show all the rest without pausing and asking me any more questions". P + (Proceed) is a synonym for G. + +6.5. Commas in Macro Definitions + + As noted in the [390]C-Kermit manual, comma is used to separate + commands in a macro definition. Even when the macro is defined on + multiple lines using curly-brace block-structure notation without + commas, the definition is still stored internally as a comma-separated + list of commands. Therefore special tricks are needed to include a + comma in a command. The classic example is: + + define foo { + (some command) + if fail echo Sorry, blah failed... + } + + This would result in Kermit trying to execute a "blah" command. This + could always be handled by enclosing the text in braces: + + define foo { + (some command) + if fail echo {Sorry, blah failed...} + } + + but doublequotes (more intuitive) should have worked too. Now they do: + + define foo { + (some command) + if fail echo "Sorry, blah failed..." + } + +6.6. Arrow Keys + + As of version 8.0.201, C-Kermit on most platforms lets you access the + command history buffer with arrow keys, just as you always could with + control characters. The restrictions are: + + 1. Only Up and Down arrow keys are accepted. + 2. Only 7-bit ANSI arrow-key sequences are understood (ESC followed by + [ or uppercase letter O, followed by uppercase letter A or (up) B + (down). + + This change was made to facilitate command recall in Linux-based PDAs + that don't have a Control key, or at least not one that's easily (or + always) accessible, such as the Sharp Zaurus SL5500. + + [ [391]Top ] [ [392]Contents ] [ [393]C-Kermit Home ] [ [394]Kermit + Home ] + +7. NEW COMMANDS AND SWITCHES + + See [395]Section 4 for more about file scanning and the /TYPE: switch. + + ASK[Q] [ /TIMEOUT:number /QUIET /DEFAULT:text ] variable [ prompt ] + The new optional /TIMEOUT: switch for ASK and ASKQ causes the + command to time out and and fail if no response is given within + the specified number of seconds, 1 or greater (0 or less means + no timeout, wait forever). This works just like SET ASK-TIMER, + except its effect is local to the ASK command with which it is + given and it does not disturb the global ask timer setting. The + new /QUIET switch tells Kermit not to print an error message if + the ASK or ASKQ command times out waiting for a response. + + Version 8.0.211 adds the /DEFAULT:text switch for ASK-Class + commands (ASK, ASKQ, and GETOK). This lets you supply a default + answer in case the user supplies an empty answer or the + /TIMEOUT: switch was included and the time limit expired without + an answer. In both these cases, the command succeeds. + + CAT filename + Equivalent to TYPE /NOPAGE. + + CDUP + Changes Kermit's local working directory to the parent of the + current one. Equivalent to "cd .." in UNIX or Windows, "cd [-]" + in VMS, "cd ^" in AOS/VS, etc; in other words, it's a + platform-independent way of moving one level up in a directory + tree. + + CHMOD [ switches ] permission files + UNIX only. Sets file permissions for one or more files or + directories. The permission must be given as an octal number, + e.g. 664, 755. Switches: /DIRECTORIES, /FILES, /NOLIST, /PAGE, + /DOTFILES, /LIST, /NOPAGE, /RECURSIVE, /TYPE:{TEXT,BINARY,ALL}, + /SIMULATE. The /TYPE: switch allows selection of only text or + binary files. For example, if you have a mixture of source files + and executables, you can use "chmod /files /type:text 664" to + give owner/group read/write and world read permission to the + text files, and "chmod /files /type:binary 775" to give the same + plus execute permission to the executables. Use /SIMULATE to see + which files would be affected, without actually changing their + permissions. + + CLEAR KEYBOARD-BUFFER + Flushes any as-yet unread characters from the keyboard input + buffer. Useful for flushing typeahead in scripts. + + CONTINUE + When given at an interactive command prompt that was reached by + issuing a PROMPT command (described in this section) from a + script, this command returns to the script, continuing its + execution at the command after the PROMPT command. In this + context, CONTINUE is simply a more-intuitive synonym for END. + + COPY, RENAME, and TRANSLATE + These commands now work on file groups if the target filename is + a directory, e.g. "copy oofa.* ..", "rename * ~olga/tmp/" + + COPY /APPEND source destination + The source file specification can now include wildcards, in + which case all of the source files that match will go into the + destination file in alphabetical order by name. + + DELETE /ASK + Asks permission to delete each file before deleting it. In + C-Kermit 7.0, the answers were "yes" (or "ok") and "no". + C-Kermit 8.0 adds "go" (meaning, delete all the rest without + asking) and "quit" (cancel the DELETE command and return to the + prompt). + + DELETE /DIRECTORIES + Deletes not only files but also directories. + + DELETE /RECURSIVE + Deletes all files that match the given file specification in the + current (or given) directory and all directories beneath it. + + DELETE /SUMMARY + Prints only the number of files deleted and total size freed, + without listing each file. + + DELETE /TREE + Shorthand for DELETE /RECURSIVE /DIRECTORIES /DOTFILES/. + Equivalent to Windows DELTREE or Unix "rm -Rf". If no file + specification is given, the contents of the current directory, + plus all of its subdirectories and their contents, are deleted. + + DELETE /TYPE:BINARY + Delete only regular binary files (requires FILE SCAN ON). + + DELETE /TYPE:TEXT + Delete only regular text files (requires FILE SCAN ON). + + DIRECTORY [ switches ] [ filespec [ filespec [ filespec ... ] ] ] + The DIRECTORY command now accepts more than one file + specification; e.g. "directory moon.txt sun.doc stars.*". + + DIRECTORY /NORECURSIVE xxx + If xxx is a directory name, forces listing of the directory + itself rather than its contents. + + DIRECTORY /FOLLOWLINKS xxx + (UNIX only) Tells the DIRECTORY command to follow symbolic + links. This not the default because it can cause endless loops. + + DIRECTORY /NOFOLLOWLINKS xxx + (UNIX only) Tells the DIRECTORY command not to follow symbolic + links, but rather, merely to list them. This is the default. + + DIRECTORY /OUTPUT:filename + Sends the results of the DIRECTORY command to the given file. + + DIRECTORY /SUMMARY + Prints only the number of directories and files and the total + size, without listing each file. + + DIRECTORY /TYPE:{TEXT,BINARY} + Shows only files of the selected type, based on file scan. + + DIRECTORY /XFERMODE + Now shows results of file scan (see [396]Section 4). + + FOPEN [ switches ] channel filename + + As of version 8.0.211, FOPEN allows /dev/tty as a filename in + Unix-based operating systems. + + FREAD /TRIM + (8.0.211) Trims any trailing blanks or tabs from the item (such + as a line of text) that it has read. + + FREAD /UNTABIFY + (8.0.211) Converts Horizontal Tab characters to the appropriate + number of spaces, based on VT100-like tab stops (1,9,17,25,...). + + GREP [ switches ] pattern files + Similar to Unix grep command: displays file lines that match the + given [397]pattern. Switches: + + /COUNT[:variable] + Don't show the matching lines, just tell how many lines + match. If a variable name is specified, the count is + stored in the given variable. + + /DOTFILES + Include files whose names begin with dot. + + /LINENUMBERS + Show line numbers of matching lines. + + /NAMEONLY + only list the names of files that contain matching lines, + but not the lines themselves. + + /NOBACKUP + Skip backup files. + + /NOCASE + Ignore alphabetic case while pattern matching. + + /NODOTFILES + skip files whose names start with dot (period). + + /NOLIST + Suppress output but set SUCCESS or FAILURE according to + search result. + + /NOMATCH + Look for lines that do not match the pattern. + + /NOPAGE + Don't pause between screens of output. + + /OUTPUT:filename + Write results into the given file. + + /PAGE + Pause between screens of output. + + /RECURSIVE + Search files in subdirectories too. + + /TYPE:{TEXT,BINARY} + Search only files of the specified type. + + Synonyms: FIND, SEARCH. + + GETOK /TIMEOUT:n /QUIET /DEFAULT:text + The new /QUIET switch instructs GETOK, when given a timeout, not + to print an error message if it times out. As of 8.0.211, a + default answer can be supplied (see ASK). + + HEAD [ switches ] filename + Equivalent to TYPE /HEAD [ other-switches ] filename. + + HELP DATE + Explains date-time formats, including timezone notation and + delta times. + + HELP FIREWALLS + Explains the firewall negotiation capabilities of your version + of Kermit. + + KCD [ symbolic-directory-name ] + Changes Kermit's working directory to the named symbolic + directory, such as such as exedir, inidir, startup, download, or + and home. Type "kcd ?" for a list of symbolic directory names + known to your copy of Kermit, or give the new ORIENTATION + command for a more detailed explanation. If you give a KCD + command without a directory name, Kermit returns to its "home" + directory, which is determined in some way that depends on the + underlying operating system, but which you can redefine with the + (new) SET CD HOME command. Your home directory is shown by SHOW + CD and it's also the value of the \v(home) variable. + + LICENSE + Displays the C-Kermit license. + + L-commands + When Kermit has a connection to a Kermit or FTP server, file + managment commands such as CD, DIRECTORY, and DELETE might be + intended for the local computer or the remote server. C-Kermit + 8.0.200 and earlier always executes these commands on the local + computer. If you want them executed by the remote server, you + have to prefix them with REMOTE (e.g. REMOTE CD) or use special + R-command aliases (e.g. RCD = REMOTE CD, RDIR = REMOTE DIR, + etc). But this feels unnatural to FTP users, who expect + unprefixed file management commands to be executed by the remote + server, rather than locally. C-Kermit 8.0.201 adds automatic + locus switching to present an FTP-like interface for FTP + connections and the normal Kermit interface for Kermit + connections, and a SET LOCUS command (described below) to + control whether or how this is done. For when LOCUS is REMOTE, a + new set of commands was added for local management: LCD (Local + CD), LDIR (Local DIR), etc. These are described below under SET + LOCUS. + + MORE filename + Equivalent to TYPE /PAGE. + + ORIENTATION + Displays symbolic directory names and the corresponding variable + names and values. The symbolic names, such as exedir, inidir, + startup, download, and home, can be used as arguments to the new + KCD command. + + PROMPT [ text ] + For use in a macro or command file: enters interactive command + mode within the current context ([398]Section 8.1). If the + optional text is included, the prompt is set to it. The text can + include variables, functions, etc, as in the SET PROMPT command. + They are evaluated each time the prompt is printed. Unlike the + SET PROMPT command, the text argument applies only to the + current command level. Thus you can have different prompts at + different levels. + + REMOTE SET MATCH { DOTFILE, FIFO } { ON, OFF } + Allows the client to tell the server whether wildcards sent to + the server should match dot files (files whose names begin with + period) or FIFOs (named pipes). See SET MATCH. + + SET ATTRIBUTE RECORD-FORMAT { ON, OFF } + Allows control of the Kermit's Record-Format attribute. Set this + to OFF in case incoming file are refused due to unknown or + invalid record formats if you want to accept the file anyway + (and, perhaps, postprocess it to fix its record format). + + SET CD HOME [ directory ] + Specifies the target directory for the CD and KCD commands, when + they are given without an argument, and also sets the value of + the \v(home) variable. + + SET EXIT HANGUP { OFF, ON } + Normally ON, meaning that when Kermit exits, it also explicitly + hangs up the current SET LINE / SET PORT serial port according + to the current SET MODEM TYPE and SET MODEM HANGUP METHOD, and + closes the port device if it was opened by Kermit in the first + place (as opposed to inherited). SET EXIT HANGUP OFF tells + Kermit not to do this. This can't prevent the operating system + from closing the device when Kermit exits (and it's a "last + close") but if the port or modem have been conditioned to + somehow ignore the close and keep the connection open, at least + Kermit itself won't do anything explicit to hang it up or close + it. + + SET FILE EOF { CTRL-Z, LENGTH } + Specifies the end-of-file detection method to be used by + C-Kermit when sending and receiving text files, and in the TYPE + and similar text-file oriented commands. The normal and default + method is LENGTH. You can specify CTRL-Z when handling CP/M or + MS-DOS format text files, in which a Ctrl-Z (ASCII 26) character + within the file marks the end of the file. + + SET FILE LISTSIZE number + Allocates space for the given number of filenames to be filled + in by the wildcard expander. The current number is shown by SHOW + FILE. If you give a command that includes a filename containing + a wildcard (such as "*") that matches more files that Kermit's + list has room for, you can adjust the list size with this + command. + + SET FILE STRINGSPACE number + Allocates space for the given amount of filename strings for use + by the wildcard expander. The current number is shown by SHOW + FILE. The number is the total number of bytes of all the file + specifications that match the given wildcard. + + If you need to process a bigger list of files than your computer has + memory for, you might be able use an external file list. The Kermit + SEND and the FTP PUT and GET commands accept a /LISTFILE: switch, + which gives the name of a file that contains the list of files to be + transferred. Example for UNIX: + + !find . -print | grep / > /tmp/names + ftp put /update /recursive /listfile:/tmp/names + + SET LOCUS { AUTO, LOCAL, REMOTE } + Added in C-Kermit 8.0.201. Sets the locus for unprefixed file + management commands such as CD, DIRECTORY, MKDIR, etc. When + LOCUS is LOCAL these commands act locally and a REMOTE (or R) + prefix (e.g. REMOTE CD, RCD, RDIR) is required to send file + management commands to a remote server. When LOCUS is REMOTE, an + L prefix is required to issue local file management commands + (e.g. LCD, LDIR). The word LOCAL can't be used as a prefix since + it is already used for declaring local variables. LOCUS applies + to all types of connections, and thus is orthogonal to SET + GET-PUT-REMOTE, which selects between Kermit and FTP for remote + file-transfer and management commands. The default LOCUS is + AUTO, which means we switch to REMOTE whenever an FTP connection + is made, and to LOCAL whenever a non-FTP connection is made, and + switch back accordingly whenever a connnection is closed. So by + default, Kermit behaves in its traditional manner unless you + make an FTP connection, in which case it acts like a regular FTP + client (but better :-) LOCUS applies to the following + commands: + + Unprefixed Remote Local Description + CD (CWD) RCD LCD Change (Working) Directory + CDUP RCDUP LCDUP CD Up + PWD RPWD LPWD Print Working Directory + DIRECTORY RDIR LDIR Request a directory listinga + DELETE RDEL LDEL Delete (a) file(s) + RENEME RREN LREN Rename a file + MKDIR RMKDIR LMKDIR Create a directory + RMDIR RRMDIR LRMDIR Remove a directory + + SET MATCH { DOTFILE, FIFO } { ON, OFF } + Whether C-Kermit filename patterns (wildcards) should match + filenames that start with dot (period), or (Unix only) FIFOs + (named pipes). The defaults are to skip dotfiles in Unix but + match them elsewhere, and to skip FIFOs. Applies to both + interactive use and to server mode, when the server receives + wildcards, e.g. in a GET command. Also see REMOTE SET MATCH. + + SET OPTIONS DIRECTORY /DOTFILES + Now works for server listings too (UNIX only). Give this command + prior to having Kermit enter server mode, and then it will show + files whose names begin with dot (period) when sent a REMOTE + DIRECTORY command. + + SET QUIET ON + (as well as the -q command-line option) Now applies also to: + + + SET HOST connection progress messages. + + "Press the X or E key to cancel" file-transfer message. + + REMOTE CD response. + + REMOTE LOGIN response. + + SET RECEIVE PERMISSIONS { ON, OFF } + Tells C-Kermit whether to set the permissions of incoming files + (received with Kermit protocol) from the permissions supplied in + the file's Attribute packet (if any). Normally ON. Also see SET + SEND PERMISSIONS. + + SET ROOT directory + Like UNIX chroot, without requiring privilege. Sets the root for + file access, does not allow reference to or creation of files + outside the root, and can't be undone. + + SET SEND PERMISSIONS { ON, OFF } + Tells C-Kermit whether to include file permissions in the + attributes it includes with each file when sending with Kermit + protocol. Also see SET RECEIVE PERMISSIONS. + + SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER:name /PASSWORD:text + These commands now allow specification of username and password. + + SET TERMINAL . . . + (See [399]Section 12.) + + SET TRANSFER MESSAGE [ text ] + Sets an initial text message to be displayed in the + file-transfer display. The transfer message is automatically + deleted once used, so must be set each time a message a desired. + Any variables in the message are evaluated at the time the SET + command is given. If the optional text is omitted, any transfer + message that is currently set is removed. Synonym: SET XFER MSG. + SHOW TRANSFER displays it if it has been set but not yet used. + + SHOW COMMUNICATIONS + In C-Kermit 8.0, SHOW COMMUNICATIONS, when given in remote mode + (i.e. before any connection has been established), tells the + typical dialout device name for the particular platform on which + it's running (e.g. TXA0: for VMS, or /dev/cua0p0 for HP-UX). On + Unix platforms, it also tells the name of the lockfile + directory. This way, you have an idea of what the SET LINE + device name should look like, and if the SET LINE command fails, + you know the name of the directory or device that is protected + against you. + + SHOW VARIABLES [ name [ name [ ... ] ] ] + In C-Kermit 8.0.201 you can request values of a list of built-in + (\v(xxx)) variables. Each name is a pattern, as before, but now + it a free pattern rather than an anchored one (explained in + [400]Section 8.12) so now "show var date time" shows the values + of all variables whose names include the strings "date" or + "time". + + TAIL [ switches ] filename + Equivalent to TYPE /TAIL [ other-switches ] filename. + + TRANSMIT /NOECHO [ other switches ] filename + The /NOECHO switch is equivalent to giving the command SET + TRANSMIT ECHO OFF prior to the TRANSMIT command, except the + switch affects only the command with which it was given and does + not affect the prevailing global setting. + + TRANSMIT /NOWAIT [ other switches ] filename + The /NOWAIT switch is equivalent to giving the command SET + TRANSMIT PROMPT 0 prior to the TRANSMIT command, except the + switch affects only the command with which it was given and does + not affect the prevailing global setting. + + TRANSMIT /NOWAIT /NOECHO /BINARY [ other switches ] filename + When the TRANSMIT command is given with the /NOWAIT, /NOECHO, + and /BINARY switches, this activates a special "blast the whole + file out the communications connection all at once" mode that + Kermit didn't have prior to version 8.0. There has been + increasing demand for this type of transmission with the advent + of devices that expect image (e.g. .JPG) or sound (e.g. .MP3) + files as raw input. The obvious question is: how does the + receiving device know when it has the whole file? This depends + on the device, of course; usually after a certain amount of time + elapses with nothing arriving, or else when Kermit hangs up or + closes the connection. + + TYPE /CHARACTER-SET:name + Allows you to specify the character set in which the file to be + typed is encoded. + + TYPE /NUMBER + Adds line numbers. + + TYPE /OUTPUT:filename + Sends the results of the TYPE command to the given file. + + TYPE /TRANSLATE-TO:name + Used in conjunction with TYPE /CHARACTER-SET:xxx; allows you to + specify the character set in which the file is to be displayed. + + TYPE /TRANSPARENT + Used to disable character-set translation in the TYPE command, + which otherwise can take place automatically based on file + scanning, even when /CHARACTER-SET and /TRANSLATE-TO switches + are not given. + + VOID text + Parses the text, evaluating any backslash items in it (such as + function calls) but doesn't do anything further, except possibly + printing error messages. Useful for invoking functions that have + side effects without using or printing their direct results, + e.g. "void \fsplit(\%a,&a)". + +Symbolic Links in UNIX + + The UNIX versions of C-Kermit have had /FOLLOWLINKS and /NOFOLLOWLINKS + switches added to several commands to control the treatment of symbolic + links. Different commands deal differently with symbolic links: + + Kermit SEND, FTP MPUT + /NOFOLLOWLINKS is the default, which means symbolic links are + skipped entirely. The alternative, /FOLLOWLINKS, should be used + with caution, since an innocent link might point to a whole file + system, or it might cause a loop. There is no way in Kermit or + FTP protocol to send the link itself. We either skip them or + follow them; we can't duplicate them. + + DIRECTORY + /NOFOLLOWLINKS is the default, which means the DIRECTORY command + lists symbolic links in a way that shows they are links, but it + does not follow them. The alternative, /FOLLOWLINKS, follows + links and gives information about the linked-to directories and + files. + + DELETE, RMDIR + The DELETE command does not have link-specific switches. DELETE + never follows links. If you tell Kermit to delete a symbolic + link, it deletes the link itself, not the linked-to file. Ditto + for RMDIR. + + COPY + The COPY command behaves just like the UNIX cp command; it + always follows links. + + RENAME + The RENAME command behaves just like the UNIX mv command; it + operates on links directly rather than following. + + [ [401]Top ] [ [402]Contents ] [ [403]C-Kermit Home ] [ [404]Kermit + Home ] + +8. OTHER SCRIPTING IMPROVEMENTS + +8.1. Performance and Debugging + + A command cache for frequently used commands plus some related + optimizations increases the speed of compute-bound scripts by anywhere + from 50% to 1000%. + + The new PROMPT command can be used to set breakpoints for debugging + scripts. If executed in a command file or macro, it gives you an + interactive command prompt in the current context of the script, with + all its variables, arguments, command stack, etc, available for + examination or change, and the ability to resume the script at any + point (END resumes it, Ctrl-C or STOP cancels it and returns to top + level). + + The new Ctrl-C trapping feature ([405]Section 8.14) lets you intercept + interruption of scripts. This can be used in combination with the + PROMPT command to debug scripts. Example: + +define ON_CTRLC { + echo INTERRUPTED BY CTRL-C... + echo The command stack has not yet been rolled back: + show stack + echo Type Ctrl-C again or use the END command to return to top level. + prompt Debug> +} + + Adding this ON_CTRL definition to your script lets you interrupt it at + any point and get prompt that is issued at the current command level, + so you can query local variables, etc. + + [ [406]Top ] [ [407]Contents ] [ [408]C-Kermit Home ] [ [409]Kermit + Home ] + +8.2. Using Macros as Numeric Variables + + A macro is a way to assign a value to a name, and then use the name to + refer to the value. Macros are used in two ways in Kermit: as + "subroutines" or functions composed of Kermit commands, which are + executed, or as variables to hold arbitrary values -- text, numbers, + filenames, etc. + + When a macro is to be executed, its name is given as if it were a + C-Kermit command, optionally preceded by the word "do". When a macro is + used as a variable, it must be "escaped" with \m(xxx) (or equivalent + function, e.g. \s(xxx), \:(xxx), \fdefinition(xxx)), where xxx is the + macro name, for example: + + define filename /usr/olga/oofa.txt + send \m(filename) + + Of course variables can also hold numbers: + + define size 17 + declare \&a[\m(size)] + ... + define index 3 + if ( == \m(index) 3 ) echo The third value is: \&a[\m(index)] + evaluate index (\m(index) * 4) + if ( > \m(index) \m(size) ) echo Out of range! + + But these are contexts in which only numbers are valid. C-Kermit 8.0 + has been changed to treat non-escaped non-numeric items in strictly + numeric contexts as macro names. So it is now possible (but not + required) to omit the \m(...) notation and just use the macro name in + these contexts: + + define size 17 + declare \&a[size] + ... + define index 3 + if ( == index 3 ) echo The third value is: \&a[index] + evaluate index (index * 4) + if ( > index size ) echo Out of range! + + This is especially nice for loops that deal with arrays. Here, for + example, is a loop that reverses the order of the elements in an array. + Whereas formerly it was necessary to write: + + .\%n ::= \fdim(&a) + for \%i 1 \%n/2 1 { + .tmp := \&a[\%n-\%i+1] + .\&a[\%n-\%i+1] := \&a[\%i] + .\&a[\%i] := \m(tmp) + } + + Recoding this to use macro names "i" and "n" instead of the backslash + variables \%i and \%n, we have: + + .n ::= \fdim(&a) + for i 1 n/2 1 { + .tmp := \&a[n-i+1] + .\&a[n-i+1] := \&a[i] + .\&a[i] := \m(tmp) + } + + which reduces the backslash count to less than half. The final + statement in the loop could be written ".\&a[i] ::= tmp" if the array + contained only numbers (since ::= indicates arithmetic expression + evaluation). + + Also, now you can use floating-point numbers in integer contexts (such + as array subscripts), in which case they are truncated to an integer + value (i.e. the fractional part is discarded). + + Examples of numeric contexts include: + + * Array subscripts. + * Any numeric function argument. + * Right-hand side of ::= assignments. + * EVALUATE command or \fevaluate() function expression. + * The INCREMENT or DECREMENT by-value. + * IF =, >, <, !=, >=, and <= comparands. + * The IF number construct. + * FOR-loop variables. + * STOP, END, and EXIT status codes. + * The INPUT timeout value. + * PAUSE, WAIT, SLEEP, MSLEEP intervals. + * The SHIFT argument. + * Numeric switch arguments, e.g. TYPE /WIDTH:number, SEND + /LARGER:number. + * SCREEN MOVE-TO row and column number. + * Various SET DIAL parameters (timeout, retry limit, etc). + * Various SET SEND or RECEIVE parameters (packet length, window size, + etc). + * Various other SET parameters. + + and: + + * S-Expressions (explained in [410]Section 9). + + Macro names used in numeric contexts must not include mathematical + operators. Although it is legal to create a macro called "foo+bar", in + a numeric context this would be taken as the sum of the values of "foo" + and "bar". Any such conflict can be avoided, of course, by enclosing + the macro name in \m(...). + + [ [411]Top ] [ [412]Contents ] [ [413]C-Kermit Home ] [ [414]Kermit + Home ] + +8.3. New IF Conditions + + Several new IF conditions are available: + + IF DECLARED arrayname + Explained in [415]Section 8.6. + + IF KBHIT + Allows a script to test whether a key was pressed without + actually trying to read it. + + IF KERBANG (Unix only) + True if Kermit was started from a Kerbang script. This is useful + for knowing how to interpret the \&@[] and \&_[] argument vector + arrays, and under what conditions to exit. + + IF INTEGER n + This is just a synonym for IF NUMERIC, which is true if n + contains only digits (or, if n is a variable, its value contains + only digits). + + By contrast, IF FLOAT n succeeds if n is a floating-point number OR an + integer (or a variable with floating-point or integer value). + Therefore, IF FLOAT should be used whenever any kind of number is + acceptable, whereas IF INTEGER (or IF NUMERIC) when only an integer can + be used. + + [ [416]Top ] [ [417]Contents ] [ [418]C-Kermit Home ] [ [419]Kermit + Home ] + +8.4. The ON_UNKNOWN_COMMAND Macro + + The new ON_UNKNOWN_COMMAND macro, if defined, is executed whenever you + give a command that is not known to C-Kermit; any operands are passed + as arguments. Here are some sample definitions: + + DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames + DEF ON_UNKNOWN_COMMAND dial \%1 ; Treat unknown commands phone numbers + DEF ON_UNKNOWN_COMMAND take \%1 ; Treat unknown commands as filenames + DEF ON_UNKNOWN_COMMAND !\%* ; Treat unknown commands as shell commands + + The ON_CD macro, if defined, is executed whenever Kermit is given a CD + (change directory) command (8.0.211). Upon entry to this macro, the + directory has already changed and the new directory string is available + in the \v(directory) variable, and also as the first argument (\%1). + + [ [420]Top ] [ [421]Contents ] [ [422]C-Kermit Home ] [ [423]Kermit + Home ] + +8.5. The SHOW MACRO Command + + The SHOW MACRO command has been changed to accept more than one macro + name: + + (setq a 1 b 2 c 3) + show mac a b c + a = 1 + b = 2 + c = 3 + + An exact match is required for each name (except that case doesn't + matter). If you include wildcard characters, however, a pattern match + is performed: + + show mac [a-c]*x + + shows all macros whose names start with a, b, or c, and end with x. + + [ [424]Top ] [ [425]Contents ] [ [426]C-Kermit Home ] [ [427]Kermit + Home ] + +8.6. Arrays + + A clarification regarding references to array names (as opposed to + array elements): You can use array-name "abbreviations" like &a only in + contexts that expect array names, like ARRAY commands or array-name + function arguments such as the second argument of \fsplit(). In a LOCAL + statement, however, you have to write \&a[], since "local &a" might + refer to a macro named "&a". + + In function arguments, however, you MUST use the abbreviated form: + \fsplit(\%a,&a) or \fsplit(\%a,&a[]). If you include the backslash (as + in "\fsplit(\%a,\&a[])") a parse error occurs. + + Here are the new array-related commands: + + IF DECLARED arrayname + Allows a script to test whether an array has been declared. The + arrayname can be a non-array backslash variable such as \%1 or + \m(name), in which case it is evaluated first, and the result is + treated as the array name. Otherwise, arrayname is treated as in + the ARRAY commands: it can be a, &a, &a[], \&a, \&a[], \&a[3], + \&a[3:9], etc, with the appropriate results in each case. + Synonym: IF DCL. + + UNDECLARE arrayname + UNDECLARE is a new top-level command to undeclare an array. + Previously this could only be done with "declare \&a[0]" (i.e. + re-declare the array with a dimension of 0). + + ARRAY LINK linkname arrayname + Creates a symbolic link from the array named by linkname (which + must be the name of an array that is not yet declared in the + current context) to the array named by arrayname (which must the + name of a currently declared array that is not itself a link, or + a variable containing the name of such an array). The two names + indicate the same array: if you change an array element, the + change is reflected in the link too, and vice versa. If you + undeclare the link, the real array is unaffected. If you + undeclare the real array, all links to it disappear. If you + resize an array (directly or through a link), all links to it + are updated automatically. + + Array links let you pass array names as arguments to macros. For + example, suppose you had a program that needed to uppercase all the + elements of different arrays at different times. You could write a + macro to do this, with the array name as an argument. But without array + links, there would be no way to refer to the argument array within the + macro. Array links make it easy: + + define arrayupper { + local \&e[] \%i + array link \&e[] \%1 + for i 1 \fdim(&e) 1 { .\&e[i] := \fupper(\&e[i]) } + } + declare \&a[] = these are some words + arrayupper &a + show array &a + + The macro declares the array link LOCAL, which means it doesn't + conflict with any array of the same name that might exist outside the + macro, and that the link is destroyed automatically when the macro + exits. This works, by the way, even if the link name and the macro + argument name are the same, as long as the link is declared LOCAL. + + As noted, you can't make a link to a nonexistent array. So when writing + a macro whose job is to create an array whose name is passed as an + argument, you must declare the array first (the size doesn't matter as + long as it's greater than 0). Example: + + define tryme { ; Demonstration macro + local \&e[] ; We only need this inside the macro + array link \&e[] \%1 ; Make local link + shift ; Shift argument list + void \fsplit(\%*,&e) ; Split remainder of arg list into array + } + declare \&a[1] ; Declare target array in advance + tryme &a here are some words ; Invoke the macro with array name and words + show array a ; See the results + + One final improvement allows the macro itself to declare the array + (this was not possible in earlier Kermit releases): if the array name + in the DECLARE command is a variable (and not an array name), or + includes variables, the resulting value is used as the array name. So: + + define tryme { ; Demonstration macro + declare \%1[1] ; Preliminary declaration for target array + local \&e[] ; We only need this inside the macro + array link \&e[] \%1 ; Make local link + shift ; Shift argument list + void \fsplit(\%*,&e) ; Split remainder of arg list into array + } + tryme &a here are some words ; Invoke the macro with array name and words + show array a ; See the results + + The SHOW ARRAY command now indicates whether an array name is a link. + + Also see the descriptions of [428]\fjoin() and [429]\fsplit(), plus + [430]Section 8.10 on the MINPUT command, which shows how an entire + array (or segment of it) can be used as the MINPUT target list. + + [ [431]Top ] [ [432]Contents ] [ [433]C-Kermit Home ] [ [434]Kermit + Home ] + +8.7. New or Improved Built-in Variables and Functions + + The following new built-in variables are available: + + \v(buildid) A date string like "20000808" indicating when C-Kermit was b +uilt. + \v(ftime) Current time, secs since midnight, including fraction of sec +ond. + \v(iprompt) The current SET PROMPT value + \v(sexp) The most recent S-Expression (see [435]Section 9) + \v(sdepth) The current S-Expression invocation depth ([436]Section 9) + \v(svalue) The value of the most recent S-Expression ([437]Section 9) + + \v(ftp_code) Most recent FTP response code ([438]Section 3) + \v(ftp_connected) FTP connection status ([439]Section 3) + \v(ftp_cpl) FTP Command Protection Level ([440]Section 3.2) + \v(ftp_dpl) FTP Data Protection Level ([441]Section 3.2) + \v(ftp_getputremote) The current SET GET-PUT-REMOTE setting ([442]Section 3.8) + + \v(ftp_host) Name or IP address of FTP server ([443]Section 3) + \v(ftp_loggedin) FTP login status ([444]Section 3) + \v(ftp_message) Most recent FTP response message ([445]Section 3) + \v(ftp_security) FTP Security method ([446]Section 3.2) + \v(ftp_server) OS type of FTP server ([447]Section 3) + + \v(http_code) Most recent HTTP response code + \v(http_connected) HTTP connection status + \v(http_host) Name or IP address of HTTP server + \v(http_message) Most recent HTTP response message + \v(http_security) TLS cipher used to secure the HTTP session + + \v(hour) Hour of the day, 0 to 23. + \v(timestamp) Equivalent to "\v(ndate) \v(time)". + + \v(log_debug) Current debug log file, if any. + \v(log_packet) Current packet log file, if any. + \v(log_session) Current session log file, if any. + \v(log_transaction) Current transaction log file, if any. + \v(log_connection) Current connection log file, if any. + + The following new or improved built-in functions are available: + + \fcmdstack() Allows programmatic access to the command stack. + \fcvtdate() [448]Section 8.13, format options added + \fdelta2secs() [449]Section 8.13 + \fdostounixpath(s1) Converts a DOS filename to Unix format. + \fsplit() Now allows grouping/nesting in source string. + \fword() Allows the same grouping and nesting. + \fjoin(&a,s1,n1,n2) Copies an array into a single string. + \fsubstitute(s1,s2,s3) Substitutes characters within a string. + \freplace() Has new 4th "occurrence" argument. + \fsexpression() Evaluates an S-Expression (explained in [450]Section 9 +). + \ftrim(), \fltrim() Now trim CR and LF by default, as well as SP and Tab. + \funixtodospath(s1) Converts a Unix filename to DOS format. + \fkeywordval(s1,c1) Assigns values to keywords (macros) (explained below). + + Most functions that have "2" in their names to stand for the word "to" + can now also be written with "to", e.g. "\fdelta2secs()," + \fdeltatosecs()." + + \funtabify(string) + (New to 8.0.211) Replaces Horizontal Tab characters in the given + string with spaces based on VT100-like tab stops. + + \fverify(s1,s2,n) + As of version 8.0.211, returns -1 if s2 is an empty string. + Previously it returned 0, making \fverify(abc,\%a) look as if + \%a was a string combosed of a's, b's, and/or c's when in fact + it contained nothing. + + \fcode(string) + As of version 8.0.211, returns 0 if string is empty or missing. + Previously it returned the empty string, which made it unsafe to + use in arithmetic or boolean expressions. + + \v(inscale) + New to version 8.0.211, its value is the INPUT SCALE-FACTOR + ([451]Section 8.10), default 1.0. + +8.7.1. The \fkeywordval() Function + + \fkeywordval(s1,c1) is new to C-Kermit 8.0. Given a string s1 of the + form "name=value", it creates a macro with the given name and assigns + it the given value. If no value appears after the equal sign, any + existing macro of the given name is undefined. Blanks are automatically + trimmed from around the name and value. The optional c1 parameter is + the assignment operator character, equal sign (=) by default. This + function is handy for processing keyword parameters or any other form + of parameter-value pair. Suppose, for example, you want to write a + macro that accepts keyword parameters rather than positional ones: + + define MYDIAL { + local \%i modem hangup method device speed number + def number 5551234 ; Assign default parameter values + def speed 57600 + def modem usrobotics + def hangup rs232 + def method tone + def country 1 + for \%i 1 \v(argc)-1 1 { ; Parse any keyword parameters... + if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]" + } + set dial country \m(country) + set modem type \m(modem) + set modem hang \m(hangup) + set dial method \m(tone) + set line \m(device) + if fail stop 1 + set speed \m(speed) + if fail stop 1 + show comm + set dial display on + dial \m(number) + if success connect + } + + In this example, all the defaults are set up inside the macro, and + therefore it can be invoked with no parameters at all. But if you want + to have the macro dial a different number, you can supply it as + follows: + + mydial number=7654321 + + You can supply any number of keyword parameters, and you can give them + in any order: + + mydial number=7654321 hangup=modem speed=115200 + +8.7.2. The \fsplit(), \fjoin(), and \fword() Functions + + \fjoin(&a,s1,n1,n2) is also new; it creates a string from an array (or + a piece of one). &a is the name of the array (a range specifier can be + included); s1 is a character or string to separate each element in the + result string (can be omitted, in which case the elements are not + separated at all), and n1 is a grouping mask, explained below. If s1 is + empty or not specified, the array elements are separated with spaces. + If you want the elements concatenated with no separator, include a + nonzero n2 argument. Given the array: + + declare \&a[] = 0 1 2 3 4 5 6 7 8 9 + + you can get effects like this: + + \fjoin(&a) 0 1 2 3 4 5 6 7 8 9 + \fjoin(&a,:) 0:1:2:3:4:5:6:7:8:9 + \fjoin(&a,{,}) 0,1,2,3,4,5,6,7,8,9 + \fjoin(&a,...) 0...1...2...3...4...5...6...7...8...9 + \fjoin(&a,,,1) 0123456789 + + \fsplit(), \fword(), \fstripb(), and \fjoin() accept a "grouping mask" + argument, n1, which is a number from 0 to 63, in which: + + 1 = "" doublequotes + 2 = {} braces + 4 = '' singlequotes + 8 = () parentheses + 16 = [] square brackets + 32 = <> angle brackets + + These can be OR'd (added) together to make any number 0-63 (-1 is + treated the same as 63, 0 means no grouping). If a bit is on, the + corresponding kind of grouping is selected. (If more than 1 bit is set + for \fjoin(), only the lowest-order one is used.) + + If you include the same character in the grouping mask and the include + list, the grouping mask takes precedence. Example: + + def \%a a "b c d" e + \fsplit(\%a,&a[],,,-1) = 3 <-- doublequote used for grouping + \fsplit(\%a,&a[],,",-1) = 3 <-- doublequote still used for grouping + + Nesting of matched left and right grouping characters (parentheses, + braces, and brackets, but not quotes) is recognized. Example: + + def \%a a (b c n o) p + \fsplit(\%a,&a,,,0) = 16 (no grouping) + \fsplit(\%a,&a,,,2) = 15 (braces only) + \fsplit(\%a,&a,,,16) = 11 (square brackets only) + \fsplit(\%a,&a,,,32) = 7 (angle brackets only) + \fsplit(\%a,&a,,,63) = 3 (all) + \fsplit(\%a,&a,,,-1) = 3 (all) + + \fsplit() and \fjoin() are "reciprocal" functions. You can split a + string up into an array and join it back into a new string that is + equivalent, as long as \fsplit() and \fjoin() are given equivalent + grouping masks, except that the type of braces might change. Example: + + def \%a a {b c [d e] f g} "h i" j m + echo STRING=[\%a] + echo WORDS=\fsplit(\%a,&a,,,-1) + show array a + asg \%b \fjoin(&a,{ },2) + echo JOIN =[\%b] + echo WORDS=\fsplit(\%b,&b,,,-1) + show array b + + The arrays a and b are identical. The strings a and b are as follows: + + \%a: a {b c [d e] f g} "h i" j m + \%b: a {b c [d e] f g} {h i} j {k l} m + + It is possible to quote separator grouping characters with backslash to + override their grouping function. And of course to include backslash + itself in the string, it must be quoted too. Furthermore, each + backslash must be doubled, so the command parser will still pass one + backslash to \fsplit() for each two that it sees. Here are some + examples using \fsplit() with a grouping mask of 8 (treat parentheses + as grouping characters). + + String Result + a b c d e f 6 + a b\\ c d e f 5 + a b (c d e) f 4 + a b \\(c d e\\) f 6 + a b \\\\(c d e\\\\) f 7 + + \fsplit() has also been changed to create its array (if one is given) + each time it is called, so now it can be conveniently called in a loop + without having to redeclare the array each time. + + Incidentally... Sometimes you might want to invoke \fsplit() in a + situation where you don't care about its return value, e.g. when you + just want to fill the array. Now you can "call" \fsplit() or any other + function with the new [452]VOID command: + + void \fsplit(\%a,&a) + + \fsplit() and \fjoin() also accept a new, optional 6th argument, an + options flag, a number that can specify a number of options. So far + there is just one option, whose value is 1: + + separator-flag + Normally separators are collapsed. So, for example, + + \fword(Three little words,2) + + returns "little" (the second word). Space is a separator, but + there are multiple spaces between each word. If the value 1 is + included in the option flag, however, each separator counts. If + two separators are adjacent, an empty word is produced between + them. This is useful for parsing (e.g.) comma-separated lists + exported from databases or spreadsheets. + +8.7.3. The \fcmdstack() Function + + The new \fcmdstack() function gives access to the command stack: + + \fcmdstack(n1,n2) + Arguments: n1 is the command stack level. If omitted, the + current level, \v(cmdlevel), is used. n2 is a function code + specifying the desired type of information: + + 0 (default) = name of object at level n1. + 1 (nonzero) = object type (0 = prompt; 1 = command file; 2 = macro). + + The default for n2 is 0. + + The name associated with prompt is "(prompt)". Here's a loop that can + be included in a macro or command file to show the stack (similar to + what the SHOW STACK command does): + + for \%i \v(cmdlevel) 0 -1 { + echo \%i. [\fcmdstack(\%i,1)] \fcmdstack(\%i,0) + } + + In this connection, note that \v(cmdfile) always indicates the most + recently invoked active command file (if any), even if that file is + executing a macro. Similarly, \v(macro) indicates the most recently + invoked macro (if any), even if the current command source is not a + macro. The name of the "caller" of the currently executing object + (command file or macro) is: + + \fcmdstack(\v(cmdlevel)-1) + + and its type is: + + \fcmdstack(\v(cmdlevel)-1,1) + + To find the name of the macro that invoked the currently executing + object, even if one or more intermediate command files (or prompting + levels) are involved, use a loop like this: + + for \%i \v(cmdlevel)-1 0 -1 { + if = \fcmdstack(\%i,1) 2 echo CALLER = \fcmdstack(\%i,0) + } + + Of course if you make a macro to do this, the macro must account for + its own additional level: + + define CALLER { + for \%i \v(cmdlevel)-2 0 -1 { + if = \fcmdstack(\%i,1) 2 return \fcmdstack(\%i,0) + } + return "(none)" + } + + The built-in variable \v(cmdsource) gives the current command source as + a word ("prompt", "file", or "macro"). + +8.7.4. The VOID Command + + VOID is like ECHO in that all functions and variables in its argument + text are evaluated. but it doesn't print anything (except possibly an + error message if a function was invocation contained or resulted in any + errors). VOID sets FAILURE if it encounters any errors, SUCCESS + otherwise. + + [ [453]Top ] [ [454]Contents ] [ [455]C-Kermit Home ] [ [456]Kermit + Home ] + +8.8. The RETURN and END Commands + + The execution of a macro is terminated in any of the following ways: + + * With an END [ number [ message ] ] command. If a number is given, + the macro succeeds if the number is 0, and fails if it is not zero; + if a number is not given, the macro succeeds. + * With a STOP command, which works just like END except it peels back + the command stack all the way to top level. + * With a RETURN [ text ] command, in which case the macro always + succeeds. + * By running out of commands to execute, in which case the macro + succeeds or fails according the most recently executed command that + sets success or failure. + + The same considerations apply to command files invoked by the TAKE + command. + + If a macro does not execute any commands that set success or failure, + then invoking the macro does not change the current SUCCESS/FAILURE + status. It follows, then, that the mere invocation of a macro does not + change the SUCCESS/FAILURE status either. This makes it possible to + write macros to react to the status of other commands (or macros), for + example: + + define CHKLINE { + if success end 0 + stop 1 SET LINE failed - please try another device. + } + set modem type usrobotics + set line /dev/cua0 + chkline + set speed 57600 + dial 7654321 + + By the way, none of this is news. But it was not explicitly documented + before, and C-Kermit 7.0 and earlier did not always handle the RETURN + statement as it should have. + + [ [457]Top ] [ [458]Contents ] [ [459]C-Kermit Home ] [ [460]Kermit + Home ] + +8.9. UNDEFINing Groups of Variables + + The UNDEFINE command, which previously accepted one variable name, now + accepts a list of them, and also accepts wildcard notation to allow + deletion of variables that match a given pattern. + + UNDEFINE [ switches ] name [ name [ name [ ... ] ] ] + Undefines the variables whose names are given. Up to 64 names + may be given in one UNDEFINE command. + + If you omit the switches and include only one name, the UNDEFINE + command works as before. + + Switches include: + + /MATCHING + Specifies that the names given are to treated as patterns rather + than literal variable names. Note: pattern matching can't be + used with array references; use the ARRAY command to manipulate + arrays and subarrays. + + /LIST + List the name of each variable to be undefined, and whether it + was undefined successfully ("ok" or "error"), plus a summary + count at the end. + + /SIMULATE + List the names of the variables that would be deleted without + actually deleting them. Implies /LIST. + + The UNDEFINE command fails if there were any errors and succeeds + otherwise. + + The new _UNDEFINE command is like UNDEFINE, except the names are + assumed to be variable names themselves, which contain the names (or + parts of them) of the variables to be undefined. For example, if you + have the following definitions: + + define \%a foo + define foo This is some text + + then: + + undef \%a + + undefines the variable \%a, but: + + _undef \%a + + undefines the macro foo. + + Normal Kermit patterns are used for matching; metacharacters include + asterisk, question mark, braces, and square brackets. Thus, when using + the /MATCHING switch, if the names of the macros you want to undefine + contain any of these characters, you must quote them with backslash to + force them to be taken literally. Also note that \%* is not the name of + a variable; it is a special notation used within a macro for "all my + arguments". The command "undef /match \%*" deletes all \%x variables, + where x is 0..9 and a..z. Use "undef /match \%[0-9]" to delete macro + argument variables or "undef /match \%[i-n]" to delete a range of \%x + variables. + + [ [461]Top ] [ [462]Contents ] [ [463]C-Kermit Home ] [ [464]Kermit + Home ] + +8.10. The INPUT and MINPUT Commands + + As of C-Kermit 8.0.211, the INPUT and MINPUT commands accept a switch: + + [M]INPUT /NOMATCH timeout + The /NOMATCH switch allows INPUT or MINPUT to read incoming + material for the specified amount of time, without attempting to + match it with any text or patterns. When this switch is + included, the [M]INPUT command succeeds when the timeout + interval expires, with \v(instatus) set to 1, meaning "timed + out", or fails upon interruption or i/o error. + + Also in version 8.0.211, there is a new way to apply a scale factor to + [M]INPUT timeouts: + + SET INPUT SCALE-FACTOR floating-point-number + This scales all [M]INPUT timeouts by the given factor, allowing + time-sensitive scripts to be adjusted to changing conditions + such as congested networks or different-speed modems without + having to change each INPUT-class command. This affects only + those timeouts that are given in seconds, not as wall-clock + times. Although the scale factor can have a fractional part, the + INPUT timeout is still an integer. The new built-in variable + \v(inscale) tells the current INPUT SCALE-FACTOR. + + The MINPUT command can be used to search the incoming data stream for + several targets simultaneously. For example: + + MINPUT 8 one two three + + waits up to 8 seconds for one of the words "one", "two", or "three" to + arrive. Words can be grouped to indicate targets that contain spaces: + + MINPUT 8 nineteeen twenty "twenty one" + + And of course you can also use variables in place of (or as part of) + the target names: + + MINPUT 8 \%a \&x[3] \m(foo) + + Until now you had to know the number of targets in advance when writing + the MINPUT statement. Each of the examples above has exactly three + targets. + + But suppose your script needs to look for a variable number of targets. + For this you can use arrays and \fjoin(), described in [465]Section + 8.7. Any number of \fjoin() invocations can be included in the MINPUT + target list, and each one is expanded into the appropriate number of + separate targets each time the MINPUT command is executed. Example: + + declare \&a[10] = one two three + minput 10 foo \fjoin(&a) bar + + This declares an array of ten elements, and assigns values to the first + three of them. The MINPUT command looks for these three (as well as the + words "foo" and "bar"). Later, if you assign additional elements to the + array, the same MINPUT command also looks for the new elements. + + If an array element contains spaces, each word becomes a separate + target. To create one target per array element, use \fjoin()'s grouping + feature: + + dcl \&a[] = {aaa bbb} {ccc ddd} {xxx yyy zzz} + + minput 10 \fjoin(&a) <-- 7 targets + minput 10 \fjoin(&a,,2) <-- 3 targets + + [ [466]Top ] [ [467]Contents ] [ [468]C-Kermit Home ] [ [469]Kermit + Home ] + +8.11. Learned Scripts + + C-Kermit now includes a simple script recorder that monitors your + commands, plus your actions during CONNECT mode, and automatically + generates a script program that mimics what it observed. You should + think of this feature as a script-writing ASSISTANT since, as you will + see [470]later in this section, the result generally needs some editing + to make it both secure and flexible. The script recorder is controlled + by the new LEARN command: + + LEARN [ /ON /OFF /CLOSE ] [ filename ] + If you give a filename, the file is opened for subsequent + recording. The /ON switch enables recording to the current file + (if any); /OFF disables recording. /CLOSE closes the current + script recording file (if any). If you give a filename without + any switches, /ON is assumed. + + The /OFF and /ON switches let you turn recording off and on during a + session without closing the file. + + When recording: + + * All commands that you type (or recall) at the prompt are recorded + in the file except: + + LEARN commands are not recorded. + + The CONNECT command is not recorded. + + The TELNET command is converted to SET HOST /NETWORK:TCP. + * Commands obtained from macros or command files are not recorded. + * During CONNECT: + + Every line you type is converted to an OUTPUT command. + + The last prompt before any line you type becomes an INPUT + command. + + Timeouts are calculated automatically for each INPUT command. + + A PAUSE command is inserted before each OUTPUT command just to + be safe. + + Thus the script recorder is inherently line-oriented. It can't be used + to script character-oriented interactions like typing Space to a + "More?" prompt or editing a text file with VI or EMACS. + + But it has advantages too; for example it takes control characters into + account that might not be visible to you otherwise, and it + automatically converts control characters in both the input and output + streams to the appropriate notation. It can tell, for example that the + "$ " prompt on the left margin in UNIX is really {\{13}\{10}$ }, + whereas in VMS it might be {\{13}\{10}\{13}$ }. These sequences are + detected and recorded automatically. + + A learned script should execute correctly when you give a TAKE command + for it. However, it is usually appropriate to edit the script a bit. + The most important change would be to remove any passwords from it. For + example, if the script contains: + + INPUT 9 {\{13}\{10}Password: } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT bigsecret\{13} + + you should replace this by something like: + + INPUT 9 {\{13}\{10}Password: } + IF FAIL STOP 1 INPUT timeout + ASKQ pswd Please type your password: + PAUSE 1 + OUTPUT \m(pswd)\{13} + + The LEARN command can't do this for you since it knows nothing about + "content"; it only knows about lines and can't be expected to parse or + understand them -- after all, the Password prompt might be in some + other language. So remember: if you use the LEARN command to record a + login script, be sure edit the resulting file to remove any passwords. + Also be sure to delete any backup copies your editor or OS might have + made of the file. + + Other manual adjustments might also be appropriate: + + * If the target of an INPUT command can vary, you can replace the + INPUT command with MINPUT and the appropriate target list, and/or + the target with a \fpattern(). For example, suppose you are dialing + a number that can be answered by any one of 100 terminal servers, + whose prompts are ts-00>, ts-01>, ts-02>, ... ts-99>. The script + records a particular one of these, but you want it to work for all + of them, so change (e.g.): + INPUT 10 ts-23> ; or whatever + + to: + INPUT 10 \fpattern(ts-[0-9][0-9]>) + + * The INPUT timeout values are conservative, but they are based only + on a single observation; you might need to tune them. + * The PAUSE commands might not be necessary, or the PAUSE interval + might need adjustment. + * In case you made typographical errors during recording, they are + incorporated in your script; you can edit them out if you want to. + + Here is a sample script generated by Kermit ("learn vms.ksc") in which + a Telnet connection is made to a VMS computer, the user logs in, starts + Kermit on VMS, sends it a file, and then logs out: + + ; Scriptfile: vms.ksc + ; Directory: /usr/olga + ; Recorded: 20001124 15:21:23 + + SET HOST /NETWORK:TCP vms.xyzcorp.com + IF FAIL STOP 1 Connection failed + + INPUT 7 {\{13}\{10}\{13}Username: } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT olga\{13} + INPUT 3 {\{13}\{10}\{13}Password: } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT secret\{13} + INPUT 18 {\{13}\{10}\{13}$ } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT set default [.incoming]\{13} + INPUT 12 {\{13}\{10}\{13}$ } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT kermit\{13} + INPUT 15 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>} + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT receive\{13} + send myfile.txt + + INPUT 18 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>} + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT exit\{13} + INPUT 6 {\{13}\{10}\{13}$ } + IF FAIL STOP 1 INPUT timeout + PAUSE 1 + OUTPUT logout\{13} + close + exit + + The commands generated by Kermit during CONNECT (INPUT, IF FAIL, PAUSE, + and OUTPUT) have uppercase keywords; the commands typed by the user are + in whatever form the user typed them (in this case, lowercase). + + [ [471]Top ] [ [472]Contents ] [ [473]C-Kermit Home ] [ [474]Kermit + Home ] + +8.12. Pattern Matching + + A pattern is a character string that is used to match other strings. + Patterns can contain metacharacters that represent special actions like + "match any single character", "match zero or more characters", "match + any single character from a list", and so on. The best known + application of patterns is in file specifications that contain + wildcards, as in "send *.txt", meaning "send all files whose names end + with .txt". + + Patterns are also used in increasingly many other ways, to the extent + it is useful to point out certain important distinctions in the ways in + which they are used: + + Anchored Patterns + If an anchored pattern does not begin with "*", it must match + the beginning of the string, and if it does not end with "*", it + must match the end of the string. For example, the anchored + pattern "abc" matches only the string "abc", not "abcde" or + "xyzabc" or "abcabc". The anchored pattern "abc*" matches any + string that starts with "abc"; the anchored pattern "*abc" + matches any string that ends with "abc"; the anchored pattern + "*abc*" matches any string that contains "abc" (including any + that start and/or end with it). + + Floating Patterns + A floating pattern matches any string that contains a substring + that matches the pattern. In other words, a floating pattern has + an implied "*" at the beginning and end. You can anchor a + floating pattern to the beginning by starting it with "^", and + you can anchor it to the end by ending it with "$" (see examples + below). + + Wildcards + A wildcard is an anchored pattern that has the additional + property that "*" does not match directory separators. + + This terminology lets us describe Kermit's commands with a bit more + precision. When a pattern is used for matching filenames, it is a + wildcard, except in the TEXT-PATTERNS and BINARY-PATTERNS lists and + /EXCEPT: clauses, in which case directory separators are not + significant (for example, a BINARY-PATTERN of "*.exe" matches any file + whose name ends in .exe, no matter how deeply it might be buried in + subdirectories). When Kermit parses a file specification directly, + however, it uses the strict wildcard definition. For example, "send + a*b" sends all files whose names start with "a" and end with "b" in the + current directory, and not any files whose names end with "b" that + happen to be in subdirectories whose names start with "a". And as + noted, wildcards are anchored, so "delete foo" deletes the file named + "foo", and not all files whose names happen to contain "foo". + + Most other patterns are anchored. For example: + + if match abc bc ... + + does not succeed (and you would be surprised if it did!). In fact, the + only floating patterns are the ones used by commands or functions that + search for patterns in files, arrays, or strings. These include: + + * The GREP and TYPE /MATCH commands. + * The \fsearch(), \frsearch(), and \farraylook() functions. + + Thus these are the only contexts in which explicit anchors ("^" and + "$") may be used: + + grep abc *.txt + Prints all lines containing "abc" in all files whose names end + with ".txt". + + grep ^abc *.txt + Prints all lines that start with "abc" in all ".txt" files. + + grep abc$ *.txt + Prints all lines that end with "abc" in all ".txt" files. + + grep ^a*z$ *.txt + Prints all lines that start with "a" and end with "z" in all + ".txt" files. + + Similarly for TYPE /PAGE, /fsearch(), /frsearch(), and \farraylook(). + + Here is a brief summary of anchored and floating pattern equivalences: + + Anchored Floating + abc ^abc$ + *abc abc$ + abc* ^abc + *abc* abc + + [ [475]Top ] [ [476]Contents ] [ [477]C-Kermit Home ] [ [478]Kermit + Home ] + +8.13. Dates and Times + + C-Kermit's comprehension of date-time formats is considerably expanded + in version 8.0. Any command that reads dates, including the DATE + command itself, or any switch, such as the /BEFORE: and /AFTER: + switches, or any function such as \fcvtdate(), now can understand dates + and times expressed in any ISO 8601 format, in Unix "asctime" format, + in FTP MDTM format, and in practically any format used in RFC 822 or + RFC 2822 electronic mail, with or without timezones, and in a great + many other formats as well. HELP DATE briefly summarizes the acceptable + date-time formats. + + Furthermore, C-Kermit 8.0 includes a new and easy-to-use form of + date-time arithmetic, in which any date or time can be combined with a + "delta time", to add or subtract the desired time interval (years, + months, weeks, days, hours, minutes, seconds) to/from the given date. + And new functions are available to compare dates and to compute their + differences. + + As you can imagine, all this requires quite a bit of "syntax". The + basic format is: + + [ date ] [ time ] [ delta ] + + Each field is optional, but in most cases (depending on the context) + there must be at least one field. If a date is given, it must come + first. If no date is given, the current date is assumed. If no time is + given, an appropriate time is supplied depending on whether a date was + supplied. If no delta is given, no arithmetic is done. If a delta is + given without a date or time, the current date and time are used as the + base. + + Date-time-delta fields are likely to contain spaces (although they need + not; space-free forms are always available). Therefore, in most + contexts -- and notably as switch arguments -- date-time information + must be enclosed in braces or doublequotes, for example: + + send /after:"8-Aug-2001 12:00 UTC" *.txt + + Kermit's standard internal format for dates and times is: + + yyyymmdd hh:mm:ss + + for example: + + 20010208 10:28:01 + + Date-times can always be given in this format. yyyy is the 4-digit + year, mm is the two-digit month (1-12; supply leading zero for + Jan-Sep), dd is the 2-digit day (leading zero for 1-9), hh is the hour + (0-23), mm the minute (0-59), ss the second (0-59), each with leading + zero if less than the field width. The date and time can be separated + by a space, an underscore, a colon, or the letter T. The time is in + 24-hour format. Thus the various quantites are at the following fixed + positions: + +Position Contents + 1-4 Year (4 digits, 0000-9999) + 5-6 Month (2 digits, 1-12) + 7-8 Day (2 digits, 1-31) + 9 Date-Time Separator (space, :, _, or the letter T) + 10-11 Hour (2 digits, 0-23) + 12 Hour-Minute Separator (colon) + 13-14 Minute (2 digits, 0-59) + 15 Minute-Second Separator (colon) + 16-17 Second (2 digits, 0-59) + + Example: + + 19800526 13:07:12 26 May 1980, 13:07:12 (1:07:12PM) + + This is the format produced by the DATE command and by any function + that returns a date-time. It is suitable for lexical comparison and + sorting, and for use as a date-time in any Kermit command. When this + format is given as input to a command or function, various date-time + separators (as noted) are accepted: + + 19800526 13:07:12 26 May 1980, 13:07:12 (1:07:12PM) + 20010208_10:28:35 2 February 2001, 10:28:35 AM + 18580101:12:00:00 1 January 1858, noon + 20110208T00:00:00 2 February 2011, midnight + + Certain other special date-time formats that are encountered on + computer networks are recognized: + + Asctime Format + This is a fixed format used by Unix, named after Unix's + asctime() ("ASCII time") function. It is always exactly 24 + characters long. Example: Fri Aug 10 16:38:01 2001 + + Asctime with Timezone + This is like Asctime format, but includes a 3-character timezone + between the time and year. It is exactly 28 characters long. + Example: Fri Aug 10 16:38:01 GMT 2001 + + E-Mail Format + E-mail date-time formats are defined in [479]RFC 2822 with a + fair amount of flexibility and options. The following examples + are typical of e-mails and HTTP (web-page) headers: + + Sat, 14 Jul 2001 11:49:29 (No timezone) + Fri, 24 Mar 2000 14:19:59 EST (Symbolic timezone) + Tue, 26 Jun 2001 10:19:45 -0400 (EDT) (GMT Offset + comment) + + FTP MDTM Format + This is the date-time format supplied by FTP servers that + support the (not yet standard but widely used nevertheless) MDTM + command, by which the FTP client asks for a file's modification + time: + + yyyymmddhhmmss[.ffff] + + where yyyy is the 4-digit year, mm is the 2-digit month, and so + on, exactly 14 digits long. An optional fractional part + (fraction of second) may also be included, separated by a + decimal point (period). Kermit rounds to the nearest second. + Example: + + 20020208102835.515 (8 February 2002 10:28:36 AM) + +8.13.1. The Date + + The date, if given, must precede the time and/or delta, and can be in + many, many formats. For starters, you can use several symbolic date + names in place of actual dates: + + NOW + This is replaced by the current date and time. The time can not + be overriden (if you want to supply a specific time, use TODAY + rather than NOW). + + TODAY + This is replaced by the current date and a default time of + 00:00:00 is supplied, but can be overridden by a specific time; + for example, if today is 8 February 2002, then "TODAY" is + "20020802 00:00:00" but "TODAY 10:28" is "20020802 10:28:00". + + TOMORROW + Like TODAY, but one day later (if today is 8 February 2002, then + "TOMORROW" is "20020803 00:00:00" but "TOMORROW 16:30" is + "20020803 16:30:00"). + + YESTERDAY + Like TODAY, but one day earlier. + + MONDAY, TUESDAY, WEDNESDAY, ..., SUNDAY + The date on the given day of the week, today or later. A default + time of 00:00:00 is supplied but can be overridden. Example: + "SATURDAY 12:00" means next Saturday (or today, if today is + Saturday) at noon. + + You can give an explicit date in almost any conceivable format, but + there are some rules: + + * If a date is given, it must have three fields: day, month, and + year; the order can vary (except that the month can not be last). + * If names are used for days, months, etc, they must be English. + * The year must lie between 0000 and 9999, inclusive. + * All calendar calculations use Gregorian dating, so calculated dates + for years prior to 1582 (or later, depending on the country) will + not agree with historical dates. Other forms of dating (e.g. + Hebrew, Chinese) are not supported. + + Various date-field separators are accepted: hyphen, slash, space, + underscore, period. The same field separator (if any) must be used in + both places; for example 18-Sep-2001 but not 18-Sep/2001. Months can be + numeric (1-12) or English names or abbreviations. Month name + abbreviations are normally three letters, e.g. Apr, May, Jun, Jul. + Capitalization doesn't matter. + + Here are a few examples: + + 18 Sep 2001 (English month, abbreviated) + 18 September 2001 (English month, spelled out) + 2001 Sept 18 (Year, month, day) + 18-Sep-2001 (With hyphens) + 18/09/2001 (All numeric with slashes) + 18.09.2001 (Ditto, with periods) + 18_09_2001 (Ditto, with underscores) + 09/18/2001 (See below) + 2001/09/18 (See below) + September 18, 2001 (Correspondence style) + Sep-18-2001 (Month-day-year) + 20010918 (Numeric, no separators) + + You can also include the day of the week with a specific date, in which + case it is accepted (if it is a valid day name), but not verified to + agree with the given date: + + Tue, 18 Sep 2001 (Abbreviated, with comma) + Tue,18 Sep 2001 (Comma but no space) + Tue 18 Sep 2001 (Abbreviated, no comma) + Tuesday 18 Sep 2001 (Spelled out) + Tuesday, 18 Sep 2001 (etc) + Friday, 18 Sep 2001 (Accepted even if not Friday) + + In all-numeric dates with the year last, such as 18/09/2001, Kermit + identifies the year because it's 4 digits, then decides which of the + other two numbers is the month or day based on its value. If both are + 12 or less and are unequal, the date is ambiguous and is rejected. In + all-numeric dates with the year first, the second field is always the + month and the third is the day. The month never comes last. A date with + no separators is accepted only if it is all numeric and has exactly + eight digits, and is assumed to be in yyyymmdd format. + + 20010918 (18-Sep-2001 00:00:00) + + or 14 digits (as in FTP MDTM format): + + 20010918123456 (18-Sep-2001 12:34:56) + + You can always avoid ambiguity by putting the year first, or by using + an English, rather than numeric, month. A date such as 09/08/2001 would + be ambiguous but 2001/09/08 is not, nor is 09-Aug-2001. + + Until the late 1990s, it was common to encounter 2-digit years, and + these are found to this day in old e-mails and other documents. Kermit + accepts these dates if they have English months, and interprets them + according to the windowing rules of [480]RFC 2822: "If a two digit year + is encountered whose value is between 00 and 49, the year is + interpreted by adding 2000, ending up with a value between 2000 and + 2049. If a two digit year is encountered with a value between 50 and + 99, or any three digit year is encountered, the year is interpreted by + adding 1900." + + If you need to specify a year prior to 1000, use leading zeros to + ensure it is not misinterpreted as a "non-Y2K-compliant" modern year: + + 7-Oct-77 (19771007 00:00:00) + 7-Oct-0077 (00771007 00:00:00) + +8.13.2. The Time + + The basic time format is hh:mm:dd; that is hours, minutes, seconds, + separated by colons, perhaps with an optional fractional second + separated by a decimal point (period). The hours are in 24-hour format; + 12 is noon, 13 is 1pm, and so on. Fields omitted from the right default + to zero. Fields can be omitted from the left or middle by including the + field's terminating colon. Examples: + + 11:59:59 (11:59:59 AM) + 11:59 (11:59:00 AM) + 11 (11:00:00 AM) + 11:59:59.33 (11:59:59 AM) + 11:59:59.66 (Noon) + 03:21:00 (3:21:00 AM) + 3:21:00 (3:21:00 AM) + 15:21:00 (3:21:00 PM) + :21:00 (00:21:00 AM) + ::01 (00:00:01 AM) + 11::59 (11:00:59 AM) + + Leading zeros can be omitted, but it is customary and more readable to + keep them in the minute and second fields: + + 03:02:01 (03:02:01 AM) + 3:02:01 (03:02:01 AM) + 3:2:1 (03:02:01 AM) + + AM/PM notation is accepted if you wish to use it: + + 11:59:59 (11:59:59 AM) + 11:59:59AM (11:59:59 AM) + 11:59:59A.M. (11:59:59 AM) + 11:59:59am (11:59:59 AM) + 11:59:59a.m. (11:59:59 AM) + 11:59:59PM (11:59:59 PM = 23:59:59) + 11:59:59P.M. (11:59:59 PM = 23:59:59) + 11:59:59pm (11:59:59 PM = 23:59:59) + 11:59:59p.m. (11:59:59 PM = 23:59:59) + + You can omit the colons if you wish, in which case Kermit uses the + following rules to interpret the time: + + 1. 6 digits is hh:mm:ss, e.g. 123456 is 12:34:56. + 2. 5 digits is h:mm:ss, e.g. 12345 is 1:23:45. + 3. 4 digits is hh:mm, e.g. 1234 is 12:34. + 4. 3 digits is h:mm, e.g. 123 is 1:23. + 5. 2 digits is hh, e.g. 12 is 12:00. + 6. 1 digit is h (the hour), e.g. 1 is 1:00. + + Examples: + + 1 (01:00:00 AM) + 10 (10:00:00 AM) + 230 (02:30:00 AM) + 230pm (02:30:00 PM = 14:30:00) + 1115 (11:15:00 AM) + 2315 (11:15:00 PM = 23:15:00 PM) + 23150 (02:31:50 AM) + 231500 (23:15:00 PM) + +8.13.3. Time Zones + + If a time is given, it can (but need not) be followed by a time zone + designator. If no time zone is included, the time is treated as local + time and no timezone conversions are performed. + + The preferred time zone designator is the UTC Offset, as specified in + [481]RFC 2822: a plus sign or minus sign immediately followed by + exactly four decimal digits, signifying the difference in hh (hours) + and mm (minutes) from Universal Coordinated Time (UTC, also known as + Greenwich Mean Time, or GMT), with negative numbers to the West and + positive numbers to the East. For example: + + Fri, 13 Jul 2001 12:54:29 -0700 + + indicates a local time of 12:54:29 that is 07 hours and 00 minutes + behind (less than, East of) Universal Time. The space is optional, so + the example could also be written as: + + Fri, 13 Jul 2001 12:54:29-0700 + + The following symbolic time zones are also accepted, as specified by + [482]RFC 2822 and/or in ISO 8601: + + GMT = +0000 Greenwich Mean Time + Z = +0000 Zulu (Zero Meridian) Time + UTC = +0000 Universal Coordinated Time + UT = +0000 Universal Time + EDT = -0400 Eastern (USA) Daylight Time + EST = -0500 Eastern (USA) Standard Time + CDT = -0500 Central (USA) Daylight Time + CST = -0600 Central (USA) Standard Time + MDT = -0600 Mountain (USA) Daylight Time + MST = -0700 Mountain (USA) Standard Time + PDT = -0700 Pacific (USA) Daylight Time + PST = -0800 Pacific (USA) Standard Time + + Note that GMT, Z, UTC, and UT all express the same concept: standard + (not daylight) time at the Zero Meridian. UTC, by the way, is an + international standard symbol and does not correspond to the order of + the English words, Universal Coordinated Time, but it happens to have + the same initial letters as these words. Of course hundreds of other + symbolic timezones and variations exist, but they are not standardized, + and are therefore not supported by Kermit. + + When a time zone is included with a time, the time is converted to + local time. In case the conversion crosses a midnight boundary, the + date is adjusted accordingly. Examples converting to EST (Eastern USA + Standard Time = -0500): + + 11:30:00 = 11:30:00 + 11:30:00 EST = 11:30:00 + 11:30:00 GMT = 06:30:00 + 11:30:00 PST = 14:30:00 + 11:30:00Z = 06:30:00 + 11:30PM GMT = 18:30:00 + 11:30 -0500 = 11:30:00 + 11:30 -0800 = 08:30:00 + 11:30 +0200 = 04:30:00 + + Unlike most of Kermit's other date-time conversions, timezone knowledge + (specifically, the offset of local time from UTC) is embodied in the + underlying operating system, not in Kermit itself, and any conversion + errors in this department are the fault of the OS. For example, most + UNIX platforms do not perform conversions for years prior to 1970. + +8.13.4. Delta Time + + Date/time expressions can be composed of a date and/or time and a delta + time, or a delta time by itself. When a delta time is given by itself, + it is relative to the current local date and time. Delta times have the + following general format: + + {+,-}[number units][hh[:mm[:ss]]] + + In other words, a delta time always starts with a plus or minus sign, + which is followed by a "part1", a "part2", or both. The "part1", if + given, specifies a number of days, weeks, months, or years; "part2" + specifies a time in hh:mm:ss notation. In arithmetic terms, these + represents some number of days or other big time units, and then a + fraction of a day expressed as hours, minutes, and seconds; these are + to be added to or subtracted from the given (or implied) date and time. + The syntax is somewhat flexible, as shown by the following examples: + + +1 day (Plus one day) + +1day (Ditto) + +1d (Ditto) + + 1 day (Ditto) + + 1 day 3:00 (Plus one day and 3 hours) + +1d3:00 (Ditto) + +1d3 (Ditto) + +3:00:00 (Plus 3 hours) + +3:00 (Ditto) + +3 (Ditto) + +2 days (Plus 2 days) + -12 days 7:14:22 (Minus 12 days, 7 hours, 14 minutes, and 22 seconds) + + The words "week", "month", and "year" can be used like "day" in the + examples above. A week is exactly equivalent to 7 days. When months are + specified, the numeric month number of the date is incremented or + decremented by the given number, and the year and day adjusted + accordingly if necessary (for example, 31-Jan-2001 +1month = + 03-Mar-2001 because February does not have 31 days). When years are + specified, they are added or subtracted to the base year. Examples + (assuming the current date is 10-Aug-2001 and the current time is + 19:21:11): + + 18-Sep-2001 +1day (20010918 00:00:00) + today +1day (20010811 00:00:00) + now+1d (20010811 19:21:11) + + 1 day (20010811 19:21:11) + + 1 day 3:14:42 (20010811 22:35:54) + + 7 weeks (20010928 19:21:11) + +1d3:14:42 (20010811 22:35:54) + +1w3:14:42 (20010817 22:35:54) + +1m3:14:42 (20010910 22:35:54) + +1y3:14:42 (20020810 22:35:54) + 2 feb 2001 + 10 years (20110208 00:00:00) + 2001-02-08 +10y12 (20110208 12:00:00) + 31-dec-1999 23:59:59+00:00:01 (20000101 00:00:00) + 28-feb-1996 +1day (19960229 00:00:00) (leap year) + 28-feb-1997 +1day (19970301 00:00:00) (nonleap year) + 28-feb-1997 +1month (19970328 00:00:00) + 28-feb-1997 +1month 11:59:59 (19970328 11:59:59) + 28-feb-1997 +20years (20170228 00:00:00) + 28-feb-1997 +8000years (99970228 00:00:00) + + For compatibility with VMS, the following special delta-time format is + also accepted: + + +number-hh:mm:ss + -number-hh:mm:ss + + (no spaces). The hyphen after the number indicates days. It corresponds + exactly to the Kermit notation: + + +numberdhh:mm:ss + -numberdhh:mm:ss + + The following forms all indicate exactly the same date and time: + + 18-Sep-2001 12:34:56 +1-3:23:01 + 18-Sep-2001 12:34:56 +1d3:23:01 + 18-Sep-2001 12:34:56 +1 day 3:23:01 + + and mean "add a day plus 3 hours, 23 minutes, and 1 second" to the + given date. + + Note that delta times are not at all the same as UTC offsets; the + former specifies an adjustment to the given date/time and the latter + specifies that the local time is a particular distance from Universal + Time, for example: + + 11-Aug-2001 12:34:56 -0800 (20010811 16:34:56 -- UTC Offset) + 11-Aug-2001 12:34:56 -08:00 (20010811 04:34:56 -- Delta time) + + If you give a time followed by a modifer that starts with a + or - + sign, how does Kermit know whether it's a UTC offset or a delta time? + It is treated as a UTC offset if the sign is followed by exactly four + decimal digits; otherwise it is a delta time. Examples (for USA Eastern + Daylight Time): + + 11-Aug-2001 12:34:56 -0800 (20010811 16:34:56 -- UTC Offset) + 11-Aug-2001 12:34:56 -08:00 (20010811 04:34:56 -- Delta time) + 11-Aug-2001 12:34:56 -800 (20010811 04:34:56 -- Delta time) + 11-Aug-2001 12:34:56 -8 (20010811 04:34:56 -- Delta time) + + The first example says that at some unknown place which is 8 hours + ahead of Universal Time, the time is 12:34:56, and this corresponds to + 16:34:56 in Eastern Daylight time. The second example says to subtract + 8 hours from the local time. The third and fourth are delta times + because, even though a colon is not included, the time does not consist + of exactly 4 digits. + + When a delta time is written after a timezone, however, there is no + ambiguity and no syntax distinction is required: + + 11-Aug-2001 12:34:56 -0800 -0800 (20010811 08:34:56) + 11-Aug-2001 12:34:56 -0800 -08:00 (Ditto) + 11-Aug-2001 12:34:56 -08:00 -08:00 (Illegal) + +8.13.5. The DATE Command + + Obviously a great many combinations of date, time, time zone, and delta + time are possible, as well as many formatting options. The purpose of + all this flexibility is to comply with as many standards as possible -- + Internet RFCs, ISO standards, and proven corporate standards -- as well + as with notations commonly used by real people, in order that dates and + times from the widest variety of sources can be assigned to a variable + and used in any date-time field in any Kermit command. + + You can test any date-and/or-time format with the DATE command, which + converts it to standard yyyymmdd hh:mm:ss format if it is understood, + or else gives an explicit error message (rather than just "BAD DATE" as + in previous C-Kermit releases) to indicate what is wrong with it. + Examples (on Tuesday, 31 July 2001 in New York City, Eastern Daylight + Time, UTC -0400): + + DATE command argument Result + 12:30 20010731 12:30:00 + 12:30:01 20010731 12:30:01 + 12:30:01.5 20010731 12:30:02 + 1230 20010731 12:30:00 + 230 20010731 02:30:00 + 230+1d 20010801 02:30:00 + 230+1d3:00 20010801 05:30:00 + 20010718 19:21:15 20010718 19:21:15 + 20010718_192115 20010718 19:21:15 + 20010718T192115 20010718 19:21:15 + 18 Jul 2001 +0400 20010717 23:59:59 + 18 Jul 2001 192115 20010718 19:21:15 + 18 Jul 2001 192115.8 20010718 19:21:16 + 18-Jul-2001T1921 20010718 19:21:00 + 18-Jul-2001 1921Z 20010718 15:21:00 + 18-Jul-2001 1921 GMT 20010718 15:21:00 + 18-Jul-2001 1921 UTC 20010718 15:21:00 + 18-Jul-2001 1921 Z 20010718 15:21:00 + 18-Jul-2001 1921Z 20010718 15:21:00 + 18-Jul-2001 1921 -04:00:00 20010718 19:21:00 + 21-Jul-2001_08:20:00am 20010721 08:20:00 + 21-Jul-2001_8:20:00P.M. 20010721 20:20:00 + Fri Jul 20 11:26:25 2001 20010720 11:26:25 + Fri Jul 20 11:26:25 GMT 2001 20010720 07:26:25 + Sun, 9 Apr 2000 06:46:46 +0100 20000409 01:46:46 + Sunday, 9 Apr 2000 06:46:46 +0100 20000409 01:46:46 + now 20010731 19:41:12 + today 20010731 00:00:00 + today 09:00 20010731 09:00:00 + tomorrow 20010801 00:00:00 + tomorrow 09:00 20010801 09:00:00 + tomorrow 09:00 GMT 20010801 05:00:00 + yesterday 20010730 00:00:00 + yesterday 09:00 20010730 09:00:00 + + 3 days 20010803 00:00:00 + +3 days 20010803 00:00:00 + +3days 20010803 00:00:00 + + 3days 20010803 00:00:00 + + 3 days 09:00 20010803 09:00:00 + + 2 weeks 20010814 00:00:00 + + 1 month 20010831 00:00:00 + - 7 months 20001231 00:00:00 + + 10 years 20110731 00:00:00 + friday 20010803 00:00:00 + saturday 20010804 00:00:00 + sunday 20010805 00:00:00 + monday 20010806 00:00:00 + tuesday 20010731 00:00:00 + wednesday 20010801 00:00:00 + thursday 20010802 00:00:00 + friday 07:00 20010803 07:00:00 + thursday 1:00pm 20010802 13:00:00 + thursday 1:00pm GMT 20010802 09:00:00 + Thu, 10 Nov 94 10:50:47 EST 19941110 10:50:47 + Fri, 20 Oct 1995 18:35:15 -0400 (EDT) 19951020 18:35:15 + 31/12/2001 20011231 00:00:00 + 12/31/2001 20011231 00:00:00 + 2001-July-20 20010720 00:00:00 + 2001-September-30 20010930 00:00:00 + 30-September-2001 20010930 00:00:00 + Sep 30, 2001 12:34:56 20010930 12:34:56 + September 30, 2001 20010930 00:00:00 + September 30, 2001 630 20010930 06:30:00 + September 30 2001 630 20010930 06:30:00 + Sep-30-2001 12:34:59 20010930 12:34:59 + 20010807113542.014 20010807 11:35.42 + 20010807113542.014Z 20010807 07:35:42 + +8.13.6. New Date-Time Functions + + In the following descriptions, date-time function arguments are the + same free-format date-time strings discussed above, with the same + defaults for missing fields. They are automatically converted to + standard format internally prior to processing. + + \fcvtdate(d1) + Converts the date-time d1 to standard format and local time. + This function is not new, but now it accepts a wider range of + argument formats that can include timezones and/or delta times. + If the first argument is omitted, the current date and time are + assumed. The optional second argument is a format code for the + result: + + n1 = 1: yyyy-mmm-dd hh:mm:ss (mmm = English 3-letter month + abbreviation) + n1 = 2: dd-mmm-yyyy hh:mm:ss (ditto) + n1 = 3: yyyymmddhhmmss (all numeric) + + \futcdate(d1) + Converts the date-time d1 to Universal Coordinated Time (UTC), + also known as GMT or Zulu or Zero-Meridian time. The default d1 + is NOW. If d1 is a valid date-time, the UTC result is returned + in standard format, yyyymmdd hh:ss:mm. + + \fcmpdates(d1,d2) + Compares two free-format date-times, d1 and d2, and, if both + arguments are valid, returns a number: -1 if d1 is earlier than + (before) d2; 0 if d1 is the same as d2; 1 if d1 is later than + (after) d2. + + \fdiffdates(d1,d2) + Computes the difference between two free-format date-times, d1 + and d2. If both arguments are valid, returns a delta time which + is negative if d1 is earlier than (before) d2 and positive + otherwise. If d1 and d2 are equal, the result is "+0:00". + Otherwise, the result consists of the number of days, hours, + minutes, and seconds that separate the two date-times. If the + number of days is zero, it is omitted. If the number of days is + nonzero but the hours, minutes, and seconds are all zero, the + time is omitted. if the seconds are zero, they are omitted. + + \fdelta2secs(dt) + Converts a delta time to seconds. For example, "+1d00:00:01" to + 86401. Valid delta times must start with a + or - sign. Days are + accepted as time units, but not years, months, or weeks. If the + result would overflow a computer long word (as would happen with + 32-bit long words when the number of days is greater than + 24854), the function fails. + + HINT: Although Kermit has a number of built-in date and time variables, + it doesn't have a single one suitable for writing a timestamp. For this + you would normally use something like "\v(ndate) \v(time)". But + \fcvtdate() (with no arguments) is equivalent: it returns the current + date and time in yyyymmdd hh:mm:ss format, suitable for time stamping. + +8.13.7. Date-Time Programming Examples + + Here's a macro that converts any date-time to UTC, which you might use + if C-Kermit didn't already have a \futcdate() function: + + define utcdate { + .local := \fcvtdate(\%*) ; 1. + .tmp := \fcvtdate(\m(local)UTC) ; 2. + .offset := \fdiffdate(\m(local),\m(tmp)) ; 3. + .utc := \fcvtdate(\m(local)\m(offset)) ; 4. + sho mac utc ; 5. + } + + Brief explanation: Line 1 converts the macro argument, a free-format + date-time, to standard-format local time. Line 2 appends the "UTC" + timezone to the local time and converts the result to local time. In + other words, we take the same time as the local time, but pretend it's + UTC time, and convert it to local time. For example, if New York time + is 4 hours ahead of UTC, then 6:00pm New York time is 2:00pm UTC. Line + 3 gets the difference of the two results (e.g. "+04:00"). Line 4 + appends the difference (delta time) to the local time, and converts it + again, which adds (or subtracts) the UTC offset to the given time. Line + 5 displays the result. + + Here's a script that opens a web page, gets its headers into an array, + scans the array for the "Last-Modified:" header, and inteprets it: + http open www.columbia.edu + if fail stop 1 HTTP OPEN failed + http /array:a head index.html /dev/null + if fail stop 1 HTTP GET failed + show array a + for \%i 1 \fdim(&a) 1 { + .\%x := \findex(:,\&a[\%i]) + if not \%x continue + .tag := \fleft(\&a[\%i],\%x-1) + .val := \fltrim(\fsubstr(\&a[\%i],\%x+1)) + if ( eq "\m(tag)" "Last-Modified" ) { + echo HTTP Date: \m(val) + .rdate := \fcvtdate(\m(val)) + echo {Standard Date (local): \m(rdate)} + echo {Standard Date (UTC): \futcdate(\m(rdate))} + break + } + } + http close + + The result: + + HTTP Date: Mon, 13 Aug 2001 20:05:42 GMT + Standard Date (local): 20010813 16:05:42 + Standard Date (UTC): 20010813 20:05:42 + + As you can see, Kermit had no trouble decoding the date-time-string + from the website, converting to local time, and converting back to UTC + with no conflicts or loss of information. If it had been in any other + known format, the result would have been the same. + + Now suppose we want to download the web page only if it is newer than + our local copy. The \fdate(filename) function (which returns the + modification date-time of the given file) and the new \fcmpdates() + function make it easy. Insert the following just before the BREAK + statement: + + if ( < 0 \fcmpdates(\m(rdate),\fdate(index.html)) ) { + echo GETTING index.html... + http get index.html index.html + if success echo HTTP GET OK + } else { + echo index.html: no update needed + } + http close + exit + + This says, "if 0 is less than the comparison of the remote file date + and the local file date, get the remote file, otherwise skip it." And + it automatically reconciles the time-zone difference (if any). + + It would be nice to be able to extend this script into a + general-purpose website updater, but unfortunately HTTP protocol + doesn't provide any mechanism for the client to ask the server for a + list of files, recursive or otherwise. + + [ [483]Top ] [ [484]Contents ] [ [485]C-Kermit Home ] [ [486]Kermit + Home ] + +8.14. Trapping Keyboard Interruption + + Normally when you type Ctrl-C and Kermit is in command mode (as opposed + to CONNECT mode) with COMMAND INTERRUPTION ON (as it is unless you have + set it OFF), Kermit interrupts any command that is currently in + progress, and if a command file or macro is executing, rolls the + command stack back to top level, closing all open command files, + deactivating all macros, deallocating all local variables and arrays, + and leaving you at the command prompt. + + Suppose, however, you want certain actions to occur when a script is + interrupted; for example, closing open files, writing log entries, or + displaying summary results. You can do this by defining a macro named + ON_CTRLC. When Ctrl-C is detected, and a macro with this name is + defined, Kermit executes it from the current command level, thus giving + it full access to the environment in which the interruption occurred, + including local variables and open files. Only when the ON_CTRLC macro + completes execution is the command stack rolled back to top level. + + Once the ON_CTRLC macro is defined, it can be executed only once. This + is to prevent recursion if the user types Ctrl-C while the ON_CTRLC + macro is executing. If you type Ctrl-C while the Ctrl-C macro is + active, this does not start a new copy of ON_CTRLC; rather, it returns + to the top-level command prompt. After the ON_CTRLC macro returns, it + has been removed from the macro table so if you want to use it again or + install a different Ctrl-C trap, you must execute a new DEFINE ON_CTRLC + command. In any case, as always when you interrupt a script with + Ctrl-C, its completion status is FAILURE. + + Normally the ON_CTRLC macro would be defined in the command file or + macro to which it applies, and should be declared LOCAL. This way, if + the command file or macro completes successfully without being + interrupted, the ON_CTRLC definition disappears automatically. + Otherwise the definition would still be valid and the macro would be + executed, probably out of context, the next time you typed Ctrl-C. + + Here's a simple example of a command file that sets a Ctrl-C trap for + itself: + + local on_ctrlc ; Make Ctrl-C trap local to this command file. + define on_ctrlc { ; Define the ON_CTRLC macro. + echo Interrupted at \v(time). + echo Iterations: \%n + } + xecho Type Ctrl-C to quit + for \%n 1 999 1 { ; Prints a dot every second until interrupted. + sleep 1 + xecho . + } + echo Finished normally at \v(time) ; Get here only if not interrupted. + decrement \%n + echo Iterations: \%n + + This prints a summary no matter whether it completes normally or is + interrupted from the keyboard. In both cases the trap is automatically + removed afterwards. + + For an example of how to use ON_CTRLC to debug scripts, see + [487]Section 8.1. + + [ [488]Top ] [ [489]Contents ] [ [490]C-Kermit Home ] [ [491]Kermit + Home ] + +9. S-EXPRESSIONS + + This section is primarily for those who want to write + calculation-intensive scripts, especially if they require + floating-point arithmetic, and/or for those who are familiar with the + LISP programming language. + + Ever since C-Kermit version 5 was released in 1988, scripting has been + one of its major attractions, and arithmetic is a key part of it. + Versions 5 and 6 included integer arithmetic only, using traditional + algebraic notation, e.g.: + + echo \fevaluate(3*(2+7)/2) + 13 + + C-Kermit 7.0 added support for floating-point arithmetic, but only + through function calls: + + echo \ffpdivide(\ffpmultiply(3.0,\ffpadd(2.0,7.0)),2.0) + 13.5 + + C-Kermit 8.0 introduces a third form of arithmetic that treats integers + and floating-point numbers uniformly, is easier to read and write, and + executes very quickly: + + (/ (* 3 (+ 2 7)) 2) + 13.5 + + But first some background. + + The Kermit command and scripting language differs from true programming + languages (such as C or Fortran) in many ways; one of the most + prominent differences is the way in which variables are distinguished + from constants. In a command language, words are taken literally; for + example, the Unix shell: + + cat foo.bar + + displays the file named foo.bar. Whereas in a programming language like + C, words are assumed to be variables: + + s = foo.bar; /* Assigns the value of foo.bar to the variable s */ + + To make a programming language take words literally, you have to quote + or "escape" them: + + s = "foo.bar"; /* Assigns a pointer to the string "foo.bar" to the variable s + */ + + The opposite holds for command languages: to get them to treat a word + as a variable rather than a constant, you have to escape them. For + example, in the Unix shell: + + foo=123 ; Assign value 123 to variable foo. + echo foo ; Prints "foo" + echo $foo ; Prints "123" + + And in Kermit: + + define foo 123 ; Assign value 123 to variable foo. + echo 123 ; This prints "123". + echo foo ; This prints "foo". + echo \m(foo) ; This prints "123". + + In other words, character strings (such as "foo" above) are interpreted + as literal strings, rather than variable names, except in special + commands like DEFINE that deal specifically with variable names (or in + numeric contexts as explained in [492]Section 8.2). The special + "escape" character (dollar sign ($) for the shell, backslash (\) for + Kermit) indicates that a variable is to be replaced by its value. + + The requirement to escape variable names in command languages normally + does not impose any special hardship, but can add a considerable + notational burden to arithmetic expressions, which are typically full + of variables. Especially in Kermit when floating point numbers are + involved, where you must use special \ffpxxx() functions, e.g. + "\ffpadd(\m(a),\m(b))" rather than the simple "+" operator to add two + floating-point numbers together, because the original arithmetic + handler doesn't support floating point (this might change in the + future). To illustrate, the general formula for the area of a triangle + is: + + sqrt(s * (s - a) * (s - b) * (s - c)) + + where a, b, and c are the lengths of the triangle's three sides and: + + s = (a + b + c) / 2 + + Except in special cases (e.g. a = 3, b = 4, c = 5), the result has a + fractional part so the computation must be done using floating-point + arithmetic. We can create a Kermit 7.0 function for this as follows: + + def area { + local s t1 t2 t3 + assign s \ffpdiv(\ffpadd(\ffpadd(\%1,\%2),\%3),2.0) + assign t1 \ffpsub(\m(s),\%1) + assign t2 \ffpsub(\m(s),\%2) + assign t3 \ffpsub(\m(s),\%3) + return \ffpsqrt(\ffpmul(\m(s),\ffpmul(\m(t1),\ffpmul(\m(t2),\m(t3))))) + } + + But as you can see, this is rather cumbersome. Note, in particular, + that arithmetic functions like \ffpadd(), \ffpmul(), etc, take exactly + two operands (like their symbolic counterparts + and *), so obtaining + the product of three or more numbers (as we do in this case) is + awkward. + + Using the alternative S-Expression notation, we can reduce this to a + form that is both easier to read and executes faster (the details are + explained later): + + def newarea { + (let s (/ (+ \%1 \%2 \%3) 2.0)) + (sqrt (* s (- s \%1) (- s \%2) (- s \%3))) + } + + In both examples, the \%1..3 variables are the normal Kermit macro + arguments, referenced by the normal escaping mechanism. For increased + readability, we can also assign the macro arguments \%1, \%2, and \%3 + to the letters a, b, and c corresponding to our formula: + +def newarea { + (let a \%1 b \%2 c \%3) + (let s (/ (+ a b c) 2.0)) + (sqrt (* s (- s a) (- s b) (- s c))) +} + + And now the Kermit function reads almost like the original formula. + Here Kermit behaves more like a regular programming language. In an + S-Expression, macro names need not be escaped when they are used as the + names of numeric variables. + + [ [493]Top ] [ [494]Contents ] [ [495]C-Kermit Home ] [ [496]Kermit + Home ] + +9.1. What is an S-Expression? + + The S-Expression concept is borrowed from the Lisp programming + language. "S-Expression" is short for Symbolic Expression (itself + sometimes shortened to SEXP). S-Expressions provide a kind of + Alternative Mini-Universe within the Kermit command language when the + regular rules don't apply, a universe enclosed in parentheses. + + C-Kermit does not pretend to be a full Lisp interpreter; only the + arithmetic parts of Lisp have been incorporated: S-Expressions that + operate on numbers and return numeric values (plus extensibility + features described in [497]Section 9.8, which allow some degree of + string processing). + + An S-Expression is a list of zero or more items, separated by spaces, + within parentheses. Examples: + + () + (1) + (a) + (+ a 1) + (* 2 a b) + + If the S-Expression is empty, it has the NIL (empty) value. If it is + not empty and the first item is an operator (such as + or *), there can + be zero or more subsequent items, called the operands: + + (+ 1 2) + + Here the operator is "+" and the operands are "1" and "2", and the + value of the S-Expression is the value of the operation (in this case + 3). The operator always comes first, which is different from the + familiar algebraic notation; this because S-Expression operators can + have different numbers of operands: + + (+ 1) + (+ 1 2) + (+ 1 2 3 4 5 6 7 8 9) + + If the first item in the S-Expression is not an operator, then it must + be a variable or a number (or a macro; see [498]Section 9.8), and the + S-Expression can only contain one item; in this case, the + S-Expression's value is the value of the variable or number: + + (a) + (3) + + Operands can be numbers, variables that have numeric values, functions + that return numbers, or other S-Expressions. To illustrate an + S-Expression within an S-Expression, observe that: + + (+ 1 2) + + is equivalent to any of the following (plus an infinite number of + others): + + (+ 1 (+ 1 1)) + (+ (- 3 2) (/ 14 (+ 3 4))) + + S-Expressions can be nested to any reasonable level; for example, the + value of the following S-Expression is 64: + + (- (* (+ 2 (* 3 4)) (- 9 (* 2 2))) 6) + + Operators have no precedence, implied or otherwise, since they can't be + mixed. The only exceptions are unary + and -, which simply indicate the + sign of a number: + + (* 3 -1) + + Order of evaluation is specified entirely by parentheses, which are + required around each operator and its operands: (+ a (* b c)) instead + of (a + b * c). + + S-Expressions provide a simple and isolated environment in which + Kermit's macro names can be used without the \m(...) escaping that is + normally required. Given: + + define a 1 + define b 2 + define c 3 + + Then: + + (+ \m(a) \m(b) \m(c)) + + is equivalent to: + + (+ a b c) + + Within an S-Expression, as in other strictly numeric contexts + ([499]Section 8.2), any operand that starts with a letter is treated as + a Kermit macro name. In this context, abbreviations are not accepted; + variable names must be spelled out in full. Alphabetic case is not + significant; "a" and "A" are the same variable, but both are different + from "area". + + Of course, regular Kermit variables and functions can be used in + S-Expressions in the normal ways: + + (* \v(math_pi) (^ \%r 2)) ; Area of a circle with radius \%r + (+ \fjoin(&a)) ; Sum of all elements of array \&a[] + + [ [500]Top ] [ [501]Contents ] [ [502]C-Kermit Home ] [ [503]Kermit + Home ] + +9.2. Integer and Floating-Point-Arithmetic + + Normally, if all numbers in an S-Expression are integers, the result is + an integer: + + (+ 1 1) ; Result is 2 + (/ 9 3) ; Result is 3 + + If any of the operands is floating point, however, the result is also + floating point: + + (+ 1 1.0) ; Result is 2.0 + (/ 9.0 3) ; Result is 3.0 + + If all the operands are integers but the result has a fractional part, + the result is floating point: + + (/ 10 3) ; Result is 3.333333333333333 + + To force an integer result in such cases, use the TRUNCATE operator: + + (truncate (/ 10 3)) ; Result is 3 + + Similarly, to force a computation to occur in floating point, you can + coerce one of its operands to FLOAT: + + (+ 1 (float 1)) ; Result is 2.0 + + The result is also floating point if the magnitude of any integer + operand, intermediate result, or the result itself, is larger than the + maximum for the underlying machine architecture: + + (^ 100 100) + + If the result is too large even for floating-point representation, + "Infinity" is printed; if it is too small to be distinguished from 0, + 0.0 is returned. + + Large numbers can be used and large results generated, but they are + accurate only to the precision of the underlying machine. For example, + the result of: + + (+ 111111111111111111111 222222222222222222222) + + should be 333333333333333333333, but 333333333333333300000.0 is + produced instead if the machine is accurate to only about 16 decimal + digits, even with coercion to floating-point. The order of magnitude is + correct but the least significant digits are wrong. The imprecise + nature of the result is indicated by the ".0" at the end. Contrast + with: + + (+ 111111111 222222222) + + which produces an exact integer result. + + [ [504]Top ] [ [505]Contents ] [ [506]C-Kermit Home ] [ [507]Kermit + Home ] + +9.3. How to Use S-Expressions + + S-Expressions may be given as commands to C-Kermit. Any command whose + first character is "(" (left parenthesis) is interpreted as an + S-Expression. + + If you enter an S-Expression at the C-Kermit> prompt, its result is + printed: + + C-Kermit>(/ 10.0 3) + 3.333333333333333 + C-Kermit> + + If an S-Expression is executed within a macro or command file, its + value is not printed. However, you can control the printing action + with: + + SET SEXPRESSION ECHO { AUTO, ON, OFF } + AUTO is the default, meaning print the value at top level only; + ON means always print the value; OFF means never print it. + + In any case, the value of the most recent S-Expression (and the + S-Expression itself) may be accessed programmatically through the + following variables: + + \v(sexpression) + The S-Expression most recently executed. + + \v(svalue) + The value of the S-Expression most recently executed. + + Besides issuing S-Expressions as commands in themselves, you can also + execute them anywhere within a Kermit command, but in this case they + must be enclosed in a function call (otherwise they are taken + literally): + + \fsexpression(s) + The argument "s" is an S-Expression; the outer parentheses may + be omitted. The value of the S-Expression is returned. Note that + since S-Expressions usually contain spaces, some form of + grouping or quoting might be needed in some contexts: + + echo \fsexpression((+ 1 1)) ; Outer parentheses may be included + echo \fsexpr(+ 1 1) ; Outer parentheses may be omitted + echo Value = "\fsexp(+ 1 a)" ; Can be embedded in strings + echo Value = \&a[\fsexp(/ b 2)] ; Can be used in array subscripts + if = {\fsexp(+ 1 1)} 2 { ; Braces needed here for grouping + echo One plus one still equals two + } + + The IF statement illustrates how to use S-Expressions as (or in) IF or + WHILE conditions: + + * Although S-Expressions and IF conditions are similar in appearance, + they are not interchangeable. Therefore you must use \fsexpr() to + let Kermit know it's an S-Expression rather than a regular IF + condition, or a boolean or algebraic expression within an IF + condition. + * In contexts where a single "word" is expected, you must enclose the + \fsexp() invocation in braces if the S-Expression contains spaces + (and most of them do). + + If an S-Expression is the last command executed in a macro, its value + becomes the return value of the macro; no RETURN command is needed. + Example: + + def newarea { + (let s (/ (+ \%1 \%2 \%3) 2.0)) + (sqrt (* s (- s \%1) (- s \%2) (- s \%3))) + } + + This is equivalent to (but more efficient than): + + def newarea { + (let s (/ (+ \%1 \%2 \%3) 2.0)) + return \fsexp(sqrt (* s (- s \%1) (- s \%2) (- s \%3))) + } + + When an S-Expression is entered as a command -- that is, the first + nonblank character of the command is a left parenthesis -- then it is + allowed to span multiple lines, as many as you like, until the first + left parenthesis is matched: + + (let s (/ + (+ + \%1 + \%2 + \%3 + ) + 2.0 + ) + ) + (sqrt (* + s + (- s \%1) + (- s \%2) + (- s \%3) + ) + ) + + The S-Expression concept lends itself easily to embedding and + recursion, but the depth to which recursion can occur is limited by the + resources of the computer (memory size, address space, swap space on + disk) and other factors. There is no way that C-Kermit can know what + this limit is, since it varies not only from computer to computer, but + also from moment to moment. If resources are exhausted by recursion, + C-Kermit simply crashes; there's no way to trap this error. However, + you can set a depth limit on S-Expressions: + + SET SEXPRESSION DEPTH-LIMIT number + Limits the number of times the S-Expression reader can invoke + itself without returning to the given number. The default limit + is 1000. This limit applies to S-Expressions embedded within + other S-Expressions as well as to S-Expressions that invoke + recursive macros. If the limit is exceeded, Kermit prints + "?S-Expression depth limit exceeded" and returns to its prompt. + More about recursion in [508]Section 9.8. + + You can also test the depth programmatically: + + \v(sdepth) + The current S-Expression invocation depth. The depth includes + both nesting level and recursion. For example, in: + (foo (foo (foo (foo (foo))))), the innermost (foo) is at depth + 5. + + Help, completion, and syntax checking are not available within an + S-Expression. If you type ? within an S-Expression, it says: + + C-Kermit>(? S-Expression ("help sexp" for details) + + As it says, typing "help sexp" will display a brief help text. + + The SHOW SEXPRESSION command displays current SET SEXPRESSION settings + and related information. + + [ [509]Top ] [ [510]Contents ] [ [511]C-Kermit Home ] [ [512]Kermit + Home ] + +9.4. Summary of Built-in Constants and Operators + + Three constants are built in: + + * PI, whose value is the value of pi (the quotient of circumference + of any circle and its diameter, 3.141592653...) to the underlying + machine's precision; + * T, which always has the value 1, which signifies truth in Kermit + logical expressions or S-Expressions; + * NIL, which always has the empty value, and can serve as a False + truth value. + + These constants are specific to S-Expressions and are not visible + outside them. They may not be used as the target of an assignment. So, + for example: + + (setq t 0) Fails + assign t 0 Succeeds but this is not the same T! + + E (the base of natural logarithms, 2.7182818184...) is not built in + since it is not intrinsic in most Lisp dialects. If you want E to be + the base of natural logarithms you can: + + (setq e (exp 1)) + + Operators are either symbols (such as "+") or words. Words must be + spelled out in full, not abbreviated. Differences of alphabetic case + are ignored. + + The most basic operation in S-Expressions is evaluation: + + EVAL [ s-expression or variable or number [ another [ another ... ] ] ] + Evaluates its operands and returns the value of the last one + evaluated. Examples: + + (eval) 0 + (eval 1) 1 + (eval a) value of a + (eval (+ 1 a)) value of a+1 + (eval (setq a 1) (setq b (+ a 0.5))) value of b (= a+0.5) + + You can use "." as a shorthand for EVAL: + + (.) + (. 1) + (. a) + (. (+ 1 a)) + (. (setq a 1) (setq b (+ a 0.5))) + + Opposite of EVAL is the operator that suppresses evaluation of its + operand: + + QUOTE item + The value (quote item) is "item". If the item is itself an + S-Expression, the result is the S-Expression with the outer + parentheses stripped. Examples: + + (quote) (illegal) + (quote a) a + (quote hello) hello + (quote (this is a string)) this is a string + (quote this is a string) (illegal) + + A shorthand notation is also accepted for quoting: + 'a is equivalent to (quote a). And therefore: + '(a b c) is equivalent to (quote (a b c)). + More about quoting in [513]Section 9.8. + + STRING item + Is a combination of EVAL and QUOTE. It evaluates the item as an + S-Expression, and then puts quotes around the result (more about + this in [514]Section 9.8). + + The following operators assign values to variables: + + SETQ [ variable [ value [ variable [ value [ ... ] ] ] ] ] + Applies to global variables. For each variable given: if a value + is not given, the variable is undefined. If a value is given, + assigns the value to the variable. The value may be a number, a + variable, or anything that resolves to a number including an + S-Expression. Returns the value of the last assignment. + Examples: + + (setq) Does nothing, returns NIL. + (setq a) Undefines a, returns NIL. + (setq a 1) Assigns 1 to a, returns 1. + (setq a 1 b 2) Assigns 1 to a, 2 to b, returns 2. + (setq a 1 b 2 c) Assigns 1 to a, 2 to b, undefines c, returns NIL. + + To undefine a variable that is not the final one in the list, give it a + value of "()" or NIL: + + (setq a () b 2) Undefines a, assigns 2 to b, returns 2. + (setq a nil b 2) Ditto. + + Note that a variable can be used right away once it has a value: + + (setq a 1 b a) Assigns 1 to a, the value of a (1) to b, returns 1. + + The results of SETQ (when used with macro names) can be checked + conveniently with SHOW MACRO, e.g: + + show mac a b c + + LET [ variable [ value [ variable [ value [ ... ] ] ] ] ] + Like SETQ, but applies to local variables. Note that "local" is + used in the Kermit sense, not the Lisp sense; it applies to the + current Kermit command level, not to the current S-Expression. + + If you want to use SETQ or LET to assign a value to a backslash + variable such as \%a or \&a[2], you must double the backslash: + + (setq \\%a 3) + (setq \\%b (+ \%a 1)) + (setq \\&a[2] (setq (\\%c (+ \%a \%b)))) + + In other words: + + * Double the backslash when you want to indicate the variable's NAME; + * Don't double the backslash when you want its VALUE. + + See [515]Section 9.6 for a fuller explanation of variable syntax and + scope. + + Here's a summary table of arithmetic operators; in the examples, a is 2 + and b is -1.3: + + Operator Description Example Result + + Adds all operands (0 or more) (+ a b) 0.7 + - Subtracts all operands (0 or more) (- 9 5 2 1) 1 + * Multiplies all operands (0 or more) (* a (+ b 1) 3) -1.80 + / Divides all operands (2 or more) (/ b a 2) -0.325 + ^ Raise given number to given power (^ 3 2) 9 + ++ Increments variables (++ a 1.2) 3.2 + -- Decrements variables (-- a) 1 + ABS Absolute value of 1 operand (abs (* a b 3)) 7.8 + MAX Maximum of all operands (1 or more) (max 1 2 3 4) 4 + MIN Minimum of all operands (1 or more) (min 1 2 3 4) 1 + MOD (%) Modulus of all operands (1 or more) (mod 7 4 2) 1 + FLOAT Convert an integer to floating-point (float 1) 1.0 + TRUNCATE Integer part of floating-point operand (truncate 3.333) 3 + CEILING Ceiling of floating-point operand (ceiling 1.25) 2 + FLOOR Floor of floating-point operand (floor 1.25) 1 + ROUND Operand rounded to nearest integer (round 1.75) 2 + SQRT Square root of 1 operand (sqrt 2) 1.414.. + EXP e (2.71828..) to the given power (exp -1) 0.367.. + SIN Sine of angle-in-radians (sin (/ pi 2)) 1.0 + COS Cosine of angle-in-radians (cos pi) -1.0 + TAN Tangent of angle-in-radians (tan pi) 0.0 + LOG Natural log (base e) of given number (log 2.7183) 1.000.. + LOG10 Log base 10 of given number (log10 1000) 3.0 + + The ++ and -- operators are also assignment operators and work just + like SETQ and LET in their interpretations of operators and operands, + but: + + * Each target variable must already be defined and have a numeric + value; + * The assignment value is the amount by which to increment or + decrement the variable. + * If an assignment value is not given, 1 is used. + + If you include more than one variable-value pair in a ++ or -- + expression, every variable (except, optionally, the last) must be + followed by a value. Examples: + + (++ a) Equivalent to (setq a (+ a 1)) and to (++ a 1) + (++ a 2) Equivalent to (setq a (+ a 2)) + (-- a (* 2 pi)) Equivalent to (setq a (- a (* 2 pi))) + (++ a 1 b 1 c 1 d) Equivalent to four SETQs incrementing a,b,c,d by 1. + + Another group of operators forms the predicates. These return a "truth + value", in which 0 (or NIL) is false, and 1 or any other nonzero number + is true. + + Operator Description Example Result + = (or ==) Operands are equal (= 1 1.0) 1 + != Operands are not equal (!= 1 1.0) 0 + < Operands in strictly ascending order (< 1 2 3) 1 + <= Operands in ascending order (<= 1 1 2 3) 1 + > Operands in strictly descending order (> 3 2 1) 1 + >= Operands in descending order (<= 3 3 2 1) 1 + AND (&&) Operands are all true (and 1 1 1 1 0) 0 + OR (||) At least one operand is true (or 1 1 1 1 0) 1 + XOR Logical Exclusive OR (xor 3 1) 0 + NOT (!) Reverses truth value of operand (not 3) 0 + + The Exclusive OR of two values is true if one value is true and the + other value is false. + + And another group operates on bits within an integer word: + + Operator Description Example Result + & Bitwise AND (& 7 2) 2 + | Bitwise OR (| 1 2 3 4) 7 + # Bitwise Exclusive OR (# 3 1) 2 + ~ Reverses all bits (~ 3) -4 + + These operators coerce their operands to integer by truncation if + necessary. The result of bit reversal is hardware dependent. + + The final category of operator works on truth values: + + Operator Description Example Result + IF Conditional evaluation (if (1) 2 3) 2 + + IF (predicate) (s1) [ (s2) ] + The IF operator is similar to Kermit's IF command. If the + predicate is true (i.e. evaluates to a nonzero number), the + first S-Expression (s1) is evaluated and its value is returned. + Otherwise, if (s2) is given, it is evaluated and its value + returned; if (s2) is not given, nothing happens and the NIL + (empty) value is returned. + + You can group multiple expressions in the s1 and s2 expressions using + EVAL (or "."): + + (if (< a 0) (eval (setq x 0) (setq y 0)) (eval (setq x a) (setq y b))) + + or equivalently: + + (if (< a 0) (. (setq x 0) (setq y 0)) (. (setq x a) (setq y b))) + + Each operator has its own requirement as to number and type of + operands. In the following table, "number" means any kind of number -- + integer or floating-point -- or a variable, function, macro, or + S-Expression that returns a number; "vname" means variable name, + "fpnumber" means a floating-point number (or anything that resolves to + one), and "integer" means integer (or anything that resolves to one). + "truthvalue" means anything that resolves to a value of zero or an + empty value (which indicates false) or a nonzero value (which indicates + true). "any" means any kind of value, including none at all. + + Operator Number of operands Type of operands Returns + EVAL (.) 0 or more S-Expression Last value (default NIL) + STRING 1 S-Expression string + QUOTE (') 1 word string + SETQ 0 or more vname value pairs Last value (default NIL) + LET 0 or more vname value pairs Last value (default NIL) + + 0 or more number number (default 0) + - 0 or more number number (default 0) + * 0 or more number number (see note (1)) + / 2 or more number number + ^ 2 or more number number + ++ 1 or more vname value pairs Result of last increment + -- 1 or more vname value pairs Result of last decrement + ABS 1 number number + MAX 1 or more number number + MIN 1 or more number number + MOD (%) 2 number number + FLOAT 1 number fpnumber + TRUNCATE 1 number integer + CEILING 1 number integer + FLOOR 1 number integer + ROUND 1 number integer + SQRT 1 number fpnumber + EXP 1 number fpnumber + SIN 1 number fpnumber + COS 1 number fpnumber + TAN 1 number fpnumber + LOG 1 number fpnumber + LOG10 1 number fpnumber + = (==) 1 or more number truthvalue + != 1 or more number truthvalue + < 1 or more number truthvalue + <= 1 or more number truthvalue + > 1 or more number truthvalue + >= 1 or more number truthvalue + AND (&&) 1 or more truthvalue truthvalue + OR (||) 1 or more truthvalue truthvalue + XOR 2 truthvalue truthvalue + NOT (!) 1 truthvalue truthvalue + & 1 or more number (see note 2) integer + | 1 or more number (see note 2) integer + # 2 number (see note 2) integer + ~ 1 number (see note 2) integer + IF 2 or 3 truthvalue,any,any any + + Operators that don't require any arguments return the default values + shown. + + 1. The value of "*", when used as an operand, is initially "1" and the + value of the most recent S-Expression thereafter, as in Franz Lisp. + This is handy when doing a series of calculations by hand: + C-Kermit>(* 13272.42 0.40) + 5308.968 + C-Kermit>(/ * 2) + 2654.4840 + C-Kermit> + + 2. The bitwise operators coerce their operands to integer by + truncation. + + [ [516]Top ] [ [517]Contents ] [ [518]C-Kermit Home ] [ [519]Kermit + Home ] + +9.5. Variables + + As noted elsewhere in this discussion, all backslash items (variables + such as \%a, macro parameters such as \%1, array elements such as + \&a[\%i], built-in variables such as \v(ndate), built-in functions such + as \fjoin(), macro names enclosed in \m(), \s(), or \:(), etc) are + evaluated at "top level" before the S-Expression is sent to the + S-Expression reader. To use a backslash variable as the target of an + assignment (e.g. by SETQ, LET, ++, or --), you must double the + backslash, e.g. (setq \\%r 1234). This is discussed at greater length + in the next section. + + Thus S-Expression reader generally deals only with macro names (not + backslash items) as variables. It is important to understand how the + reader handles macro names. There are fundamentally two kinds of + S-Expressions: those that contain a single element, such as: + + (foo) + + and those that contain more than one element: + + (foo a b c) + + If an S-Expression contains only one element, and it is the name of a + macro, the macro's definition is examined. If the definition is a + number (integer or floating-point, positive or negative), then this + becomes the value of the expression. If the definition starts with ' + (apostrophe), then the quoted word or string is the value of the + expression (explained in [520]Section 9.8). Otherwise, the macro is + assumed to be composed of Kermit commands (possibly including + S-Expressions), which are executed. If the macro has a RETURN value, or + it executes an S-Expression as its last command, the result becomes the + value of the S-Expression; otherwise the result is empty. + + For S-Expressions that contain more than one element, and the first + element is the name of a macro, then this macro is executed with the + arguments that are given, after the arguments are evaluated by the + S-Expression reader. Likewise, If the first element is a built-in + operator, then it is applied to the operands after they are evaluated. + In both cases, each operand is fed to the S-Expression reader + recursively for evaluation. If an operand is a number or a quoted + string, it is used as-is. But if it's a macro name, this degenerates + into the first case, and the previous paragraph applies. + + Examples: + + define foo 123 + (foo) Result: 123 + define foo 'abc + (foo) Result: abc + define foo '(one two three) + (foo) Result: one two three + define foo return \frandom(1000) + (foo) Result: 713 (or other number) + define foo (+ a b) + (foo) Result: The sum of a and b + + A more difficult example: + + define foo abc + (foo) Result: ??? + + The result in the last example depends on the definition of abc: + + * If it has no definition, an error occurs; otherwise: + * If the definition is an S-Expression, the result is the + S-Expression's value; otherwise: + * If the definition consists of Kermit commands, they are executed. + But in this case "(foo)" produces the empty result, because it + doesn't RETURN anything. + + The use of macros as S-Expression operators is described in + [521]Section 9.8. + + [ [522]Top ] [ [523]Contents ] [ [524]C-Kermit Home ] [ [525]Kermit + Home ] + +9.6. Assignments and Scope + + The assignment operators SETQ and LET apply to global and local + variables, respectively. SETQ and LET are standard Lisp operators + adapted to Kermit scoping rules. When the operands are numeric or + arithmetic, SETQ is equivalent to Kermit's EVALUATE command: + + (setq a (+ 1 2)) + evaluate a 1 + 2 + + When the operand is a string, SETQ is equivalent to DEFINE: + + (setq a '(this is a string)) + define a this is a string + + In the first case, both statements create a macro named "a" with a + value of 3. But in neither case is the macro "a" necessarily global. If + either of these commands executes in an environment (i.e. macro + invocation level) where a "local a" command has been given, the "a" + macro is global to that environment, but is not visible outside it. + + LET is equivalent to the Kermit LOCAL command, followed by the + corresponding EVALUATE: + + (let a (+ 1 2)) + + is equivalent to: + + local a + evaluate a 1 + 2 + + Again, "local" in this context applies to the Kermit macro invocation + stack, not to the S-Expression nesting level. To illustrate, recall our + "newarea" macro: + +def newarea { + (let a \%1 b \%2 c \%3) + (let s (/ (+ a b c) 2.0)) + (sqrt (* s (- s a) (- s b) (- s c))) +} + + Because SETQ and LET expressions return a value, they can be placed + within a larger S-Expression. In this case we can replace the first + reference to the "s" variable by its defining expression: + +def newarea { + (let a \%1 b \%2 c \%3) + (sqrt (* (let s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c))) +} + + This would not work if LET were local to the S-Expression, but it works + nicely in the context of Kermit macros. The previous definition is + equivalent to: + +def newarea { + local a b c s + (setq a \%1 b \%2 c \%3) + (sqrt (* (setq s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c))) +} + + In both cases, the variables a, b, c, and s are local to the "newarea" + macro, and global within it. + + Multiple assignments can be handled in several ways. Here is the + obvious way to initialize a series of variables to the same value: + + (setq a 0) + (setq b 0) + (setq c 0) + (setq s 0) + + Here is a more compact and efficient way of doing the same thing: + + (setq a 0 b 0 c 0 s 0) + + However, in case the value was more complex, it's better to put only + one copy of it in the S-Expression; in this case we rely on the fact + that SETQ returns the value of its last assignment: + + (setq a (setq b (setq c (setq s (* x (^ y 2)))))) + + Similarly, to set a series of variables to x, x+1, x+2, ... + + (setq c (+ (setq b (+ (setq a (+ (setq s x) 1)) 1)) 1)) + + In the last example, you can see why "last" does not always correspond + to "rightmost" (the leftmost variable "c" is assigned last). + + If you are working with backslash variables like \%a or array elements + like \&a[1], remember two rules: + 1. Don't put spaces inside array brackets. + 2. You must double the backslash when using SETQ, LET, ++, or -- to + assign a value to a backslash variable. + + Examples of assigning to a backslash variable: + + (setq x 1) + (setq \\%a 0) + (setq \\&a[x+1] 1) + (++ \\%x) + (-- \\&a[x+2]) + + Examples of referring to a backslash variable's value: + + (setq a (+ \%a 1)) + (setq b (+ \%a \&a[1])) + (++ a \%x) + (-- b \&a[1]) + + The special notation is required because all backslashed items (\%x + variables, array elements, built-in \v(xxx) variables, and \fxxx() + function invocations) are evaluated in a single pass BEFORE the + S-Expression is executed; any other approach would result in + unacceptable performance. So, for example, in: + + declare \&a[] = 1 2 3 + define \%x 4 + define \%y 0 + (setq \\%y (+ \%x \&a[1])) + + the S-Expression becomes: + + (setq \%y (+ 4 1)) + + before it is sent to the S-Expression evaluator. If the backslash had + not been doubled on the assignment target, the result would have been: + + (setq 0 (+ 4 1)) + + which is illegal because you can't assign a value to a number. + Conversely, if backslashes were doubled on right-hand-side values: + + (setq \\%y (+ \\%x \\&a[1]) + + this too, would give an error (not numeric - "\%x"). + + If you omit the double backslash in the assignment target, the result + depends on whether the variable already has a value: + + (setq \%a (* 3 3)) + + If \%a has a non-numeric single-word value, then this becomes the name + of the variable that is assigned by SETQ. To illustrate: + + define \%a foo + echo \%a + foo + (setq \%a (* 3 3)) + echo \%a + foo + show macro foo + foo = 9 + + If \%a has no value, a numeric value, or a multiword value, an "invalid + assignment" error occurs. + + [ [526]Top ] [ [527]Contents ] [ [528]C-Kermit Home ] [ [529]Kermit + Home ] + +9.7. Conditional Expressions + + The IF operator provides a compact form of decision-making within + S-Expressions. An IF expression can stand wherever a number might + stand, as long is it returns a number. Here's a quick way to obtain the + average value of all the elements in an array that contains only + numbers: + + (/ (+ \fjoin(&a)) (float \fdim(&a))) + + This results in a "Divide by zero" error if the array is empty. If you + want to define the average value of an empty array to be 0 instead of + getting an error, you can use IF to check the array size: + + (if \fdim(&a) (/ (+ \fjoin(&a)) (float \fdim(&a))) 0) + + or equivalently: + + (if (not \fdim(&a)) 0 (/ (+ \fjoin(&a)) (float \fdim(&a)))) + + Of course, IF can fit anywhere else into an S-Expression: + + (setq a (+ b (if (< c 0) 0 c))) + + and the IF expression can be as complex as you like: + + (setq a (+ b (if (and (or (> x 0) (> y 0)) (< c 0) (> d 1) (!= e 0)) 1 0))) + + and the "then" and "else" parts can contain multiple S-Expressions + enclosed within (EVAL ...): + + (if x (eval (...) (...) (...)) (eval (...) (...) (...))) + + AND and OR operators are guaranteed to "short circuit". If any operand + of AND is false, none of the subsequent operands is evaluated; + likewise, if an OR operand is true, no further operands are evaluated. + + Bear in mind that the S-Expression IF is not the same as Kermit IF; the + condition is only allowed to be an S-Expression or a variable or + number, not the whole list of possibilities you see when you type "if + ?" at the C-Kermit> prompt. But keep reading... + + [ [530]Top ] [ [531]Contents ] [ [532]C-Kermit Home ] [ [533]Kermit + Home ] + +9.8. Extensibility + + To extend the capabilities of S-Expressions, you can use Kermit macro + names as operators, with the following limitations: + + * The macro must not have the same name as a built-in operator. + * You must use the full macro name, not an abbreviation. + + And with the following enhancement: + + * If the last statement executed by the macro is an S-Expression, its + value is returned automatically. In other words: + + define bump (++ \%1) + + is equivalent to: + + define bump return \fsexpression(++ \%1) + + Here's an example in which we define a FIBONACCI operator that returns + the nth element, n >= 0, of the Fibonacci series, 0 1 1 2 3 5 8 13 21 + 34 55, . . ., in which the first element is 0, the second is 1, and + each subsequent element is the sum of the two before it. This series + was devised by Leonardo Pisano, Filius Bonacci (Fibonacci for short) in + 1202 to describe how fast rabbits can breed, and also forms the basis + for the Golden Mean, the branching behavior of plants, the spiral of a + nautilus shell, etc. (Thanks to [534]Dat Thuc Nguyen for December 2003 + corrections to this section!) + + We can write a FIBONACCI function as a macro easily with S-Expressions: + + define FIBONACCI { + (if (== \%1 0) 0 + (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))) + } + + You can read this as: + + If the argument (\%1) is 0, return a result of 0; if it is 1, + return 1; otherwise: + return the sum of fibonacci(argument - 2) and fibonacci(argument - + 1) + + Note that a RETURN statement is not needed, since S-Expressions + automatically set the return value of their containing macros. + + For comparison, here's how it would be coded without S-Expressions: + + define FIBONACCI { + if == \%1 0 { + return 0 + } else if == \%1 1 { + return 1 + } else { + return \feval(\fexec(fibonacci \feval(\%1-2)) - + + \fexec(fibonacci \feval(\%1-1))) + } + } + + Now we can use the FIBONACCI function (whichever way you write it) just + as if it were a built-in operator: + + (fibonacci 6) + + Or: + + (setq a 10) + (fibonacci a) + + Within S-Expressions only (not outside them), S-Expressions themselves + can be used as macro arguments: + + (setq a 2 b 4) + (setq x (fibonacci (* a b ))) + + The value of the S-Expression (in this case "8"), and not the + S-Expression itself, is sent to the macro. + + Your macro is responsible for argument validation and error handling. A + robust Fibonacci macro would be more like this: + + define FIBONACCI { + if < \v(argc) 2 end 1 ?\%0: Missing argument + if > \v(argc) 2 end 1 ?\%0: Too many arguments + if not integer \%1 end 1 ?\%0: Integers only + if < \%1 1 end 1 ?\%0: Argument out of range + (if (== \%1 0) 0 + (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))) + } + + Recall that "END nonzero-number [ message ]" causes a macro invocation + to fail. When the macro is the operator in an S-Expression, this makes + the S-Expression fail too. Also note that our Fibonacci macro is just + an illustration, not a practical example. Since it is recursive (calls + itself), it won't work for large arguments because the call stack can + exceed available memory. See [535]Section 9.9.2 for a practical + alternative. + + Kermit macros, when used as S-Expression operators, can do anything at + all except initiate file transfers: they can print messages on the + screen, read and write files, interact with the user, and so on. For + example, here's a macro ASKME that asks you to enter a number, makes + sure that you did, and then returns its value for use in the + S-Expression: + + define ASKME { + local \%n + while true { + ask \%n { Number: } + if not def \%n continue + if not numeric \%n { + echo Not numeric - "\%n" + continue + } + break + } + return \%n + } + (setq a (* 2 (askme))) ; Get number from user, double it, assign result to a. + + Here's a macro you can use to validate that a number is in a given + range: + + define inrange { + if != \v(argc) 4 end 1 ?\%0: Wrong number of arguments + if ( < \%1 \%2 || > \%1 \%3 ) return 0 + return 1 + } + + The first argument is the number to be checked, the second is the + minimum acceptable value, the third is the maximum. You can use this + (for example) in IF conditions: + + define yes echo \%1 IS OK + define no echo \%1 IS NOT OK + + (setq a -1 b 999) + (if (inrange a 0 100) (yes a) (no a)) + (if (inrange b -1000 +1000) (yes b) (no b)) + + This is just an illustration, of course; there's already a built-in + operator to let you do range checking without help from macros: + + (if (<= 0 a 100) (yes a) (no a)) + (if (<= -1000 b +1000) (yes b) (no b)) + + To send string parameters to a macro, some kind of quoting is required + to tell the S-Expression parser to take a given "word" literally rather + than replacing it by its value. For this we use the Lisp QUOTE + operator: + + define length return \flength(\%1) + (length (quote abcdefghijklmnopqrstuvwxyz)) + 26 + + This causes the string "abcdefghijklmnopqrstuvwxyz" to be sent + literally to the LENGTH macro. Kermit, like Lisp, also offers a + shortcut for QUOTE, that lets us quote a word by prefixing it with a + single quote (') character, also called apostophe (ASCII 39): + + (length 'abcdefghijklmnopqrstuvwxyz) + 26 + + The two forms are equivalent. + + How the macro treats its arguments is up to the macro. In the example + above, the argument is treated as a literal string. However, it can + also be treated as a variable name: + + define string This is a string + define length return \flength(\m(\%1)) + (length 'string) + 16 + + Note the construct \m(\%1). This means "the value of the macro whose + name is the value of + \%1". The value of \%1 in this case is the word "string", and the value + of the macro whose name is "string" is "This is a string". + + What if the macro takes multiple arguments, or a variable number of + them? Here's a simple macro that prints a phrase that includes its + arguments: + + define complain echo It's too \%*! + + (Recall that \%* means "all arguments".) + + It can be called in the traditional way: + + complain hot Result: "It's too hot!" + complain cold and wet Result: "It's too cold and wet!" + + Or from an S-Expression if you quote the arguments: + + (complain 'hot) Result: "It's too hot!" + (complain 'cold 'and 'wet) Result: "It's too cold and wet!" + + To group multiple words into a single argument, use parentheses: + + (complain (quote (cold and wet))) Result: "It's too cold and wet!" + (complain '(cold and wet)) Result: "It's too cold and wet!" + + Note the difference: + + (complain 'cold 'and 'wet) Three arguments + (complain '(cold and wet)) One argument + + Since the COMPLAIN macro uses \%* to refer to all its arguments, no + matter how many, it doesn't care which form you use. But it makes a + difference in cases where the macro refers to its arguments + individually. + + To illustrate, let's consider a macro that receives the name of a macro + and its argument list and executes it with its arguments, without + knowing how many arguments there are. The following LOOP macro is used + to execute the given macro with the given argument list the requested + number of times: + + def loop { local i, for i 1 \%1 1 do \%2 \%3 } + + Within the LOOP macro, the first argument (\%1) is the loop count, \%2 + is the macro name, and \%3 is the argument list. When the LOOP macro is + invoked traditionally like this: + + loop 3 complain hot + + it prints "It's too hot!" three times. To invoke it from an + S-Expression, you must quote both the macro name as well as the + argument, since in this case the macro name itself is an argument: + + (loop 3 'complain 'hot) + + Now what if you need to send different or variable numbers of arguments + to the LOOP macro? The LOOP macro can handle it already, provided you + group the arguments into LOOP's third argument (\%3). In Kermit syntax, + without grouping: + + loop 3 complain cold and wet + + prints "It's too cold!" three times ("and wet" is lost); but with + grouping (either of the following two forms): + + loop 3 complain {cold and wet} + loop 3 complain "cold and wet" + + the LOOP macro prints "It's too cold and wet!" three times as desired. + + To do the same thing in an S-Expression, just use the Lisp forms of + quoting instead of the Kermit forms; the following two are equivalent: + + (loop 3 'complain (quote (cold and wet))) + (loop 3 'complain '(cold and wet)) + + Here's a similar example in which we write a macro that shows both the + name and the value of one or more other macros, whose names are given + as arguments (similar to "show macro"): + + define display { + local \%i + for \%i 1 \v(argc)-1 1 { + echo \&_[\%i] = \m(\&_[\%i]) + } + } + + (Recall that \&_[] is the macro's argument vector array, equivalent to + \%1, \%2, ...) The DISPLAY macro can be used in S-Expressions like + this: + + (setq a 1 b 2 c 3) + (display 'a 'b 'c 'd) + + which prints: + + a = 1 + b = 2 + c = 3 + d = + + The names must be quoted to prevent their evaluation before they are + sent to the macro. This ability to pass variables "by name" to macros, + rather than by value, lets you write macros that change the values of + argument variables. For example, here's a macro that doubles the value + of its argument variable: + + define double (++ \%1 \%1) + + which you can call like this: + + (setq a 12) + (double 'a) + + In the macro, \%1 is replace by the variable name "a"; "(++ a a)" adds + "a" to itself, and sets the value of "a" to the result. + + There are no built-in operators other than QUOTE, ', and STRING for + handling strings in S-Expressions, but using just these, plus macros + that use Kermit's regular string-handling features, you can easily + extend S-Expressions to do string manipulation: + + define len return \flen(\%1) Returns length of argument string + define cap return \fupper(\%1) Uppercase argument string + define rev return \freverse(\%1) Reverses argument string + define sub return \fsubstr(\%1,\%2,\%3) Returns substring of arg string + + (len '(this is a string)) Result: 16 + (rev '(this is a string)) Result: gnirts a si siht + (rev (cap '(this is a string))) Result: GNIRTS A SI SIHT + (sub (rev (cap '(this is a string))) 5 9) Result: TS A SI S + + You can assign a string to a macro name as follows: + + (setq foo '(this is a string)) + (setq foo (quote (this is a string))) + + The two are exactly equivalent. In both cases, the macro "foo" has the + value: + + '(this is a string) + + so when it is retrieved it can be identified as a string rather than a + number or commands to be executed. Thus: + + (setq foo (quote (this is a string))) + show macro foo + foo = '(this is a string) + (foo) + this is a string + + Note the different results for "show macro foo" and "(foo)". The former + shows the internal definition; the latter evaluates the variable, which + removes the quoting. And perhaps more important, note that if the + apostrophe and surrounding parentheses were not stored as part of the + definition, (foo) would try to execute "this is a string" as a command. + + Given the assignment above, the following work as expected: + + (len foo) Result: 16 + (rev foo) Result: gnirts a si siht + (rev (cap foo)) Result: GNIRTS A SI SIHT + (sub (rev (cap foo)) 5 8) Result: TS A SI S + + Note that, unlike built-in S-Expression operators that return numbers + or truth values, these operators return strings. If you want to assign + their return values to other variables, you can do so: + + (setq bar (rev (cap foo))) Result: GNIRTS A SI SIHT + + But now the S-Expression processor doesn't know the value of "bar" is + supposed to be a string, rather than a macro to execute. For this you + need one final special operator, STRING. The STRING operator takes an + S-Expression as an operand, evaluates it, and then returns its value + enclosed in '(), so you can use the value as a string is subsequent + S-Expressions. Use STRING for referencing macros that return strings: + + (setq bar (string (rev (cap foo)))) Result: '(GNIRTS A SI SIHT) + + STRING is like QUOTE, except that it evaluates its operand before + applying the quoting, rather than taking the operand literally. + + To reference backslash variables or functions that return string + values, you must use the regular quoting mechanisms: + + (setq time '(\v(time))) + (setq date '(\v(date))) + assign \%r this is a string + (setq s1 '(\%r)) + + That's because backslash items are evaluated BEFORE the S-Expression + parser ever sees them, and the values of \v(time) and so on are not + valid S-Expressions, so STRING won't like them. + + Finally a brief word on the touchy topic of quoting. Suppose you want + to include (say) literal parentheses in a string that will later be + processed by the S-Expression reader (or \fsplit() or \fword()). + Normally, you can't do this because parentheses are meaningful in these + contexts. To defeat the normal parsing rules, you can quote the + parentheses with backslash. However, due to the many levels of string + processing involved, a surprisingly large amount of backslashes might + be required, for example: + + (setq s '(a b (c d) \\\\\\\\\\\\\\\\(e f (g h) x\\\\\\\\\\\\\\\\) j k)) + + This is nearly impossible to explain(*). Instead, just remember two + points: + + * In situations like this, it's better to use DEFINE to create the + string, rather than SETQ. The example above requires only double + backslashes when DEFINE is used: + define s '(a b (c d) \\(e f (g h) x\\) j k) + + * The level of quoting depends on how many levels of evaluation the + string must pass through, which is not always obvious. However, the + number of backslashes required in any given situation is always a + power of 2. So if 1 doesn't work, try 2; if 2 doesn't work, try 4; + if 4 doesn't work, try 8, 16, 32, and so on. + + Considerations like this apply in any scripting language (shell, Tcl, + Perl, Python, etc). The situation is known as "Quoting Hell". + + (*) If you really want an explanation, here it is: + + * Every SEXP has its backslash items evaluated in a single pass at + top level before being passed to the SEXP reader, so \%1, + \v(ftime), etc, can be evaluated up front, freeing the SEXP reader + of having to know about such things, which in turn makes it much + more efficient. Therefore one level of quoting is lost right away, + and therefore you must double each backslash that is to be used as + a quote. + * When the SEXP reader sees '\', it treats it as a quote; discards it + and keeps the next character. Thus '\\' becomes '\'. This would be + the end of it, except that: + * The SEXP reader must call itself recursively on its operands, so we + must double any quotes in the operands: 2^2 = 4. + * If the result is to be passed as an argument to a macro, the + backslashes must again be doubled, because the macro processor + evaluates the arguments before sending them to the macro: 2^3 = 8. + * If the macro itself is to see the quotes, rather than just the + result of the quoting, the quotes must be doubled again: 2^4 = 16. + + Moral: To create string constants in which grouping characters must be + quoted, use DEFINE rather than SETQ. + + [ [536]Top ] [ [537]Contents ] [ [538]C-Kermit Home ] [ [539]Kermit + Home ] + +9.9. Examples + +9.9.1. Statistics + + The following program computes statistics -- means, maxima, mimima, + variance, standard deviation, and correlation -- from data stored in + parallel arrays, \&x[] and \&y[], which can contain any mixture of + integer and floating-point numbers: positive, negative, or zero. Array + setup and validation are not shown. Except for the traditional FOR loop + and printing the results at the end, the entire computation is done + with S-Expressions: + +; Initialize sums, maxima, minima, and number of elements + + (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0) + (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1])) + (setq n \fdim(&x)) + +; Loop through elements and accumulate sums, maxima, and minima + + for i 1 n 1 { + (setq x \&x[i] y \&y[i]) ; Notational convenience + (setq xmax (max xmax x) ymax (max ymax y)) ; X and Y maxima + (setq xmin (min xmin x) ymin (min ymin y)) ; X and Y minima + (++ xsum x ysum y) ; X and Y sums + (++ xsum2 (^ x 2) ysum2 (^ y 2)) ; Sum of X and Y squares + (++ xysum (* x y)) ; Sum of XY products + } + +; Calculate results + + (setq xmean (/ xsum n) ymean (/ ysum n)) ; Mean X and Y + (setq xss (- xsum2 (/ (^ xsum 2) n))) ; Intermediate values + (setq yss (- ysum2 (/ (^ ysum 2) n))) + (setq xyss (- xysum (/ (* xsum ysum) n))) + (setq xvar (/ xss n) yvar (/ yss n)) ; X and Y variance + (setq sdx (sqrt xvar) sdy (sqrt yvar)) ; Std deviation in X and Y + (setq tmp (* xss yss)) + (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0)) ; Correlation coefficient + show macro xmean ymean xvar yvar sdx sdy cc ; Print the results + + The final "if tmp" check accounts for the possibility that both arrays + contain all 0's. Results can also be printed with "echo CC = \m(cc)", + or any other desired way. Interestingly, if we had not needed the sum + of the squares and products, we could have obtained the sums, maxima, + and minima of the X's and Y's without a loop like this: + + (setq xsum (+ \fjoin(&x)) ysum (+ \fjoin(&y))) + (setq xmax (max \fjoin(&x)) ymax (max \fjoin(&y))) + (setq xmin (min \fjoin(&x)) ymin (min \fjoin(&y))) + + Any Kermit function that returns numbers or lists of numbers can be + included in an S-Expression as an operand. + +9.9.2. Practical Fibonacci Series + + The recursive Fibonacci example given previously is simple and elegant, + but not very useful since it causes memory occupation to grow each time + it calls itself, until eventually both physical memory and disk swap + space are filled and the program crashes. Even for small arguments, + like 17, execution time can be prohibitive: + + (setq t1 \v(ftime)) + (setq result (fibonacci 17)) + (setq t2 (- \v(ftime) t1)) + echo FIBONACCI(17) = \m(result): TIME = \ffpround(t2,3) + + prints (on a certain rather slow computer): + + FIBONACCI(17) = 1597: TIME = 5.861 + + Any recursive function can be recoded iteratively. The result is not as + pretty, but execution is far less expensive: + + define FIBITER { + (if (== \%3 0) (\%2) (fibiter (+ \%1 \%2) \%1 (- \%3 1))) + } + define FIBONACCI { + (fibiter 1 0 \%1) + } + + Here's the result on the same computer for the same argument of 17: + + FIBONACCI(17) = 1597: TIME = 0.015 + + (47 times faster.) Execution time increases proportionally to the size + of the argument in the iterative case, whereas in the recursive case it + goes up geometrically, quickly reaching infinity. + + [ [540]Top ] [ [541]Contents ] [ [542]C-Kermit Home ] [ [543]Kermit + Home ] + +9.10. Differences from Algebraic Notation + + In C-Kermit: + + * Algebraic notation uses infix operators and normal rules of + operator precedence, with parentheses used to force exceptions to + the rules; many operations can be included in an expression. + S-Expressions use prefix operators with no intrinsic precedence; + each operation is enclosed in parentheses, and the arrangement of + parentheses determines precedence. + * Algebraic infix operators require two operands; S-Expression prefix + operators can accept a variable number of operands. + * You can use algebraic notation anywhere that C-Kermit accepts a + number, e.g. "echo \&a[((1+1)*2-1]", but you can use S-Expressions + only as top-level commands. You can, however, use either algebraic + or S-Expressions anywhere at all by enclosing them in \fevaluate() + or \fsexpression(), respectively. + * You can use any mixture of integer and floating-point numbers in + S-Expressions, but only integers are permitted in algebraic + expressions. Outside of S-Expressions, floating point arithmetic is + supported only by \ffp...() function calls. + * Operators and operands in S-Expressions must be separated by + spaces, e.g. "(+ a b)". Spaces are not required in algebraic + expressions: "((a+b)*c)". + * When assigning values to backslash variables (such as \%x or + \&a[2]) using SETQ or LET, you must double the backslash. + + [ [544]Top ] [ [545]Contents ] [ [546]C-Kermit Home ] [ [547]Kermit + Home ] + +9.11. Differences from Lisp + + * Kermit has a lot of built-in operators not found in Lisp: ++, ^, + etc. + * Most dialects of real Lisp do not allow S-Expressions that don't + start with an operator, for example: + (a) + + This expression can cause an error in Lisp (even if "a" has a + value), but is acceptable in Kermit, where it returns the value of + the variable "a". Similarly, (1) returns the value "1". + * In real Lisp, EVAL requires exactly one operand. In Kermit, it can + have 0, 1, 2, or more operands. It returns the value of the last + operand evaluated. + * Real Lisp SETQ and LET usually require an even number of operands. + Kermit allows an odd number, in which case the last (or only) + variable is undefined (i.e. deleted, destroyed). + * Kermit does not support ratios such as "7/8". Some Lisp dialects + accept ratios as numbers, and generate ratios when told to divide + two integers whose quotient is not a whole number; e.g. in Common + Lisp: + [13] USER(37): (/ (+ 1 2 3 4) 3) + 10/3 + [13] USER(38): + + * The result of (/ 10 3) is 3.333.... Some Lisp dialects truncate the + result to 3 since both operands are integers, some don't; some give + the result as a ratio. C-Kermit always gives a floating point + result when there is a fractional part. If you want an integer + result, you can use TRUNCATE, FLOOR, or CEILING, e.g. (truncate (/ + 10 3)). + * There is currently no "bignum" support. Large numbers can be used + and large results generated, but (as noted in [548]Section 9.2) + they are accurate only to the precision of the underlying machine. + \v(math_precision) gives the machine precision as a number of + decimal digits, e.g. 16. + * Scientific notation for floating-point numbers is not supported. If + the magnitude of a number is greater than the precision of the + underlying hardware, the less-significant digits are shown but + their values are meaningless. If it the number is too small to be + represented internally, it is shown as "0.0". + * Many Lisp features are omitted: List processing (CAR, CDR, etc), + DEFUN, Lisp-specific control structures, and so on. + + [ [549]Top ] [ [550]Contents ] [ [551]C-Kermit Home ] [ [552]Kermit + Home ] + +10. FILE TRANSFER + + New commands and switches: + + SET TRANSFER REPORT { OFF, ON } + Enables or disables the (new) one-line message printed by Kermit + after a remote-mode file transfer to indicate the source and + destination file, complete with path, to let you know where the + file went. + + SEND /TYPE:{TEXT,BINARY} + Sends only files of the given type (see [553]Section 4). + + SEND /NOFOLLOWLINKS: + (UNIX only) Skip over symbolic links rather than following them + (default). This applies to wildcard and/or recursive SENDs; if a + single filename is given, and it happens to be a symbolic link, + the file it points to is sent. + + SEND /FOLLOWLINKS: + (UNIX only) Follow (resolve) symbolic links. Watch out for + circular links, endless loops, etc. + + SET SEND I-PACKETS { OFF, ON } + When sending commands to a Kermit server, this tells whether + command packets should be preceded by an I (information) packet, + which is used to synchronize parameters prior to executing the + command. Normally ON. The only reason to set this OFF is for + communicating with buggy Kermit servers that misbehave when an I + packet is sent to them. There is also a SET RECEIVE I-PACKETS + command, but presently it has no effect. + + SET TRANSFER MESSAGE [ text ] + Sets an initial message to be shown in the Last Message field of + the fullscreen file-transfer display. + + SET TRANSFER TRANSLATION { ON, OFF } + Inhibits or re-enables text-file transfer character-set + translation globally. + + { SEND, MSEND, GET, RECEIVE } /TRANSPARENT + Inhibits character-set translation for this transfer only. + + { GET, RECEIVE } /PIPES:{ON,OFF} + Overrides global TRANSFER PIPES setting for this transfer only; + ON allows incoming files with names like "!tar xf -" to be + opened as pipelines rather than regular files. + + The following new "hot keys" are available when Kermit's file-transfer + display is visible: + + D: Turn on debugging, open "debug.log" if not already open. + d: Turn off debugging but leave log open (if it was open). + T: Turn on debug-log timestamps. + t: Turn off debug-log timestamps. + + Other improvements: + * SET FILE DOWNLOAD-DIRECTORY now works for external protocols (e.g. + sz/rz) too. + * Improved automatic per-file text/binary switching, described in + [554]Section 4. + * When sending a file group (e.g. "send *.*"), failure to open a file + is no longer fatal; now C-Kermit simply goes ahead to the next + file. + * Transaction log entries are now made for external protocols too. + + [ [555]Top ] [ [556]Contents ] [ [557]C-Kermit Home ] [ [558]Kermit + Home ] + +11. MODEMS AND DIALING + + In C-Kermit 8.0, the default modem type for dialing has changed from + NONE (= DIRECT, meaning no modem) to GENERIC. This change should have + no impact on direct connections. For dialing, it means that, unless you + SET MODEM TYPE to a specific type, such as USROBOTICS or CONEXANT, + Kermit assumes: + + 1. The modem uses the Hayes AT command set. + 2. The modem supports error correction, data compression, and hardware + flow control and is already configured to use them. + + In fact, Kermit assumes the modem is completely configured, and + therefore does not send it an initialization string or any + configuration commands. Instead, it sends only the simplest and most + portable commands: + + ATQ0V1 Give dial result codes. + ATDTnumber Dial the number. + + (or ATD or ATDP, as appropriate). + + The new defaults work for direct connections and for most modern modems + on most platforms, and they work much faster than "full-treatment" + dialing. If the new defaults don't work for you, or if you need to + perform explicit modem configuations or interactions, then set a + specific modem type and use the SET MODEM and SET DIAL commands as + documented in Using C-Kermit. + + WARNING: Don't use the generic modem on hosts that do not support + RTS/CTS flow control. If Xon/Xoff is in use on the serial port, + you'll need to select a particular modem type so Kermit knows what + command to give it to enable Xon/Xoff flow control between itself + and your serial port. + + The following new modem types were added in C-Kermit 8.0: + + lucent: Lucent Venus chipset + pctel: PCTel V.90 chipset + conexant: Conexant (ex-Rockwell) modem family + zoom-v32bis: New name for "Zoom" + zoom-v34 Zoom V.34 + zoom-v90 Zoom V.90 56K + zoom-v92: Zoom V.92 with V.44 data compression + zoltrix-v34: New name for "zoltrix" + zoltrix-hsp-v90: Synonym for PCTel + zoltrix-hcf-v90: Synonym for ITU-T-V250 + smartlink-v90: Synonym for usrobotics (same chipset) + acer-v90: Synonym for Rockwell-v90 + + New DIAL-related variables: + + \v(dm_hf): Dial modifier: Wait for Hook-Flash. + \v(dm_wb): Dial modifier: Wait for Bong. + + Finally, if dialing fails, Kermit now prints a context-sensitive hint + suggesting possible reasons and remedies. + + Added in C-Kermit 8.0.201: Rudimentary support for Caller ID, for use + with the ANSWER command. If the modem reports Caller ID information, + Kermit stores it in variables that you can access after the call is + answered: + + \v(callid_date) The date of the call + \v(callid_time) The time of the call + \v(callid_name) The name of the caller + \v(callid_nmbr) The telephone number of the caller + \v(callid_mesg) A message + + The format of these items depends on the originating and answering + phone companies and the modems and their configuration. + + Not very many modems support Caller ID, and those that do (a) tend to + have it disabled by default, and (b) use different commands to enable + it. A quick survey shows of some current models shows: + + - USR V.90: No + - ITU-T V.250: No + - Lucent Venus: No + - Diamond Supra: #CID=1 + - Rockwell 56K: #CID=1 + - PCTEL: #CID=1 + - Zoltrix: +VCID=1 + - Conexant: +VCID=1 + + To use Kermit's Caller ID feature, you have to set the modem to wait + for at least two rings before answering, and you have to give the + command to enable Caller ID; for example (after choosing a modem with + SET MODEM TYPE): + + set modem command autoanswer on ATS0=2#CID=1\{13} + set modem command autoanswer on ATS0=2+VCID=1\{13} + + These commands can be undone with: + + set modem command autoanswer on ATS0=1#CID=0\{13} + set modem command autoanswer on ATS0=1+VCID=0\{13} + + Kermit presently has no built-in knowledge of the Caller ID + capabilities or commands of the modems in its database. + + Since the variables can be accessed only after the call is answered, + the only way to refuse a call is to answer it, inspect the variables, + and then hang it up if desired. + + [ [559]Top ] [ [560]Contents ] [ [561]C-Kermit Home ] [ [562]Kermit + Home ] + +12. TERMINAL CONNECTION + + Now that 7-bit connections are no longer the norm, the default terminal + bytesize (also called "data size" or "word size") in C-Kermit 8.0 is 8 + bits, rather than 7 bits as it was in C-Kermit 7.0 and earlier: + + SET ESCAPE character + This command, which specifies your CONNECT-mode escape + character, allows you to specify any ASCII control character in + a variety of formats. C-Kermit 8.0.201 now also lets you specify + any 8-bit value, 128-255, as the escape character. In the SET + ESCAPE command, you can type the 8-bit character literally or + you can enter its numeric code. Here are examples that you can + enter from a terminal or console that uses the ISO Latin-1 + character set: + + C-Kermit> set escape à + C-Kermit> set escape 195 + C-Kermit> show escape + Escape character: Code 195 (Ã): enabled + C-Kermit> + + Both of these commands set the escape character value to 195 + (decimal), which happens to be uppercase letter A with Tilde in + Latin-1. SHOW ESCAPE and SHOW TERMINAL show the value, as does + the CONNECT message. + + SET TERMINAL AUTODOWNLOAD ERROR { STOP, CONTINUE } + When Kermit has a terminal connection to another computer, and a + file transfer is initiated automatically because a Kermit packet + was received in CONNECT mode (i.e. in the terminal screen), this + command tells what Kermit should do if the transfer fails. The + default is to STOP, which leaves Kermit in command mode with its + file-transfer display showing, so you can see that the transfer + failed and why. If you SET TERMINAL AUTODOWNLOAD ERROR CONTINUE, + this causes Kermit to return automatically to its terminal + screen (i.e. resume its CONNECT session) as if the transfer had + succeeded; this can be desirable if the entire session is under + control of a host-based script. + + SET TERMINAL BYTESIZE { 7, 8 } + The byte size to use during CONNECT and INPUT command execution, + which can be more restrictive than the bytesize implied by the + current PARITY setting, but not less restrictive. In C-Kermit + 7.0 and earlier, the terminal bytesize was 7 by default to + protect against the likelihood that parity was in use on the + connection without the user's knowledge. When the terminal + bytesize is 8 (as it is in C-Kermit 8.0 and later), the user + will see garbage in this (increasingly unlikely) situation. Note + that 8 data bits are required for most character sets other than + ASCII: Latin-1, UTF-8, and so on. + + A new command has been added to produce timestamped session logs: + + SET TERMINAL SESSION-LOG TIMESTAMPED-TEXT + Records the terminal session in text mode (like SET TERMINAL + SESSION-LOG TEXT) but adds a timestamp at the beginning of each + line. The timestamp format is hh:mm:ss.nnn, and indicates the + time at which the first character of the line appeared. + + In most UNIX versions (those built with the select()-capable CONNECT + module -- pretty much all the ones that have or could have TELNET + included), an idle timeout feature has been added: + + SET TERMINAL IDLE-TIMEOUT number + If the number is not 0, then Kermit is to take an action when + the given amount of time passes with no activity during CONNECT + mode. If the number is positive it is the maximum number of idle + seconds; if number is negative it represents milliseconds + (thousandths of seconds). If 0 is given as the number, there are + no idle timeouts. Synonym: SET TERMINAL IDLE-LIMIT. + + SET TERMINAL IDLE-ACTION { RETURN, HANGUP, EXIT, OUTPUT [ string ] } + The action to be taken upon an idle timeout in CONNECT mode. + RETURN to the prompt, HANGUP the connection, EXIT from Kermit, + or OUTPUT the given string (if no string is given, a NUL (ASCII + 0) character is sent). + + SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT } + Actions that can be selected on Telnet connections only, that + might be useful if idle limits are enforced by the Telnet server + or in the TCP/IP protocol: TELNET-NOP sends a "NO Operation" + (do-nothing) command, which causes no response from the server; + TELNET-AYT sends an "Are You There" message to the server, which + should make the server send back a message. Neither of these + actions interferes with your remote session. + + SET TERMINAL IDLE-ACTION is useful for connections to hosts or services + that automatically log you out after a certain amount of idle time, + e.g.: + + set term idle-timeout 300 + set term idle-action output \32 + + sends a space (as if you had pressed the space bar) every 300 seconds + (five minutes) while there is no activity (32 is the ASCII code for + space). + + When C-Kermit returns from CONNECT to command mode, the reason for the + transition is given in a new variable, \v(cx_status): + + 0 No CONNECT command given yet. + 1 User escaped back manually. + 2 A trigger string was encountered. + 3 IKSD entered server mode. + 4 Application Program Command received from host. + 5 Idle timeout. + 6 Telnet protocol error. + 7 Keystroke macro. + 8 Time limit exceeded. + 100 Internal error. + 101 Carrier required by not detected. + 102 I/O error on connection. + 103 Disconnected by host. + 104 Disconnected by user. + 105 Session limit exceeded. + 106 Rejected due to Telnet policy. + 107 Received kill signal. + + Values 100 and above indicate there is no connection. + + [ [563]Top ] [ [564]Contents ] [ [565]C-Kermit Home ] [ [566]Kermit + Home ] + +13. CHARACTER SETS + + See the section on [567]file scanning above, and the section on + character-set conversion in [568]FTP. Also: + + * True support for CP1252 (rather than treating it as Latin-1). + * Proper handling of C1 values when converting ISO 8-bit text to + UTF-8. + * TYPE /CHARACTER-SET: /TRANSLATE-TO: allows specific translations. + * The TRANSLATE command now works on multiple files. + * K_CHARSET environment variable to set the file character-set. + * SET TRANSFER TRANSLATION OFF. + * FTP client character-set translation ([569]Section 3.7). + + [ [570]Top ] [ [571]Contents ] [ [572]C-Kermit Home ] [ [573]Kermit + Home ] + +14. DIALOUT FROM TELNET TERMINAL SERVERS + + For years, C-Kermit has supported dialing out from Telnet modem servers + (also called reverse terminal servers or access servers), but until now + there was no way for Kermit to control the communication parameters + (speed, parity, etc) on the serial port of the terminal server; it had + to use whatever was there. + + But now, if you make a connection to a server that supports the Telnet + Com Port Control Option, [574]RFC 2217, you have the same degree of + control as you would have over a serial port on the computer where + Kermit is running: SET SPEED, SET FLOW, SET PARITY, SET STOP-BITS, SHOW + COMM, WAIT, SET CARRIER-WATCH, the modem-signal variables, sending + Break, and so on, apply to the connection between the terminal server + and the modem. + + For example, using a Cisco Access Server 2509, where specifying a TCP + port in the 6000's selects a serial port that can be used for dialing + out: + + set host xxx 6001 ; xxx is the IP hostname or address of the server + (log in if necessary) ; With a script or by hand + set modem type usr ; Tell Kermit what kind of modem it has + set speed 57600 ; This affects the server's port + set flow rts/cts ; Ditto + dial 7654321 + + The modem server might or might not require a login sequence. It might + also allow for automatic authentication, e.g. via Kerberos tickets. + NOTE: If the modem server requires a login sequence, then REDIAL might + not work as expected. + + When you have a Telnet Com Port connection, your SET SPEED and SET FLOW + options change automatically to reflect the capabilities of the server, + rather than those of your local computer. + + See the configuration manual for your server for additional + information. For example, how to set up the server to drop the Telnet + connection automatically when the telephone call is hung up (e.g. + "autohangup" on Cisco models). + + For a Linux-based Telnet Com-Port server, click the Srdird link: + + [ [575]Top ] [ [576]Contents ] [ [577]Sredird ] [ [578]C-Kermit Home ] + [ [579]Kermit Home ] + +15. COPING WITH BROKEN KERMIT PARTNERS + + There are lots of faulty Kermit protocol implementations out there, + found mainly in 3rd-party products ranging from communications software + packages to file-transfer functions imbedded within devices. This topic + is covered [580]HERE for C-Kermit 7.0, but C-Kermit 8.0 adds some + additional tricks. + + SET ATTRIBUTE RECORD-FORMAT { ON, OFF } + Allows control of the Kermit's Record-Format attribute. Set this + to OFF in case incoming file are refused due to unknown or + invalid record formats if you want to accept the file anyway. + + SET ATTRIBUTES OFF + This is not a new trick, but it was recently discovered that the + Kermit implementation embedded within a certain kind of + punching/bending machine (Salvagnini if you must know) hangs + upon reception of standard format Kermit attributes when + receiving files. When sending files, it sends attributes of its + own, one per A-packet, which is slightly unusual but legal. When + receiving files from C-Kermit, K95, MS-DOS Kermit, Kermit-370, + etc, it simply exits upon reception of the first A-packet; + apparently it was not coded according to the protocol + specification, which allows multiple attributes per A-packet. + Solution: tell the file sender to SET ATTRIBUTES OFF. + + SET SEND I-PACKETS { ON, OFF } + A Kermit server is supposed to accept I-packets; this is how the + client lets the server know its capabilities and preferences + before sending a command. Apparently there is at least one + Kermit server implementation that does not accept I-packets, and + does not properly respond with an Error packet if it gets one. + To get around such situations in C-Kermit 8.0, you can use SET + SEND I-PACKETS OFF to inhibit the sending of I packets. In this + case, the client must be able to adjust to the server's + configuration, rather than the other way around as we are used + to. + + SET PROTOCOL KERMIT {} {} {} + C-Kermit 6.0 and later automatically send "autoupload" and + "autodownload" commands when in local mode and you give a file + transfer command. For example, if you tell kermit to "send + oofa.txt", Kermit sends "kermit -r" and a carriage return, in + case you had forgotten to start Kermit on the far end and told + it to receive a file. If a Kermit program had already been + started on the far end, it should harmlessly absorb this string. + However, some Kermit programs violate the Kermit protocol + definition and treat such strings as Kermit packets even though + they are not. In such cases, give this command to set the Kermit + protocol autoupload and download strings to nothing, which tells + Kermit not to send them. (This is not a new feature, but it was + not previously included in the "Coping" section of the + documentation.) + + [ [581]Top ] [ [582]Contents ] [ [583]C-Kermit Home ] [ [584]Kermit + Home ] + +16. NEW COMMAND-LINE OPTIONS + + kermit -h Now prints a complete listing of its command-line options, + rather than an abbreviated list squeezed into a 24x80 space. + + -dd Debug, like -d but adds timestamps + --version Shows C-Kermit version number. + --noperms Equivalent to SET ATTRIBUTE PROTECTION OFF. + + Kermit now accepts a selection of URLs (Universal Resource Locators) as + its first command-line argument. These are: + + telnet:hostname + Makes a Telnet connection to the given host (IP hostname or + address). + + ftp://[user[:password]@]hostname[/path...] + Makes an FTP connection to the given host (IP hostname or + address). If a username is given, Kermit tries to log you in; if + a password is given, it is used; if not, you are prompted for + one. If no username is given, an anonymous login is performed. + If a pathname is included, Kermit tries to GET the given file. + See [585]Section 3.1.3 for details. + + ftps://[user[:password]@]hostname[/path...] + Makes a secure FTP connection over SSL. + + telnets://[user[:password]@]hostname + Makes a secure Telnet connection over SSL. + + kermit://[user[:password]@]hostname[/path...] + Makes a connection to an [586]Internet Kermit Server. + + http://[user[:password]@]hostname[/path...] + Makes a connection to Web server. + + https://[user[:password]@]hostname[/path...] + Makes a connection to secure Web server. + + [ [587]Top ] [ [588]Contents ] [ [589]C-Kermit Home ] [ [590]Kermit + Home ] + +17. LOGS + + In C-Kermit 8.0, we make an effort to keep passwords out of the debug + log. This can never be 100% effective, but it's better than before, + when there were no precautions at all. Whenever Kermit knows it's + prompting for, parsing, or transmitting a password, it temporarily + turns off logging and then turns it back on afterwards. This keeps the + debug log password-free in most common cases, but there can be no + guarantees. + + As noted elsewhere, the new "-dd" command-line option selects a + timestamped debug log (equivalent to "set debug timestamps on", "log + debug debug.log"). + + C-Kermit 8.0 also supports a new timestamped session log via "set + session-log timestamped-text", "log session". + + There have been requests for other kinds of logs, for example a command + log. These might be added at some point. One person wanted to be able + to log commands with timestamps, but only commands issued at the + prompt, not commands from files or macros, and also wanted a header + line at the beginning showing the date, user, and host. This can be + done as follows: + + .filename := \v(home)commands.log ; (for example) + fopen /write \%c \m(filename) + if success { + fwrite /line \%c \v(date): User=\v(user) Host=\v(host) + fclose \%c + set debug timestamps on + log debug {| grep "CMD(P)" >> \m(filename)} append + } + + [ [591]Top ] [ [592]Contents ] [ [593]C-Kermit Home ] [ [594]Kermit + Home ] + __________________________________________________________________ + + + C-Kermit 8.0 Update Notes / [595]The Kermit Project / Columbia + University / 15 Dec 2003 - 13 Sep 2010 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ckermit80.html#contents + 12. http://www.columbia.edu/kermit/ckermit.html + 13. http://www.columbia.edu/kermit/index.html + 14. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641 + 15. http://www.columbia.edu/kermit/ckermit80.html + 16. mailto:kermit-support@columbia.edu + 17. http://www.columbia.edu/kermit/ + 18. http://www.kermit-project.org/ + 19. http://www.columbia.nyc.ny.us/kermit/ + 20. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT + 21. ftp://kermit.columbia.edu/kermit/f/ckcmai.c + 22. http://www.columbia.edu/kermit/ckermit80.html#xv + 23. http://www.columbia.edu/kermit/ck60manual.html + 24. http://www.columbia.edu/kermit/ckermi70.html + 25. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt + 26. http://www.columbia.edu/kermit/ckututor.html + 27. ftp://kermit.columbia.edu/kermit/f/ckuker.nr + 28. http://www.columbia.edu/kermit/security.htm + 29. http://www.columbia.edu/kermit/telnet.htm + 30. http://www.columbia.edu/kermit/ftpscripts.html + 31. http://www.columbia.edu/kermit/ckcbwr.html + 32. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt + 33. http://www.columbia.edu/kermit/ckubwr.html + 34. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt + 35. http://www.columbia.edu/kermit/ckvbwr.html + 36. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt + 37. http://www.columbia.edu/kermit/ckuins.html + 38. ftp://kermit.columbia.edu/kermit/f/ckuins.txt + 39. http://www.columbia.edu/kermit/ckvins.html + 40. ftp://kermit.columbia.edu/kermit/f/ckvins.txt + 41. http://www.columbia.edu/kermit/ckccfg.html + 42. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt + 43. http://www.columbia.edu/kermit/ckcplm.html + 44. ftp://kermit.columbia.edu/kermit/f/ckcplm.txt + 45. http://www.columbia.edu/kermit/iksd.html + 46. http://www.columbia.edu/kermit/skermit.html + 47. http://www.columbia.edu/kermit/ckermit80.html#top + 48. http://www.columbia.edu/kermit/ckermit.html + 49. http://www.columbia.edu/kermit/index.html + 50. http://www.columbia.edu/kermit/ckermit80.html#x0 + 51. http://www.columbia.edu/kermit/ckermit80.html#x1 + 52. http://www.columbia.edu/kermit/ckermit80.html#x2 + 53. http://www.columbia.edu/kermit/ckermit80.html#x2.1 + 54. http://www.columbia.edu/kermit/ckermit80.html#x2.2 + 55. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1 + 56. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2 + 57. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3 + 58. http://www.columbia.edu/kermit/ckermit80.html#x2.2.4 + 59. http://www.columbia.edu/kermit/ckermit80.html#x2.2.5 + 60. http://www.columbia.edu/kermit/ckermit80.html#x2.2.6 + 61. http://www.columbia.edu/kermit/ckermit80.html#x3 + 62. http://www.columbia.edu/kermit/ckermit80.html#x3.1 + 63. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1 + 64. http://www.columbia.edu/kermit/ckermit80.html#x3.1.2 + 65. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3 + 66. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4 + 67. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 68. http://www.columbia.edu/kermit/ckermit80.html#x3.3 + 69. http://www.columbia.edu/kermit/ckermit80.html#x3.4 + 70. http://www.columbia.edu/kermit/ckermit80.html#x3.5 + 71. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1 + 72. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2 + 73. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3 + 74. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 75. http://www.columbia.edu/kermit/ckermit80.html#x3.6.1 + 76. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2 + 77. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3 + 78. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 79. http://www.columbia.edu/kermit/ckermit80.html#x3.7.1 + 80. http://www.columbia.edu/kermit/ckermit80.html#x3.7.2 + 81. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 82. http://www.columbia.edu/kermit/ckermit80.html#x3.9 + 83. http://www.columbia.edu/kermit/ckermit80.html#x3.10 + 84. http://www.columbia.edu/kermit/ckermit80.html#x3.10.1 + 85. http://www.columbia.edu/kermit/ckermit80.html#x3.10.2 + 86. http://www.columbia.edu/kermit/ckermit80.html#x3.10.3 + 87. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 88. http://www.columbia.edu/kermit/ckermit80.html#x4 + 89. http://www.columbia.edu/kermit/ckermit80.html#x5 + 90. http://www.columbia.edu/kermit/ckermit80.html#x6 + 91. http://www.columbia.edu/kermit/ckermit80.html#x6.1 + 92. http://www.columbia.edu/kermit/ckermit80.html#x6.2 + 93. http://www.columbia.edu/kermit/ckermit80.html#x6.3 + 94. http://www.columbia.edu/kermit/ckermit80.html#x6.4 + 95. http://www.columbia.edu/kermit/ckermit80.html#x6.5 + 96. http://www.columbia.edu/kermit/ckermit80.html#x6.6 + 97. http://www.columbia.edu/kermit/ckermit80.html#x7 + 98. http://www.columbia.edu/kermit/ckermit80.html#x8 + 99. http://www.columbia.edu/kermit/ckermit80.html#x8.1 + 100. http://www.columbia.edu/kermit/ckermit80.html#x8.2 + 101. http://www.columbia.edu/kermit/ckermit80.html#x8.3 + 102. http://www.columbia.edu/kermit/ckermit80.html#x8.4 + 103. http://www.columbia.edu/kermit/ckermit80.html#x8.5 + 104. http://www.columbia.edu/kermit/ckermit80.html#x8.6 + 105. http://www.columbia.edu/kermit/ckermit80.html#x8.7 + 106. http://www.columbia.edu/kermit/ckermit80.html#x8.8 + 107. http://www.columbia.edu/kermit/ckermit80.html#x8.9 + 108. http://www.columbia.edu/kermit/ckermit80.html#x8.10 + 109. http://www.columbia.edu/kermit/ckermit80.html#x8.11 + 110. http://www.columbia.edu/kermit/ckermit80.html#x8.12 + 111. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 112. http://www.columbia.edu/kermit/ckermit80.html#x8.14 + 113. http://www.columbia.edu/kermit/ckermit80.html#x9 + 114. http://www.columbia.edu/kermit/ckermit80.html#x9.1 + 115. http://www.columbia.edu/kermit/ckermit80.html#x9.2 + 116. http://www.columbia.edu/kermit/ckermit80.html#x9.3 + 117. http://www.columbia.edu/kermit/ckermit80.html#x9.4 + 118. http://www.columbia.edu/kermit/ckermit80.html#x9.5 + 119. http://www.columbia.edu/kermit/ckermit80.html#x9.6 + 120. http://www.columbia.edu/kermit/ckermit80.html#x9.7 + 121. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 122. http://www.columbia.edu/kermit/ckermit80.html#x9.9 + 123. http://www.columbia.edu/kermit/ckermit80.html#x9.10 + 124. http://www.columbia.edu/kermit/ckermit80.html#x9.11 + 125. http://www.columbia.edu/kermit/ckermit80.html#x10 + 126. http://www.columbia.edu/kermit/ckermit80.html#x11 + 127. http://www.columbia.edu/kermit/ckermit80.html#x12 + 128. http://www.columbia.edu/kermit/ckermit80.html#x13 + 129. http://www.columbia.edu/kermit/ckermit80.html#x14 + 130. http://www.columbia.edu/kermit/ckermit80.html#x15 + 131. http://www.columbia.edu/kermit/ckermit80.html#x16 + 132. http://www.columbia.edu/kermit/ckermit80.html#x17 + 133. http://www.columbia.edu/kermit/ckermit80.html#top + 134. http://www.columbia.edu/kermit/ckermit.html + 135. http://www.columbia.edu/kermit/index.html + 136. http://www.columbia.edu/kermit/ckuins.html#x5 + 137. http://www.columbia.edu/kermit/ckuins.html + 138. http://www.columbia.edu/kermit/ckermit80.html#x5 + 139. http://www.columbia.edu/kermit/ckermit80.html#x2.2 + 140. http://www.columbia.edu/kermit/ckermit80.html#contents + 141. http://www.columbia.edu/kermit/ckermit80.html#x15 + 142. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 143. http://www.columbia.edu/kermit/ckermit80.html#ftpdates + 144. http://www.columbia.edu/kermit/ckermit80.html#ftpcheck + 145. http://www.columbia.edu/kermit/ckermit80.html#ftpnamelist + 146. http://www.columbia.edu/kermit/ckermit80.html#srvrename + 147. http://www.columbia.edu/kermit/ckermit80.html#ftpvdir + 148. http://www.columbia.edu/kermit/ckermit80.html#setftptype + 149. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 150. http://www.columbia.edu/kermit/ckermit80.html#x15 + 151. http://www.columbia.edu/kermit/ckermit80.html#x8.7 + 152. http://www.columbia.edu/kermit/ckermit80.html#x2.1 + 153. http://www.columbia.edu/kermit/ckermit80.html#x2.2 + 154. http://www.columbia.edu/kermit/ckermit80.html#x8.14 + 155. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 156. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 157. http://www.columbia.edu/kermit/ckututor.html + 158. http://www.columbia.edu/kermit/ckuins.html + 159. http://www.columbia.edu/kermit/skermit.html + 160. http://www.columbia.edu/kermit/ckermit80.html#setlocus + 161. http://www.columbia.edu/kermit/ckermit80.html#lcommands + 162. http://www.columbia.edu/kermit/ckermit80.html#ftpuser + 163. http://www.columbia.edu/kermit/ckermit80.html#showvar + 164. http://www.columbia.edu/kermit/ckermit80.html#callerid + 165. http://www.columbia.edu/kermit/ckermit80.html#x6.6 + 166. http://www.columbia.edu/kermit/ckermit80.html#x0 + 167. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 168. http://www.columbia.edu/kermit/ckermit80.html#top + 169. http://www.columbia.edu/kermit/ckermit80.html#contents + 170. http://www.columbia.edu/kermit/ckermit.html + 171. http://www.columbia.edu/kermit/index.html + 172. http://www.columbia.edu/kermit/ckermit80.html#x0 + 173. http://www.columbia.edu/kermit/ckermit80.html#top + 174. http://www.columbia.edu/kermit/ckermit80.html#contents + 175. http://www.columbia.edu/kermit/ckermit.html + 176. http://www.columbia.edu/kermit/index.html + 177. http://www.columbia.edu/kermit/k95.html + 178. http://www.columbia.edu/kermit/sshclient.html + 179. http://www.columbia.edu/kermit/skermit.html + 180. http://www.columbia.edu/kermit/skermit.html + 181. http://www.columbia.edu/kermit/sshclien.htm + 182. http://www.columbia.edu/kermit/ckermit80.html#x3 + 183. ftp://ftp.isi.edu/in-notes/rfc1738.txt + 184. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2 + 185. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1 + 186. ftp://ftp.isi.edu/in-notes/rfc2396.txt + 187. ftp://ftp.isi.edu/in-notes/rfc2616.txt + 188. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3 + 189. ftp://ftp.isi.edu/in-notes/rfc2616.txt + 190. http://www.columbia.edu/kermit/ckermit80.html#x8.13.7 + 191. http://www.columbia.edu/kermit/security.htm#x5.4 + 192. http://www.columbia.edu/kermit/security.htm#x15 + 193. http://www.columbia.edu/kermit/security.htm#x6.2 + 194. http://www.columbia.edu/kermit/security.html + 195. http://www.columbia.edu/kermit/ckermit80.html#x16 + 196. http://www.columbia.edu/kermit/ckermit80.html#top + 197. http://www.columbia.edu/kermit/ckermit80.html#contents + 198. http://www.columbia.edu/kermit/ckermit.html + 199. http://www.columbia.edu/kermit/index.html + 200. http://www.columbia.edu/kermit/ckermit80.html#x3.1 + 201. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 202. http://www.columbia.edu/kermit/ckermit80.html#x3.3 + 203. http://www.columbia.edu/kermit/ckermit80.html#x3.4 + 204. http://www.columbia.edu/kermit/ckermit80.html#x3.5 + 205. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 206. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 207. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 208. http://www.columbia.edu/kermit/ckermit80.html#x3.9 + 209. http://www.columbia.edu/kermit/ckermit80.html#x3.10 + 210. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 211. http://www.columbia.edu/kermit/security.htm + 212. http://www.columbia.edu/kermit/security.htm#servers + 213. http://www.columbia.edu/kermit/ckcsets.html + 214. http://www.columbia.edu/kermit/unicode.html + 215. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4 + 216. http://www.columbia.edu/kermit/case10.html + 217. http://www.columbia.edu/kermit/ckermit80.html#x4 + 218. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 219. http://www.columbia.edu/kermit/ftpscripts.html + 220. http://www.columbia.edu/kermit/ckermit80.html#top + 221. http://www.columbia.edu/kermit/ckermit80.html#ftp + 222. http://www.columbia.edu/kermit/ftpclient.html + 223. http://www.columbia.edu/kermit/ftpscripts.html + 224. http://www.columbia.edu/kermit/ckermit.html + 225. http://www.columbia.edu/kermit/index.html + 226. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1 + 227. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3 + 228. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4 + 229. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3 + 230. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3 + 231. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 232. http://www.columbia.edu/kermit/ckermit80.html#x3.5 + 233. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 234. http://www.columbia.edu/kermit/ftpscripts.html + 235. http://www.columbia.edu/kermit/ckb2.htm + 236. http://www.columbia.edu/kermit/ckermit80.html#ftpautolog + 237. http://www.columbia.edu/kermit/ckermit80.html#ftpuser + 238. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 239. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 240. http://www.columbia.edu/kermit/ckermit80.html#top + 241. http://www.columbia.edu/kermit/ckermit80.html#ftp + 242. http://www.columbia.edu/kermit/ckermit.html + 243. http://www.columbia.edu/kermit/index.html + 244. http://www.columbia.edu/kermit/ibm_ie.html + 245. http://www.columbia.edu/kermit/ckermit80.html#x3.10 + 246. http://www.columbia.edu/kermit/ckermit80.html#top + 247. http://www.columbia.edu/kermit/ckermit80.html#ftp + 248. http://www.columbia.edu/kermit/ckermit.html + 249. http://www.columbia.edu/kermit/index.html + 250. http://www.columbia.edu/kermit/ck60manual.html + 251. http://www.columbia.edu/kermit/ckermit70.html#x4.17 + 252. http://www.columbia.edu/kermit/ckermit70.html + 253. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 254. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 255. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4 + 256. http://www.columbia.edu/kermit/security.html + 257. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 258. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 259. http://www.columbia.edu/kermit/ckermit80.html#x8.13.4 + 260. http://www.columbia.edu/kermit/ckermit80.html#permswitch + 261. http://www.columbia.edu/kermit/ckermit80.html#ftpchmod + 262. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2 + 263. http://www.columbia.edu/kermit/ckermit80.html#x4 + 264. http://www.columbia.edu/kermit/ckermit80.html#top + 265. http://www.columbia.edu/kermit/ckermit80.html#ftp + 266. http://www.columbia.edu/kermit/ckermit.html + 267. http://www.columbia.edu/kermit/index.html + 268. http://www.columbia.edu/kermit/ckermit80.html#x7 + 269. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 270. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 271. http://www.columbia.edu/kermit/ckb2.htm + 272. http://www.columbia.edu/kermit/ckermit80.html#x3.10 + 273. http://www.columbia.edu/kermit/ckermit80.html#x3.10 + 274. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 275. http://www.columbia.edu/kermit/ckermit80.html#setftptype + 276. http://www.columbia.edu/kermit/ckermit80.html#top + 277. http://www.columbia.edu/kermit/ckermit80.html#ftp + 278. http://www.columbia.edu/kermit/ckermit.html + 279. http://www.columbia.edu/kermit/index.html + 280. http://www.columbia.edu/kermit/ckermit70.html#x4.9 + 281. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1 + 282. http://www.columbia.edu/kermit/ckermit80.html#erroraction + 283. http://www.columbia.edu/kermit/ckermit70.html#x1.5 + 284. http://www.columbia.edu/kermit/ckermit70.html#x4.7 + 285. http://www.columbia.edu/kermit/ckermit70.html#x1.6 + 286. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 287. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4 + 288. http://www.columbia.edu/kermit/ckermi70.htm + 289. http://www.columbia.edu/kermit/ckermit80.html#x4 + 290. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 291. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2 + 292. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 293. http://www.columbia.edu/kermit/ckermit80.html#erroraction + 294. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2 + 295. http://www.columbia.edu/kermit/ckermit80.html#erroraction + 296. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames + 297. http://www.columbia.edu/kermit/ckermit80.html#ftpperms + 298. http://www.columbia.edu/kermit/ckermit80.html#ftpunique + 299. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames + 300. http://www.columbia.edu/kermit/ckermit80.html#note_utc + 301. http://www.columbia.edu/kermit/ckermit80.html#note_date + 302. http://www.columbia.edu/kermit/ckermit80.html#x3.6 + 303. http://www.boulder.nist.gov/timefreq/faq/faq.htm#10: + 304. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 305. http://www.columbia.edu/kermit/ckermit80.html#top + 306. http://www.columbia.edu/kermit/ckermit80.html#ftp + 307. http://www.columbia.edu/kermit/ckermit.html + 308. http://www.columbia.edu/kermit/index.html + 309. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 310. http://www.columbia.edu/kermit/ckermi70.htm#x4.3 + 311. http://www.columbia.edu/kermit/ckermit70.html + 312. http://www.columbia.edu/kermit/ckermit80.html#x5 + 313. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3 + 314. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames + 315. http://www.columbia.edu/kermit/ckermi70.htm#x4.1 + 316. http://www.columbia.edu/kermit/ckermi70.htm#x4.2.2 + 317. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4 + 318. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2 + 319. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 320. http://www.columbia.edu/kermit/ckermit80.html#x3.11 + 321. http://www.columbia.edu/kermit/ckermit80.html#srvrename + 322. http://www.columbia.edu/kermit/ckermi70.htm#x4.1 + 323. http://www.columbia.edu/kermit/ckermi70.htm + 324. http://www.columbia.edu/kermit/ckb2.htm + 325. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames + 326. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3 + 327. http://www.proftpd.net/ + 328. http://www.columbia.edu/kermit/ckermit80.html#top + 329. http://www.columbia.edu/kermit/ckermit80.html#ftp + 330. http://www.columbia.edu/kermit/ckermit.html + 331. http://www.columbia.edu/kermit/index.html + 332. http://www.columbia.edu/kermit/ckb2.htm + 333. http://www.columbia.edu/kermit/ckcsets.html + 334. http://www.columbia.edu/kermit/unicode.html + 335. http://www.columbia.edu/kermit/ckcsets.html + 336. http://www.columbia.edu/kermit/ckcsets.html + 337. http://www.columbia.edu/kermit/ckermit80.html#x4 + 338. http://www.columbia.edu/kermit/utf8.html + 339. http://www.columbia.edu/kermit/ckcsets.html + 340. http://www.columbia.edu/kermit/ckermit80.html#x4 + 341. ftp://ftp.isi.edu/in-notes/rfc2640.txt + 342. http://www.columbia.edu/kermit/ckermit80.html#top + 343. http://www.columbia.edu/kermit/ckermit80.html#ftp + 344. http://www.columbia.edu/kermit/ckermit.html + 345. http://www.columbia.edu/kermit/index.html + 346. http://www.columbia.edu/kermit/ckermit80.html#top + 347. http://www.columbia.edu/kermit/ckermit80.html#ftp + 348. http://www.columbia.edu/kermit/ckermit.html + 349. http://www.columbia.edu/kermit/index.html + 350. http://www.columbia.edu/kermit/ckermit80.html#top + 351. http://www.columbia.edu/kermit/ckermit80.html#ftp + 352. http://www.columbia.edu/kermit/ckermit.html + 353. http://www.columbia.edu/kermit/index.html + 354. http://www.columbia.edu/kermit/ftpscripts.html + 355. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 356. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 357. ftp://ftp.isi.edu/in-notes/rfc959.txt + 358. http://www.columbia.edu/kermit/ckscripts.html + 359. http://www.columbia.edu/kermit/ckermit80.html#top + 360. http://www.columbia.edu/kermit/ckermit80.html#ftp + 361. http://www.columbia.edu/kermit/ftpscript.html + 362. http://www.columbia.edu/kermit/ckermit.html + 363. http://www.columbia.edu/kermit/index.html + 364. http://www.columbia.edu/kermit/ckermit80.html#x3.11.1 + 365. http://www.columbia.edu/kermit/ckermit80.html#x3.11.2 + 366. http://www.columbia.edu/kermit/ckermit80.html#x3.11.3 + 367. http://www.columbia.edu/kermit/ckermit80.html#x3.11.4 + 368. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5 + 369. http://www.columbia.edu/kermit/ckermit.html + 370. http://www.columbia.edu/kermit/k95.html + 371. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5 + 372. ftp://ftp.isi.edu/in-notes/rfc959.txt + 373. ftp://ftp.isi.edu/in-notes/rfc2389.txt + 374. http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.txt + 375. http://www.columbia.edu/kermit/ftpclient.html + 376. http://www.columbia.edu/kermit/ckermit80.html#top + 377. http://www.columbia.edu/kermit/ckermit80.html#ftp + 378. http://www.columbia.edu/kermit/ckermit.html + 379. http://www.columbia.edu/kermit/index.html + 380. http://www.columbia.edu/kermit/ckermit80.html#x3 + 381. http://www.columbia.edu/kermit/ckermit80.html#ucs2 + 382. http://www.columbia.edu/kermit/ckermit80.html#top + 383. http://www.columbia.edu/kermit/ckermit80.html#contents + 384. http://www.columbia.edu/kermit/ckermit.html + 385. http://www.columbia.edu/kermit/index.html + 386. http://www.columbia.edu/kermit/ckermit80.html#top + 387. http://www.columbia.edu/kermit/ckermit80.html#contents + 388. http://www.columbia.edu/kermit/ckermit.html + 389. http://www.columbia.edu/kermit/index.html + 390. http://www.columbia.edu/kermit/ckb2.htm + 391. http://www.columbia.edu/kermit/ckermit80.html#top + 392. http://www.columbia.edu/kermit/ckermit80.html#contents + 393. http://www.columbia.edu/kermit/ckermit.html + 394. http://www.columbia.edu/kermit/index.html + 395. http://www.columbia.edu/kermit/ckermit80.html#x4 + 396. http://www.columbia.edu/kermit/ckermit80.html#x4 + 397. http://www.columbia.edu/kermit/ckermit80.html#x8.12 + 398. http://www.columbia.edu/kermit/ckermit80.html#x8.1 + 399. http://www.columbia.edu/kermit/ckermit80.html#x12 + 400. http://www.columbia.edu/kermit/ckermit80.html#x8.12 + 401. http://www.columbia.edu/kermit/ckermit80.html#top + 402. http://www.columbia.edu/kermit/ckermit80.html#contents + 403. http://www.columbia.edu/kermit/ckermit.html + 404. http://www.columbia.edu/kermit/index.html + 405. http://www.columbia.edu/kermit/ckermit80.html#x8.14 + 406. http://www.columbia.edu/kermit/ckermit80.html#top + 407. http://www.columbia.edu/kermit/ckermit80.html#contents + 408. http://www.columbia.edu/kermit/ckermit.html + 409. http://www.columbia.edu/kermit/index.html + 410. http://www.columbia.edu/kermit/ckermit80.html#x9 + 411. http://www.columbia.edu/kermit/ckermit80.html#top + 412. http://www.columbia.edu/kermit/ckermit80.html#contents + 413. http://www.columbia.edu/kermit/ckermit.html + 414. http://www.columbia.edu/kermit/index.html + 415. http://www.columbia.edu/kermit/ckermit80.html#x8.6 + 416. http://www.columbia.edu/kermit/ckermit80.html#top + 417. http://www.columbia.edu/kermit/ckermit80.html#contents + 418. http://www.columbia.edu/kermit/ckermit.html + 419. http://www.columbia.edu/kermit/index.html + 420. http://www.columbia.edu/kermit/ckermit80.html#top + 421. http://www.columbia.edu/kermit/ckermit80.html#contents + 422. http://www.columbia.edu/kermit/ckermit.html + 423. http://www.columbia.edu/kermit/index.html + 424. http://www.columbia.edu/kermit/ckermit80.html#top + 425. http://www.columbia.edu/kermit/ckermit80.html#contents + 426. http://www.columbia.edu/kermit/ckermit.html + 427. http://www.columbia.edu/kermit/index.html + 428. http://www.columbia.edu/kermit/ckermit80.html#fjoin + 429. http://www.columbia.edu/kermit/ckermit80.html#fsplit + 430. http://www.columbia.edu/kermit/ckermit80.html#x8.10 + 431. http://www.columbia.edu/kermit/ckermit80.html#top + 432. http://www.columbia.edu/kermit/ckermit80.html#contents + 433. http://www.columbia.edu/kermit/ckermit.html + 434. http://www.columbia.edu/kermit/index.html + 435. http://www.columbia.edu/kermit/ckermit80.html#x9 + 436. http://www.columbia.edu/kermit/ckermit80.html#x9 + 437. http://www.columbia.edu/kermit/ckermit80.html#x9 + 438. http://www.columbia.edu/kermit/ckermit80.html#x3 + 439. http://www.columbia.edu/kermit/ckermit80.html#x3 + 440. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 441. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 442. http://www.columbia.edu/kermit/ckermit80.html#x3.8 + 443. http://www.columbia.edu/kermit/ckermit80.html#x3 + 444. http://www.columbia.edu/kermit/ckermit80.html#x3 + 445. http://www.columbia.edu/kermit/ckermit80.html#x3 + 446. http://www.columbia.edu/kermit/ckermit80.html#x3.2 + 447. http://www.columbia.edu/kermit/ckermit80.html#x3 + 448. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 449. http://www.columbia.edu/kermit/ckermit80.html#x8.13 + 450. http://www.columbia.edu/kermit/ckermit80.html#x9 + 451. http://www.columbia.edu/kermit/ckermit80.html#x8.10 + 452. http://www.columbia.edu/kermit/ckermit80.html#x8.7.4 + 453. http://www.columbia.edu/kermit/ckermit80.html#top + 454. http://www.columbia.edu/kermit/ckermit80.html#contents + 455. http://www.columbia.edu/kermit/ckermit.html + 456. http://www.columbia.edu/kermit/index.html + 457. http://www.columbia.edu/kermit/ckermit80.html#top + 458. http://www.columbia.edu/kermit/ckermit80.html#contents + 459. http://www.columbia.edu/kermit/ckermit.html + 460. http://www.columbia.edu/kermit/index.html + 461. http://www.columbia.edu/kermit/ckermit80.html#top + 462. http://www.columbia.edu/kermit/ckermit80.html#contents + 463. http://www.columbia.edu/kermit/ckermit.html + 464. http://www.columbia.edu/kermit/index.html + 465. http://www.columbia.edu/kermit/ckermit80.html#x8.7 + 466. http://www.columbia.edu/kermit/ckermit80.html#top + 467. http://www.columbia.edu/kermit/ckermit80.html#contents + 468. http://www.columbia.edu/kermit/ckermit.html + 469. http://www.columbia.edu/kermit/index.html + 470. http://www.columbia.edu/kermit/ckermit80.html#scriptedit + 471. http://www.columbia.edu/kermit/ckermit80.html#top + 472. http://www.columbia.edu/kermit/ckermit80.html#contents + 473. http://www.columbia.edu/kermit/ckermit.html + 474. http://www.columbia.edu/kermit/index.html + 475. http://www.columbia.edu/kermit/ckermit80.html#top + 476. http://www.columbia.edu/kermit/ckermit80.html#contents + 477. http://www.columbia.edu/kermit/ckermit.html + 478. http://www.columbia.edu/kermit/index.html + 479. ftp://ftp.isi.edu/in-notes/rfc2822.txt + 480. ftp://ftp.isi.edu/in-notes/rfc2822.txt + 481. ftp://ftp.isi.edu/in-notes/rfc2822.txt + 482. ftp://ftp.isi.edu/in-notes/rfc2822.txt + 483. http://www.columbia.edu/kermit/ckermit80.html#top + 484. http://www.columbia.edu/kermit/ckermit80.html#contents + 485. http://www.columbia.edu/kermit/ckermit.html + 486. http://www.columbia.edu/kermit/index.html + 487. http://www.columbia.edu/kermit/ckermit80.html#x8.1 + 488. http://www.columbia.edu/kermit/ckermit80.html#top + 489. http://www.columbia.edu/kermit/ckermit80.html#contents + 490. http://www.columbia.edu/kermit/ckermit.html + 491. http://www.columbia.edu/kermit/index.html + 492. http://www.columbia.edu/kermit/ckermit80.html#x8.2 + 493. http://www.columbia.edu/kermit/ckermit80.html#top + 494. http://www.columbia.edu/kermit/ckermit80.html#contents + 495. http://www.columbia.edu/kermit/ckermit.html + 496. http://www.columbia.edu/kermit/index.html + 497. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 498. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 499. http://www.columbia.edu/kermit/ckermit80.html#x8.2 + 500. http://www.columbia.edu/kermit/ckermit80.html#top + 501. http://www.columbia.edu/kermit/ckermit80.html#contents + 502. http://www.columbia.edu/kermit/ckermit.html + 503. http://www.columbia.edu/kermit/index.html + 504. http://www.columbia.edu/kermit/ckermit80.html#top + 505. http://www.columbia.edu/kermit/ckermit80.html#contents + 506. http://www.columbia.edu/kermit/ckermit.html + 507. http://www.columbia.edu/kermit/index.html + 508. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 509. http://www.columbia.edu/kermit/ckermit80.html#top + 510. http://www.columbia.edu/kermit/ckermit80.html#contents + 511. http://www.columbia.edu/kermit/ckermit.html + 512. http://www.columbia.edu/kermit/index.html + 513. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 514. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 515. http://www.columbia.edu/kermit/ckermit80.html#x9.6 + 516. http://www.columbia.edu/kermit/ckermit80.html#top + 517. http://www.columbia.edu/kermit/ckermit80.html#contents + 518. http://www.columbia.edu/kermit/ckermit.html + 519. http://www.columbia.edu/kermit/index.html + 520. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 521. http://www.columbia.edu/kermit/ckermit80.html#x9.8 + 522. http://www.columbia.edu/kermit/ckermit80.html#top + 523. http://www.columbia.edu/kermit/ckermit80.html#contents + 524. http://www.columbia.edu/kermit/ckermit.html + 525. http://www.columbia.edu/kermit/index.html + 526. http://www.columbia.edu/kermit/ckermit80.html#top + 527. http://www.columbia.edu/kermit/ckermit80.html#contents + 528. http://www.columbia.edu/kermit/ckermit.html + 529. http://www.columbia.edu/kermit/index.html + 530. http://www.columbia.edu/kermit/ckermit80.html#top + 531. http://www.columbia.edu/kermit/ckermit80.html#contents + 532. http://www.columbia.edu/kermit/ckermit.html + 533. http://www.columbia.edu/kermit/index.html + 534. mailto:thucdat@hotmail.com + 535. http://www.columbia.edu/kermit/ckermit80.html#x9.9.2 + 536. http://www.columbia.edu/kermit/ckermit80.html#top + 537. http://www.columbia.edu/kermit/ckermit80.html#contents + 538. http://www.columbia.edu/kermit/ckermit.html + 539. http://www.columbia.edu/kermit/index.html + 540. http://www.columbia.edu/kermit/ckermit80.html#top + 541. http://www.columbia.edu/kermit/ckermit80.html#contents + 542. http://www.columbia.edu/kermit/ckermit.html + 543. http://www.columbia.edu/kermit/index.html + 544. http://www.columbia.edu/kermit/ckermit80.html#top + 545. http://www.columbia.edu/kermit/ckermit80.html#contents + 546. http://www.columbia.edu/kermit/ckermit.html + 547. http://www.columbia.edu/kermit/index.html + 548. http://www.columbia.edu/kermit/ckermit80.html#x9.2 + 549. http://www.columbia.edu/kermit/ckermit80.html#top + 550. http://www.columbia.edu/kermit/ckermit80.html#contents + 551. http://www.columbia.edu/kermit/ckermit.html + 552. http://www.columbia.edu/kermit/index.html + 553. http://www.columbia.edu/kermit/ckermit80.html#x4 + 554. http://www.columbia.edu/kermit/ckermit80.html#x4 + 555. http://www.columbia.edu/kermit/ckermit80.html#top + 556. http://www.columbia.edu/kermit/ckermit80.html#contents + 557. http://www.columbia.edu/kermit/ckermit.html + 558. http://www.columbia.edu/kermit/index.html + 559. http://www.columbia.edu/kermit/ckermit80.html#top + 560. http://www.columbia.edu/kermit/ckermit80.html#contents + 561. http://www.columbia.edu/kermit/ckermit.html + 562. http://www.columbia.edu/kermit/index.html + 563. http://www.columbia.edu/kermit/ckermit80.html#top + 564. http://www.columbia.edu/kermit/ckermit80.html#contents + 565. http://www.columbia.edu/kermit/ckermit.html + 566. http://www.columbia.edu/kermit/index.html + 567. http://www.columbia.edu/kermit/ckermit80.html#x4 + 568. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 569. http://www.columbia.edu/kermit/ckermit80.html#x3.7 + 570. http://www.columbia.edu/kermit/ckermit80.html#top + 571. http://www.columbia.edu/kermit/ckermit80.html#contents + 572. http://www.columbia.edu/kermit/ckermit.html + 573. http://www.columbia.edu/kermit/index.html + 574. ftp://ftp.isi.edu/in-notes/rfc2217.txt + 575. http://www.columbia.edu/kermit/ckermit80.html#top + 576. http://www.columbia.edu/kermit/ckermit80.html#contents + 577. ftp://kermit.columbia.edu/kermit/sredird/ + 578. http://www.columbia.edu/kermit/ckermit.html + 579. http://www.columbia.edu/kermit/index.html + 580. http://www.columbia.edu/kermit/ckermi70.htm#x4.22 + 581. http://www.columbia.edu/kermit/ckermit80.html#top + 582. http://www.columbia.edu/kermit/ckermit80.html#contents + 583. http://www.columbia.edu/kermit/ckermit.html + 584. http://www.columbia.edu/kermit/index.html + 585. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3 + 586. http://www.columbia.edu/kermit/cuiksd.html + 587. http://www.columbia.edu/kermit/ckermit80.html#top + 588. http://www.columbia.edu/kermit/ckermit80.html#contents + 589. http://www.columbia.edu/kermit/ckermit.html + 590. http://www.columbia.edu/kermit/index.html + 591. http://www.columbia.edu/kermit/ckermit80.html#top + 592. http://www.columbia.edu/kermit/ckermit80.html#contents + 593. http://www.columbia.edu/kermit/ckermit.html + 594. http://www.columbia.edu/kermit/index.html + 595. http://www.columbia.edu/kermit/index.html diff --git a/ckermit90.txt b/ckermit90.txt new file mode 100644 index 0000000..51a0694 --- /dev/null +++ b/ckermit90.txt @@ -0,0 +1,2125 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + + [11]Table of platforms [12]Book: Using C-Kermit [13]Download + C-Kermit 9.0 + +C-Kermit 9.0 Update Notes + + * [14]Large Files + * [15]How to Test Large-File Transfer + * [16]Arithmetic with Large Integers + * [17]FORCE-3 Packet Protocol + * [18]Variable Evaluation + + * [19]The RENAME Command You Always Wanted + * [20]Other New Features + * [21]Incompatibilities + * [22]What's Not In C-Kermit 9.0 + * [23]And a Loose End + + * [24]Demonstration: Secure POP mail fetcher + * [25]Demonstration: HP Switch Configuration Backup + * [26]Demonstration: HP iLO Blade Configuration + * [27]Demonstration: IBM/Rolm/Siemens CBX Management + * [28]Demonstration: CSV and TSV Files + * [29]Demonstration Scripts for Webmasters + + This is the third supplement to [30]Using C-Kermit, Second Edition. I + apologize for the scattered nature of the information and I hope I can + organize it and gather it all into one place for easy and definitive + reference some day. It's a big job and it depends on the demand. For + the time being the definitive reference and introduction is the book + (which is now available also in a [31]Kindle Edition), plus the + [32]C-Kermit 7.0 update, [33]C-Kermit 8.0 update, and now this one. + Plus tons of other web pages on this site, sample script programs, and + so on. + + In version 6.0, C-Kermit was a pretty powerful and flexible + communication program with scripting capabilities. By version 9.0, I'd + like to think of it more as a scripting language with built-in + communications. You can get an idea of the kinds of programs you can + write in Kermit language [34]here. You can develop programs quickly + because it's an interactive program, not a compiler. The scripting + language is the command language. Kind of like the Unix shell but + "somewhat" less cryptic, including concepts not only from C but from + PL/I, Snobol, LISP, and Smalltalk. The language itself is built upon + the command language of the much-loved [35]DECSYSTEM-20 from the 1970s + and 80s, the Clipper Ship of the Text Era. (Text is not a bad word. + Those of us who can touch-type and who are proficient in text-based + computing environments like Unix shell or VMS DCL are likely to be + orders of magnitude more productive than users of GUIs.) + + - Frank da Cruz [36]fdc@columbia.edu + +What's New in General + + Very briefly, the major items: + * [37]Open Source license. + * [38]64-bit file access and transfer and 64-bit integer arithmetic + on most common platforms. + * Support for recent releases of Linux, Mac OS X, *BSD, etc ([39]see + table). + * Support for newer OpenSSL releases up to and including 1.0.0d + ([40]see table). + * [41]Strengthened error checking for file transfer under extremely + harsh conditions. + * [42]Simplified semantics for variables used in scripts. + * Super-handy and useful [43]extensions to the RENAME command. + * Many other scripting improvements including support for reading and + writing [44]CSV and TSV files. + * [45]MIME character-set names are now recognized. + * Improved logging and debugging (see demo [46]here). + * Lots more described or listed below, and [47]here. + +Open Source License + + C-Kermit 9.0 has the [48]Revised 3-Clause BSD License, an open source + license approved by OSI, the [49]Open Source Initiative. + +Large Files + + Kermit is, first and foremost, a file-transfer program. One might + expect it to be able to transfer any kind of file, but that has been + decreasingly the case as file sizes began to cross the 2 gigabyte + threshold. + + The biggest change since C-Kermit 8.0.211 is support for large files on + platforms that support them. A "large file" is one whose size is + greater than 2^31-1 (2,147,483,647) bytes (2GB-1); that is, one whose + size requires more than 31 bits to represent. Before now, Kermit was + able to access such files only on 100% 64-bit platforms such as Digital + Unix, later known as Tru64 Unix. In the new release, Kermit takes + advantage of the X/Open Single UNIX Specification Version 2 (UNIX 98) + Large File Support (LFS) specification, which allows 32-bit platforms + to create, access, and manage files larger than 2GB. + + Accommodating large files required code changes in many modules, + affecting not only file transfer, but also file management functions + from directory listings to local file manipulation, plus the user + interface itself to allow entry and display of large numbers. All this + had to be done in a way that would not affect pure 32-bit builds on + platforms that do not support large files. Large file support is + summarized in the [50]Table of Platforms; entries in Yellow (32-bit + builds that support 64-bit integers) and Green (64-bit builds) support + large files. + + Note that VMS C-Kermit and Kermit 95 for Windows have always been able + to transfer large files. However their user interface used 32-bit + integers for statistics and the file transfer display. In C-Kermit 9.0 + Alpha.03, VMS C-Kermit on 64-bit platforms (Alpha and Itanium) should + now give correct statistics and progress displays. (We'll see about + Kermit 95 later.) + +How to Test Large-File Transfer + + Several methods are available for testing large-file transfers: + * By transferring a real file that is more than 2147483648 bytes long + (a file whose length requires more than 31 bits to express); or to + be totally sure, that is longer than 4294967296 bytes (32 bits or + more). Or to be double super sure, longer than 8589934592 (33 + bits). + * If you don't have such a file or there is not sufficient disk space + for such a file, you can create a special kind of file that takes + up one block on the disk but appears to be 4.3GB long by compiling + and running [51]THIS C PROGRAM on Linux, Solaris, HP-UX, or other + Unix platform that supports large files. Kermit or FTP or any other + file transfer program will transfer the result (BIGFILE) in such a + way as to actually put 4.3GB (or other desired size; see source) on + the wire. + * You can use Kermit's CALIBRATE feature to transfer a large file + that doesn't exist. At the receiver, use RECEIVE /CALIBRATE. At the + sender, use SEND /CALIBRATE:length, e.g.: + + (At remote kermit...) + $ kermit -Y + C-Kermit> receive /calibrate + (Return to local kermit...) + Ctrl-\c + C-Kermit> send /calibrate:4300000000 + This sends a simulated file 4.3GB in length, that does not exist on + the sender and will not take up any disk space on the receiver. + SEND /CALIBRATE: accepts big numbers only in Kermit versions that + support them (this does not include Kermit 95 on Windows). This + method tests only Kermit's ability to express and understand large + file sizes, but does not test Kermit's file-system interface, since + no files are involved. + +Arithmetic with Large Integers + + Because large file support requires the availability of a 64-bit signed + integer data type, other aspects of C-Kermit were adapted to use it + too, most notably Kermit's algebraic expression evaluator and its + [52]S-Expression interpreter, on all platforms that support large files + (those listed as 64 or 32/64 in the Word column of the [53]table). In + fact, every Kermit command that parses a number in any field can now + parse a large number on those platforms. + + S-Expressions can now be forced to operate with integers only, without + floating-point conversion or having to explicitly truncate each result; + as an example. see the revised [54]Easter date calculation script. + +FORCE-3 Packet Protocol + + The Kermit protocol has proven itself over the past 30 years to be + robust in terms of surviving harsh transmission environments and + delivering the data correctly and completely. In these times of + Internet everywhere and error-correcting modems in the few places where + the Internet isn't, few people even recall the kinds of difficult + conditions that were common when the Kermit protocol was first + developed: noisy telephone lines, serial interfaces that drop + characters, lack of transparency to control or 8-bit characters, + absence of flow control, "bare" modems without error correction. + + But the Internet is not everywhere, and not all modems are + error-correcting. Perhaps the most difficult trial so far for Kermit or + any other protocol is the [55]EM-APEX project, in which floats are + dropped into the ocean from an aircraft into the path of a hurricane; + these floats dive into the water measuring current, temperature, and + salinity at different depths and then surfacing to phone home, sending + the data to land stations using Kermit protocol over + non-error-correcting 300bps [56]Iridium satellite modems, with high + seas and winds battering the floats and heavy ([57]sometimes + electrical) storms between the modem and the satellite. + + Because of the transmission speed and long distances involved, the + transfers were very slow. The Kermit software in the floats is + [58]Embedded Kermit, which did not implement sliding windows, which + would have sped up the flow considerably. John Dunlap, engineer at the + University of Washington's Applied Physics Laboratory, undertook the + task of adding sliding windows to E-Kermit. For testing, he rigged up a + [59]simulator in which Kermit transfers take place over a connection + with different amounts of noise and delay. He found that occasionally, + a transfer would appear to succeed, but the received file would be + corrupt. + + According to the Kermit protocol definition, the first packet always + has block-check type 1, a 6-bit checksum, which is the only block check + type that all Kermit implementations are required to support; thus any + Kermit partner can process this packet. This packet itself can + negotiate a higher level of checking, such that subsequent packets have + (say) block-check type 3, a 16-bit cyclic redundancy check (CRC) + encoded as three printable 7-bit ASCII characters. The 16-bit CRC can + catch all errors of certain kinds (single-bit, double-bit, bursts of 16 + bits or less), and more than 99.9984741210937% of all other possible + errors. + + John's simulations revealed that file corruption could occur undetected + when the initial packet was corrupted in such a way that a parameter or + capability byte was changed and the checksum also changed to make the + packet appear to be correct, thus allowing the transfer to proceed with + the two Kermit partners out of sync as to packet encoding and + interpretation (the chances of two such errors producing a seemingly + valid packet are about 1 in 6000 when using the 6-bit checksum). For + example the compression technique might be misnegotiated and then the + receiver might store incoming data without decompressing it. + + The solution is a new option, selected by: + + BLOCK-CHECK TYPE 5 + + to require a type 3 block check (16-bit CRC) on every packet, including + the initial ones, thus reducing the probability of a misnegotiation by + many orders of magnitude. THIS PARAMETER CAN NOT BE NEGOTIATED. Each + Kermit program must be given the "set block 5" command prior to + transfer. That's because normally every Kermit program expects the + first packet to have a 6-bit checksum, and if the first packet has a + 3-byte, 16-bit CRC, the packet receiver will think it is corrupted. + + In practice, however, it is possible to code the packet receiver + "cheat" by reading the packet data before verifying the block check. + Thus when the receiver is C-Kermit 9.0 Beta.01 or later or E-Kermit 1.7 + or later, it is only necessary to give the "set block 5" command to the + file sender, and the receiver will check for a FORCE-3 first packet. If + the receiver does not support this feature, however, the the initial + packet will be be rejected (after several retries) and the file + transfer will not take place. There is no attempt to "back off" to + normal behavior. + + CAPTION: Table 4. Kermit Protocol Packet Block Check Types + + Type Command Bytes Status Explanation + 1 SET BLOCK 1 1 Required in all Kermit implementations. Negotiated. + 6-bit checksum, suitable for good connections. + 2 SET BLOCK 2 2 Optional, negotiated. 12-bit checksum. 64 times + stronger than type 1. + 3 SET BLOCK 3 3 Optional, negotiated. 16-bit CRC. + BLANK-FREE-2 SET BLOCK 4 2 Optional, negotiated. 12-bit checksum, two + nonblank bytes. + FORCE-3 SET BLOCK 5 3 Optional, not negotiated. 16-bit CRC forced all + packets. + + [60]E-Kermit 1.7 + +Variable Evaluation + + Does the strange behavior of Kermit's \%x variables puzzle or annoy + you? + + Kermit software development has been a collaborative project over the + years, with contributions coming in from almost every country and every + sector of the economy - academic, corporate, government. Thus not all + versions, and not all features of a given version, are a product of + systematic design. + + One example was the introduction of variables for text substitution, + first in a version of MS-DOS Kermit that was sent in by someone + somewhere (I could look it up, but no time...) Although the design of + the notation for variable names (table below) is mine, the underlying + code was contributed. In that code there was only one kind of variable, + and if I recall correctly the variable name was a backslash followed by + a single letter, for example \a, \b, etc. The contributed code + evaluated these variables recursively, meaning if the definition of a + variable contained variable references, then these were resolved when + dererencing the variable, and the process would continue as deep down + as necessary to resolve the thing fully. + + This was sometimes handy, but it had one severe drawback: There was no + way to use variables in a straightforward way to represent strings that + contained literal backslashes; for example, DOS or Windows pathnames. + This gave rise to all kinds of quoting rules and conventions (e.g. + doubling backslashes or forcing single-level evaluation with + \\fcontents()), and also to the introduction of other kinds of + variables that were evaluated one level deep, rather than recursively. + + To accommodate coexistence of different kinds of variables as well as + "escape sequences" for representing control and 8-bit characters, the + syntax for variable names was extended to include three elements: the + leading backslash, then a single character indicating the type of + variable, and then the name of the variable in a format corresponding + to the type designator, as shown in this somewhat simplified table: + + CAPTION: Table 1. Variable-name Syntax in Kermit + + Notation Meaning + \000 - \255 8-bit character constant (decimal) + \d000 - \d255 Alternative notation for 8-bit character (byte) constant + (decimal) + \o000 - \o377 8-bit character constant (octal) + \x00 - \xff 8-bit character constant (hexadecimal) + \%a - \%z Scalar variable, evaluated recursively. + \%0 - \%9 Macro argument, scalar, evaluated recursively. + \&a - \%& Array name + \&a[x] Array reference, evaluated recursively (x is any constant or + variable) + \v(name) Built-in scalar variable, evaluated one level deep. + \m(name) User-defined scalar variable, evaluated one level deep. + \$(name) An environment variable, evaluated one level deep. + \s(name[n:m]) Compact substring notation, evaluated one level deep. + \fname(args...)) Built-in function with zero or more arguments. + \\ Literal backslash + \N OUTPUT comand only: NUL, ASCII 0 + \B OUTPUT comand only: BREAK + \L OUTPUT comand only: Long BREAK + + Variable names in Kermit are case-independent. The simplifications in + the table are that the notation for decimal and octal bytes can have + from one to three digits, and can include braces to separate them from + text digits, e.g. \7, \{123}, \o{50}. Hex bytes too, except they must + always have exactly two hex digits, 0-9a-f. Array indices must be, or + must evaluate to, numbers (floating point numbers are truncated). + Associative arrays are also available (dynamic arrays with arbitrary + text as subscript), but they are really just a variation on \m() + variables (read about associative arrays [61]here). Also, there are + some alternative notations for compact substring notation. + + We didn't want to have lots of "distinguished" characters, as the UNIX + shell does; one is enough, clarity over brevity. Although the notation + can be a bit cumbersome, we can use the \m(name) form to circumvent the + overevaluation in most contexts. But macro arguments are always + assigned to the \%0-9 variables, and thus always evaluated recursively, + making it difficult and confusing to pass (e.g.) Windows pathnames as + arguments to macros. The same is true for array elements, especially in + contexts where they are used to return results from built-in functions + (for example, \fsplit() used to return the elements of a + [62]comma-separated value list if any of the values contained + backslashes). An even worse scenario is when macro arguments are passed + from one macro to another; for some graphic illustrations see + [63]Taming the Wild Backslash - Part Deux from the [64]C-Kermit 7.0 + Update Notes. + + We can't just change how variables are evaluated because that would + break existing scripts. But we can always add Yet Another SET Command: + + SET COMMAND VARIABLE-EVALUATION { RECURSIVE, SIMPLE } + + This applies only to \%a-z and \%0-9 variables and to \&a-z[] arrays + (since all other kinds of variables are evaluated only one level deep). + The default, of course, for backwards compatibility, is RECURSIVE. + SIMPLE forces the evaluation of these variables to return their literal + contents, without further evaluation: + + * An exception is made in the case of array subscripts, because + changing how they are evaluated could break a lot of scripts, and + anyway there should never be any harm in evaluating them + recursively because their final value is always (or should be) + numeric, not some string that might contain backslashes. + * The VARIABLE-EVALUTION setting is on the command stack. Thus you + can give this command in a macro, command file, or user-defined + function without affecting the calling environment. + * The new \frecurse() function forces recursive evaluation of its + argument regardless of the VARIABLE-EVALUATION setting. The + argument can be any string (or nothing at all); all the variables + in the string, even \m() ones, are evaluated recursively: + +def \%a 1 \%b 3 +def \%b 2 +def xx easy as \%a +show mac xx +echo \frecurse(\m(xx)) +easy as 1 2 3 +echo \frecurse(it's as easy as \m(xx)) +it's as easy as easy as 1 2 3 + + * The new \v(vareval) built-in variable contains the current setting + (recursive or simple) at the current command-stack level. + + Here's a short script for illustration: + +define path c:\users\fdc\somefile.txt +define test1 { # Normal recursive argument evaluation + echo \%0: arg=\%1 +} +define test2 { # Simple argument evaluation + set var simple + echo \%0: arg=\%1 +} +test1 \m(path) +test2 \m(path) +exit + + And here's the result: + +? +test2: arg=c:\users\fdc\somefile.txt + + The first line might seem surprising, but under the normal rules (see + table above) \f indicates a function call, with the letters following + the 'f' being the name of the function. But there is no function by + that name... and if there were, you probably didn't intend to call it! + + SET COMMAND VARIABLE-EVALUATION SIMPLE has no effect on constants, only + on variables. Note how \m(path) is defined. The DEFINE command assigns + the literal value of its argument to the named variable (see Table 3 + below), thus in this case no special syntax is needed. But in other + contexts, you must double the backslashes or use the \fliteral() + function to use literal backslashes in data: + +test2 c:\\users\\fdc\\somefile.txt +test2 \fliteral(c:\users\fdc\somefile.txt) + + C-Kermit 9.0 adds a new notation for \fliteral() which also has certain + advantages over it: \q(string) + : + +test2 \q(c:\users\fdc\somefile.txt) + + Since \fliteral() is a function, its argument list (the text within + parantheses) has special syntax of its own, in which commas and braces + are treated specially and introduce another set of quoting problems. + \q(string) doesn't have these problems. The only consideration is that + parentheses must be balanced or else quoted (preceded by backslash), or + represented as numeric character entities (left paren = \40, (right + paren = \41). + + Or else hold the value in a simple variable as we did with \\m(path) + above. + + SET COMMAND VARIABLE-EVALUATION SIMPLE is a big change and might have + repurcussions that didn't show up in the initial tests; a lot more + testing is needed. + + On the topic of variables, let's summarize in one place the ways in + which values can be explicitly assigned to variables. There is nothing + new here except the table itself: + + CAPTION: Table 2. Variable Assignment in Kermit + + Command Shorthand Explanation + DEFINE name value .name = value The literal value becomes the contents + of the named variable; variables names in the value are copied without + evaluation. This command is for defining macros that take parameters, + as well as for defining simple variables, especially if the values + contain backslashes. + _DEFINE name value Like DEFINE but the name is evaluated before use. + ASSIGN name value .name := value The value is evaluated and the result + becomes the contents of the named variable. + _ASSIGN name value Like ASSIGN but the name is evaluated before use. + EVALUATE name expression .name ::= value The expression (in regular + algebraic notation) is evaluated arithmetically and the result becomes + the contents of the named variable. If the expression contains any + variables they are evaluated first. + _EVALUATE name expression Like EVALUATE but the name is evaluated + before use. + INCREMENT name expression Evaluates the variables in the expression, + then evaluates the expression arithmetically, and then adds the value + to the contents of the named variable, which must be a number or an + algebraic expression. If the expression is empty, a value of 1 is used. + _INCREMENT name expression Like INCREMENT but the name is evaluated + before use. + DECREMENT name expression Evaluates the variables in the expression, + then evaluates the expression arithmetically, and then subtracts the + value from the contents of the named variable, which must be a number + or an algebraic expression. If the expression is empty, a value of 1 is + used. + _DECREMENT name expression Like DECREMENT but the name is evaluated + before use. + DECLARE name = list An array declaration can include an initializer + list; items in the list are evaluated before assignment. This can be + defeated by doubling any backslashes or enclosing individual arguments + in \fliteral(). + DO name arguments name arguments When invoking a macro with a DO + command (or an implied one), the arguments are evaluated, then assigned + to \%1, \%2, etc, and the macro's name to \%0. + (SETQ name value) Kermit also includes a mini-[65]LISP intpreter + + Variables are evaluated automatically in Kermit commands simply by + referencing them, according to rules given in Table 1. The following + functions can be used to change how a a particular variable is + evaluated: + + CAPTION: Table 3. Kermit Functions for Evaluating Variables + + Function Argument Description + \fcontents() \%x or \&x[y] Evaluates the variable or array element + (which normally would be evaluated recursively) one level deep. + \fdefinition() name If the argument is a \%x variable or an array + element, it is evaluated to get the name; otherwise the argument is the + name. Its definition is returned with no recursion. + \m() name Equivalent to \fdefinition(). + \recurse() \m(name) Forces recursive evaluation of a macro definition + (a.k.a. long variable name). NOTE: \frecurse() can operate on any kind + of variable as well as on any string containing any mixture of + variables. + +C-Kermit's RENAME Command + + C-Kermit's RENAME command, which is used for changing the names of + local files or for moving files locally, has two basic forms: + + RENAME [ optional-switches ] oldfilename newfilename + This form lets you change the name of a single file from + oldfilename to newfilename. Example: + rename thismonth.log lastmonth.log + + RENAME [ optional-switches ] filespec directoryname + This form lets you move (without renaming) one or more files + (all the files that match the filespec, which may contain + wildcard characters such as "*") to the given directory. + Example: + rename *.txt ~/textfiles/ + + Traditionally, the optional switches have been: + + RENAME /LIST oldname newname + Display the old and new name for each file while renaming. + Synonyms: /LOG, /VERBOSE. Example: + rename /list *.txt ~/textfiles/ + + RENAME /NOLIST oldname newname + Don't display the old and new name for each file while renaming. + This is the default behavior. Synonyms: /NOLOG, /QUIET. Example: + rename /nolist *.txt ~/textfiles/ + + Reminder: Every switch starts with a slash (/) and must be preceded by + a space. + +New RENAME Features for C-Kermit 9.0 + + A series of new options (switches) have been added to let you change + the names of multiple files at once by case conversion, string + substitution, or character-set conversion, and optionally also move + them to a different directory: + + /LOWER: Convert the filename to lowercase + /UPPER: Convert the filename to uppercase + /CONVERT: Change the filename's character encoding + /REPLACE: Do string substitutions on the filename + + If the source-file specification includes a path or directory, any + changes are applied to the filenames only, not to the directory or path + specification. + + Since name changes, when applied to many files at once, can have + consequences that are not easily undone, there are also some new + controls, safeguards, and conveniences: + + RENAME /SIMULATE + This switch tells Kermit to show you what the RENAME command + would do without actually doing it. /SIMULATE implies /LIST. + + RENAME /COLLISION:{FAIL,SKIP,OVERWRITE} + This switch governs Kermit's behavior when renaming multiple + files, and any of the names would collide with the name of a + file that already exists. The default, for compatibility with + earlier releases of C-Kermit, is OVERWRITE, i.e. write over the + existing file. The other two protect existing files. SKIP means + to skip (not rename) the file that would cause the collision, + and proceed to the next file, if any. FAIL means that no files + will be renamed if there would be any collisions; for this + Kermit makes two passes, checking each new name it constructs + for existence before starting the second pass (however, there is + no guarantee that in the second pass, it won't create the same + new name for more than one file; in that case, it will stop + before executing the second rename). Example: + rename /simulate /collision:proceed * ~/tmp/ + + Reminder: In switches such as /COLLISION that take arguments + (operands), the switch name and its argument(s) are separated by a + colon (:) with no intevening spaces. Also remember that Kermit keywords + can always be abbreviated by leaving off characters from the right, as + long as the result is still unique in its context. Thus "ren /col:f" + would be equivalent to "rename /collision:fail". + + You can change the following preferences for the RENAME command with + the new SET RENAME command: + + SET RENAME LIST { ON, OFF } + Tells the RENAME command whether to list its actions if you + don't include a /LIST or /NOLIST or equivalent switch. + + SET RENAME COLLISION { FAIL, OVERWRITE, SKIP } + Tells the RENAME command how to handle filename collisions in + the absence of a /COLLISION switch. That is, it replaces the + default action of OVERWRITE with action of your choosing, which + is then used in any RENAME command that does not include an + explicit /COLLISION switch. + + SHOW RENAME + Displays the current SET RENAME settings. + +Changing the Case of Filenames + + RENAME /UPPER:{ALL,LOWER} filespec [ directory ] + RENAME /LOWER:{ALL,UPPER} filespec [ directory ] + These switches let you change the alphabetic case of letters in + all the files whose names match the filespec. If a directory + name is given after the filespec, then the files are also moved + to the given directory. + + By default, all files that match the given filespec have their names + changed (if necessary). This is what the ALL argument means, e.g.: + + RENAME /LOWER:ALL * + RENAME /LOWER * + + You can use either form: RENAME /LOWER is equivalent to RENAME + /LOWER:ALL. The other argument (/LOWER:UPPER or /UPPER:LOWER) means to + leave mixed-case filenames alone, and rename only those files whose + names contain letters of only the given case. Examples: + + RENAME /UPPER:ALL foo.bar + Changes the filename to FOO.BAR. + + RENAME /UPPER foo.bar + Same as "rename /upper:all foo.bar". + + RENAME /UPPER foo.bar ~/old/ + Renames foo.bar to FOO.BAR and moves it to the user's old + directory (Unix). + + RENAME /LOWER * + Changes the names of all files to have only lowercase letters. + + RENAME /LOWER:UPPER * + Changes the names of only those files whose names contain no + lowercase letters to have only lowercase letters. For example, + FOO.BAR would be changed, Foo.Bar would not be changed. foo.bar + would not be changed either because it's already all lowercase. + + RENAME /LOWER:UPPER * ~/new/ + Same as the previous example, but also moves each file to the + user's new directory (whether it was renamed or not). + + Case conversion works reliably for ASCII characters only. Kermit uses + the C library for this, which on any given platform might or might not + handle non-ASCII letters, and if it does, then how it works would + normally depend on your locale definitions (the LC_CTYPE and/or LANG + environment variable in Unix). When non-ASCII letters are not handled + by the C library, the RENAME command does change their case. For + example, Olga_Tañón.txt might become OLGA_TAñóN.TXT. + +String Replacement in Filenames + + The RENAME command also lets you change filenames by string + substitution. + + RENAME /FIXSPACES[:String] filespec [ directory ] + Replaces all spaces in each matching filename by the given + string, if any, or if none is given, by underscore. Examples: + + RENAME /FIX * + RENAME /FIXSPACES:_ * + RENAME /FIXSPACES:"" * + RENAME /FIXSPACES:<040> * + + The first two are equivalent, replacing each space with + underscore; a file called "My Favorite Photo.jpg" becomes + "My_Favorite_Photo.jpg". The third example removes all spaces + ("MyFavoritePhoto.jpg"). The fourth replaces each space with the + string "<040>" ("My<040>Favorite<040>Photo.jpg"). + + RENAME /REPLACE:{{String1}{String2}} filespec [ directory ] + Renames each matching file by changing occurrences of String1 in + its name to String2. If a directory specification is included, + the file is also moved to the given directory (even if the name + was not changed). Note that in this case, the curly braces are + part of the command. Example: + + RENAME /REPLACE:{{.jpeg}{.jpg}} * + + changes all *.jpeg files to *.jpg. + + By default, RENAME /REPLACE changes all occurrences of String1 in each + filename to String2 so, for example, if you had a file called + abcjpegxyz.jpeg, the command just shown would change its name to + abcjpgxyz.jpg. + + For greater control and flexibility, the /REPLACE: switch argument can + take several distinct forms: + + RENAME /REPLACE:String1 filespec [ directory ] + This means to remove all occurrences of String1 from the given + filenames name. It is equivalent to /REPLACE:{{String1}{}}. A + handy use for this option is to remove spaces from filenames. + + RENAME /REPLACE:{{String1}{String2}} filespec [ directory ] + As already noted, this replaces every occurrence of String1 with + String2 in each filename. Alphabetic case in string matching is + done according to the current SET CASE setting. + + RENAME /REPLACE:{{ }{_}} filespec [ directory ] + This replaces all spaces in the given filenames with underscore, + equivalent to RENAME /FIXSPACES. + + RENAME /REPLACE:{{String1}{String2}{Options}} filespec [ directory ] + Options can be included that add more control to the process. + The option string is a sequence of characters; each character in + the string is an option. The choices are: + + A String matching is to be case-sensitive, regardless of SET CASE. + a String matching is to be case-independent, regardless of SET CASE. + ^ String replacement will occur only at the beginning of the filename. + $ String replacement will occur only at the end of the filename. + 1 Only the first occurrence of the string will be replaced. + 2 Only the second occurrence of the string will be replaced. + 3 4 5 6 7 8 ... + 9 Only the ninth occurrence of the string will be replaced. + - (hyphen, minus sign) Before a digit: occurrences will be counted from + the right. + ~ (tilde) Before digit or minus sign: all occurrences but the given one + will be replaced. + + The tilde modifier works only with single-byte character sets such as + ASCII, CP437, ISO 8859-1, etc, but not with multibyte character sets + such as UCS2, UTF8, or any of the Japanese Kanji sets. + + Here are some examples showing how to use the /REPLACE options: + + RENAME /REPLACE:{{foo}{bar}{^}} * + For all files whose names start with "foo", replaces the "foo" + at the beginning with "bar". + + RENAME /REPLACE:{{}{New-}{^}} * + Prepends "New-" to the name of each file. + + RENAME /REPLACE:{{.jpeg}{.jpg}{$}} * + Replaces ".jpeg" at the end of each filename with ".jpg". + + RENAME /REPLACE:{{}{-Old}{$}} * + Appends "-Old" to the name of each file. + + RENAME /REPLACE:{{foo}{bar}{a}} * + Replaces "foo", "FOO", "Foo", "fOO", etc, with "bar" in each + filename. + + RENAME /REPLACE:{{foo}{bar}{A}} * + Replaces only (lowercase) "foo" in filenames with "bar". + + RENAME /REPLACE:{{a}{XX}} * + Changes every "a" to "XX". For example a file called "a.a.a.a" + would become "XX.XX.XX.XX". + + RENAME /REPLACE:{{a}{X}{2}} + Changes only the second "a" to "X". For example a file called + "a.a.a.a" would become "a.X.a.a". + + RENAME /REPLACE:{{a}{X}{-1}} + Changes only the final "a" in the filename (it doesn't have to + be at the end) to "X". For example a file called "a.b.a.c.a.d" + would become "a.b.a.c.X.d". + + RENAME /REPLACE:{{foo}{NOTFOO}{-2}} + Changes the second-to-last "foo" (if any) in the filename to + "NOTFOO". + + RENAME /REPLACE:{{foo}{}{-2}} + Deletes the second-to-last "foo" (if any) from the filename. + + RENAME /REPLACE:{{.}{_}{~1}} + Changes all but the first period to an underscore; for example, + "a.b.c.d.e" would become "a.b_c_d_e". + + RENAME /REPLACE:{{.}{_}{~-1}} + Changes all but the final period to an underscore; for example, + "a.b.c.d.e" would become "a_b_c_d.e". + + In the Options field, digits (and their modifiers), ^, and $ are + mutually exclusive. If you include more than one of these in the option + string, only the last one is used. Similarly for 'a' and 'A': + + RENAME /REPLACE:{{foo}{bar}{Aa2$^}} * + This replaces "foo" with "bar" no matter what combination of + upper and lower case letters are used in "foo" ('a' overrides + 'A' in the option string), but only if "foo" is at the beginning + of the filename ('^' overrides '$' and '2'). + + If you give an /UPPER or /LOWER switch and a /REPLACE switch in the + same RENAME command, the /REPLACE action occurs first, then the case + conversion: + + RENAME /REPLACE:{{foo}{bar}} /UPPER * /tmp + For each file: changes all occurrences of "foo" in the name to + "bar", then converts the result to uppercase, and then moves the + file to the /tmp directory. So (for example) "foot.txt" would + become "/tmp/BART.TXT". + +Changing the Character Encoding of Filenames + + As you know, text is represented on the computer as a series of + numbers, with a given number corresponding to a given character + according to some convention or standard. Filenames are represented the + same way. The trouble is, different computers, or even different + applications on the same computer, might use different standards or + conventions ("character sets") for representing the same characters. + Usually ASCII is safe, but anything beyond that -- non-ASCII characters + such as accented or non-Roman letters -- is likely to vary. Sometimes + you have text that's in the "wrong" character set and you need to + convert it to something you can can use. Kermit has always been able to + handle this as part of file transfer and terminal emulation, as well as + being able to convert text files locally with its TRANSLATE command. + Now there's a way to convert filenames too, for example after copying + files from a CD that uses a different encoding: + + RENAME /CONVERT:charset1:charset2 filespec [ directory ] + Converts filenames from the first character set to the second + one. The two character sets can be chosen from the SET FILE + CHARACTER-SET list; for complete details see [66]this page. For + example suppose you have a file called "Olga_Tañón.txt" on a + computer where ISO 8859-1 Latin Alphabet 1 is used, and you have + transported it (e.g. on CDROM) to another computer where the + text encoding is UTF8. Maybe you also have a lot of other files + with similar names in the same directory. You can convert the + filenames to UTF8 like this: + + RENAME /CONVERT:latin1:utf8 * + + /CONVERT can not be combined with /UPPER, /LOWER, or /REPLACE. + + You should NOT use UCS2 for filenames since this encoding is not + compatible with C strings used in Unix and elsewhere. + + RENAME /CONVERT affects only the filename, not the file's contents. You + can use the TRANSLATE command to convert the encoding of the contents + of a text file. + +Other New Features + + See the [67]C-Kermit Daily Builds page for details. Very briefly: + + * Perhaps most important, modernized makefile targets for the major + Unix platforms: Linux, Mac OS X, AIX, Solaris, etc. These are + somewhat automated; not autoconf exactly, but they cut down + significantly on redundant targets. For example, one single "linux" + target works on many (hopefully all) different Linux + configurations, where before different targets were required for + different combinations of (e.g.) curses / ncurses / no curses; + 32-bit / 64-bit; different feature sets and library locations. + (Separate targets are still required for Kerberos and/or SSL + builds, but they are "subroutinized".) + * Bigger buffers, more storage for commands, macros, scripts, + strings, and filename expansion in 64-bit versions and in 32-bit + versions that support large files. + * New options for the RENAME command, allowing you to rename groups + of files at once, changing case of letters in the name or changing + its character set, removing spaces or changing them to something + else, and/or doing anchored or floating or occurrence-based string + replacement, described [68]HERE. + * Built-in FTP client for VMS. This is the [69]same FTP client Unix + C-Kermit has had since version 8.0, minimally adapted to VMS by + SMS, supporting binary and Stream_LF file transfer only (in other + words, nothing to handle RMS files), but otherwise fully functional + (and scriptable) and theoretically capable of making connections + secured by SSL (at least it compiles and links OK with SSL - HP SSL + 1.3 in this case). In the present Alpha release, this is an + optional feature requested by including the "i" option in P1 (and + by including "CK_SSL" in P3 if you also want SSL, and then also + "OPENSSL_DISABLE_OLD_DES_SUPPORT" if necessary). Much testing is + needed to determine if it should be included in the final C-Kermit + 9.0 release. + * Large file support in VMS, also by SMS. Alpha and Itanium only (not + VAX). VMS C-Kermit was already able to transfer large files, but + the file-transfer display (numbers and progress bar) and statistics + were wrong because they used ints. In the present Alpha test + release, this is an optional feature requested by including the "f" + option in P1. + * User-settable FTP timeout, works on both the data and control + connection. + * FTP access to ports higher than 16383. + * New PUTENV command that allows Kermit to pass environment variables + to subprocesses (Unix only). + * Unix C-Kermit SET TERMINAL TYPE now passes its arguments to + subprocesses as an environment variable. + * New TOUCH command, many file selection options. + * New DIRECTORY command options and switches (/TOP, /COUNT; + HDIRECTORY, WDIRECTORY...). To see the ten biggest files in the + current directory: "dir /top:10 /sort:size /reverse *" or + equivalently, "hdir /top:10 *". WDIR lists files in reverse + chronological order, shorthand for "dir /sort:date /reverse". + * New command FSEEK /FIND:string-or-pattern, seeks to the first line + in an FOPEN'd file that contains the given string or matching the + given pattern. Example: Suppose you have a file of lines like this: + + quantity description... + in which the first "word" is a number, and a description (for + example, the name of an item). Here is how to use FSEEK to quickly + get the total quantity of any given item, which is passed as a + parameter (either a literal string or a pattern) on the command + line: + +#!/usr/local/bin/kermit + +if not def \%1 exit 1 Usage: \fbasename(\%0) string-or-pattern + +.filename = /usr/local/data/items.log # Substitute the actual filename +set case off # Searches are case-independent +fopen /read \%c \m(filename) # Open the file +if fail exit 1 "\m(filename): \v(errstring)" # Fail: exit with error message +.total = 0 # OK: Initialize the total +echo Searching "\%1"... + +while true { + fseek /line /relative /find:\%1 \%c 0 # Get next line that has target + if fail break # Failure indicates EOF + fread /line \%c line # Read it + if fail break # (shouldn't happen) + increment total \fword(\m(line),1) # Increment the total +} +fclose \%c # Close the file +echo Total for "\%1" : \m(total) # Print the result +exit 0 + + The syntax of the FSEEK command in this example indicates that each + search should start relative to the current file line. Since Kermit + is an interpretive language, FSEEK is a lot faster than FREAD'ing + each line and checking it for the target, especially for big files. + An especially handy use for FSEEK is for use with potentially huge + sequentially timestamped logs, to seek directly to the date-time + where you want to start processing. Some other improvements for the + FOPEN/FREAD/FWRITE/FCLOSE family of commands are included also + (perfomance, bug fixes, convenience features), listed in the + [70]change log. (Prior to 9.0.299 Alpha.02, the FSEEK /FIND: + command always started from the top.) + * SET SESSION-LOG TEXT now strips out ANSI escape sequences from the + session log. + * For interacting with POP servers over clear-text or SSL-secured + connections: + + New SSL and TLS "raw" connections (no Telnet protocol). + + New INPUT command options for reading and capturing (perhaps + while scanning) continuous incoming text, such as INPUT + /NOWRAP (explained [71]HERE). + + New \femailaddress() command to extract the e-mail address + from an Internet mail message To: or From: line, used in + fetching mail from POP servers. + + Improved date parsing commands and functions for parsing the + different date formats that can appear in e-mail. + + Production scripts for fetching mail from a secure POP server, + available [72]HERE. + * Various features added to make Kermit more useful for writing CGI + scripts such as INPUT /COUNT:n to INPUT exactly n characters + (useful for reading form data). + * New \fpictureinfo() function for getting orientation and dimensions + of JPG and GIF images, described [73]HERE. + * New \fgetpidinfo() function for testing whether a given process + exists. + * \fkwdvalue() function fixed to allow multiword values. + * New function \fcount(s1,s2) to tell the number of occurrences of s1 + in s2. + * New \flopx() function returns rightmost field from string (such as + a file's extension). + * New function \ffunction(s1) to tell whether a built-in s1 function + exists. + * New \fsqueeze(s1) function removes leading and trailing whitespace + from string s1, changes tabs to spaces, squeezing each run of + repeated whitespace characters to a single space (Alpha.02). + * Compact substring notation: \s(somestring[12:18]) is the same as + \fsubstring(\m(somestring),12,18), i.e. the substring starting at + position 12, 18 charcters long. \s(somestring[12_18]) means + characters 12 through 18 of the string (7 characters). + * The string indexing functions now accept an optional trailing + argument specifying the occurrence number of the target string. + Likewise, \fword() can fetch words from the right as well as the + left. + * The COPY command in Unix C-Kermit has a new /PRESERVE switch, + equivalent to Unix "cp -p". + * ASKQ /ECHO:c can be used to make the characters the user types echo + as the character c, e.g. asterisk when typing a password. + * IF LINK filename to test if the filename is a symlink. + * Ctrl-K, when typed at the command parser, replaces itself with most + recently entered file specification. + * In Unix, the ability to log a terminal session to a serial port, + for use with speaking devices or serial printers; described + [74]HERE. Also for the same purpose, SET SESSION-LOG + NULL-PADDED-LINES for a speech synthesizer than needed this. + * Adaptation to OpenSSL 0.9.8 and 1.0.0. + * Lifted the restriction on having a remote Kermit program send + REMOTE commands to the local. A very big ex-client needed to be + able to do this (branches would connect to headquarters and upload + files; HQ would then download patches, a REMOTE HOST command was + necessary to allow the remote headquarters machines to install the + patches on the local client; of course the client first has to + ENABLE HOST because this is a risky scenario). The reason for the + restriction was that the server, upon receiving any REMOTE command + would send the results (output) back to the client as a file + transfer with "destination screen", but of course the remote has no + screen. + * [75]MIME synonyms for character-set names were introduced in + Alpha.05. Nobody seemed to notice that after that, character-set + selection didn't work at all. Anyway, now it's fixed. + * Added XMESSAGE, which is to MESSAGE (Alpha.03) as XECHO is ECHO: it + outputs a string with no line terminator DEBUG MESSAGE is ON. + * Fixed \recurse() to not dump core when invoked with no arguments. + * Improved text for HELP FUNCTION SPLIT and HELP FUNCTION WORD. + * Patches for Debian 6.0 "Squeeze" from Ian Beckwith. + * \fcontents(\&a[3]) got an error if the array was declared but its + dimension was less than 3. Now it simply returns and empty string. + * \fsplit(), when parsing lines from CSV and TSV files, was treating + backslash in the data the same way it treats backslash in Kermit + commands. This was fixed to treat backslash like any other + character. + * Builds for Solaris 9 and later now use streams ptys rather then the + old BSD-style ptys. Thanks to Gary Mills for this one, who noticed + that he couldn't have more than 48 C-Kermit SSH sessions going at + once and figured out why. + * As noted [76]below DES encryption is being retired from many + platforms and libraries that once used it. I changed the Solaris + and Linux OpenSSL builds to account for this by testing for it. I + probably should also add a OMITDES option to omit DES even if it is + installed, but "KFLAGS=-UCK_DES" seems to do the job for now. + * I changed the Linux build to test for the OpenSSL version (like the + Solaris version already did), rather than assuming OpenSSL 0.9.7. + * A couple minor changes for Tru64 Unix 5.1B from Steven Schweda but + we still have some trouble on that platform. As a workaround "make + osf1" can be used there. + * Unix makefile and man page are now included in the Zip + distribution. + * \fjoin(), which is the inverse function of fsplit() now accepts CSV + and TSV as a second argument, to transform an array into a + comma-separated or tab-separated value list, as described [77]HERE. + * Even in 2010, Unix distributions continue to change their UUCP + lockfile conventions. Alpha.08 contains support from Joop Boonen + for OpenSuse >= 11.3 and recent Debian, which no longer have + baudboy.h, which first appeared in Red Hat 7.2 in 2003. + * From Lewis McCarthy: + + Based on code inspection, C-Kermit appears to have an SSL-related + security vulnerability analogous to that identified as CVE-2009-3767 + (see e.g. + [78]http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767). + + I'm attaching a patch for this issue relative to the revision of + ck_ssl.c obtained from a copy of + [79]http://www.columbia.edu/kermit/ftp/test/tar/x.zip downloaded on + 2010/07/30, which I believe is the latest. + When this flaw was first widely publicized at last year's Black Hat + conference, it was claimed that some public certificate authorities + had indeed issued certificates that could be used to exploit this + class of vulnerability. As far as I know they have not revealed + specifically which public CA(s) had been found issuing such + certificates. Some references: + + [80]http://www.mseclab.com/?p=180 + + [81]http://www.theregister.co.uk/2009/07/30/universal_ssl_cert + ificate/ + + * Peter Eichhorn reported that "RENAME ../x ." didn't work; fixed + now. + * If only one file is FOPEN'd, FCLOSE given with no arguments would + close it; this was a "convenience feature" that turned out to be + dangerous. For safety FCLOSE has to require a specific channel + number or the word ALL. + * Added \fstrcmp(s1,s2,case,start,length), which has the advantage + over IF EQU,LGT,LLT that case senstivity can be specified as a + function arg, and also substrings can be specified. + * Fixed a subtle flaw in the [82]CSV feature that was added in + Alpha.06, namely that if the last item in a comma separated list + was enclosed within doublequotes with a trailing space after the + closing doublequote, a spurious empty final element would be + created in the result array. + * New built-in functions: + + \fcvtcsets(string,cs1,cs2) + Function to convert a string from one character set to + another. + + \fdecodehex(string[,prefix]) + Function to decode a string containing hex escapes. + + \fstringtype(string) + Function to tell whether a string is 7-bit, 8-bit, or + UTF-8. + + For the motivation for these features and an application that uses + them to analyze web logs, see the Weblog script below. + * MIME Character-Set Names: A new equivalence between MIME names and + Kermit names for character sets, with a new table showing the + supported sets [83]HERE (this feature is also illustrated in the + Weblog script). + * + + Lazy IF Conditions: Third, now you can do this: + define foo some number + if foo command + + instead of this: + define foo some number + if \m(foo) command + + Of course the old way still works too. But watch out because if the + variable name is the same as a symbolic IF condition (for example + COUNT), it won't do what you expected. (IF COUNT was used for loop + control in early versions of MS-DOS Kermit, before it got true FOR + and WHILE loops; it was added to C-Kermit for compatibility, and it + can't be removed because it could break existing scripts). + * Escape sequences are now stripped from text-mode session logs not + only in CONNECT sessions but also in whatever is logged by the + INPUT command; described in the [84]next section. + * New commands for selectively issuing progress or debugging messages + from scripts, also described in the next section. + * Fix from [85]John Dunlap to prevent the fixed packet-timeout + interval from going to an unexpected value. + * Alpha.04 fixes a problem with FTP connections made from 64-bit Unix + platforms. All the other changes in this section were to Alpha.03. + * Relaunching a closed SSH connection with the CONNECT command is now + possible, as it always has been with Telnet and other connection + types; suggested by Peter Eichhorn (needs testing). + * A symbol conflict fixed that prevented successful build on + [86]FreeBSD 8.0. + * Fixes from Christian Corti for building on SunOS 4.1. + * New aixg target for building on AIX with gcc. + * New aix+ibmssl target. This is nice because the IBM-supplied SSL + libraries and header files are in a known location; no need to + [87]set environment variables giving their locations. + * "Large File Support" is now included by default on Alpha and IA64 + hardware on VMS 7.3 and later, and it should work much better than + before. + * Kermit's internal FTP client is now included by default in any + build that also includes TCP/IP networking. At present, the FTP + client seems to work well for binary-mode transfers; text (ASCII) + mode transfers still need some work. In builds that also include + Secure Sockets Layer (SSL) security (next item) the FTP client + should be able to make securely authenticated and encrypted + connections. + * In network builds that request OpenSSL support, e.g.: + + $ @ckvker "" "" "CK_SSL" + the OpenSSL version is detected automatically and the appropriate + compile-time options are emitted (such as + OPENSSL_DISABLE_OLD_DES_SUPPORT). + * Preliminary / limited support for the ODS-5 file system on VMS 7.2 + and later, Alpha and Itanium only (needs testing): Filenames can be + mixed case and can be longer. + * Support for older and older VMS versions. + * In the VMS build procedure, CKVKER.COM, the "i" option in P1 now + means don't include the internal FTP client, and the "f" option + means do not include "Large File" support. Large File support in + VMS really only applies to the file-transfer display and + statistics, which would go out of whack as soon as the byte count + overflowed 31 bits because this is C-Kermit, built with the C + compiler and the C library (runtime system), which did not support + long integers until VMS 7.3. + * The [88]LISP Operator ROUND now takes an optional second argument + that specifies the number of places to round to, e.g. + (ROUND dollars 2) rounds dollars to 2 decimal places. + * Improved pattern matching in many commands for both strings and + filenames. + * Various minor new features, plus numerous bug fixes and speedups. + +Incompatibilities + + A top priority for new Kermit software releases has always been + backwards compatibility. A script written for a previous Kermit release + should run the same way in the new release. + + There's one exception this time. The [89]\fsplit() function is + incredibly handy, it can do almost anything, up to and including + parsing a LISP program (the underlying code is the basis of the + [90]S-Expression interpreter). But did you ever try to use it to parse + (say) a Tab-Separated-List (TSV file) or Comma-Separated-List (CSV)? It + works as expected as long as the data contains only 7-bit characters. + But if your data contains (say) Spanish or German or Russian text + written in an 8-bit character set such as ISO 8859-1, every 8-bit + character (any value 128-255) is treated as a break character. This is + fixed in C-Kermit 9.0 by treating all 8-bit bytes as "include" + characters rather than break characters, a total reversal of past + behavior. I don't think it will affect anyone though, because if this + had happened to anyone, I would have heard about it! + + Since most standard 8-bit character sets have control characters in + positions 128-160, it might have made sense to keep 128-160 in the + break set, but with the proliferation of Microsoft Windows code pages, + there is no telling which 8-bit character is likely to be some kind of + text, e.g. "smart quotes" or East European or Turkish accented letters. + +What's Not In C-Kermit 9.0 + + Some large projects that were contemplated have not been done, + including: + * IPv6. Honestly, there has been zero demand for this, and it would + be a lot of work and disruption to the code base. Volunteers + welcome, I guess. It could be a CS project. + * A database interface - MySQL or ODBC. For this one, there is some + demand but I haven't had a chance to even look into it. + * There's a looming issue with DES encryption; major vendors are + removing it from their platforms, starting with Apple in Mac OS X + 10.6, with Microsoft to follow suit. A secure version of Kermit can + be built without DES, but in limited testing successful connections + were spotty (e.g. with Kerberos 5). + * Cleaning up the Unix makefile. It has 25 years' worth of targets in + it. It is very likely safe to remove most of them, since (a) most + old platforms have gone away by now, or have been upgraded, due to + hacking vulnerabilities; (b) the market has consolidated + considerably; and (c) most of the new features of C-Kermit 9.0, + such as large files, won't be of any use on older platforms and + previous C-Kermit versions will remain available. + * Packages. Everybody wants an install package custom made for their + own computer, Linux RPMs being the prime example but far from the + only one. These will come, I suppose (especially with some Linux + sites having a policy against installing any application that does + not come as an RPM). In the meantime, here's a page that describes + some Kermit-specific issues in package construction: + [91]ckpackages.html. + +And a Loose End... +Using External File-Transfer Protocols on Secure Connections + + After C-Kermit 8.0.212 Dev.27 (2006/12/22), I spent a big chunk of time + trying to solve a particular problem that some of you have complained + about and others might be familiar with: If you use C-Kermit to make a + secure Telnet connection to another host (e.g. with Telnet SSL/TLS, + Kerberos, or SRP) and then attempt to transfer a file using an external + protocol such as Zmodem, it doesn't work. + + That's because as coded (through 8.0.211), C-Kermit simply starts the + external protocol in a fork with its standard i/o redirected to the + connection. This completely bypasses the encryption and decryption that + is done by C-Kermit itself, and of course it doesn't work. The same + thing occurs if you use the REDIRECT command. The routine that handles + this is ttruncmd() in ckutio.c. + + In order to allow (say) Zmodem transfers on secure connections, it is + necessary for C-Kermit to interpose itself between the external Zmodem + program and the connection, decrypting the incoming stream before + feeding it to Zmodem and encrypting Zmodem's output before sending out + the connection. + + In principal, this is simple enough. We open a pseudoterminal pair + ("master" and "slave") for Zmodem's i/o and we create a fork and start + Zmodem in it; we read from the fork pty's standard output, encrypt, and + send to the net; we read from the net, decrypt, and write to the fork + pty's standard input. + + In practice, it's not so simple. First of all, pseudoterminals (ptys) + don't seem to interface correctly with certain crucial APIs, at least + not in the OS's I have tried (Mac OS X, Linux, NetBSD, etc), such as + select(). And i/o with the pty often - perhaps always - fails to + indicate errors when they occur; for example, when the fork has exited. + + But, even after coding around the apparent uselessness of select() for + multiplexing pty and net, and using various tricks to detect when the + external protocol exits and what its exit status is, I'm still left + with a show-stopping problem: I just simply can not download (receive) + a file with Zmodem, which is the main thing that people would probably + want to do. I can send files just fine, but not receive. The incoming + stream is delivered to Zmodem (to the pty slave) but upon arrival at + the Zmodem process itself, pieces are always missing and/or corrupt. + Yet I can receive files just fine if I use Kermit itself (C-Kermit or + G-Kermit) as the external protocol, rather than Zmodem. + + I can think of two reasons why this might be the case: + + 1. Zmodem sends all 8-bit bytes and control codes in the clear, and + maybe the pty is choking on them because it thinks it is a real + terminal. + + But Zmodem puts its controlling terminal into raw mode. And C-Kermit + puts the pty into raw mode too, just for good measure. If any 0xFF + codes are in the Zmodem data stream, and it's a Telnet session, Kermit + does any needed byte stuffing/unstuffing automatically. Anyway, if I + tell Zmodem to prefix everything, it makes no difference. + + 2. Zmodem is a streaming protocol and perhaps the pty driver can't + keep up with a sustained stream of input at network speeds. What + would be the method of flow control? + + I can vary the size of the i/o buffers used for writing to the pty, and + get different effects, but I am not able to get a clean download, no + matter what buffer size I use. write()'ing to the pty does not return + an error, and I can't see the errors because they happen on the master + side. It's as if the path between the pty slave and master lacks flow + control; I deliver a valid data stream to the pty slave and the master + gets bits and pieces. This impression is bolstered somewhat by the + "[92]man 7 pty" page in HP-UX, which talks about some special modes for + ptys that turn off all termio processing and guarantee a + flow-controlled reliable stream of bytes in both directions - a feature + that seems to be specific to HP-UX, and exactly the one we need + everywhere. + + Well, in Pass One I used C-Kermit's existing pty routines from + ckupty.[ch], which are well-proven in terms of portability and of + actually working. They are currently used by SET HOST /PTY for making + terminal connections to external processes. But these routines are + written on the assumption that the pty is to be accessed interactively, + and maybe they are setting the fork/pty arrangement up in such a way + that that's not suitable for file transfer. The Pass One routine is + called xttptycmd() in ckutio.c. + + So in Pass Two I made a second copy of the routine, yttptycmd(), that + manages the pty and fork itself, so all the code is in one place and + it's simple and understandable. But it still doesn't work for Zmodem + downloads. In this routine, I use openpty() to get the pty pair, which + is not portable, so I can have access to both the master and slave pty + file descriptors. This version can be used only a platforms that have + openpty(): Linux, Mac OS X, NetBSD, etc. + + In Pass Three, zttptycmd(), I tried using pipes instead of ptys, in + case ptys are simply not up to this task (but that can't be true + because if I make a Telnet or SSH connection into a host, I can send + files to it with Zmodem, and the remote Zmodem receiver is, indeed, + running on a pty). But pipes didn't work either. + + In Pass Four, I extracted the relevant routines into a standalone + program based on yttptycmd() (the openpty() version, for simplicity), + which I tested on Mac OS X, the idea being to rule out any + "environmental" effects of running inside the C-Kermit process. There + was no difference -- Kermit transfers (with C-Kermit itself as the + external protocol) worked; Zmodem transfers (neither sz or lsz) did + not. + + Well, it's a much longer story. As the external protocol, I've tried + rzsz, crzsz, and lrzsz. We know that some of these have quirks + regarding standard i/o, etc, which is one of the reasons for using ptys + in the first place, and i/o does work - just not reliably. Anyway, the + 1100 lines or so of [93]ckc299.txt, starting just below where it says + "--- Dev.27 ---" tell the full story. At this point I have to give up + and move on; it might be more productive to let somebody else who has + more experience with ptys take a look at it - if indeed anyone still + cares about being able to do Zmodem transfers over secure Telnet + connections. + + C-Kermit 9.0 contains the three new routines (and some auxiliary ones), + but they are not compiled or called unless you build it specially: + + make targetname KFLAGS=-DXTTPTYCMD (builds with xttptycmd()) + make targetname KFLAGS=-DYTTPTYCMD (builds with yttptycmd()) + make targetname KFLAGS=-DZTTPTYCMD (builds with zttptycmd()) + + These are all in [94]ckutio.c. As noted, the second one works only for + Linux, FreeBSD, NetBSD, and Mac OS X, because it uses non-POSIX, + non-portable openpty(). If you want to try it on some other platform + that has openpty(), you can build it like this: + + make targetname "KFLAGS=-DYTTPTYCMD -DHAVE_OPENPTY" + + (and let me know, so I can have HAVE_OPENPTY predefined for that + platform too). The best strategy to get this working, I think, would be + to concentrate on yttptycmd(), which is the simpler of the two + pty-based routines. If it can be made to work, then we'll see if we can + retrofit it to use the ckupty.c routines so it will be portable to + non-BSD platforms. + + By the way, if you build with any of [XYZ]TTPTYCMD defined, then the + selected routine will always be used in place of ttruncmd(). This is to + allow testing on all kinds of connections, not just secure ones, in + both local and remote mode. Once the thing works, if it ever does, I'll + add the appropriate tests and/or commands. + + By default, in the initial test release, C-Kermit 9.0 uses ttruncmd() + on serial connections and ttyptycmd() on network connections. Even when + a network connection is not encrypted, Kermit still needs to handle the + network protocol, e.g. the quoting of 0xff bytes on Telnet connections. + +Demonstration: Fetch Mail from POP Server Secured by SSL + + [95]pop.ksc is a fully elaborated production script for fetching one's + mail from a POP3 server over a connection secured by SSL. For + explanation and documentation, [96]CLICK HERE. [97]mailcheck is a + wrapper for the pop.ksc script, which collects your password one time, + and then checks for new mail every 5 minutes (or other selected + interval) and calls pop.ksc to fetch it if there is any. + +Demonstration: HP Switch Configuration Backup + + A common use for Kermit software is to make automated backups of the + configuration of network switches and routers, such as those made by + Cisco or Hewlett-Packard (although [98]tftp can be used for this, it is + not available in all such devices; Kermit, however, works with those + that have tftp as well as those that don't). + + Typically a backup can be done by making a Telnet, SSH, or serial + connection to the device with Kermit and giving a command such as "show + config" at the command-line prompt of the device with Kermit's session + log activated. The result is a list of the commands that were used to + establish the current configuration, suitable for feeding back to the + device's console (e.g. with C-Kermit's TRANSMIT command) to reestablish + the same configuration or to duplicate it on another device. + + At an HP installation it was noted, however, that while the HP switches + (various ProCurve models) produced the desired list of commands, they + were interspersed with escape sequences for special effects, thus + rendering the recorded sessions unsuitable for feeding back into the + switches. + + C-Kermit 9.0 introduces a new feature to strip the offending sequences + out of a session log, leaving just the text. The command SET + SESSION-LOG TEXT activates this feature. In C-Kermit 9.0 Alpha.02 and + earlier, escape sequence stripping occurred only while logging + interactive (CONNECT) sessions; beginning with Alpha.03 it is done also + for data that is read by INPUT commands and therefore works for scripts + too. + + A sample HP Switch Configuration Backup script is [99]HERE, and its + data file is [100]HERE. This script also illustrates some other new + features of Alpha.03: + + MESSAGE text + This lets you put debugging messages in your script that can be + displayed or not, according to SET DEBUG MESSAGE (below). This + way you don't have to change your script for debugging. Hint: + In Unix, invoke the script like this: + + $ DEBUG=1 scriptname arg1 arg2... + + and then include the following command in your script: + + if defined \$(DEBUG) set debug message on + + XMESSAGE text + Like MESSAGE but prints the text with no line terminator, so it + can be continued by subsequent messages. + + SET DEBUG MESSAGE { ON, OFF, STDERR } + ON means MESSAGE commands should print to standard output; OFF + means they shouldn't print anything; STDERR means the messages + should be printed to [101]stderr. DEBUG MESSAGE is OFF by + default, i.e. unless you SET it to ON or STDERR. + + IF DEBUG command + Executes the command if SET DEBUG MESSAGE is not OFF. + + The \v(lastcommand) variable + This variable contains the previous command. You can use it in + debugging and error message to show (for example) exactly what + the command was that just failed, without having to make a copy + of the command: + +set host somehost.somecompany.com +if fail exit 1 "FATAL - \v(lastcommand)" + + which, if the SET HOST command fails, prints "FATAL - set host + somehost.somecompany.com" and then exits with status 1 (which + normally indicates failure). + +Demonstration: HP iLO Blade Configuration + + [102]THIS DOCUMENT describes a script in production use at Columbia + University for configuring and deploying racks full of HP blade servers + through their "integrated Lights Out" (iLO) management interface, + bypassing the tedious and error-prone process of configuring the + servers one by one through the vendor-provided point-and-click Web + interface, which is ill-suited to configuring large numbers of blades. + The script illustrates some of C-Kermit 9.0's new features; source code + is available through the link. The code is apt to change from time to + time as new requirements surface. + +Demonstration: IBM/Rolm/Siemens CBX Management + + [103]THIS DOCUMENT describes a suite of scripts (some in production, + some in development) used to manage the Columbia campus 20,000-line + main telephone switch, along with about 10 satellite switches at + off-campus locations. These switches are 1980s technology*, their + management consoles are serial ports. Access is via Telnet to reverse + terminal servers. The scripts allow for interactive sessions as well as + automatic production (and in some cases formatting) of different + reports required by different groups at different intervals. These + scripts replace a whole assortment of ad-hoc ProComm ASPECT scripts + that were scattered all over the place, with passwords embedded. The + new scripts are intended to be run from a centralized server where + there is a single well-secured configuration file, and where they can + be used on demand, or in cron jobs. They are modular so code + duplication is minimal. + __________________________ + * Of course the University is deploying new technology but the but the + old system will be used in parallel for some time to come. + +Demonstration: CSV and TSV Files + + Contents + + * [104]Reading a CSV or TSV Record and Converting it to an Array + * [105]Using \fjoin() to create a Comma- or Tab-Separated Value List + from an Array + * [106]Using CSV or TSV Files + + Comma-Separated Value (CSV) format is commonly output by spreadsheets + and databases when exporting data into plain-text files for import into + other applications. Here are the details: + + Comma-Separated List Syntax + + 1. Each record is a series of fields. + 2. Records are in whatever format is used by the underlying file + system for lines of text. + 3. Fields within records are separated by commas, with zero or more + whitespace characters (space or tab) before and/or after the comma; + such whitespace is considered part of the separator. + 4. Fields with imbedded commas must be enclosed in ASCII doublequote + characters. + 5. Fields with leading or trailing spaces must be enclosed in ASCII + doublequotes. + 6. Any field may be enclosed in ASCII doublequotes. + 7. Fields with embedded doublequotes must be enclosed in doublequotes + and each interior doublequote is doubled. + + Here is an example: + +aaa, bbb, has spaces,,"ddd,eee,fff", " has spaces ","Muhammad ""The Greatest"" A +li" + + The first two are regular fields. The second is a field that has an + embedded space but in which any leading or trailing spaces are to be + ignored. The fourth is an empty field, but still a field. The fifth is + a field that contains embedded commas. The sixth has leading and + trailing spaces. The last field has embedded quotation marks. + + Prior to C-Kermit 9.0 Alpha.06, C-Kermit did not handle CSV files + according to the specification above. Most seriously, there was no + provision for a separator to be surrounded by whitespace that was to be + considered part of the separator. Also there was no provision for + quoting doublequotes inside of a quoted string. + +Reading a CSV record + + Now the \fsplit() function can handle any CSV-format string if you + include the symbolic include set "CSV" as the 4th parameter. To + illustrate, this program: + +def xx { + echo [\fcontents(\%1)] + .\%9 := \fsplit(\fcontents(\%1), &a, \44, CSV) + for \%i 1 \%9 1 { echo "\flpad(\%i,3). [\&a[\%i]]" } + echo "-----------" +} +xx {a,b,c} +xx { a , b , c } +xx { aaa,,ccc," with spaces ",zzz } +xx { "1","2","3","","5" } +xx { this is a single field } +xx { this is one field, " and this is another " } +xx { name,"Mohammad ""The Greatest"" Ali", age, 67 } +xx { """field enclosed in doublequotes""" } +exit + + gives the following results: + +[a,b,c] + 1. [a] + 2. [b] + 3. [c] +----------- +[ a , b , c ] + 1. [a] + 2. [b] + 3. [c] +----------- +[ aaa,,ccc," with spaces ",zzz ] + 1. [aaa] + 2. [] + 3. [ccc] + 4. [ with spaces ] + 5. [zzz] +----------- +[ "1","2","3","","5" ] + 1. [1] + 2. [2] + 3. [3] + 4. [] + 5. [5] +----------- +[ this is a single field ] + 1. [this is a single field] +----------- +[ this is one field, " and this is another " ] + 1. [this is one field] + 2. [ and this is another ] +----------- +[ name,"Mohammad ""The Greatest"" Ali", age, 67 ] + 1. [name] + 2. [Mohammad "The Greatest" Ali] + 3. [age] + 4. [67] +----------- +[ """field enclosed in doublequotes""" ] + 1. ["field enclosed in doublequotes"] +----------- + + The separator \44 (comma) must still be specified as the break set (3rd + \fsplit() parameter). When "CSV" is specified as the include set: + * The Grouping Mask is automatically set to 1 (which specifies that + the ASCII doublequote character (") is used for grouping; + * The Separator Flag is automatically set to 1 so that adjacent field + separators will not be collapsed; + * All bytes (values 0 through 255) other than the break character are + added to the include set; + * Any leading whitespace is stripped from the first element unless it + is enclosed in doublequotes; + * Any trailing whitespace is trimmed from the end of the last element + unless it is enclosed in doublequotes; + * If the separator character has any spaces or tabs preceding it or + following it, they are ignored and discarded; + * The separator character is treated as an ordinary data character if + it appears in a quoted field; + * A sequence of two doublequote characters ("") within a quoted field + is converted to a single doublequote. + + There is also a new TSV symbolic include set, which is like CSV except + without the quoting rules or the stripping of whitespace around the + separator because, by definition, TSV fields do not contain tabs. + + Of course you can specify any separator(s) you want with either the + CSV, TSV, or ALL symbolic include sets. For example, if you have a TSV + file in which you want the spaces around each Tab to be discarded, you + can use: + +\fsplit(variable, &a, \9, CSV) + + \9 is Tab. + + The new symbolic include sets can also be used with \fword(), which is + just like \fsplit() except that it retrieves the nth word from the + argument string, rather than an array of all the words. In C-Kermit you + can get information about these or any other functions with the HELP + FUNCTION command, e.g.: + +C-Kermit> help func word + +Function \fword(s1,n1,s2,s3,n2,n3) - Extracts a word from a string. + s1 = source string. + n1 = word number (1-based) counting from left; if negative, from right. + s2 = optional break set. + s3 = optional include set (or ALL, CSV, or TSV). + n2 = optional grouping mask. + n3 = optional separator flag: + 0 = collapse adjacent separators; + 1 = don't collapse adjacent separators. + + \fword() returns the n1th "word" of the string s1, according to the + criteria specified by the other parameters. + + The BREAK SET is the set of all characters that separate words. The + default break set is all characters except ASCII letters and digits. + ASCII (C0) control characters are treated as break characters by default, + as are spacing and punctuation characters, brackets, and so on, and + all 8-bit characters. + + The INCLUDE SET is the set of characters that are to be treated as + parts of words even though they normally would be separators. The + default include set is empty. Three special symbolic include sets are + also allowed: + + ALL (meaning include all bytes that are not in the break set) + CSV (special treatment for Comma-Separated-Value records) + TSV (special treatment for Tab-Separated-Value records) + + For operating on 8-bit character sets, the include set should be ALL. + + If the GROUPING MASK is given and is nonzero, words can be grouped by + quotes or brackets selected by the sum of the following: + + 1 = doublequotes: "a b c" + 2 = braces: {a b c} + 4 = apostrophes: 'a b c' + 8 = parentheses: (a b c) + 16 = square brackets: [a b c] + 32 = angle brackets: + + Nesting is possible with {}()[]<> but not with quotes or apostrophes. + +Returns string: + Word number n1, if there is one, otherwise an empty string. + +Also see: + HELP FUNCTION SPLIT + +C-Kermit> + +Using \fjoin() to create Comma- or Tab-Separated Value Lists from Arrays + + In C-Kermit 9.0, \fsplit()'s inverse function, [107]\fjoin() received + the capability of converting an array into a comma-separated or a + tab-separated value list. Thus, given a CSV, if you split it into an + array with \fsplit() and then join the array with \fjoin(), giving each + function the new CSV parameter in the appropriate argument position, + the result will be will be equivalent to the original, according to the + CSV definition. It might not be identical, because if the result had + extraneous spaces before or after the separating commas, these are + discarded, but that does not affect the elements themselves. The new + syntax for \fjoin() is: + + \fjoin(&a,CSV) + Given the array \&a[] or any other valid array designator, joins + its elements into a comma-separated list according to the + [108]rules listed above. + + \fjoin(&a,TSV) + Joins the elements of the given array into a tab-separated list, + also described above. + + [109]Previous calling conventions for \fjoin() are undisturbed, + including the ability to specify a portion of an array, rather than the + whole array: + +declare \&a[] = 1 2 3 4 5 6 7 8 9 +echo \fjoin(&a[3:7],CSV) +3,4,5,6,7 + + Using \fsplit() and \fjoin() it is now possible to convert a + comma-separated value list into a tab-separated value list, and vice + versa (which is not a simple matter of changing commas to tabs or vice + versa). + +Applications for CSV Files + + Databases such as MS Access or MySQL can export tables or reports in + CSV format, and then Kermit can read the resulting CSV file and do + whatever you like with it; typically something that could not be done + with the database query language itself (or that you didn't know how to + do that way): create reports or datasets based on complex criteria or + procedures, edit or modify some fields, etc, and then use \fjoin() to + put each record back in CSV form so it can be reimported into a + spreadsheet or database. + + Here is a simple example in which we purge all records of customers who + have two or more unpaid bills. The file is sorted so that each license + purchase record is followed by its annual maintenance payment records + in chronological order. + +#!/usr/local/bin/kermit +.filename = somefile.csv # Input file in CSV format +fopen /read \%c \m(filename) # Open it +if fail exit # Don't go on if open failed +copy \m(filename) ./new # Make a copy of the file + +.oldserial = 00000000000 # Multiple records for each serial number +.zeros = 0 # Unpaid bill counter + +while true { # Loop + fread /line \%c line # Get a record + if fail exit # End of file + .n := \fsplit(\m(line),&a,\44,CSV) # Split the fields into an array + if not equ "\m(oldserial)" "\&a[6]" { # Have new serial number? + # Remove all records for previous serial number + # if two or more bills were not paid... + if > \m(zeros) 1 { + grep /nomatch \m(oldserial) /output:./new2 ./new + rename ./new2 ./new + } + .oldserial := \&a[6] # To detect next time serial number changes + .zeros = 0 # Reset unpaid bill counter + } + if equ "\&a[5]" "$0.00" { # Element 5 is amount paid + increment zeros # If it's zero, count it. + } +} +fclose \%c + + Rewriting the file multiple times is inelegant, but this is a quick and + dirty use-once-and-discard script, so elegance doesn't count. The + example is interesting in that it purges certain records based on the + contents of other records. Maybe there is a way to do this directly + with SQL, but why use SQL when you can use Kermit? + + Here is the same task but this time no shelling out, and this time we + do change and add some fields and then join the result back into a CSV + record and write it out to a new file. The object is to create a record + for each license that shows not only the date and purchase price of the + license but also the date and amount of the last maintenance payment, + and to add new fields for sorting by anniversary (month and day): + +#!usr/local/bin/kermit + +cd ~/somedirectory # CD to appropriate directory +if fail exit 1 # Make sure we did +.filename := \%1 # Filename from command line +if not def filename { # If none give usage message + exit 1 "Usage: \%0: infile [ outfile ]" +} +fopen /read \%c \m(filename) # Open the input CSV file +if fail exit # Make sure we did + +.output := \%2 # Output filename from command line +if not def output { # Supply one if not given + .output := New_\m(filename) +} +fopen /write \%o \m(output) # Open output file +if fail exit # Check that we did + +.serial = 00000000000 # Initialize serial number +.licenses = 0 # and license counter + +fread /line \%c line # First line is column labels +if fail exit # Check +fwrite /line \%o "\m(line),AMM_DD,AYYYY" # Write new labels line + +# Remaining lines are license purchases (K95B) followed by zero or more +# maintenance invoices (K95BM) for each license. + +.datepaid = 00/00/0000 # Initialize last maint payment date +.amtpaid = $0.00 # Initialize last maint payment amount +set flag off # For remembering we're at end of file +while not flag { # Loop to read all records + fread /line \%c line # Read a record + if fail set flag on # If EOF set flag for later + .n := \fsplit(\m(line),&a,\44,CSV) # Break record into array + if ( flag || equ "\&a[3]" "K95B" ) { # License or EOF + if fail exit 1 "FAILED: \v(lastcommand)" + if licenses { # If this is not the first license + .\&x[5] := \m(amtpaid) # Substitute most recent amount paid + .\&x[21] := \m(datepaid) # Substitute most recent date paid + void \fsplit(\&x[18],&d,/) # Break up original (anniversary) date + # and put mm_dd and yyyy in separate fields for sorting... + fwrite /line \%o "\fjoin(&x,CSV),\flpad(\&d[1],2,0)_\flpad(\&d[2],2, +0),\&d[3]" + if fail exit 1 WRITE # Check for error + xecho . # Show progress as one dot per record + } + if flag break # We're at EOF so we're finished + increment licenses # New license - count it + array copy &a &x # Keep this record while reading next + .serial := \&a[6] # Remember serial number + .datepaid = 00/00/0000 # Initial maintenance payment date + .amtpaid = $0.00 # and amount + continue # and go back to read next record + } + if not eq "\m(serial)" "\&a[6]" { # Catch out-of-sequence record + echo + echo "SEQUENCE: \m(serial)..\&a[6]: \&a[7] [\&a[1]]" + continue + } + if equ "\&a[5]" "" .\&a[5] = $0.00 # If amount is empty make it $0.00 + if not equ "\&a[5]" "$0.00" { # If amount is not $0.00 + .datepaid := \&a[21] # remember date paid + .amtpaid := \&a[5] # and amount paid + } +} +fclose ALL # Done - close all files and exit +exit 0 Done. + + + The result imports back into Excel, where it can be sorted, formatted, + or otherwise manipulated as desired. + +Using CSV Files: Extending Kermit's Data Structures + + Now that we can parse a CSV record, what would we do with a CSV file - + that is, a sequence of records? If we needed all the data available at + once, we would want to load it into a matrix of (row,column) values. + But Kermit doesn't have matrices. Or does it? + + Kermit has several built-in data types, but you can invent your own + data types as needed using Kermit's macro feature: + +define variablename value + + For example: + +define alphabet abcdefghijklmnopqrstuvwxyz + + This defines a macro named alphabet and gives it the value + abcdefghijklmnopqrstuvwxyz. A more convenient notation (added in + C-Kermit 7.0, see [110]Table 2) for this is: + +.alphabet = abcdefghijklmnopqrstuvwxyz + + The two are exactly equivalent: they make a literal copy the "right + hand side" as the value of the macro. Then you can refer to the macro + anywhere in a Kermit command as "\m(macroname)": + +echo "Alphabet = \m(alphabet)" + + There is a second way to define a macro, which is like the first except + that the right-hand side is evaluated first; that is, any variable + references or function calls in the right-hand side are replaced by + their values before the result is assigned to the macro. The command + for this is ASSIGN rather than DEFINE: + +define alphabet abcdefghijklmnopqrstuvwxyz +assign backwards \freverse(\m(alphabet)) +echo "Alphabet backwards = \m(backwards)" + + which prints: + +Alphabet backwards = zyxwvutsrqponmlkjihgfedcba + + This kind of assignment can also be done like this: + +.alphabet = abcdefghijklmnopqrstuvwxyz +.backwards := \freverse(\m(alphabet)) + + [111]Any command starting with a period is an assignment, and the + operator (= or :=) tells what to do with the right-hand side before + making the assignment. + + In both the DEFINE and ASSIGN commands, the variable name itself is + taken literally. It is also possible, however, to have Kermit compute + the variable name. This is done (as described in [112]Using C-Kermit, + 2nd Ed., p.457), using parallel commands that start with underscore: + _DEFINE and _ASSIGN (alias _DEF and _ASG). These are just like DEFINE + and ASSIGN except they evaluate the variable name before making the + assigment. For example: + +define \%a one +_define \%a\%a\%a 111 + + would create a macro named ONEONEONE with a value of 111, and: + +define \%a one +define number 111 +_assign \%a\%a\%a \m(number) + + would create the same macro with the same value, but: + +define \%a one +define number 111 +_define \%a\%a\%a \m(number) + + would give the macro a value of "\m(number)". + + You can use the _ASSIGN command to create any kind of data structure + you want; you can find some examples in the [113]Object-Oriented + Programming section of the [114]Kermit Script Library. In the following + program we use this capability to create a two-dimensional array, or + matrix, to hold the all the elements of the CSV file, and then to + display the matrix: + +fopen /read \%c data.csv # Open CSV file +if fail exit 1 + +.\%r = 0 # Row +.\%m = 0 # Maximum columns +while true { + fread /line \%c line # Read a record + if fail break # End of file + .\%n := \fsplit(\m(line),&a,\44,CSV) # Split record into items + incr \%r # Count this row + for \%i 1 \%n 1 { # Assign items to this row of matrix + _asg a[\%r][\%i] \&a[\%i] + } + if > \%i \%m { .\%m := \%i } # Remember width of widest row +} +fclose \%c # Close CSV file +decrement \%m # (because of how FOR loop works) +echo MATRIX A ROWS: \%r COLUMNS: \%m # Show the matrix + +for \%i 1 \%r 1 { # Loop through rows + for \%j 1 \%m 1 { # Loop through columns of each row + xecho "\flpad(\m(a[\%i][\%j]),6)" + } + echo +} +exit 0 + + The matrix is called a and its elements are a[1][1], a[1][2], a[1][3], + ... a[2][1], etc, and you can treat this data structure exactly like a + two-dimensional array, in which you can refer to any element by its "X + and Y coordinates". For example, if the CSV file contained numeric data + you could compute row and column sums using simple FOR loops and + Kermit's built-in one-dimensional array data type: + +declare \&r[\%r] # Make an array for the row sums +declare \&c[\%m] # Make an array for the column sums +for \%i 1 \%r 1 { # Loop through rows + for \%j 1 \%m 1 { # Loop through columns of each row + increment \&r[\%i] \m(a[\%i][\%j]) # Accumulate row sum + increment \&c[\%j] \m(a[\%i][\%j]) # Accumulate column sum + } +} + + Note that the sum arrays don't have to be initialized to zero because + Kermit's INCREMENT command treats empty definitions as zero. + +Demonstration Scripts for Webmasters + + [115]ksitemap + A C-Kermit 9.0 script to build sitemap.xml for a website, + complete with Google image extensions (this is the file used by + webmasters to get their sites crawled and indexed optimally). + + [116]The Weblog Script + Reads a web log, extracts the Google searches, normalizes the + search strings, and prints the top 20 searches, along with their + counts. Documented [117]HERE. + + [118]The Amazon Script + Reads an Amazon Associate orders report and lists the products + according to the number of orders for each, or the number of + clicks on each. + + [119]Photoalbum + Makes a website from a collecion of JPG images. For explanation + and documentation, [120]CLICK HERE. Requires [121]C-Kermit 9.0 + or later. + + [122]Home [123]Kermit 95 [124]C-Kermit [125]Scripts [126]Current + [127]New [128]FAQ [129]Support + + + C-Kermit 9.0 / [130]The Kermit Project / [131]Columbia University / + [132]kermit@columbia.edu / [133]validate + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ck90tables.html + 12. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641 + 13. http://www.columbia.edu/kermit/ckermit.html#download + 14. http://www.columbia.edu/kermit/ckermit90.html#LargeFiles + 15. http://www.columbia.edu/kermit/ckermit90.html#TestLargeFiles + 16. http://www.columbia.edu/kermit/ckermit90.html#Bignums + 17. http://www.columbia.edu/kermit/ckermit90.html#force3 + 18. http://www.columbia.edu/kermit/ckermit90.html#Vareval + 19. http://www.columbia.edu/kermit/ckermit90.html#rename + 20. http://www.columbia.edu/kermit/ckermit90.html#Other + 21. http://www.columbia.edu/kermit/ckermit90.html#Incompatibilities + 22. http://www.columbia.edu/kermit/ckermit90.html#NotIn9.0 + 23. http://www.columbia.edu/kermit/ckermit90.html#LooseEnd + 24. http://www.columbia.edu/kermit/ckermit90.html#pop + 25. http://www.columbia.edu/kermit/ckermit90.html#HPswitch + 26. http://www.columbia.edu/kermit/ckermit90.html#iLO + 27. http://www.columbia.edu/kermit/ckermit90.html#Rolm + 28. http://www.columbia.edu/kermit/ckermit90.html#CSV + 29. http://www.columbia.edu/kermit/ckermit90.html#Otherdemos + 30. http://www.columbia.edu/kermit/ck60manual.html + 31. http://www.amazon.com/gp/product/B002ACPF9M?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B002ACPF9M + 32. http://www.columbia.edu/kermit/ckermit70.html + 33. http://www.columbia.edu/kermit/ckermit80.html + 34. http://www.columbia.edu/kermit/ckscripts.html + 35. http://www.columbia.edu/kermit/dec20.html + 36. mailto:fdc@columbia.edu + 37. http://www.columbia.edu/kermit/cu-bsd-license.html + 38. http://www.columbia.edu/kermit/ckermit90.html#LargeFiles + 39. http://www.columbia.edu/kermit/ck90tables.html + 40. http://www.columbia.edu/kermit/ck90tables.html + 41. http://www.columbia.edu/kermit/ckermit90.html#force3 + 42. http://www.columbia.edu/kermit/ckermit90.html#Vareval + 43. http://www.columbia.edu/kermit/ckrename.html + 44. http://www.columbia.edu/kermit/csv.html + 45. http://www.columbia.edu/kermit/csetnames.html + 46. http://www.columbia.edu/kermit/ckermit90.html#HPswitch + 47. http://www.columbia.edu/kermit/ckdaily.html + 48. http://www.columbia.edu/kermit/cu-bsd-license.html + 49. http://www.opensource.org/ + 50. http://kermit.columbia.edu/ck90tables.html#LF + 51. ftp://kermit.columbia.edu/kermit/utils/bigfile.c + 52. http://www.columbia.edu/kermit/ckermit80.html#x9 + 53. http://www.columbia.edu/kermit/ck90tables.html#LF + 54. ftp://kermit.columbia.edu/kermit/scripts/ckermit/easter2 + 55. http://www.columbia.edu/kermit/em-apex.html + 56. http://www.iridium.com/ + 57. http://science1.nasa.gov/science-news/science-at-nasa/2006/09jan_electrichurricanes/ + 58. http://www.columbia.edu/kermit/ek.html + 59. ftp://kermit.columbia.edu/kermit/ek/simirid/ + 60. http://www.columbia.edu/kermit/ek.html + 61. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10 + 62. http://www.columbia.edu/kermit/csv.html + 63. http://www.columbia.edu/kermit/ckermit70.html#x1.11 + 64. http://www.columbia.edu/kermit/ckermit70.html + 65. http://www.columbia.edu/kermit/ckermit80.html#x9 + 66. http://www.columbia.edu/kermit/csetnames.html + 67. http://www.columbia.edu/kermit/ckdaily.html + 68. http://www.columbia.edu/kermit/ckrename.html + 69. http://www.columbia.edu/kermit/ftpclient.html + 70. http://www.columbia.edu/kermit/ckdaily.html + 71. http://www.columbia.edu/kermit/input_nowrap.html + 72. http://www.columbia.edu/~fdc/mm/index.html + 73. http://www.columbia.edu/kermit/photoalbum.html + 74. http://www.columbia.edu/~fdc/kermit/logserial.html + 75. http://www.columbia.edu/kermit/csetnames.html + 76. http://www.columbia.edu/kermit/ckermit90.html#NotIn9.0 + 77. http://www.columbia.edu/kermit/csv.html#join + 78. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767 + 79. http://www.columbia.edu/kermit/ftp/test/tar/x.zip + 80. http://www.mseclab.com/?p=180 + 81. http://www.theregister.co.uk/2009/07/30/universal_ssl_certificate/ + 82. http://www.columbia.edu/kermit/csv.html + 83. http://www.columbia.edu/kermit/csetnames.html + 84. http://www.columbia.edu/kermit/ckermit90.html#HPswitch + 85. http://www.columbia.edu/kermit/em-apex.html + 86. http://www.freebsd.org/releases/8.0R/announce.html + 87. http://www.columbia.edu/kermit/security81.html#x4.2.3 + 88. http://www.columbia.edu/kermit/ckermit80.html#x9 + 89. http://www.columbia.edu/kermit/ckermit80.html#x8.7.2 + 90. http://www.columbia.edu/kermit/ckermit80.html#x9 + 91. http://www.columbia.edu/kermit/ckpackages.html + 92. http://docs.hp.com/en/B9106-90013/pty.7.html + 93. http://www.columbia.edu/kermit/test/text/ckc299.txt + 94. http://www.columbia.edu/kermit/test/text/ckutio.c + 95. http://www.columbia.edu/~fdc/mm/pop + 96. http://www.columbia.edu/~fdc/mm/ + 97. http://www.columbia.edu/~fdc/mm/mailcheck + 98. http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol + 99. http://www.columbia.edu/kermit/ftp/scripts/ckermit/gethpconfig + 100. http://www.columbia.edu/kermit/ftp/scripts/ckermit/TestSwitches.txt + 101. http://en.wikipedia.org/wiki/Standard_streams + 102. http://kermit.columbia.edu/cudocs/ilosetup.html + 103. http://www.columbia.edu/kermit/cudocs/cbx.html + 104. http://www.columbia.edu/kermit/ckermit90.html#record + 105. http://www.columbia.edu/kermit/ckermit90.html#join + 106. http://www.columbia.edu/kermit/ckermit90.html#file + 107. http://www.columbia.edu/kermit/ckermit80.html#fjoin + 108. http://www.columbia.edu/kermit/ckermit90.html#rules + 109. http://www.columbia.edu/kermit/ckermit80.html#fjoin + 110. http://www.columbia.edu/kermit/ckermit90.html#varasg + 111. http://www.columbia.edu/kermit/ckermit70.html#x7.9 + 112. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641 + 113. http://www.columbia.edu/kermit/ckscripts.html#oops + 114. http://www.columbia.edu/kermit/ckscripts.html + 115. http://www.columbia.edu/kermit/ksitemap.html + 116. http://kermit.columbia.edu/ftp/scripts/ckermit/weblog + 117. http://www.columbia.edu/kermit/weblog.html + 118. http://kermit.columbia.edu/ftp/scripts/ckermit/amazon + 119. http://kermit.columbia.edu/ftp/scripts/ckermit/photoalbum + 120. http://www.columbia.edu/kermit/photoalbum.html + 121. http://www.columbia.edu/kermit/ck90.html + 122. http://www.columbia.edu/kermit/index.html + 123. http://www.columbia.edu/kermit/k95.html + 124. http://www.columbia.edu/kermit/ckermit.html + 125. http://www.columbia.edu/kermit/ckscripts.html + 126. http://www.columbia.edu/kermit/current.html + 127. http://www.columbia.edu/kermit/whatsnew.html + 128. http://www.columbia.edu/kermit/faq.html + 129. http://www.columbia.edu/kermit/support.html + 130. http://www.columbia.edu/kermit/index.html + 131. http://www.columbia.edu/ + 132. mailto:kermit@columbia.edu + 133. http://validator.w3.org/check?uri=http%3A%2F%2Fkermit.columbia.edu%2Fck90.html diff --git a/ckermod.ini b/ckermod.ini new file mode 100644 index 0000000..6b13c85 --- /dev/null +++ b/ckermod.ini @@ -0,0 +1,8 @@ +; File CKERMOD.INI, Sample C-Kermit 7.0 customization file. +; +echo +echo The very long standard initialization file that was distributed +echo with C-Kermit 6, 7, and 8 is no longer recommended as "standard", +echo since its features were little used. It is still available in +echo the C-Kermit distribution as ockermod.ini. +echo diff --git a/ckubwr.txt b/ckubwr.txt new file mode 100644 index 0000000..58174bf --- /dev/null +++ b/ckubwr.txt @@ -0,0 +1,5353 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +C-Kermit Unix Hints and Tips + + Frank da Cruz + [11]The Kermit Project, [12]Columbia University + + As of: C-Kermit 9.0.300 30 June 2011 + This page last updated: Mon Jun 27 16:01:50 2011 (New York USA Time) + + IF YOU ARE READING A PLAIN-TEXT version of this document, note it is + a plain-text dump of a Web page. You can visit the original (and + possibly more up-to-date) Web page here: + + [13]http://www.columbia.edu/kermit/ckubwr.html + + Since the material in this file has been accumulating since 1985, + some (much) of it might be dated. [14]Feedback from experts on + particular OS's and platforms is always welcome. + + [ [15]C-Kermit ] [ [16]Installation Instructions ] [ [17]TUTORIAL ] + +CONTENTS + + 1. [18]INTRODUCTION + 2. [19]PREBUILT C-KERMIT BINARIES + 3. [20]PLATFORM-SPECIFIC NOTES + 4. [21]GENERAL UNIX-SPECIFIC LIMITATIONS AND BUGS + 5. [22]INITIALIZATION AND COMMAND FILES + 6. [23]COMMUNICATION SPEED SELECTION + 7. [24]COMMUNICATIONS AND DIALING + 8. [25]HARDWARE FLOW CONTROL + 9. [26]TERMINAL CONNECTION AND KEY MAPPING + 10. [27]FILE TRANSFER + 11. [28]EXTERNAL FILE TRANSFER PROTOCOLS + 12. [29]SECURITY + 13. [30]MISCELLANEOUS USER REPORTS + 14. [31]THIRD-PARTY DRIVERS + + Quick Links: [ [32]Linux ] [ [33]*BSD ] [[34]Mac OS X] [ [35]AIX ] [ + [36]HP-UX ] [ [37]Solaris ] [ [38]SCO ] [ [39]DEC/Compaq ] + +1. INTRODUCTION + + [ [40]Top ] [ [41]Contents ] [ [42]Next ] + + SECTION CONTENTS + + 1.1. [43]Documentation + 1.2. [44]Technical Support + 1.3. [45]The Year 2000 + 1.4. [46]The Euro + + THIS IS WHAT USED TO BE CALLED the "beware file" for the Unix version + of C-Kermit, previously distributed as ckubwr.txt and, before that, as + ckuker.bwr, after the fashion of old Digital Equipment Corporation + (DEC) software releases that came with release notes (describing what + had changed) and a "beware file" listing known bugs, limitations, + "non-goals", and things to watch out for. The C-Kermit beware file has + been accumulating since 1985, and it applies to many different hardware + platforms and operating systems, and many versions of them, so it is + quite large. Prior to C-Kermit 8.0, it was distributed only in + plain-text format. Now it is available as a Web document with links, + internal cross references, and so on, to make it easier to use. + + This document applies to Unix C-Kermit in general, as well as to + specific Unix variations like [47]Linux, [48]AIX, [49]HP-UX, + [50]Solaris, and so on, and should be read in conjunction with the + [51]platform-independent C-Kermit beware file, which contains similar + information, but applying to all versions of C-Kermit (VMS, Windows, + OS/2, AOS/VS, VOS, etc, as well as to Unix). + + There is much in this document that is (only) of historical interest. + The navigation links should help you skip directly to the sections that + are relevant to you. Numerous offsite Web links are supposed to lead to + further information but, as you know, Web links go stale frequently and + without warning. If you can supply additional, corrected, updated, or + better Web links, please feel free to [52]let me know. + +1.1. Documentation + + [ [53]Top ] [ [54]Contents ] [ [55]Next ] + + C-Kermit 6.0 is documented in the book [56]Using C-Kermit, Second + Edition, by Frank da Cruz and Christine M. Gianone, Digital Press, + Burlington, MA, USA, ISBN 1-55558-164-1 (1997), 622 pages. This remains + the definitive C-Kermit documentation. Until the third edition is + published (sorry, there is no firm timeframe for this), please also + refer to: + + [57]Supplement to Using C-Kermit, Second Edition, For C-Kermit 7.0 + Thorough documentation of features new to version 7.0. + + [58]Supplement to Using C-Kermit, Second Edition, For C-Kermit 8.0 + Thorough documentation of features new to version 8.0. + + [59]Supplement to Using C-Kermit, Second Edition, For C-Kermit 9.0 + Thorough documentation of features new to version 9.0. + +1.2. Technical Support + + [ [60]Top ] [ [61]Contents ] [ [62]Section Contents ] [ [63]Next ] [ + [64]Previous ] + + For information on how to get technical support, please visit: + + [65]http://www.columbia.edu/kermit/support.html + +1.3. The Year 2000 + + [ [66]Top ] [ [67]Contents ] [ [68]Section Contents ] [ [69]Next ] [ + [70]Previous ] + + The Unix version of C-Kermit, release 6.0 and later, is "Year 2000 + compliant", but only if the underlying operating system is too. Contact + your Unix operating system vendor to find out which operating system + versions, patches, hardware, and/or updates are required. (Quite a few + old Unixes are still in operation in the new millenium, but with their + date set 28 years in the past so at least the non-year parts of the + calendar are correct.) + + As of C-Kermit 6.0 (6 September 1996), post-millenium file dates are + recognized, transmitted, received, and reproduced correctly during the + file transfer process in C-Kermit's File Attribute packets. If + post-millenium dates are not processed correctly on the other end, file + transfer still takes place, but the modification or creation date of + the received file might be incorrect. The only exception would be if + the "file collision update" feature is being used to prevent + unnecessary transfer of files that have not changed since the last time + a transfer took place; in this case, a file might be transferred + unnecessarily, or it might not be transferred when it should have been. + Correct operation of the update feature depends on both Kermit programs + having the correct date and time. + + Of secondary importance are the time stamps in the transaction and/or + debug logs, and the date-related script programming constructs, such as + \v(date), \v(ndate), \v(day), \v(nday), and perhaps also the + time-related ones, \v(time) and \v(ntime), insofar as they might be + affected by the date. The \v(ndate) is a numeric-format date of the + form yyyymmdd, suitable for both lexical and numeric comparison and + sorting: e.g. 19970208 or 20011231. If the underlying operating system + returns the correct date information, these variables will have the + proper values. If not, then scripts that make decisions based on these + variables might not operate correctly. + + Most date-related code is based upon the C Library asctime() string, + which always has a four-digit year. In Unix, the one bit of code in + C-Kermit that is an exception to this rule is several calls to + localtime(), which returns a pointer to a tm struct, in which the year + is presumed to be expressed as "years since 1900". The code depends on + this assumption. Any platforms that violate it will need special + coding. As of this writing, no such platforms are known. + + Command and script programming functions that deal with dates use + C-Kermit specific code that always uses full years. + +1.4. The Euro + + [ [71]Top ] [ [72]Contents ] [ [73]Section Contents ] [ [74]Previous ] + + C-Kermit 7.0 and later support Unicode (ISO 10646), ISO 8859-15 Latin + Alphabet 9, PC Code Page 858, Windows Code Pages 1250 and 1251, and + perhaps other character sets, that encode the Euro symbol, and can + translate among them as long as no intermediate character-set is + involved that does not include the Euro. + +2. PREBUILT C-KERMIT BINARIES + + [ [75]Top ] [ [76]Contents ] [ [77]Next ] [ [78]Previous ] + + It is often dangerous to run a binary C-Kermit (or any other) program + built on a different computer. Particularly if that computer had a + different C compiler, libraries, operating system version, processor + features, etc, and especially if the program was built with shared + libraries, because as soon as you update the libraries on your system, + they no longer match the ones referenced in the binary, and the binary + might refuse to load when you run it, in which case you'll see error + messages similar to: + + Could not load program kermit + Member shr4.o not found or file not an archive + Could not load library libcurses.a[shr4.o] + Error was: No such file or directory + + (These samples are from AIX.) To avoid this problem, we try to build + C-Kermit with statically linked libraries whenever we can, but this is + increasingly impossible as shared libraries become the norm. + + It is often OK to run a binary built on an earlier OS version, but it + is rarely possible (or safe) to run a binary built on a later one, for + example to run a binary built under Solaris 8 on Solaris 2.6. Sometimes + even the OS-or-library patch/ECO level makes a difference. + + A particularly insidious problem occurs when a binary was built on a + version of the OS that has patches from the vendor (e.g. to libraries); + in many cases you won't be able to run such a binary on an unpatched + version of the same platform. + + When in doubt, build C-Kermit from the source code on the computer + where it is to be run (if possible!). If not, ask us for a binary + specific to your configuration. We might have one, and if we don't, we + might be able to find somebody who will build one for you. + +3. NOTES ON SPECIFIC UNIX VERSIONS + + [ [79]Top ] [ [80]Contents ] [ [81]Next ] [ [82]Previous ] + + SECTION CONTENTS + + 3.0. [83]C-KERMIT ON PC-BASED UNIXES + 3.1. [84]C-KERMIT AND AIX + 3.2. [85]C-KERMIT AND HP-UX + 3.3. [86]C-KERMIT AND LINUX + 3.4. [87]C-KERMIT AND NEXTSTEP + 3.5. [88]C-KERMIT AND QNX + 3.6. [89]C-KERMIT AND SCO + 3.7. [90]C-KERMIT AND SOLARIS + 3.8. [91]C-KERMIT AND SUNOS + 3.9. [92]C-KERMIT AND ULTRIX + 3.10. [93]C-KERMIT AND UNIXWARE + 3.11. [94]C-KERMIT AND APOLLO SR10 + 3.12. [95]C-KERMIT AND TANDY XENIX 3.0 + 3.13. [96]C-KERMIT AND OSF/1 (DIGITAL UNIX) (TRU64 UNIX) + 3.14. [97]C-KERMIT AND SGI IRIX + 3.15. [98]C-KERMIT AND THE BEBOX + 3.16. [99]C-KERMIT AND DG/UX + 3.17. [100]C-KERMIT AND SEQUENT DYNIX + 3.18. [101]C-KERMIT AND {FREE,OPEN,NET}BSD + 3.19. [102]C-KERMIT AND MAC OS X + 3.20. [103]C-KERMIT AND COHERENT + + The following sections apply to specific Unix versions. Most of them + contain references to FAQs (Frequently Asked Questions), but these tend + to be ephemeral. For possibly more current information see: + + [104]http://www.faqs.org + [105]http://aplawrence.com/Unixart/newtounix.html + + One thread that runs through many of them, and implicitly perhaps + through all, concerns the problems that occur when trying to dial out + on a serial device that is (also) enabled for dialing in. The + "solutions" to this problem are many, varied, diverse, and usually + gross, involving configuring the device for bidirectional use. This is + done in a highly OS-dependent and often obscure manner, and the effects + (good or evil) are also highly dependent on the particular OS (and + getty variety, etc). Many examples are given in the [106]OS-specific + sections below. + + An important point to keep in mind is that C-Kermit is a + cross-platform, portable software program. It was not designed + specifically and only for your particular Unix version, or for that + matter, for Unix in particular at all. It also runs on VMS, AOS/VS, + VOS, and other non-Unix platforms. All the Unix versions of C-Kermit + share common i/o modules, with compile-time #ifdef constructions used + to account for the differences among the many Unix products and + releases. If you think that C-Kermit is behaving badly or missing + something on your particular Unix version, you might be right -- we + can't claim to be expert in hundreds of different OS / version / + hardware / library combinations. If you're a programmer, take a look at + the source code and [107]send us your suggested fixes or changes. Or + else just [108]send us a report about what seems to be wrong and we'll + see what we can do. + +3.0. C-KERMIT ON PC-BASED UNIXES + + [ [109]Top ] [ [110]Contents ] [ [111]Section Contents ] [ [112]Next ] + + Also see: [113]http://www.pcunix.com/. + + SECTION CONTENTS + + 3.0.1. [114]Interrupt Conflicts + 3.0.2. [115]Windows-Specific Hardware + 3.0.3. [116]Modems + 3.0.4. [117]Character Sets + 3.0.5. [118]Keyboard, Screen, and Mouse Access + 3.0.6. [119]Laptops + +3.0.1. Interrupt Conflicts + + [ [120]Top ] [ [121]Contents ] [ [122]Section Contents ] [ [123]Next ] + + PCs are not the best platform for real operating systems like Unix. The + architecture suffers from numerous deficiencies, not the least of which + is the stiflingly small number of hardware interrupts (either 7 or 15, + many of which are preallocated). Thus adding devices, using multiple + serial ports, etc, is always a challenge and often a nightmare. The + free-for-all nature of the PC market and the lack of standards combined + with the diversity of Unix OS versions make it difficult to find + drivers for any particular device on any particular version of Unix. + + Of special interest to Kermit users is the fact that there is no + standard provision in the PC architecture for more than 2 communication + (serial) ports. COM3 and COM4 (or higher) will not work unless you (a) + find out the hardware address and interrupt for each, (b) find out how + to provide your Unix version with this information, and (c) actually + set up the configuration in the Unix startup files (or whatever other + method is used). Watch out for interrupt conflicts, especially when + using a serial mouse, and don't expect to be able to use more than two + serial ports. + + The techniques for resolving interrupt conflicts are different for each + operating system (Linux, NetBSD, etc). In general, there is a + configuration file somewhere that lists COM ports, something like this: + + com0 at isa? port 0x3f8 irq 4 # DOS COM1 + com1 at isa? port 0x2f8 irq 3 # DOS COM2 + + The address and IRQ values in this file must agree with the values in + the PC BIOS and with the ports themselves, and there must not be more + than one device with the same interrupt. Unfortunately, due to the + small number of available interrupts, installing new devices on a PC + almost always creates a conflict. Here is a typical tale from a Linux + user (Fred Smith) about installing a third serial port: + + ...problems can come from a number of causes. The one I fought with + for some time, and finally conquered, was that my modem is on an + add-in serial port, cua3/IRQ5. By default IRQ5 has a very low + priority, and does not get enough service in times when the system + is busy to prevent losing data. This in turn causes many resends. + There are two 'fixes' that I know of, one is to relax hard disk + interrupt hogging by using the correct parameter to hdparm, but I + don't like that one because the hdparm man page indicates it is + risky to use. The other one, the one I used, was to get 'irqtune' + and use it to give IRQ5 the highest priority instead of nearly the + lowest. Completely cured the problem. + + Here's another one from a newsgroup posting: + + After much hair pulling, I've discovered why my serial port won't + work. Apparently my [PC] has three serial devices (two comm ports + and an IR port), of which only two at a time can be active. I looked + in the BIOS setup and noticed that the IR port was activated, but + didn't realize at the time that this meant that COM2 was thereby + de-activated. I turned off the IR port and now the serial port works + as advertised. + +3.0.2. Windows-Specific Hardware + + [ [124]Top ] [ [125]Contents ] [ [126]Section Contents ] [ [127]Next ] + [ [128]Previous ] + + To complicate matters, the PC platform is becoming increasingly and + inexorably Windows-oriented. More and more add-on devices are "Windows + only" -- meaning they are incomplete and rely on proprietary + Windows-based software drivers to do the jobs that you would expect the + device itself to do. PCMCIA, PCI, or "Plug-n-Play" devices are rarely + supported on PC-based Unix versions such as SCO; Winmodems, + Winprinters, and the like are not supported on any Unix variety (with + [129]a few exceptions). The self-proclaimed Microsoft PC 97 (or later) + standard only makes matters worse since its only purpose to ensure that + PCs are "optimized to run Windows 95 and Windows NT 4.0 and future + versions of these operating systems". + + With the exception noted (the Lucent modem, perhaps a handful of others + by the time you read this), drivers for "Win" devices are available + only for Windows, since the Windows market dwarfs that of any + particular Unix brand, and for that matter all Unixes (or for that + matter, all non-Windows operating systems) combined. If your version of + Unix (SCO, Linux, BSDI, FreeBSD, etc) does not support a particular + device, then C-Kermit can't use it either. C-Kermit, like any Unix + application, must access all devices through drivers and not directly + because Unix is a real operating system. + + Don't waste time thinking that you, or anybody else, could write a + Linux (or other Unix) driver for a Winmodem or other "Win" device. + First of all, these devices generally require realtime control, but + since Unix is a true multitasking operating system, realtime device + control is not possible outside the kernel. Second, the specifications + for these devices are secret and proprietary, and each one (and each + version of each one) is potentially different. Third, a Winmodem driver + would be enormously complex; it would take years to write and debug, by + which time it would be obsolete. + + A more recent generation of PCs (circa 1999-2000) is marketed as + "Legacy Free". One can only speculate what that could mean. Most likely + it means it will ONLY run the very latest versions of Windows, and is + made exclusively of Winmodems, Winprinters, Winmemory, and Win-CPU-fans + (Legacy Free is a concept [130]pioneered by Microsoft). + + Before you buy a new PC or add-on equipment, especially serial ports, + internal modems, or printers, make sure they are compatible with your + version of Unix. This is becoming an ever-greater challenge; only a + huge company like Microsoft can afford to be constantly cranking out + and/or verifying drivers for the thousands of video boards, sound + cards, network adapters, SCSI adapters, buses, etc, that spew forth in + an uncontrolled manner from all corners of the world on a daily basis. + With very few exceptions, makers of PCs assemble the various components + and then verify them only with Windows, which they must do since they + are, no doubt, preloading the PC with Windows. To find a modern PC that + is capable of running a variety of non-Windows operating systems (e.g. + Linux, SCO OpenServer, Unixware, and Solaris) is a formidable challenge + requiring careful study of each vendor's "compatibility lists" and + precise attention to exact component model numbers and revision levels. + +3.0.3. Modems + + [ [131]Top ] [ [132]Contents ] [ [133]Section Contents ] [ [134]Next ] + [ [135]Previous ] + + External modems are recommended: + + * They don't need any special drivers. + * You can use the lights and speaker to troubleshoot dialing. + * You can share them among all types of computers. + * You can easily turn them off and on when power-cycling seems + warranted. + * They are more likely to have manuals. + + Internal PC modems (even when they are not Winmodems, which is + increasingly unlikely in new PCs) are always trouble, especially in + Unix. Even when they work for dialing out, they might not work for + dialing in, etc. Problems that occur when using an internal modem can + almost always be eliminated by switching to an external one. Even when + an internal modem is not a Winmodem or Plug-n-Play, it is often a + no-name model of unknown quality -- not the sort of thing you want + sitting directly on your computer's bus. (Even if it does not cause + hardware problems, it probably came without a command list, so no Unix + software will know how to control it.) For more about Unix compatible + modems, see: + + [136]http://www.idir.net/~gromitkc/winmodem.html + + Remember that PCs, even now -- more than two decades after they were + first introduced -- are not (in general) capable of supporting more + than 2 serial devices. Here's a short success story from a recent + newsgroup posting: "I have a Diamond SupraSonic II dual modem in my + machine. What I had to end up doing is buying a PS/2 mouse and port and + install it. Had to get rid of my serial mouse. I also had to disable + PnP in my computer bios. I was having IRQ conflicts between my serial + mouse and 'com 3'. Both modems work fine for me. My first modem is + ttyS0 and my second is ttyS1." Special third-party multiport boards + such as [137]DigiBoard are available for certain Unix platforms + (typically SCO, maybe Linux) that come with special platform-specific + drivers. + +3.0.4. Character Sets + + [ [138]Top ] [ [139]Contents ] [ [140]Section Contents ] [ [141]Next ] + [ [142]Previous ] + + PCs generally have PC code pages such as CP437 or CP850, and these are + often used by PC-based Unix operating systems, particularly on the + console. These are supported directly by C-Kermit's SET FILE + CHARACTER-SET and SET TERMINAL CHARACTER-SET commands. Some PC-based + Unix versions, such as recent Red Hat Linux releases, might also + support Microsoft Windows code pages such as CP1252, or even Latin + Alphabet 1 itself (perhaps displayed with CP437 glyphs). (And work is + in progress to support Unicode UTF8 in Linux.) + + Certain Windows code pages are not supported directly by C-Kermit, but + since they are ISO Latin Alphabets with nonstandard "extensions" in the + C1 control range, you can substitute the corresponding Latin alphabet + (or other character set) in any C-Kermit character-set related + commands: + + Windows Code Page Substitution + CP 1004 Latin-1 + CP 1051 HP Roman-8 + + Other Windows code pages are mostly (or totally) incompatible with + their Latin Alphabet counterparts (e.g. CP1250 and Latin-2), and + several of these are already supported by C-Kermit 7.0 and later (1250, + 1251, and 1252). + +3.0.5. Keyboard, Screen, and Mouse Access + + [ [143]Top ] [ [144]Contents ] [ [145]Section Contents ] [ [146]Next ] + [ [147]Previous ] + + Finally, note that as a real operating system, Unix (unlike Windows) + does not provide the intimate connection to the PC keyboard, screen, + and mouse that you might expect. Unix applications can not "see" the + keyboard, and therefore can not be programmed to understand F-keys, + Editing keys, Arrow keys, Alt-key combinations, and the like. This is + because: + + a. Unix is a portable operating system, not only for PCs; + b. Unix sessions can come from anywhere, not just the PC's own + keyboard and screen; and: + c. even though it might be possible for an application that actually + is running on the PC's keyboard and screen to access these devices + directly, there are no APIs (outside of X) for this. + +3.0.6. Laptops + + [ [148]Top ] [ [149]Contents ] [ [150]Section Contents ] [ + [151]Previous ] + + (To be filled in . . .) + +3.1. C-KERMIT AND AIX + + [ [152]Top ] [ [153]Contents ] [ [154]Section Contents ] [ [155]Next ] + [ [156]Previous ] + + SECTION CONTENTS + + 3.1.1. [157]AIX: General + 3.1.2. [158]AIX: Network Connections + 3.1.3. [159]AIX: Serial Connections + 3.1.4. [160]AIX: File Transfer + 3.1.5. [161]AIX: Xterm Key Map + + For additional information see: + * [162]http://www.emerson.emory.edu/services/aix-faq/ + * [163]http://www.faqs.org/faqs/by-newsgroup/comp/comp.unix.aix.html + * [164]http://www.cis.ohio-state.edu/hypertext/faq/usenet/aix-faq/top + .html + * [165]http://aixpdslib.seas.ucla.edu/ + * [166]http://www.rootvg.net (AIX history) + * [167]ftp://rtfm.mit.edu/pub/usenet/news.answers/aix-faq/part1 + * [168]ftp://mirrors.aol.com/pub/rtfm/usenet-by-hierarchy/comp/unix/a + ix + + and/or read the [169]comp.unix.aix newsgroup. + ________________________________________________________________________ + +3.1.1. AIX: General + + [ [170]Top ] [ [171]Contents ] [ [172]Section Contents ] [ [173]Next ] + + About AIX version numbers: "uname -a" tells the two-digit version + number, such as 3.2 or 4.1. The three-digit form can be seen with the + "oslevel" command (this information is unavailable at the API level and + is reportedly obtained by scanning the installed patch list). + Supposedly all three-digit versions within the same two-digit version + (e.g. 4.3.1, 4.3.2) are binary compatible; i.e. a binary built on any + one of them should run on all others, but who knows. Most AIX advocates + tell you that any AIX binary will run on any AIX version greater than + or equal to the one under which it was built, but experience with + C-Kermit suggests otherwise. It is always best to run a binary built + under your exact same AIX version, down to the third decimal place, if + possible. Ideally, build it from source code yourself. Yes, this advice + would be easier to follow if AIX came with a C compiler. + ________________________________________________________________________ + +3.1.2. AIX: Network Connections + + [ [174]Top ] [ [175]Contents ] [ [176]Section Contents ] [ [177]Next ] + [ [178]Previous ] + + File transfers into AIX 4.2 or 4.3 through the AIX Telnet or Rlogin + server have been observed to fail (or accumulate huge numbers of + correctable errors, or even disconnect the session), when exactly the + same kind of transfers into AIX 4.1 work without incident, as do such + transfers into all non-AIX platforms on the same kind of connections + (with a few exceptions noted elsewhere in this document). AIX 4.3.3 + seems to be particularly fragile in this regard; the weakness seems to + be in its pseudoterminal (pty) driver. High-speed streaming transfers + work perfectly, however, if the AIX Telnet server and pty driver are + removed from the picture; e.g, by using "set host * 3000" on AIX. + + The problem can be completely cured by replacing the IBM Telnet server + with [179]MIT's Kerberos Telnet server -- even if you don't actually + use the Kerberos part. Diagnosis: AIX pseudoterminals (which are + controlled by the Telnet server to give you a login terminal for your + session) have quirks that not even IBM knows about. The situation with + AIX 5.x is not known, but if it has the same problem, the same cure is + available. + + Meanwhile, the only remedy when going through the IBM Telnet server is + to cut back on Kermit's performance settings until you find a + combination that works: + + * SET STREAMING OFF + * SET WINDOW-SIZE small-number + * SET { SEND, RECEIVE } PACKET-LENGTH small-number + * SET PREFIXING { CAUTIOUS, ALL } + + In some cases, severe cutbacks are required, e.g. those implied by the + ROBUST command. Also be sure that the AIX C-Kermit on the remote end + has "set flow none" (which is the default). NOTE: Maybe this one can + also be addressed by starting AIX telnetd with the "-a" option. The + situation with SSH connections is not known, but almost certainly the + same. + + When these problems occur, the system error log contains: + + LABEL: TTY_TTYHOG + IDENTIFIER: 0873CF9F + Type: TEMP + Resource Name: pts/1 + + Description + TTYHOG OVER-RUN + + Failure Causes + EXCESSIVE LOAD ON PROCESSOR + + Recommended Actions + REDUCE SYSTEM LOAD. + REDUCE SERIAL PORT BAUD RATE + + Before leaving the topic of AIX pseudoterminals, it is very likely that + Kermit's PTY and SSH commands do not work well either, for the same + reason that Telnet connections into AIX don't work well. A brief test + with "pty rlogin somehost" got a perfectly usable terminal (CONNECT) + session, but file-transfer problems like those just described. + + Reportedly, telnet from AIX 4.1-point-something to non-Telnet ports + does not work unless the port number is in the /etc/services file; it's + not clear from the report whether this is a problem with AIX Telnet (in + which case it would not affect Kermit), or with the sockets library (in + which case it would). The purported fix is IBM APAR IX61523. + + C-Kermit SET HOST or TELNET from one AIX 3.1 (or earlier) system to + another won't work right unless you set your local terminal type to + something other than AIXTERM. When your terminal type is AIXTERM, AIX + TELNET sends two escapes whenever you type one, and the AIX telnet + server swallows one of them. This has something to do with the "hft" + device. This behavior seems to be removed in AIX 3.2 and later. + ________________________________________________________________________ + +3.1.3. AIX: Serial Connections + + [ [180]Top ] [ [181]Contents ] [ [182]Section Contents ] [ [183]Next ] + [ [184]Previous ] + + In AIX 3, 4, or 5, C-Kermit won't be able to "set line /dev/tty0" (or + any other dialout device) if you haven't installed "cu" or "uucp" on + your system, because installing these is what creates the UUCP lockfile + directory. If SET LINE commands always result in "Sorry, access to lock + denied", even when C-Kermit has been given the same owner, group, and + permissions as cu: + + -r-sr-xr-x 1 uucp uucp 67216 Jul 27 1999 cu + + and even when you run it as root, then you must go back and install + "cu" from your AIX installation media. + + According to IBM's "From Strength to Strength" document (21 April + 1998), in AIX 4.2 and later "Async supports speeds on native serial + ports up to 115.2kbps". However, no API is documented to achieve serial + speeds higher than 38400 bps. Apparently the way to do this -- which + might or might not work only on the IBM 128-port multiplexer -- is: + + cxma-stty fastbaud /dev/tty0 + + which, according to "man cxma-stty": + + fastbaud Alters the baud rate table, so 50 baud becomes 57600 baud. + -fastbaud Restores the baud rate table, so 57600 baud becomes 50 + baud. + + Presumably (but not certainly) this extrapolates to 110 "baud" becomes + 76800 bps, and 150 becomes 115200 bps. So to use high serial speeds in + AIX 4.2 or 4.3, the trick would be to give the "cxma-stty fastbaud" + command for the desired tty device before starting Kermit, and then use + "set speed 50", "set speed 110", or "set speed 150" to select 56700, + 76800, or 115200 bps. It is not known whether cxma-stty requires + privilege. + + According to one report, "Further investigation with IBM seems to + indicate that the only hardware capable of doing this is the 128-port + multiplexor with one (or more) of the 16 port breakout cables (Enhanced + Remote Async Node 16-Port EIA-232). We are looking at about CDN$4,000 + in hardware just to hang a 56kb modem on there. Of course, we can then + hang 15 more, if we want. This hardware combo is described to be good + to 230.4kbps." + + Another report says (quote from AIX newsgroup, March 1999): + + The machine type and the adapter determine the speed that one can + actually run at. The older microchannel machines have much slower + crystal frequencies and may not go beyond 76,800. A feature put into + AIX 421 allows one to key in non-POSIX baud rates and if the uart + can support that speed, it will get set. this applies also to 43p's + and beyond. 115200 is the max for the 43P's native serial port. As + crytal frequencies continue to increase, the built-in serial ports + speeds will improve. To use 'uucp' or 'ate' at the higher baud + rates, configure the port for the desired speed, but set the speed + of uucp or ate to 50. Any non-POSIX speeds set in the ttys + configuration will the be used. In the case of the 128-port adapters + or the ISA 8-port or PCI 8-port adapter, there are only a few higher + baud rates. + + a. Change the port to enable high baud rates: + + B50 for 57600 + + B75 for 76800 + + B110 for 115200 + + B200 for 230000 + b. chdev -l ttyX -a fastbaud=enable + + For the 128 ports original style rans, only 57600 bps is + supported. + + For the new enhanced RANs, up to 230Kbps is supported. + + In AIX 2.2.1 on the RT PC with the 8-port multiplexer, SET SPEED 38400 + gives 9600 bps, but SET SPEED 19200 gives 19200 (on the built-in S1 + port). + + Note that some RS/6000s (e.g. the IBM PowerServer 320) have nonstandard + rectangular 10-pin serial ports; the DB-25 connector is NOT a serial + port; it is a parallel printer port. IBM cables are required for the + serial ports, (The IBM RT PC also had rectangular serial ports -- + perhaps the same as these, perhaps different.) + + If you dial in to AIX through a modem that is connected directly to an + AIX port (e.g. on the 128-port multiplexer) and find that data is lost, + especially when uploading files to the AIX system (and system error + logs report buffer overruns on the port): + + 1. Make sure the port and modem are BOTH configured for hardware + (RTS/CTS) flow control. The port is configured somewhere in the + system configuration, outside of Kermit. + 2. Tell C-Kermit to "set flow keep"; experimentation shows that SET + FLOW RTS/CTS has no effect when used in remote mode (i.e. on + /dev/tty, as opposed to a specify port device). + 3. Fixes for bugs in the original AIX 4.2 tty (serial i/o) support and + other AIX bugs are available from IBM at: + [185]http://service.software.ibm.com/rs6000/ + + Downloads -> Software Fixes -> Download FixDist gets an application + for looking up known problems. + + Many problems reported with bidirectional terminal lines on AIX 3.2.x + on the RS/6000. Workaround: don't use bidirectional terminal lines, or + write a shell-script wrapper for Kermit that turns getty off on the + line before starting Kermit, or before Kermit attempts to do the SET + LINE. (But note: These problems MIGHT be fixed in C-Kermit 6.0 and + later.) The commands for turning getty off and on (respectively) are + /usr/sbin/pdisable and /usr/sbin/penable. + ________________________________________________________________________ + +3.1.4. AIX: File Transfer + + [ [186]Top ] [ [187]Contents ] [ [188]Section Contents ] [ [189]Next ] + [ [190]Previous ] + + Evidently AIX 4.3 (I don't know about earlier versions) does not allow + open files to be overwritten. This can cause Kermit transfers to fail + when FILE COLLISION is OVERWRITE, where they might work on other Unix + varieties or earlier AIX versions. + + Transfer of binary -- and maybe even text -- files can fail in AIX if + the AIX terminal has particular port can have character-set translation + done for it by the tty driver. The following advice from a + knowledgeable AIX user: + + [This feature] has to be checked (and set/cleared) with a separate + command, unfortunately stty doesn't handle this. To check: + + $ setmaps + input map: none installed + output map: none installed + + If it says anything other than "none installed" for either one, it + is likely to cause a problem with kermit. To get rid of installed + maps: + + $ setmaps -t NOMAP + + However, I seem to recall that with some versions of AIX before + 3.2.5, only root could change the setting. I'm not sure what + versions - it might have only been under AIX 3.1 that this was true. + At least with AIX 3.2.5 an ordinary user can set or clear the maps. + + On the same problem, another knowledgeable AIX user says: + + The way to get information on the NLS mapping under AIX (3.2.5 + anyway) is as follows. From the command line type: + + lsattr -l tty# -a imap -a omap -E -H + + Replace the tty number for the number sign above. This will give a + human readable output of the settings that looks like this; + + # lsattr -l tty2 -a imap -a omap -E -H + attribute value description user_settable + + imap none INPUT map file True + omap none OUTPUT map file True + + If you change the -H to a -O, you get output that can easily be + processed by another program or a shell script, for example: + + # lsattr -l tty2 -a imap -a omap -E -O + #imap:omap + none:none + + To change the settings from the command line, the chdev command is + used with the following syntax. + + chdev -l tty# -a imap='none' -a omap='none' + + Again substituting the appropriate tty port number for the number + sign, "none" being the value we want for C-Kermit. Of course, the + above can also be changed by using the SMIT utility and selecting + devices - tty. (...end quote) + + In 2007 I noticed the following on high-speed SSH connections (local + network) into AIX 5.3: streaming transfers into AIX just don't work. + The same might be true for Telnet connections; I have no way to check. + It appears that the AIX pty driver and/or the SSH (and possibly Telnet) + server are not capable of receiving a steady stream of incoming data at + high speed. Solution: unknown. Workaround: put "set streaming off" in + your .kermrc or .mykermrc file, since streaming is the default for + network connections. + ________________________________________________________________________ + +3.1.5. AIX: Xterm Key Map + + [ [191]Top ] [ [192]Contents ] [ [193]Section Contents ] [ + [194]Previous ] + + Here is a sample configuration for setting up an xterm keyboard for + VT220 or higher terminal emulation on AIX, courtesy of Bruce Momjian, + Drexel Hill, PA. Xterm can be started like this: + + xterm $XTERMFLAGS +rw +sb +ls $@ -tm 'erase ^? intr ^c' -name vt220 \ + -title vt220 -tn xterm-220 "$@" & + +--------------------------------------------------------------------------- + XTerm*VT100.Translations: #override \n\ + Home: string(0x1b) string("[3~") \n \ + End: string(0x1b) string("[4~") \n + vt220*VT100.Translations: #override \n\ + Shift F1: string("[23~") \n \ + Shift F2: string("[24~") \n \ + Shift F3: string("[25~") \n \ + Shift F4: string("[26~") \n \ + Shift F5: string("[K~") \n \ + Shift F6: string("[31~") \n \ + Shift F7: string("[31~") \n \ + Shift F8: string("[32~") \n \ + Shift F9: string("[33~") \n \ + Shift F10: string("[34~") \n \ + Shift F11: string("[28~") \n \ + Shift F12: string("[29~") \n \ + Print: string(0x1b) string("[32~") \n\ + Cancel: string(0x1b) string("[33~") \n\ + Pause: string(0x1b) string("[34~") \n\ + Insert: string(0x1b) string("[2~") \n\ + Delete: string(0x1b) string("[3~") \n\ + Home: string(0x1b) string("[1~") \n\ + End: string(0x1b) string("[4~") \n\ + Prior: string(0x1b) string("[5~") \n\ + Next: string(0x1b) string("[6~") \n\ + BackSpace: string(0x7f) \n\ + Num_Lock: string(0x1b) string("OP") \n\ + KP_Divide: string(0x1b) string("Ol") \n\ + KP_Multiply: string(0x1b) string("Om") \n\ + KP_Subtract: string(0x1b) string("OS") \n\ + KP_Add: string(0x1b) string("OM") \n\ + KP_Enter: string(0x1b) string("OM") \n\ + KP_Decimal: string(0x1b) string("On") \n\ + KP_0: string(0x1b) string("Op") \n\ + KP_1: string(0x1b) string("Oq") \n\ + KP_2: string(0x1b) string("Or") \n\ + KP_3: string(0x1b) string("Os") \n\ + KP_4: string(0x1b) string("Ot") \n\ + KP_5: string(0x1b) string("Ou") \n\ + KP_6: string(0x1b) string("Ov") \n\ + KP_7: string(0x1b) string("Ow") \n\ + KP_8: string(0x1b) string("Ox") \n\ + KP_9: string(0x1b) string("Oy") \n + + ! Up: string(0x1b) string("[A") \n\ + ! Down: string(0x1b) string("[B") \n\ + ! Right: string(0x1b) string("[C") \n\ + ! Left: string(0x1b) string("[D") \n\ + + *visualBell: true + *saveLines: 1000 + *cursesemul: true + *scrollKey: true + *scrollBar: true + +3.2. C-KERMIT AND HP-UX + + [ [195]Top ] [ [196]Contents ] [ [197]Section Contents ] [ [198]Next ] + [ [199]Previous ] + + SECTION CONTENTS + + 3.2.0. [200]Common Problems + 3.2.1. [201]Building C-Kermit on HP-UX + 3.2.2. [202]File Transfer + 3.2.3. [203]Dialing Out and UUCP Lockfiles in HP-UX + 3.2.4. [204]Notes on Specific HP-UX Releases + 3.2.5. [205]HP-UX and X.25 + + REFERENCES + + For further information, read the [206]comp.sys.hp.hpux newsgroup. + + C-Kermit is included as part of the HP-UX operating system by contract + between Hewlett Packard and Columbia University for HP-UX 10.00 and + later. Each level of HP-UX includes a freshly built C-Kermit binary in + /bin/kermit, which should work correctly. Binaries built for regular + HP-UX may be used on Trusted HP-UX and vice-versa, except for use as + IKSD because of the different authentication methods. + + Note that HP does not update C-Kermit versions for any but its most + current HP-UX release. So, for example, HP-UX 10.20 has C-Kermit 6.0; + 11.00 has C-Kermit 7.0, and 11.22 has 8.0. Of course, as with all + software, older Kermit versions have bugs (such as buffer overflow + vulnerabilities) that are fixed in later versions. From time to time, + HP discovers one of these (long-ago fixed) bugs and issues a security + alert for the older OS's, recommending some draconian measure to avoid + the problem. The true fix in each situation is to install the current + release of C-Kermit. + +3.2.0. Common Problems + + [ [207]Top ] [ [208]Contents ] [ [209]Section Contents ] [ [210]Next ] + + Some HP workstations have a BREAK/RESET key. If you hit this key while + C-Kermit is running, it might kill or suspend the C-Kermit process. + C-Kermit arms itself against these signals, but evidently the + BREAK/RESET key is -- at least in some circumstances, on certain HP-UX + versions -- too powerful to be caught. (Some report that the first + BREAK/RESET shows up as SIGINT and is caught by C-Kermit's former + SIGINT handler even when SIGINT is currently set to SIG_IGN; the second + kills Kermit; other reports suggest the first BREAK/RESET sends a + SIGTSTP (suspend signal) to Kermit, which it catches and suspends + itself. You can tell C-Kermit to ignore suspend signals with SET + SUSPEND OFF. You can tell C-Kermit to ignore SIGINT with SET COMMAND + INTERRUPTION OFF. It is not known whether these commands also grant + immunity to the BREAK/RESET key (one report states that with SET + SUSPEND OFF, the BREAK/RESET key is ignored the first four times, but + kills Kermit the 5th time). In any case: + + 1. If this key is mapped to SIGINT or SIGTSTP, C-Kermit catches or + ignores it, depending on which mode (CONNECT, command, etc) Kermit + is in. + 2. If it causes HP-UX to kill C-Kermit, there is nothing C-Kermit can + do to prevent it. + + When HP-UX is on the remote end of the connection, it is essential that + HP-UX C-Kermit be configured for Xon/Xoff flow control (this is the + default, but in case you change it and then experience file-transfer + failures, this is a likely reason). + +3.2.1. Building C-Kermit on HP-UX + + [ [211]Top ] [ [212]Contents ] [ [213]Section Contents ] [ [214]Next ] + [ [215]Previous ] + + This section applies mainly to old (pre-10.20) HP-UX version on old, + slow, and/or memory-constrained hardware. + + During the C-Kermit 6.0 Beta cycle, something happened to ckcpro.w (or, + more precisely, the ckcpro.c file that is generated from it) which + causes HP optimizing compilers under HP-UX versions 7.0 and 8.0 + (apparently on all platforms) as well as under HP-UX 9.0 on Motorola + platforms only, to blow up. In versions 7.0 and 8.0 the problem has + spread to other modules. + + The symptoms vary from the system grinding to a halt, to the compiler + crashing, to the compilation of the ckcpro.c module taking very long + periods of time, like 9 hours. This problem is handled by compiling the + modules that tickle it without optimization; the new C-Kermit makefile + takes care of this, and shows how to do it in case the same thing + begins happening with other modules. + + On HP-UX 9.0, a kernel parameter, maxdsiz (maximum process data segment + size), seems to be important. On Motorola systems, it is 16MB by + default, whereas on RISC systems the default is much bigger. Increasing + maxdsiz to about 80MB seems to make the problem go away, but only if + the system also has a lot of physical memory -- otherwise it swaps + itself to death. + + The optimizing compiler might complain about "some optimizations + skipped" on certain modules, due to lack of space available to the + optimizer. You can increase the space (the incantation depends on the + particular compiler version -- see the [216]makefile), but doing so + tends to make the compilations take a much longer time. For example, + the "hpux0100o+" makefile target adds the "+Onolimit" compiler flag, + and about an hour to the compile time on an HP-9000/730. But it *does* + produce an executable that is about 10K smaller :-) + + In the makefile, all HP-UX entries automatically skip optimization of + problematic modules. + +3.2.2. File Transfer + + [ [217]Top ] [ [218]Contents ] [ [219]Section Contents ] [ [220]Next ] + [ [221]Previous ] + + Telnet connections into HP-UX versions up to and including 11.11 (and + possibly 11.20) tend not to lend themselves to file transfer due to + limitations, restrictions, and/or bugs in the HP-UX Telnet server + and/or pseudoterminal (pty) driver. + + In C-Kermit 6.0 (1996) an unexpected slowness was noted when + transferring files over local Ethernet connections when an HP-UX system + (9.05 or 10.00) was on the remote end. The following experiment was + conducted to determine the cause. C-Kermit 6.0 was used; the situation + is slightly better using C-Kermit 7.0's streaming feature and HP-UX + 10.20 on the far end. + + The systems were HP-UX 10.00 (on 715/33) and SunOS 4.1.3 (on Sparc-20), + both on the same local 10Mbps Ethernet, packet length 4096, parity + none, control prefixing "cautious", using only local disks on each + machine -- no NFS. In the C-Kermit 6.0 (ACK/NAK) case, the window size + was 20; in the streaming case there is no window size (i.e. it is + infinite). The test file was C-Kermit executable, transferred in binary + mode. Conditions were relatively poor: the Sun and the local net + heavily loaded; the HP system is old, slow, and memory-constrained. + + C-Kermit 6.0... C-Kermit 7.0... + Local Remote ACK/NAK........ Streaming...... + Client Server Send Receive Send Receive + Sun HP 36 18 64 18 + HP HP 25 15 37 16 + HP Sun 77 83 118 92 + Sun Sun 60 60 153 158 + + So whenever HP is the remote we have poor performance. Why? + + * Changing file display to CRT has no effect (so it's not the curses + library on the client side). + * Changing TCP RECV-BUFFER or SEND-BUFFER has little effect. + * Telling the client to make a binary-mode connection (SET TELNET + BINARY REQUESTED, which successfully negotiates a binary + connection) has no effect on throughput. + + BUT... If I start HP-UX C-Kermit as a TCP service: + + set host * 3000 + server + + and then from the client "set host xxx 3000", I get: + + C-Kermit 6.0... C-Kermit 7.0... + Local Remote ACK/NAK........ Streaming...... + Client Server Send Receive Send Receive + Sun HP 77 67 106 139 + HP HP 50 50 64 62 + HP Sun 57 85 155 105 + Sun Sun 57 50 321 314 + + Therefore the HP-UX telnet server or pty driver seems to be adding more + overhead than the SunOS one, and most others. When going through this + type of connection (a remote telnet server) there is little Kermit can + do improve matters, since the telnet server and pty driver are between + the two Kermits, and neither Kermit program can have any influence over + them (except putting the Telnet connection in binary mode, but that + doesn't help). + + (The numbers for the HP-HP transfers are lower than the others since + both Kermit processes are running on the same slow 33MHz CPU.) + + Matters seem to have deteriorated in HP-UX 11. Now file transfers over + Telnet connections fail completely, rather than just being slow. In the + following trial, a Telnet connection was made from Kermit 95 to HP-UX + 11.11 on an HP-9000/785/B2000 over local 10Mbps Ethernet running + C-Kermit 8.00 in server mode (under the HP-UX Telnet server): + + Text........ Binary...... + Stream Pktlen GET SEND GET SEND + On 4000 Fail Fail Fail Fail + Off 4000 Fail Fail Fail Fail + Off 2000 OK Fail OK Fail + On 2000 OK Fail OK Fail + On 3000 Fail Fail Fail Fail + On 2500 Fail Fail Fail Fail + On 2047 OK Fail OK Fail + On 2045 OK Fail OK Fail + Off 500 OK OK OK OK + On 500 OK Fail OK Fail + On 240 OK Fail OK Fail + + As you can see, downloads are problematic unless the receiver's Kermit + packet length is 2045 or less, but uploads work only with streaming + disabled and the packet length restricted to 500. To force file + transfers to work on this connection, the desktop Kermit must be told + to: + + set streaming off + set receive packet-length 2000 + set send packet-length 500 + + However, if a connection is made between the same two programs on the + same two computers over the same network, but this time a direct + socket-to-socket connection bypassing the HP-UX Telnet server and pty + driver (tell HP-UX C-Kermit to "set host /server * 3000 /raw"; tell + desktop client program to "set host blah 3000 /raw"), everything works + perfectly with the default Kermit settings (streaming, 4K packets, + liberal control-character unprefixing, 8-bit transparency, etc): + + Text........ Binary...... + Stream Pktlen GET SEND GET SEND + On 4000 OK OK OK OK + + And in this case, transfer rates were approximately 900,000 cps. To + verify that the behavior reported here is not caused by the new Kermit + release, the same experiment was performed on a Telnet connection from + the same PC over the same network to the old 715/33 running HP-UX 10.20 + and C-Kermit 8.00. Text and binary uploads and downloads worked + perfectly (albeit slowly) with all the default settings -- streaming, + 4K packets, etc. + +3.2.3. Dialing Out and UUCP Lockfiles in HP-UX + + [ [222]Top ] [ [223]Contents ] [ [224]Section Contents ] [ [225]Next ] + [ [226]Previous ] + + HP workstations do not come with dialout devices configured; you have + to do it yourself (as root). First look in /dev to see what's there; + for example in HP-UX 10.00 or later: + + ls -l /dev/cua* + ls -l /dev/tty* + + If you find a tty0p0 device but no cua0p0, you'll need to creat one if + you want to dial out; the tty0p0 does not work for dialing out. It's + easy: start SAM; in the main Sam window, double-click on Peripheral + Device, then in the Peripheral Devices window, double-click on + Terminals and Modems. In the Terminals and Modems dialog, click on + Actions, then choose "Add modem" and fill in the blanks. For example: + Port number 0, speed 57600 (higher speeds tend not to work reliably), + "Use device for calling out", do NOT "Receive incoming calls" (unless + you know what you are doing), leave "CCITT modem" unchecked unless you + really have one, and do select "Use hardware flow control (RTS/CTS)". + Then click OK. This creates cua0p0 as well as cul0p0 and ttyd0p0 + + If the following sequence: + + set line /dev/cua0p0 ; or other device + set speed 115200 ; or other normal speed + + produces the message "?Unsupported line speed". This means either that + the port is not configured for dialout (go into SAM as described above + and make sure "Use device for calling out" is selected), or else that + speed you have given (such as 460800) is supported by the operating + system but not by the physical device (in which case, use a lower speed + like 57600). + + In HP-UX 9.0, serial device names began to change. The older names + looked like "/dev/cua00", "/dev/tty01", etc (sometimes with only one + digit). The newer names have two digits with the letter "p" in between. + HP-UX 8.xx and earlier have the older form, HP-UX 10.00 and later have + the newer form. HP-UX 9.xx has the newer form on Series 800 machines, + and the older form on other hardware models. The situation is + summarized in the following table (the Convio 10.0 column applies to + HP-UX 10 and 11). + + Converged HP-UX Serial I/O Filenames : TTY Mux Naming + --------------------------------------------------------------------- + General meaning Old Form S800 9.0 Convio 10.0 + --------------------------------------------------------------------- + tty* hardwired ports tty ttyp ttyp

+ diag:mux diag:mux + --------------------------------------------------------------------- + ttyd* dial-in modems ttyd ttydp ttydp

+ diag:ttydp diag:ttydp

+ --------------------------------------------------------------------- + cua* auto-dial out cua cuap cuap

+ diag:cuap + --------------------------------------------------------------------- + cul* dial-out cul culp culp

+ diag:culp + --------------------------------------------------------------------- + = LU (Logical Unit) = Devspec (decimal card instance) + or = Port

= Port + + For dialing out, you should use the cua or cul devices. When C-Kermit's + CARRIER setting is AUTO or ON, C-Kermit should pop back to its prompt + automatically if the carrier signal drops, e.g. when you log out from + the remote computer or service. If you use the ttyp (e.g. tty0p0) + device, the carrier signal should be ignored. The ttyp device + should be used for direct connections where the carrier signal does not + follow RS-232 conventions (use the cul device for hardwired connections + through a true null modem). Do not use the ttydp device for + dialing out. + + Kermit's access to serial devices is controlled by "UUCP lockfiles", + which are intended to prevent different users using different software + programs (Kermit, cu, etc, and UUCP itself) from accessing the same + serial device at the same time. When a device is in use by a particular + user, a file with a special name is created in: + + /var/spool/locks (HP-UX 10.00 and later) + /usr/spool/uucp (HP-UX 9.xx and earlier) + + The file's name indicates the device that is in use, and its contents + indicates the process ID (pid) of the process that is using the device. + Since serial devices and the locks directory are not both publicly + readable and writable, Kermit and other communication software must be + installed setuid to the owner (bin) of the serial device and setgid to + the group (daemon) of the /var/spool/locks directory. Kermit's setuid + and setgid privileges are enabled only when opening the device and + accessing the lockfiles. + + Let's say "unit" means a string of decimal digits (the interface + instance number) followed (in HP-UX 10.00 and later) by the letter "p" + (lowercase), followed by another string of decimal digits (the port + number on the interface), e.g.: + + "0p0", "0p1", "1p0", etc (HP-UX 10.00 and later) + "0p0", "0p1", "1p0", etc (HP-UX 9.xx on Series 800) + "00", "01", "10", "0", etc (HP-UX 9.xx not on Series 800) + "00", "01", "10", "0", etc (HP-UX 8.xx and earlier) + + Then a normal serial device (driver) name consists of a prefix ("tty", + "ttyd", "cua", "cul", or possibly "cuad" or "culd") followed by a unit, + e.g. "cua0p0". Kermit's treatment of UUCP lockfiles is as close as + possible to that of the HP-UX "cu" program. Here is a table of the + lockfiles that Kermit creates for unit 0p0: + + Selection Lockfile 1 Lockfile 2 + /dev/tty0p0 LCK..tty0p0 (none) +* /dev/ttyd0p0 LCK..ttyd0p0 (none) + /dev/cua0p0 LCK..cua0p0 LCK..ttyd0p0 + /dev/cul0p0 LCK..cul0p0 LCK..ttyd0p0 + /dev/cuad0p0 LCK..cuad0p0 LCK..ttyd0p0 + /dev/culd0p0 LCK..culd0p0 LCK..ttyd0p0 + LCK.. (none) + + (* = Dialin device, should not be used.) + + In other words, if the device name begins with "cu", a second lockfile + for the "ttyd" device, same unit, is created, which should prevent + dialin access on that device. + + The case allows for symbolic links, etc, but of course it is + not foolproof since we have no way of telling which device is really + being used. + + When C-Kermit tries to open a dialout device whose name ends with a + "unit", it searches the lockfile directory for all possible names for + the same unit. For example, if user selects /dev/cul2p3, Kermit looks + for lockfiles named: + + LCK..tty2p3 + LCK..ttyd2p3 + LCK..cua2p3 + LCK..cul2p3 + LCK..cuad2p3 + LCK..culd2p3 + + If any of these files are found, Kermit opens them to find out the ID + (pid) of the process that created them; if the pid is still valid, the + process is still active, and so the SET LINE command fails and the user + is informed of the pid so s/he can use "ps" to find out who is using + the device. + + If the pid is not valid, the file is deleted. If all such files (i.e. + with same "unit" designation) are successfully removed, then the SET + LINE command succeeds; up to six messages are printed telling the user + which "stale lockfiles" are being removed. + + When the "set line" command succeeds in HP-UX 10.00 and later, C-Kermit + also creates a Unix System V R4 "advisory lock" as a further precaution + (but not guarantee) against any other process obtaining access to the + device while you are using it. + + If the selected device was in use by "cu", Kermit can't open it, + because "cu" has changed its ownership, so we never get as far as + looking at the lockfiles. In the normal case, we can't even look at the + device to see who the owner is because it is visible only to its + (present) owner. In this case, Kermit says (for example): + + /dev/cua0p0: Permission denied + + When Kermit releases a device it has successfully opened, it removes + all the lockfiles that it created. This also happens whenever Kermit + exits "under its own power". + + If Kermit is killed with a device open, the lockfile(s) are left + behind. The next Kermit program that tries to assign the device, under + any of its various names, will automatically clean up the stale + lockfiles because the pids they contain are invalid. The behavior of cu + and other communication programs under these conditions should be the + same. + + Here, by the way, is a summary of the differences between the HP-UX + port driver types from John Pezzano of HP: + + There are three types of device files for each port. + + The ttydXXX device file is designed to work as follows: + + 1. The process that opens it does NOT get control of the port until CD + is asserted. This was intentional (over 15 years ago) to allow + getty to open the port but not control it until someone called in. + If a process wants to use the direct or callout device files + (ttyXXX and culXXX respectively), they will then get control and + getty would be blocked. This eliminated the need to use uugetty + (and its inherent problems with lock files) for modems. You can see + this demonstrated by the fact that "ps -ef" shows a ? in the tty + column for the getty process as getty does not have the port yet. + 2. Once CD is asserted, the port is controlled by getty (or the + process handling an incoming call) if there was no process using + the port. The ? in the "ps" command now shows the port. At this + point, the port accepts data. + + Therefore you should use either the callout culXXX device file + (immediate control but no data until CD is asserted) or the direct + device file ttyXXX which gives immediate control and immediate data + and which ignores by default modem control signals. + + The ttydXXX device should be used only for callin and my + recommendation is to use it only for getty and uugetty. + +3.2.4 Notes on Specific HP-UX Releases + + SECTION CONTENTS + + 3.2.4.1. [227]HP-UX 11 + 3.2.4.2. [228]HP-UX 10 + 3.2.4.3. [229]HP-UX 9 + 3.2.4.4. [230]HP-UX 8 + 3.2.4.5. [231]HP-UX 7 and Earlier + +3.2.4.1. HP-UX 11 + + [ [232]Top ] [ [233]Contents ] [ [234]Section Contents ] [ [235]Next ] + + As noted in [236]Section 3.2.2, the HP-UX 11 Telnet server and/or + pseudoterminal driver are a serious impediment to file transfer over + Telnet connections into HP-UX. If you have a Telnet connection into + HP-UX 11, tell your desktop Kermit program to: + + set streaming off + set receive packet-length 2000 + set send packet-length 500 + + File transfer speeds over connections from HP-UX 11 (dialed or Telnet) + are not impeded whatsoever, and can go at whatever speed is allowed by + the connection and the Kermit partner on the far end. + + PA-RISC binaries for HP-UX 10.20 or later should run on any PA-RISC + system, S700 or S800, as long as the binary was not built under a later + HP-UX version than the host operating system. HP-UX 11.00 and 11.11 are + only for PA-RISC systems. HP-UX 11.20 is only for IA64 (subsequent + HP-UX releases will be for both PA-RISC and IA64). To check binary + compatibility, the following C-Kermit 8.0 binaries were run + successfully on an HP-9000/785 with HP-UX 11.11: + + * Model 7xx HP-UX 10.20 + * Model 8xx HP-UX 10.20 + * Model 7xx HP-UX 11.00 + * Model 8xx HP-UX 11.00 + * Model 7xx HP-UX 11.11 + * Model 8xx HP-UX 11.11 + + Binaries built under some of the earlier HP-UX releases, such as 9.05, + might also work, but only if built for the same hardware family (e.g. + s700). + +3.2.4.2. HP-UX 10 + + [ [237]Top ] [ [238]Contents ] [ [239]Section Contents ] [ [240]Next ] + [ [241]Previous ] + + Beginning in HP-UX 10.10, libcurses is linked to libxcurses, the new + UNIX95 (X/Open) version of curses, which has some serious bugs; some + routines, when called, would hang and never return, some would dump + core. Evidently libxcurses contains a select() routine, and whenever + C-Kermit calls what it thinks is the regular (sockets) select(), it + gets the curses one, causing a segmentation fault. There is a patch for + this from HP, PHCO_8086, "s700_800 10.10 libcurses patch", "shared lib + curses program hangs on 10.10", "10.10 enhanced X/Open curses core + dumps due to using wrong select call", 96/08/02 (you can tell if the + patch is installed with "what /usr/lib/libxcurses.1"; the unpatched + version is 76.20, the patched one is 76.20.1.2). It has been verified + that C-Kermit works OK with the patched library, but results are not + definite for HP-UX 10.20 or higher. + + To ensure that C-Kermit works even on non-patched HP-UX 10.10 systems, + separate makefile entries are provided for HP-UX 10.00/10.01, 10.10, + 10.20, etc, in which the entries for 10.10 and above link with + libHcurses, which is "HP curses", the one that was used in 10.00/10.01. + HP-UX 11.20 and later, however, link with libcurses, as libHcurses + disappeared in 11.20. + +3.2.4.3. HP-UX 9 + + [ [242]Top ] [ [243]Contents ] [ [244]Section Contents ] [ [245]Next ] + [ [246]Previous ] + + HP-UX 9.00 and 9.01 need patch PHNE_10572 (note: this replaces + PHNE_3641) for hptt0.o, asio0.o, and ttycomn.o in libhp-ux.a. Contact + Hewlett Packard if you need this patch. Without it, the dialout device + (tty) will be hung after first use; subsequent attempts to use will + return an error like "device busy". (There are also equivalent patches + for s700 9.03 9.05 9.07 (PHNE_10573) and s800 9.00 9.04 (PHNE_10416). + + When C-Kermit is in server mode, it might have trouble executing REMOTE + HOST commands. This problem happens under HP-UX 9.00 (Motorola) and + HP-UX 9.01 (RISC) IF the C-Shell is the login shell AND with the + C-Shell Revision 70.15. Best thing is to install HP's Patch PHCO_4919 + for Series 300/400 and PHCO_5015 for the Series 700/800. PHCO_5015 is + called "s700_800 9.X cumulative csh(1) patch with memory leak fix" + which works for HP-UX 9.00, 9.01, 9.03, 9.04, 9.05 and 9.07. At least + you need C-Shell Revision 72.12! + + C-Kermit works fine -- including its curses-based file-transfer display + -- on the console terminal, in a remote session (e.g. when logged in to + the HP 9000 on a terminal port or when telnetted or rlogin'd), and in + an HP-VUE hpterm window or an xterm window. + +3.2.4.4. HP-UX 8 + + [ [247]Top ] [ [248]Contents ] [ [249]Section Contents ] [ [250]Next ] + [ [251]Previous ] + + To make C-Kermit work on HP-UX 8.05 on a model 720, obtain and install + HP-UX patch PHNE_0899. This patch deals with a lot of driver issues, + particularly related to communication at higher speeds. + + One user reports: + + On HP-UX 8 DON'T install 'tty patch' PHKL_4656, install PHKL_3047 + instead! Yesterday I tried this latest tty patch PHKL_4656 and had + terrible problems. This patch should fix RTS/CTS problems. With text + transver all looks nice. But when I switched over to binary files + the serial interface returned only rubish to C-Kermit. All sorts of + protocol, CRC and packed errors I had. After several tests and after + uninstalling that patch, all transvers worked fine. MB's of data + without any errors. So keep your fingers away from that patch. If + anybody needs the PHKL_3047 patch I have it here. It is no longer + availabel from HP's patch base. + +3.2.4.5. HP-UX 7 and Earlier + + [ [252]Top ] [ [253]Contents ] [ [254]Section Contents ] [ + [255]Previous ] + + When transferring files into HP-UX 5 or 6 over a Telnet connection, you + must not use streaming, and you must not use a packet length greater + than 512. However, you can use streaming and longer packets when + sending files from HP-UX on a Telnet connection. In C-Kermit 8.0, the + default receive packet length for HP-UX 5 and 6 was changed to 500 (but + you can still increase it with SET RECEIVE PACKET-LENGTH if you wish, + e.g. for non-Telnet connections). Disable streaming with SET STREAMING + OFF. + + The HP-UX 5.00 version of C-Kermit does not include the fullscreen + file-transfer because of problems with the curses library. + + If HP-UX 5.21 with Wollongong TCP/IP is on the remote end of a Telnet + connection, streaming transfers to HP-UX invariably fail. Workaround: + SET STREAMING OFF. Packets longer than about 1000 should not be used. + Transfers from these systems, however, can use streaming and/or longer + packets. + + Reportedly, "[there is] a bug in C-Kermit using HP-UX version 5.21 on + the HP-9000 series 500 computers. It only occurs when the controlling + terminal is using an HP-27140 six-port modem mux. The problem is not + present if the controlling terminal is logged into an HP-27130 + eight-port mux. The symptom is that just after dialing successfully and + connecting Kermit locks up and the port is unusable until both forks of + Kermit and the login shell are killed." (This report predates C-Kermit + 6.0 and might no longer apply.) + +3.2.5. HP-UX and X.25 + + [ [256]Top ] [ [257]Contents ] [ [258]Section Contents ] [ + [259]Previous ] + + Although C-Kermit presently does not include built-in support for HP-UX + X.25 (as it does for the Sun and IBM X.25 products), it can still be + used to make X.25 connections as follows: start Kermit and then telnet + to localhost. After logging back in, start padem as you would normally + do to connect over X.25. Padem acts as a pipe between Kermit and X.25. + In C-Kermit 7.0, you might also be able to avoid the "telnet localhost" + step by using: + + C-Kermit> pty padem address + + This works if padem uses standard i/o (who knows?). + +3.3. C-KERMIT AND LINUX + + [ [260]Top ] [ [261]Contents ] [ [262]Section Contents ] [ [263]Next ] + [ [264]Previous ] + + SECTION CONTENTS + + 3.3.1. [265]Problems Building C-Kermit for Linux + 3.3.2. [266]Problems with Serial Devices in Linux + 3.3.3. [267]Terminal Emulation in Linux + 3.3.4. [268]Dates and Times + 3.3.5. [269]Startup Errors + 3.3.6. [270]The Fullscreen File Transfer Display + + (August 2010) Reportedly C-Kermit packages for certain Linux + distributions such as Centos and Ubuntu have certain features + disabled, for example the SSH command, SET HOST PTY /SSH, and + perhaps anything else to do with SSH and/or pseudoterminals and who + knows what else. If you download the regular package ("tarball") + from the Kermit Project and build from it ("make linux"), everything + is fine. + + C-Kermit in Ubuntu 10.04 and 9.10 was reported slow to start because + it was trying to resolve the IP address 255.255.255.255. Later, also + in recent Debian versions. The following is seen in the strace: + +write(3, "RESOLVE-ADDRESS 255.255.255.255\n", 32) + + This is not Kermit Project code. Turns out to be something in + glibc's resolver, and can be fixed by changing /etc/nsswitch.conf, + but it might break other software, such as [271]Avahi or anything + (such as Gnome, Java, or Cups) that depends on it. I'm not sure + where it happens; I don't think Kermit tries to get its IP address + at startup time, only when it's needed or asked for, e.g. when + making a connection or evaluating \v(ipaddress). + + REFERENCES + + For further information, read the [272]comp.os.linux.misc, + [273]comp.os.linux.answers, and other Linux-oriented newsgroups, and + see: + + The Linux Document Project (LDP) + [274]http://www.tldp.org/ + + The Linux FAQ + [275]http://www.tldp.org/FAQ/Linux-FAQ.html + + The Linux HOWTOs (especially the Serial HOWTO) + + [276]http://www.tldp.org/HOWTO/Serial-HOWTO.html + + [277]http://tldp.org/HOWTO/Modem-HOWTO.html + + [278]ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO + + [279]ftp://tsx-11.mit.edu/pub/linux/docs/HOWTO + + [280]http://www.tldp.org/HOWTO/ + + [281]http://www.tldp.org/hmirrors.html + + Linux Vendor Tech Support Pages: + + [282]http://www.redhat.com/apps/support/ + + [283]http://www.debian.org/support + + [284]http://www.slackware.com/support/ + + [285]http://www.caldera.com/support/ + + [286]SUSE Linux Support + + [287]http://www.mandrake.com/support/ + + [288]http://www.turbolinux.com/support/ + + Linux Winmodem Support + [289]http://www.linmodems.org/ + + Also see general comments on PC-based Unixes in [290]Section 3.0. + + What Linux version is it? -- "uname -a" supplies only kernel + information, but these days it's the distribution that matters: Red Hat + 7.3, Debian 2.2, Slackware 8.0, etc. Unfortunately there's no + consistent way to get the distribution version. Usually it's in a + distribution-specific file: + + Red Hat: /etc/issue or /etc/redhat-release + Debian: /etc/debian_version + Slackware: /etc/slackware-version (at least in later versions) + + Did you know: DECnet is available for Linux? See: + + [291]http://linux.dreamtime.org/decnet/ + + (But there is no support for it in C-Kermit -- anybody interested in + adding it, please [292]let me know). + + Before proceeding, let's handle the some of the most frequently asked + question in the Linux newsgroups: + + 1. Neither C-Kermit nor any other Linux application can use Winmodems, + except in the [293]rare cases where Linux drivers have been written + for them. See [294]Section 3.0.2 for details. + 2. "Why does it take such a long time to make a telnet connection to + (or from) my Linux PC?" (this applies to C-Kermit and to regular + Telnet). Most telnet servers these days perform reverse DNS lookups + on the client (for security and/or logging reasons). If the Telnet + client's address cannot be found by the server's local DNS server, + the DNS request goes out to the Internet at large, and this can + take quite some time. The solution to this problem is to make sure + that both client and host are registered in DNS, and that the + registrations are exported. C-Kermit itself performs reverse DNS + lookups unless you tell it not to; this is to allow C-Kermit to let + you know which host it is actually connected to in case you have + made a connection to a host pool (multihomed host). You can disable + C-Kermit's reverse DNS lookup with SET TCP REVERSE-DNS-LOOKUP OFF. + 3. (Any question that has the word "Telnet" in it...) The knee-jerk + reaction is "don't use Telnet, use SSH!" There's nothing wrong with + Telnet. In fact it's far superior to SSH as a protocol in terms of + features and extensibility, not to mention platform neutrality. The + issue lurking behind the knee-jerk reaction is security. SSH is + thought to be secure, whereas Telnet is thought to be insecure. + This is true for clear-text Telnet (because passwords travel in the + clear across the network), but apparently few people realize that + [295]secure Telnet clients and servers have been available for + years, and these are more secure than SSH (for reasons explained + [296]HERE). + 4. (Any question that has the word "FTP" in it...) The knee-jerk + reaction being "Don't use FTP, use SCP!" (or SFTP). Same answer as + above, but moreso. SCP and SFTP are not only not platform neutral, + they're diversity-hostile. They transfer files only in binary mode, + which mangles text files across different platforms, to the same + degree the platform's text-file record format and character set + differ. An extreme example would be an Variable-Block format EBCDIC + text file on an IBM mainframe, binary transfer of which to Unix + would do you little good indeed. FTP was designed with diversity in + mind and secure versions are available. + +3.3.1. Problems Building C-Kermit for Linux + + [ [297]Top ] [ [298]Contents ] [ [299]Section Contents ] [ [300]Next ] + + Modern Linux distributions like Red Hat give you a choice at + installation whether to include "developer tools". Obviously, you can't + build C-Kermit or any other C program from source code if you have not + installed the developer tools. But to confuse matters, you might also + have to choose (separately) to install the "curses" or "ncurses" + terminal control library; thus it is possible to install the C compiler + and linker, but omit the (n)curses library and headers. If curses is + not installed, you will not be able to build a version of C-Kermit that + supports the fullscreen file-transfer display, in which case you'll + need to use the "linuxnc" makefile target (nc = No Curses) or else + install ncurses before building. + + There are all sorts of confusing issues caused by the many and varied + Linux distributions. Some of the worst involve the curses library and + header files: where are they, what are they called, which ones are they + really? Other vexing questions involve libc5 vs libc6 vs glibc vs + glibc2 (C libraries), gcc vs egcs vs lcc (compilers), plus using or + avoiding features that were added in a certain version of Linux or a + library or a distribution, and are not available in others. As of + C-Kermit 8.0, these questions should be resolved by the "linux" + makefile target itself, which does a bit of looking around to see + what's what, and then sets the appropriate CFLAGS. + +3.3.2. Problems with Serial Devices in Linux + + [ [301]Top ] [ [302]Contents ] [ [303]Section Contents ] [ [304]Next ] + [ [305]Previous ] + + Also see: "man setserial", "man irqtune". + And: [306]Sections 3.0, [307]6, [308]7, and [309]8 of this document. + + NOTE: Red Hat Linux 7.2 and later include a new API that allows + serial-port arbitration by non-setuid/gid programs. This API has not + yet been added to C-Kermit. If C-Kermit is to be used for dialing + out on Red Hat 7.2 or later, it must still be installed as described + in in Sections [310]10 and [311]11 of the [312]Installation + Instructions. + + Don't expect it to be easy. Queries like the following are posted to + the Linux newsgroups almost daily: + + Problem of a major kind with my Compaq Presario 1805 in the sense + that the pnpdump doesn't find the modem and the configuration tells + me that the modem is busy when I set everything by hand! + + I have , kernel 2.0.35. Using the + Compaq tells me that the modem (which is internal) is on COM2, with + the usual IRQ and port numbers. Running various Windows diagnostics + show me AT-style commands exchanged so I have no reason to beleive + that it is a Winmodem. Also, the diagnostics under Win98 tell me + that I am talking to an NS 16550AN. + + [Editor's note: This does not necessarily mean it isn't a Winmodem.] + + Under Linux, no joy trying to talk to the modem on /dev/cua1 whether + via minicom, kppp, or chat; kppp at least tells me that tcgetattr() + failed. + + Usage of setserial: + + setserial /dev/cua1 port 0x2F8 irq 3 autoconfig + setserial -g /dev/cua1 + + tells me that the uart is 'unknown'. I have tried setting the UART + manullay via. setserial to 16550A, 16550, and the other one (8550?) + (I didn't try 16540). None of these manual settings resulted in any + success. + + A look at past articles leads me to investigate PNP issues by + calling pnpdump but pnpdump returns "no boards found". I have looked + around on my BIOS (Phoenix) and there is not much evidence of it + being PNP aware. However for what it calls "Serial port A", it + offers a choice of Auto, Disabled or Manual settings (currently set + to Auto), but using the BIOS interface I tried to change to 'manual' + and saw the default settings offered to be were 0x3F8 and IRQ 4 + (COM1). The BIOS menus did not give me any chance to configure COM2 + or any "modem". I ended up not saving any BIOS changes in the course + of my investigations. + + You can also find out a fair amount about your PC's hardware + configuration in the text files in /proc, e.g.: + + -r--r--r-- 1 root 0 Sep 4 14:00 /proc/devices + -r--r--r-- 1 root 0 Sep 4 14:00 /proc/interrupts + -r--r--r-- 1 root 0 Sep 4 14:00 /proc/ioports + -r--r--r-- 1 root 0 Sep 4 14:00 /proc/pci + + From the directory listing they look like empty files, but in fact they + are text files that you "cat": + +$ cat /proc/pci + Bus 0, device 14, function 0: + Serial controller: US Robotics/3Com 56K FaxModem Model 5610 (rev 1). + IRQ 10. + I/O at 0x1050 [0x1057]. + +$ setserial -g /dev/ttyS4 +/dev/ttyS4, UART: 16550A, Port: 0x1050, IRQ: 10 + +$ cat /proc/ioports +1050-1057 : US Robotics/3Com 56K FaxModem Model 5610 + 1050-1057 : serial(auto) + +$ cat /proc/interrupts + CPU0 + 0: 7037515 XT-PIC timer + 1: 2 XT-PIC keyboard + 2: 0 XT-PIC cascade + 4: 0 XT-PIC serial + 8: 1 XT-PIC rtc + 9: 209811 XT-PIC usb-uhci, eth0 + 14: 282015 XT-PIC ide0 + 15: 6 XT-PIC ide1 + + Watch out for PCI, PCMCIA and Plug-n-Play devices, Winmodems, and the + like (see cautions in [313]Section 3.0 Linux supports Plug-n-Play + devices to some degree via the isapnp and pnpdump programs; read the + man pages for them. (If you don't have them, look on your installation + CD for isapnptool or download it from sunsite or a sunsite mirror or + other politically correct location du jour). + + PCI modems do not use standard COM port addresses. The I/O address and + IRQ are assigned by the BIOS. All you need to do to get one working, + find out the I/O address and interrupt number with (as root) "lspci -v + | more" and then give the resulting address and interrupt number to + setserial. + + Even when you have a real serial port, always be wary of interrupt + conflicts and similar PC hardware configuration issues: a PC is not a + real computer like other Unix workstations -- it is generally pieced + together from whatever random components were the best bargain on the + commodity market the week it was built. Once it's assembled and boxed, + not even the manufacturer will remember what it's made of or how it was + put together because they've moved on to a new model. Their job is to + get it (barely) working with Windows; for Linux and other OS's you are + on your own. + + "set line /dev/modem" or "set line /dev/ttyS2", etc, results in an + error, "/dev/modem is not a tty". Cause unknown, but obviously a driver + issue, not a Kermit one (Kermit uses "isatty()" to check that the + device is a tty, so it knows it will be able to issue all the + tty-related ioctl's on it, like setting the speed & flow control). Try + a different name (i.e. driver) for the same port, e.g. "set line + /dev/cua2" or whatever. + + To find what serial ports were registered at the most recent system + boot, type (as root): "grep tty /var/log/dmesg". + + "set modem type xxx" (where xxx is the name of a modem) followed by + "set line /dev/modem" or "set + line /dev/ttyS2", etc, hangs (but can be interrupted with Ctrl-C). + Experimentation shows that if the modem is configured to always assert + carrier (&C0) the same command does not hang. Again, a driver issue. + Use /dev/cua2 (or whatever) instead. (Or not -- hopefully none of these + symptoms occurs in C-Kermit 7.0 or later.) + + "set line /dev/cua0" reports "Device is busy", but "set line + /dev/ttyS0" works OK. + + In short: If the cua device doesn't work, try the corresponding ttyS + device. If the ttyS device doesn't work, try the corresponding cua + device -- but note that Linux developers do not recommend this, and are + phasing out the cua devices. From /usr/doc/faq/howto/Serial-HOWTO: + + 12.4. What's The Real Difference Between the /dev/cuaN And /dev/ttySN + Devices? + The only difference is the way that the devices are opened. The + dialin devices /dev/ttySN are opened in blocking mode, until CD + is asserted (ie someone connects). So, when someone wants to use + the /dev/cuaN device, there is no conflict with a program + watching the /dev/ttySN device (unless someone is connected of + course). The multiple /dev entries, allow operation of the same + physical device with different operating characteristics. It + also allows standard getty programs to coexist with any other + serial program, without the getty being retrofitted with locking + of some sort. It's especially useful since standard Unix kernel + file locking, and UUCP locking are both advisory and not + mandatory. + + It was discovered during development of C-Kermit 7.0 that rebuilding + C-Kermit with -DNOCOTFMC (No Close/Open To Force Mode Change) made the + aforementioned problem with /dev/ttyS0 go away. It is not yet clear, + however, what its affect might be on the /dev/cua* devices. As of 19 + March 1998, this option has been added to the CFLAGS in the makefile + entries for Linux ("make linux"). + + Note that the cua device is now "deprecated", and new editions of Linux + will phase (have phased) it out in favor of the ttyS device. See (if + it's still there): + + [314]http://linuxwww.db.erau.edu/mail_archives/linux-kernel/Mar_98/1441.html + + (no, of course it isn't; you'll have to use your imagination). One user + reported that C-Kermit 7.0, when built with egcs 1.1.2 and run on Linux + 2.2.6 with glibc 2.1 (hardware unknown but probably a PC) dumps core + when given a "set line /dev/ttyS1" command. When rebuilt with gcc, it + works fine. + + All versions of Linux seem to have the following deficiency: When a + modem call is hung up and CD drops, Kermit can no longer read the modem + signals; SHOW COMMUNICATIONS says "Modem signals not available". The + TIOCMGET ioctl() returns -1 with errno 5 ("I/O Error"). + + The Linux version of POSIX tcsendbreak(), which is used by C-Kermit to + send regular (275msec) and long (1.5sec) BREAK signals, appears to + ignore its argument (despite its description in the man page and info + topic), and always sends a regular 275msec BREAK. This has been + observed in Linux versions ranging from Debian 2.1 to Red Hat 7.1. + +3.3.3. Terminal Emulation in Linux + + [ [315]Top ] [ [316]Contents ] [ [317]Section Contents ] [ [318]Next ] + [ [319]Previous ] + + C-Kermit is not a terminal emulator. For a brief explanation of why + not, see [320]Section 3.0.5. For a fuller explanation, [321]ClICK HERE. + + In Unix, terminal emulation is supplied by the Window in which you run + Kermit: the regular console screen, which provides Linux Console + "emulation" via the "console" termcap entry, or under X-Windows in an + xterm window, which gives VTxxx emulation. An xterm that includes color + ANSI and VT220 emulation is available with Xfree86: + + [322]http://dickey.his.com/xterm/xterm.html + + Before starting C-Kermit in an xterm window, you might need to tell the + xterm window's shell to "stty sane". + + To set up your PC console keyboard to send VT220 key sequences when + using C-Kermit as your communications program in an X terminal window + (if it doesn't already), create a file somewhere (e.g. in /root/) + called .xmodmaprc, containing something like the following: + + keycode 77 = KP_F1 ! Num Lock => DEC Gold (PF1) + keycode 112 = KP_F2 ! Keypad / => DEC PF1 + keycode 63 = KP_F3 ! Keypad * => DEC PF3 + keycode 82 = KP_F4 ! Keypad - => DEC PF4 + keycode 111 = Help ! Print Screen => DEC Help + keycode 78 = F16 ! Scroll Lock => DEC Do + keycode 110 = F16 ! Pause => DEC Do + keycode 106 = Find ! Insert => DEC Find + keycode 97 = Insert ! Home => DEC Insert + keycode 99 = 0x1000ff00 ! Page Up => DEC Remove + keycode 107 = Select ! Delete => DEC Select + keycode 103 = Page_Up ! End => DEC Prev Screen + keycode 22 = Delete ! Backspace sends Delete (127) + + Then put "xmodmap filename" in your .xinitrc file (in your login + directory), e.g. + + xmodmap /root/.xmodmaprc + + Of course you can move things around. Use the xev program to find out + key codes. + + Console-mode keys are mapped separately using loadkeys, and different + keycodes are used. Find out what they are with showkey. + + For a much more complete VT220/320 key mapping for [323]Xfree86 xterm, + [324]CLICK HERE. + +3.3.4. Dates and Times + + [ [325]Top ] [ [326]Contents ] [ [327]Section Contents ] [ [328]Next ] + [ [329]Previous ] + + If C-Kermit's date-time (e.g. as shown by its DATE command) differs + from the system's date and time: + + a. Make sure the libc to which Kermit is linked is set to GMT or is + not set to any time zone. Watch out for mixed libc5/libc6 systems; + each must be set indpendently. + b. If you have changed your TZ environment variable, make sure it is + exported. This is normally done in /etc/profile or /etc/TZ. + +3.3.5. Startup Errors + + [ [330]Top ] [ [331]Contents ] [ [332]Section Contents ] [ [333]Next ] + [ [334]Previous ] + + C-Kermit should work on all versions of Linux current through March + 2003, provided it was built on the same version you have, with the same + libraries and header files (just get the source code and "make linux"). + Binaries tend not to travel well from one Linux machine to another, due + to their many differences. There is no guarantee that a particular + C-Kermit binary will not stop working at a later date, since Linux + tends to change out from under its applications. If that happens, + rebuild C-Kermit from source. If something goes wrong with the build + process, look on the [335]C-Kermit website for a newer version. If you + have the latest version, then [336]report the problem to us. + + Inability to transfer files in Red Hat 7.2: the typical symptom would + be if you start Kermit and tell it to RECEIVE, it fails right away with + "?/dev/tty: No such device or address" or "?Bad file descriptor". One + report says this is because of csh, and if you change your shell to + bash or other shell, it doesn't happen. Another report cite bugs in Red + Hat 7.2 Telnetd "very seldom (if ever) providing a controlling tty, and + lots of other people piled on saying they have the same problem.") A + third theory is that this happens only when Linux has been installed + without "virtual terminal support". + + A search of RedHat's errata pages shows a bug advisory (RHBA-2001-153) + issued 13 November 2001, but updated 6 December, about this same + symptom (but with tcsh and login.) Seems that login was not always + assigning a controlling TTY for the session, which would make most use + of "/dev/tty" somewhat less than useful. + + [337]http://www.redhat.com/support/errata/RHBA-2001-153.html + + Quoting: "Due to terminal handling problems in /bin/login, tcsh would + not find the controlling terminal correctly, and a shell in single user + mode would exhibit strange terminal input characteristics. This update + fixes both of these problems." + + Since the Red Hat 5.1 release (circa August 1998), there have been + numerous reports of prebuilt Linux executables, and particularly the + Kermit RPM for Red Hat Linux, not working; either it won't start at + all, or it gives error messages about "terminal type unknown" and + refuses to initialize its curses support. The following is from the + [338]Kermit newsgroup: + + From: rchandra@hal9000.buf.servtech.com + Newsgroups: comp.protocols.kermit.misc + Subject: Red Hat Linux/Intel 5.1 and ncurses: suggestions + Date: 22 Aug 1998 15:54:46 GMT + Organization: Verio New York + Keywords: RedHat RPM 5.1 + + Several factors can influence whether "linux" is recognized as a + terminal type on many Linux systems. + + 1. Your program, or the libraries it linked with (if statically + linked), or the libraries it dynamically links with at runtime, are + looking for an entry in /etc/termcap that isn't there. (not likely, + but possible... I believe but am not certain that this is a very + old practice in very old [n]curses library implementations to use a + single file for all terminal descriptions.) + 2. Your program, or the libraries...are looking for a terminfo file + that just plain isn't there. (also not so likely, since many people + in other recent message threads said that other programs work OK). + 3. Your program, or the libraries...are looking for a terminfo file + that is stored at a pathname that isn't expected by your program, + the libraries--and so on. I forgot if I read this in the errata Web + page or where exactly I discovered this (Netscape install? Acrobat + install?), but it may just be that one libc (let's say for sake of + argument, libc5, but I don't know this to be true) expects your + terminfo to be in /usr/share/terminfo, and the other (let's say + libc6/glibc) expects /usr/lib/terminfo. I remember that the + specific instructions in this bugfix/workaround were to do the + following or equivalent: + cd /usr/lib + ln -s ../share/terminfo ./terminfo + + or: + ln -s /usr/share/terminfo /usr/lib/terminfo + + So what this says is that the terminfo database/directory structure + can be accessed by either path. When something goes to reference + /usr/lib/terminfo, the symlink redirects it to essentially + /usr/share/terminfo, which is where it really resides on your + system. I personally prefer wherever possible to use relative + symlinks, because they still hold, more often than break, across + mount points, particularly NFS mounts, where the directory structure + may be different on the different systems. + + Evidently the terminfo file moved between Red Hat 5.0 and 5.1, but Red + Hat did not include a link to let applications built prior to 5.1 find + it. Users reported that installing the link fixes the problem. + +3.3.6. The Fullscreen File Transfer Display + + [ [339]Top ] [ [340]Contents ] [ [341]Section Contents ] [ + [342]Previous ] + + Starting with ncurses versions dated 1998-12-12 (about a year before + ncurses 5.0), ncurses sets the terminal for buffered i/o, but + unfortunately is not able to restore it upon exit from curses (via + endwin()). Thus after a file transfer that uses the fullscreen file + transfer display, the terminal no longer echos nor responds immediately + to Tab, ?, and other special command characters. The same thing happens + on other platforms that use ncurses, e.g. FreeBSD. Workarounds: + + * Use SET XFER DISPLAY BRIEF, CRT, SERIAL, or NONE instead of + FULLSCREEN; or: + * Rebuild with KFLAGS=-DNONOSETBUF (C-Kermit 8.0) + + In Red Hat 7.1, when using C-Kermit in a Gnome terminal window, it was + noticed that when the fullscreen file transfer display exits (via + endwin()), the previous (pre-file-transfer-display) screen is restored. + Thus you can't look at the completed display to see what happened. This + is a evidently a new feature of xterm. I can only speculate that + initscreen() and endwin() must send some kind of special escape + sequences that command xterm to save and restore the screen. To defeat + this effect, tell Linux you have a vt100 or other xterm-compatible + terminal that is not actually an xterm, or else tell Kermit to SET + TRANSFER DISPLAY to something besides FULLSCREEN. + +3.4. C-KERMIT AND NEXTSTEP + + [ [343]Top ] [ [344]Contents ] [ [345]Section Contents ] [ [346]Next ] + [ [347]Previous ] + + Run C-Kermit in a Terminal, Stuart, or xterm window, or when logged in + remotely through a serial port or TELNET connection. C-Kermit does not + work correctly when invoked directly from the NeXTSTEP File Viewer or + Dock. This is because the terminal-oriented gtty, stty, & ioctl calls + don't work on the little window that NeXTSTEP pops up for non-NeXTSTEP + applications like Kermit. CBREAK and No-ECHO settings do not take + effect in the command parser -- commands are parsed strictly line at a + time. "set line /dev/cua" works. During CONNECT mode, the console stays + in cooked mode, so characters are not transmitted until carriage return + or linefeed is typed, and you can't escape back. If you want to run + Kermit directly from the File Viewer, then launch it from a shell + script that puts it in the desired kind of window, something like this + (for "Terminal"): + + Terminal -Lines 24 -Columns 80 -WinLocX 100 -WinLocY 100 $FONT $FONTSIZE \ + -SourceDotLogin -Shell /usr/local/bin/kermit & + + C-Kermit does not work correctly on a NeXT with NeXTSTEP 3.0 to which + you have established an rlogin connection, due to a bug in NeXTSTEP + 3.0, which has been reported to NeXT. + + The SET CARRIER command has no effect on the NeXT -- this is a + limitation of the NeXTSTEP serial-port device drivers. + + Hardware flow control on the NeXT is selected not by "set flow rts/cts" + in Kermit (since NeXTSTEP offers no API for this), but rather, by using + a specially-named driver for the serial device: /dev/cufa instead + /dev/cua; /dev/cufb instead of /dev/cub. This is available only on + 68040-based NeXT models (the situation for Intel NeXTSTEP + implementations is unknown). + + NeXT-built 68030 and 68040 models have different kinds of serial + interfaces; the 68030 has a Macintosh-like RS-422 interface, which + lacks RTS and CTS signals; the 68040 has an RS-423 (RS-232 compatible) + interface, which supports the commonly-used modem signals. WARNING: the + connectors look exactly the same, but the pins are used in completely + DIFFERENT ways -- different cables are required for the two kinds of + interfaces. + + IF YOU GET LOTS OF RETRANSMISSIONS during file transfer, even when + using a /dev/cuf* device and the modem is correctly configured for + RTS/CTS flow control, YOU PROBABLY HAVE THE WRONG KIND OF CABLE. + + On the NeXT, Kermit reportedly (by TimeMon) causes the kernel to use a + lot of CPU time when using a "set line" connection. That's because + there is no DMA channel for the NeXT serial port, so the port must + interrupt the kernel for each character in or out. + + One user reported trouble running C-Kermit on a NeXT from within NeXT's + Subprocess class under NeXTstep 3.0, and/or when rlogin'd from one NeXT + to another: Error opening /dev/tty:, congm: No such device or address. + Diagnosis: Bug in NeXTSTEP 3.0, cure unknown. + +3.5. C-KERMIT AND QNX + + [ [348]Top ] [ [349]Contents ] [ [350]Section Contents ] [ [351]Next ] + [ [352]Previous ] + + See also: The [353]comp.os.qnx newsgroup. + + Support for QNX 4.x was added in C-Kermit 5A(190). This is a + full-function implementation, thoroughly tested on QNX 4.21 and later, + and verified to work in both 16-bit and 32-bit versions. The 16-bit + version was dropped in C-Kermit 7.0 since it can no longer be built + successfully (after stripping most most features, I succeeded in + getting it to compile and link without complaint, but the executable + just beeps when you run it); for 16-bit QNX 4.2x, use C-Kermit 6.0 or + earlier, or else [354]G-Kermit. + + The 32-bit version (and the 16-bit version prior to C-Kermit 7.0) + supports most of C-Kermit's advanced features including TCP/IP, high + serial speeds, hardware flow-control, modem-signal awareness, curses + support, etc. + + BUG: In C-Kermit 6.0 on QNX 4.22 and earlier, the fullscreen file + transfer display worked fine the first time, but was fractured on + subsequent file transfers. Cause and cure unknown. In C-Kermit 7.0 and + QNX 4.25, this no longer occurs. It is not known if it would occur in + C-Kermit 7.0 or later on earlier QNX versions. + + Dialout devices are normally /dev/ser1, /dev/ser2, ..., and can be + opened explicitly with SET LINE. Reportedly, "/dev/ser" (no unit + number) opens the first available /dev/sern device. + + Like all other Unix C-Kermit implementations, QNX C-Kermit does not + provide any kind of terminal emulation. Terminal specific functions are + provided by your terminal, terminal window (e.g. QNX Terminal or + xterm), or emulator. + + QNX C-Kermit, as distributed, does not include support for UUCP + line-locking; the QNX makefile entries (qnx32 and qnx16) include the + -DNOUUCP switch. This is because QNX, as distributed, does not include + UUCP, and its own communications software (e.g. qterm) does not use + UUCP line locking. If you have a UUCP product installed on your QNX + system, remove the -DNOUUCP switch from the makefile entry and rebuild. + Then check to see that Kermit's UUCP lockfile conventions are the same + as those of your UUCP package; if not, read the [355]UUCP lockfile + section of the [356]Installation Instructions and make the necessary + changes to the makefile entry (e.g. add -DHDBUUCP). + + QNX does, however, allow a program to get the device open count. This + can not be a reliable form of locking unless all applications do it, so + by default, Kermit uses this information only for printing a warning + message such as: + + C-Kermit>set line /dev/ser1 + WARNING - "/dev/ser1" looks busy... + + However, if you want to use it as a lock, you can do so with: + + SET QNX-PORT-LOCK { ON, OFF } + + This is OFF by default; if you set in ON, C-Kermit will fail to open + any dialout device when its open count indicates that another process + has it open. SHOW COMM (in QNX only) displays the setting, and if you + have a port open, it also shows the open count. + + As of C-Kermit 8.0, C-Kermit's "open-count" form of line locking works + only in QNX4, not in QNX6 (this might change in a future C-Kermit + release). + +3.6. C-KERMIT AND SCO + + [ [357]Top ] [ [358]Contents ] [ [359]Section Contents ] [ [360]Next ] + [ [361]Previous ] + + SECTION CONTENTS + +3.6.1. [362]SCO XENIX +3.6.2. [363]SCO UNIX and OSR5 +3.6.3. [364]Unixware +3.6.4. [365]Open UNIX 8 + + REFERENCES + + * The comp.unix.sco.* newsgroups. + * [366]Section 3.10 below for Unixware. + * The following FAQs: + + The comp.sco.misc FAQ: + [367]http://aplawrence.com/SCOFAQ/ + + Caldera (SCO) comp.unix.sco.programmer FAQ: + [368]http://www.zenez.com/cgi-bin/scoprogfaq/faq.pl + + The UnixWare 7/OpenUNIX 8 FAQ: + [369]http://www.zenez.com/cgi-bin/scouw7faq/faq.pl + [370]http://zenez.pcunix.com/cgi-bin/scouw7faq/faq.pl + + High Speed Modems for SCO Unix: + [371]http://pcunix.com/Unixart/modems.html + + The UnixWare FAQ + [372]http://www.freebird.org/faq/ + + The UnixWare 1.x and 2.0 Programmer FAQ + [373]http://www.freebird.org/faq/developer.html + + Caldera Support Knowledge Base + [374]http://support.caldera.com/caldera + + [375]http://stage.caldera.com/ta/ + Caldera (SCO) Technical Article Search Center + + [376]http://aplawrence.com/newtosco.html + New to SCO (Tony Lawrence) + + The same comments regarding terminal emulation and key mapping apply to + SCO operating systems as to all other Unixes. C-Kermit is not a + terminal emulator, and you can't use it to map F-keys, Arrow keys, etc. + The way to do this is with xmodmap (xterm) or loadkeys (console). For a + brief explanation, see [377]Section 3.0.5. For a fuller explanation, + [378]ClICK HERE. + + Also see general comments on PC-based Unixes in [379]Section 3.0. + +3.6.1. SCO XENIX + + [ [380]Top ] [ [381]Contents ] [ [382]Section Contents ] [ [383]Next ] + + Old Xenix versions... Did you know: Xenix 3.0 is *older* than Xenix + 2.0? + + In Xenix 2.3.4 and probably other Xenix versions, momentarily dropping + DTR to hang up a modem does not work. DTR goes down but does not come + up again. Workaround: Use SET MODEM HANGUP-METHOD MODEM-COMMAND. + Anybody who would like to fix this is welcome to take a look at + tthang() in [384]ckutio.c. Also: modem signals can not be read in + Xenix, and the maximum serial speed is 38400. + + There is all sorts of confusion among SCO versions, particularly when + third- party communications boards and drivers are installed, regarding + lockfile naming conventions, as well as basic functionality. As far as + lockfiles go, all bets are off if you are using a third-party multiport + board. At least you have the source code. Hopefully you also have a C + compiler :-) + + Xenix 2.3.0 and later claim to support RTSFLOW and CTSFLOW, but this is + not modern bidirectional hardware flow control; rather it implements + the original RS-232 meanings of these signals for unidirectional + half-duplex line access: If both RTSFLOW and CTSFLOW bits are set, + Xenix asserts RTS when it wants to send data and waits for CTS + assertion before it actually starts sending data (also, reportedly, + even this is broken in Xenix 2.3.0 and 2.3.1). + +3.6.2. SCO UNIX AND OSR5 + + [ [385]Top ] [ [386]Contents ] [ [387]Section Contents ] [ [388]Next ] + [ [389]Previous ] + + SCO systems tend to use different names (i.e. drivers) for the same + device. Typically /dev/tty1a refers to a terminal device that has no + modem control; open, read, write, and close operations do not depend on + carrier. On the other hand, /dev/tty1A (same name, but with final + letter upper case), is the same device with modem control, in which + carrier is required (the SET LINE command does not complete until + carrier appears, read/write operations fail if there is no carrier, + etc). + + SCO OpenServer 5.0.5 and earlier do not support the reading of modem + signals. Thus "show comm" does not list modem signals, and C-Kermit + does not automatically pop back to its prompt when the modem hangs up + the connection (drops CD). The ioctl() call for this is simply not + implmented, at least not in the standard drivers. OSR5.0.6 attempts to + deal with modem signals but fails; however OSR5.0.6a appears to + function properly. + + Dialing is likely not to work well in SCO OpenServer 5.0.x because many + of the serial-port APIs simply do not operate when using the standard + drivers. For example, if DTR is dropped by the recommended method + (setting speed to 0 for half a seconds, then restoring the speed), DTR + and RTS go down but never come back up. When in doubt SET MODEM + HANGUP-METHOD MODEM-COMMAND or SET DIAL HANGUP OFF. + + On the other hand, certain functions that might not (do not) work right + or at all when using SCO drivers (e.g. high serial speeds, hardware + flow control, and/or reading of modem signals) might work right when + using third-party drivers. (Example: hardware flow control works, + reportedly, only on uppercase device like tty1A -- not tty1a -- and + only when CLOCAL is clear when using the SCO sio driver, but there are + no such restrictions in, e.g., [390]Digiboard drivers). + + One user reports that he can't transfer large files with C-Kermit under + SCO OSR5.0.0 and 5.0.4 -- after the first 5K, everything falls apart. + Same thing without Kermit -- e.g. with ftp over a PPP connection. + Later, he said that replacing SCO's SIO driver with FAS, an alternative + communications driver, made the problem go away: + + [391]ftp://ftp.fu-berlin.de/pub/unix/driver/fas + + With regard to bidirectional serial ports on OpenServer 5.0.4, the + following advice appeared on an SCO-related newsgroup: + + No amount of configuration information is going to help you on 5.0.4 + unless it includes the kludge for the primary problem. With almost + every modem, the 5.0.4 getty will barf messages and may or may not + connect. There are 2 solutions and only one works on 5.0.4. Get the + atdialer binary from a 5.0.0 system and substitute it for the native + 5.0.4 atdialer. The other solution is to upgrade to 5.0.5. And, most + of all, on any OpenServer products, do NOT run the badly broken + Modem Manager. Configure the modems in the time honored way that + dates back to Xenix. + + Use SCO-provided utilities for switching the directionality of a modem + line, such as "enable" and "disable" commands. For example, to dial out + on tty1a, which is normally set up for logins: + + disable tty1a + kermit -l /dev/tty1a + enable tty1a + + If a tty device is listed as an ACU in /usr/lib/uucp/Devices and is + enabled, getty resets the ownership and permissions to uucp.uucp and + 640 every time the device is released. If you want to use the device + only for dialout, and you want to specify other owners or permissions, + you should disable it in /usr/lib/uucp/Devices; this will prevent getty + from doing things to it. You should also changes the device's file + modes in /etc/conf/node.d/sio by changing fields 5-7 for the desired + device(s); this determines how the devices are set if you relink the + kernel. + + One SCO user of C-Kermit 5A(190) reported that only one copy of Kermit + can run at a time when a Stallion Technologies multiport boards are + installed. Cause, cure, and present status unknown (see [392]Section 14 + for more info regarding Stallion). + + Prior to SCO OpenServer 5.0.4, the highest serial port speed supported + by SCO was 38400. However, in some SCO versions (e.g. OSR5) it is + possible to map rarely-used lower speeds (like 600 and 1800) to higher + ones like 57600 and 115200. To find out how, go to + [393]http://www.sco.com/ and search for "115200". In OSR5.0.4, serial + speeds up to 921600 are supported through the POSIX interface; C-Kermit + 6.1.193 or later, when built for OSR5.0.4 using /bin/cc (NOT the UDK, + which hides the high-speed definitions from CPP), supports these + speeds, but you might be able to run this binary on earlier releases to + get the high serial speeds, depending on various factors, described by + Bela Lubkin of SCO: + + Serial speeds under SCO Unix / Open Desktop / OpenServer + ======================================================== + Third party drivers (intelligent serial boards) may provide any speeds + they desire; most support up to 115.2Kbps. + + SCO's "sio" driver, which is used to drive standard serial ports with + 8250/16450/16550 and similar UARTs, was limited to 38400bps in older + releases. Support for rates through 115.2Kbps was added in the + following releases: + + SCO OpenServer Release 5.0.0 (requires supplement "rs40b") + SCO OpenServer Release 5.0.2 (requires supplement "rs40a" or "rs40b") + SCO OpenServer Release 5.0.4 or later + SCO Internet FastStart Release 1.0.0 or later + + SCO supplements are at [394]ftp://ftp.sco.com/; the "rs40" series are + under directory /Supplements/internet + + Kermit includes the high serial speeds in all OSR5 builds, but that + does not necessarily mean they work. For example, on our in-house 5.0.5 + system, SET SPEED 57600 or higher seems to succeed (no error occurs) + but when we read the speed back the driver says it is 50. Similarly, + 76800 becomes 75, and 115200 becomes 110. Testing shows the resulting + speed is indeed the low one we read back, not the high one we asked + for. Moral: Use speeds higher than 38400 with caution on SCO OSR5. + + Reportedly, if you have a script that makes a TCP/IP SET HOST (e.g. + Telnet) connection to SCO 3.2v4.2 with TCP/IP 1.2.1, and then does the + following: + + script $ exit + hangup + + this causes a pseudoterminal (pty) to be consumed on the SCO system; if + you do it enough times, it will run out of ptys. An "exit" command is + being sent to the SCO shell, and a HANGUP command is executed locally, + so the chances are good that both sides are trying to close the + connection at once, perhaps inducing a race condition in which the + remote pty is not released. It was speculated that this would be fixed + by applying SLS net382e, but it did not. Meanwhile, the workaround is + to insert a "pause" between the SCRIPT and HANGUP commands. (The + situation with later SCO releases is not known.) + + SCO UNIX and OpenServer allow their console and/or terminal drivers to + be configured to translate character sets for you. DON'T DO THIS WHEN + USING KERMIT! First of all, you don't need it -- Kermit itself already + does this for you. And second, it will (a) probably ruin the formatting + of your screens (depending on which emulation you are using); and (b) + interfere with all sorts of other things -- legibility of non-ASCII + text on the terminal screen, file transfer, etc. Use: + + mapchan -n + + to turn off this feature. + + Note that there is a multitude of SCO entries in the makefile, many of + them exhibiting an unusually large number of compiler options. Some + people actually understand all of this. Reportedly, things are settling + down with SCO OpenServer 5.x and Unixware 7 (and Open UNIX 8 and who + knows what the next one will be -- Linux probably) -- the SCO UDK + compiler is said to generate binaries that will run on either platform, + by default, automatically. When using gcc or egcs, on the other hand, + differences persist, plus issues regarding the type of binary that is + generated (COFF, ELF, etc), and where and how it can run. All of this + could stand further clarification by SCO experts. + +3.6.3. Unixware + + [ [395]Top ] [ [396]Contents ] [ [397]Section Contents ] [ [398]Next ] + [ [399]Previous ] + + Unixware changed hands several times before landing at SCO, and so has + its [400]own section in this document. (Briefly: AT&T UNIX Systems + Laboratories sold the rights to the UNIX name and to System V R4 (or + R5?) to Novell; later Novell spun its UNIX division off into a new + company called Univel, which eventually was bought by SCO, which later + was bought by Caldera, which later sort of semi-spun-off SCO...) + +3.6.4. Open UNIX 8 + + [ [401]Top ] [ [402]Contents ] [ [403]Section Contents ] [ + [404]Previous ] + + SCO was bought by Caldera in 2000 or 2001 and evolved Unixware 7.1 into + Caldera Open UNIX 8.00. It's just like Unixware 7.1 as far as Kermit is + concerned (the Unixware 7.1 makefile target works for Open UNIX 8.00, + and in fact a Unixware 7.1 Kermit binary built on Unixware 7.1 runs + under OU8; a separate OU8 makefile target exists simply to generate an + appropriate program startup herald). Open Unix is now defunct; + subsequent releases are called UnixWare again (e.g. UnixWare 7.1.3). + +3.7. C-KERMIT AND SOLARIS + + [ [405]Top ] [ [406]Contents ] [ [407]Section Contents ] [ [408]Next ] + [ [409]Previous ] + + SECTION CONTENTS + +3.7.1. [410]Serial Port Configuration +3.7.2. [411]Serial Port Problems +3.7.3. [412]SunLink X.25 +3.7.4. [413]Sun Workstation Keyboard Mapping +3.7.5. [414]Solaris 2.4 and Earlier + + REFERENCES + + * The [415]comp.unix.solaris newsgroup + * [416]http://access1.sun.com/ + * [417]http://docs.sun.com/ + * [418]http://www.sunhelp.com/ + * [419]http://www.wins.uva.nl/pub/solaris/solaris2/ + * [420]http://www.wins.uva.nl/cgi-bin/sfaq.cgi + * [421]ftp://ftp.wins.uva.nl/pub/solaris + * [422]http://www.science.uva.nl/pub/solaris/solaris2.html + + And about serial communications in particular, see "Celeste's Tutorial + on Solaris 2.x Modems and Terminals": + + [423]http://www.stokely.com/ + + In particular: + + [424]http://www.stokely.com/unix.sysadm.resources/faqs.sun.html + + For PC-based Solaris, also see general comments on PC-based Unixes in + [425]Section 3.0. Don't expect Solaris or any other kind of Unix to + work right on a PC until you resolve all interrupt conflicts. Don't + expect to be able to use COM3 or COM4 (or even COM2) until you have + configured their addresses and interrupts. + +3.7.1. Serial Port Configuration + + [ [426]Top ] [ [427]Contents ] [ [428]Section Contents ] [ [429]Section + Contents ] [ [430]Next ] + + Your serial port can't be used -- or at least won't work right -- until + it is enabled in Solaris. For example, you get a message like "SERIAL: + Operation would block" when attempting to dial. This probably indicates + that the serial port has not been enabled for use with modems. You'll + need to follow the instructions in your system setup or management + manual, such as (e.g.) the Desktop SPARC Sun System & Network Manager's + Guide, which should contain a section "Setting up Modem Software"; read + it and follow the instructions. These might (or might not) include + running a program called "eeprom", editing some system configuration + file (such as, for example: + + /platform/i86pc/kernel/drv/asy.conf + + and then doing a configuration reboot, or running some other programs + like drvconfig and devlinks. "man eeprom" for details. + + Also, on certain Sun models like IPC, the serial port hardware might + need to have a jumper changed to make it an RS-232 port rather than + RS-423. + + eeprom applies only to real serial ports, not to "Spiff" devices + (serial port expander), in which case setup with Solaris' admintool is + required. + + Another command you might need to use is pmadm, e.g.: + + pmadm -d -p zsmon -s tty3 + pmadm -e -p zsmon -s tty3 + + You can use the following command to check if a process has the device + open: + + fuser -f /dev/term/3 + + In some cases, however (according to Sun support, May 2001) "It is + still possible that a zombie process has hold of the port EVEN IF there + is no lock file and the fuser command comes up empty. In that case, the + only way to resolve the problem is by rebooting." + + If you can't establish communication through a serial port to a device + that is not asserting CD (Carrier Detect), try setting the environment + variable "ttya-ignore-cd" to "true" (replace "ttya" with the port + name). + +3.7.2. Serial Port Problems + + [ [431]Top ] [ [432]Contents ] [ [433]Section Contents ] [ [434]Next ] + [ [435]Previous ] + + Current advice from Sun is to always the /dev/cua/x devices for dialing + out, rather than the /dev/term/x. Nevertheless, if you have trouble + dialing out with one, try the other. + + Reportedly, if you start C-Kermit and "set line" to a port that has a + modem connected to it that is not turned on, and then "set flow + rts/cts", there might be some (unspecified) difficulties closing the + device because the CTS signal is not coming in from the modem. + +3.7.3. SunLink X.25 + + [ [436]Top ] [ [437]Contents ] [ [438]Section Contents ] [ [439]Next ] + [ [440]Previous ] + + The built-in SunLink X.25 support for Solaris 2.3/2.4./25 and SunLink + 8.01 or 9.00 works OK provided the X.25 system has been installed and + initialized properly. Packet sizes might need to be reduced to 256, + maybe even less, depending on the configuration of the X.25 + installation. On one connection where C-Kermit 6.0 was tested, very + large packets and window sizes could be used in one direction, but only + very small ones would work in the other. + + In any case, according to Sun, C-Kermit's X.25 support is superfluous + with SunLink 8.x / Solaris 2.3. Quoting an anonymous Sun engineer: + + ... there is now no need to include any X.25 code within kermit. As + of X.25 8.0.1 we support the use of kermit, uucp and similar + protocols over devices of type /dev/xty. This facility was there in + 8.0, and should also work on the 8.0 release if patch 101524 is + applied, but I'm not 100% sure it will work in all cases, which is + why we only claim support from 8.0.1 onwards. + + When configuring X.25, on the "Advanced Configuration->Parameters" + screen of the x25tool you can select a number of XTY devices. If you + set this to be > 1, press Apply, and reboot, you will get a number + of /dev/xty entries created. + + Ignore /dev/xty0, it is a special case. All the others can be used + exactly as if they were a serial line (e.g. /dev/tty) connected to a + modem, except that instead of using Hayes-style commands, you use + PAD commands. + + From kermit you can do a 'set line' command to, say, /dev/xty1, then + set your dialing command to be "CALL 12345678", etc. All the usual + PAD commands will work (SET, PAR, etc). + + I know of one customer in Australia who is successfully using this, + with kermit scripts, to manage some X.25-connected switches. He used + standard kermit, compiled for Solaris 2, with X.25 8.0 xty devices. + +3.7.4. Sun Workstation Keyboard Mapping + + [ [441]Top ] [ [442]Contents ] [ [443]Section Contents ] [ [444]Next ] + [ [445]Previous ] + + Hints for using a Sun workstation keyboard for VT emulation when + accessing VMS, from the [446]comp.os.vms newsgroup: + + From: Jerry Leichter + Newsgroups: comp.os.vms + Subject: Re: VT100 keyboard mapping to Sun X server + Date: Mon, 19 Aug 1996 12:44:21 -0400 + + > I am stuck right now using a Sun keyboard (type 5) on systems + running SunOS + > and Solaris. I would like to use EVE on an OpenVMS box with + display back to + > the Sun. Does anyone know of a keyboard mapping (or some other + procedure) + > which will allow the Sun keyboard to approximate a VT100/VT220? + + You can't get it exactly - because the keypad has one fewer key - + but you can come pretty close. Here's a set of keydefs I use: + + keycode 101=KP_0 + keycode 119=KP_1 + keycode 120=KP_2 + keycode 121=KP_3 + keycode 98=KP_4 + keycode 99=KP_5 + keycode 100=KP_6 + keycode 75=KP_7 + keycode 76=KP_8 + keycode 77=KP_9 + keycode 52=KP_F1 + keycode 53=KP_F2 + keycode 54=KP_F3 + keycode 57=KP_Decimal + keycode 28=Left + keycode 29=Right + keycode 30=KP_Separator + keycode 105=KP_F4 + keycode 78=KP_Subtract + keycode 8=Left + keycode 10=Right + keycode 32=Up + keycode 33=Down + keycode 97=KP_Enter + + Put this in a file - I use "keydefs" in my home directory and feed + it into xmodmap: + + xmodmap - <$HOME/keydefs + + This takes care of the arrow keys and the "calculator" key cluster. + The "+" key will play the role of the DEC "," key. The Sun "-" key + will be like the DEC "-" key, though it's in a physically different + position - where the DEC PF4 key is. The PF4 key is ... damn, I'm + not sure where "key 105" is. I *think* it may be on the leftmost key + of the group of four just above the "calculator" key cluster. + + I also execute the following (this is all in my xinitrc file): + + xmodmap -e 'keysym KP_Decimal = KP_Decimal' + xmodmap -e 'keysym BackSpace = Delete BackSpace' \ + -e 'keysym Delete = BackSpace Delete' + xmodmap -e 'keysym KP_Decimal = Delete Delete KP_Decimal' + xmodmap -e 'add mod1 = Meta_R' + xmodmap -e 'add mod1 = Meta_L' + + Beware of one thing about xmodmap: Keymap changes are applied to the + *whole workstation*, not just to individual windows. There is, in + fact, no way I know of to apply them to individual windows. These + definitions *may* confuse some Unix programs (and/or some Unix + users). + + If you're using Motif, you may also need to apply bindings at the + Motif level. If just using xmodmap doesn't work, I can try and dig + that stuff up for you. + +3.7.5. Solaris PPP Connections + + [ [447]Top ] [ [448]Contents ] [ [449]Section Contents ] [ [450]Next ] + [ [451]Previous ] + + The following is a report from a user of C-Kermit 8.0 on Solaris 8 and + 9, who had complained that while Kermit file transfers worked perfectly + on direct (non-PPP) dialout connections, they failed miserably on PPP + connections. We suggested that the PPP dialer probably was not setting + the port and/or modem up in the same way that Kermit did: + + I want to get back on this and tell you what the resolution was. You + pointed me in the direction of flow control, which turned out to be + the key. + + Some discussion on the comp.unix.solaris newsgroup led to some + comments from Greg Andrews about the need to use the uucp driver to + talk to the modem (/dev/cua/a). I had to remind Greg that no matter + what the manpages for the zs and se drivers say, the ppp that Sun + released with Solaris 8 7/01, and has in Solaris 9, is a setuid root + program, and simply trying to make a pppd call from user space + specifying /dev/cua/a would fail because of permissions. Greg + finally put the question to the ppp people, who came back with + information that is not laid out anywhere in the docs available for + Solaris users. Namely, put /dev/cua/a in one of the priviledged + options files in the /etc/ppp directory. That, plus resetting the + OBP ttya-ignore-cd flag (this is Sun hardware) to false, seems to + have solved the problems. + + While I note that I had installed Kermit suid to uucp to use + /dev/cua/a on this particular box, it seems to run fine through + /dev/term/a. Not so with pppd. + + With this change in place, I seem to be able to upload and download + through telnet run on Kermit with the maximum length packets. I note + that the window allocation display does show STREAMING, using + telnet. Running ssh on Kermit, I see the standard 1 of 30 windows + display, and note that there appears to be a buffer length limit + between 1000 and 2000 bytes. Run with 1000, and it's tick-tock, + solid as a rock. With 2000 I see timeout errors and RTS/CTS action + on the modem. + + Kermit's packet-length and other controls let you make adjustments like + this to get around whatever obstacles might be thrown up -- in this + case (running Kermit over ssh), the underling Solaris PTY driver. + +3.7.6. Solaris 2.4 and Earlier + + [ [452]Top ] [ [453]Contents ] [ [454]Section Contents ] [ + [455]Previous ] + + C-Kermit can't be compiled successfully under Solaris 2.3 using + SUNWspro cc 2.0.1 unless at least some of the following patches are + applied to cc (it is not known which one(s), if any, fix the problem): + + * 100935-01 SparcCompiler C 2.0.1: bad code generated when addresses + of two double arguments are involved + * 100961-05 SPARCcompilers C 2.0.1: conditional expression with + function returning structure gives wrong value + * 100974-01 SparcWorks 2.0.1: dbx jumbo patch + * 101424-01 SPARCworks 2.0.1 maketool SEGV's instantly on Solaris 2.3 + + With unpatched cc 2.0.1, the symptom is that certain modules generate + truncated object files, resulting in many unresolved references at link + time. + + The rest of the problems in this section have to do with + bidirectional terminal ports and the Solaris Port Monitor. A bug in + C-Kermit 5A ticked a bug in Solaris. The C-Kermit bug was fixed in + version 6.0, and the Solaris bug was fixed in 2.4 (I think, or maybe + 2.5). + + Reportedly, "C-Kermit ... causes a SPARCstation running Solaris 2.3 to + panic after the modem connects. I have tried compiling C-Kermit with + Sun's unbundled C compiler, with GCC Versions 2.4.5 and 2.5.3, with + make targets 'sunos51', 'sunos51tcp', 'sunos51gcc', and even 'sys5r4', + and each time it compiles and starts up cleanly, but without fail, as + soon as I dial the number and get a 'CONNECT' message from the modem, I + get: + + BAD TRAP + kermit: Data fault + kernel read fault at addr=0x45c, pme=0x0 + Sync Error Reg 80 + ... + panic: Data Fault. + ... + Rebooting... + + The same modem works fine for UUCP/tip calling." Also (reportedly), + this only happens if the dialout port is configured as in/out via + admintool. If it is configured as out-only, no problem. This is the + same dialing code that works on hundreds of other System-V based Unix + OS's. Since it should be impossible for a user program to crash the + operating system, this problem must be chalked up to a Solaris bug. + Even if you SET CARRIER OFF, CONNECT, and dial manually by typing + ATDTnnnnnnn, the system panics as soon as the modem issues its CONNECT + message. (Clearly, when you are dialing manually, C-Kermit does not + know a thing about the CONNECT message, and so the panic is almost + certainly caused by the transition of the Carrier Detect (CD) line from + off to on.) This problem was reported by many users, all of whom say + that C-Kermit worked fine on Solaris 2.1 and 2.2. If the speculation + about CD is true, then a possible workaround might be to configure the + modem to leave CD on (or off) all the time. Perhaps by the time you + read this, a patch will have been issued for Solaris 2.3. + + The following is from Karl S. Marsh, Systems & Networks Administrator, + AMBIX Systems Corp, Rochester, NY: + + Environment: Solaris 2.3 Patch 101318-45 C-Kermit 5A(189) (and + presumably this applies to 188 and 190 also). eeprom setting: + + ttya-rts-dtr-off=false + ttya-ignore-cd=false + ttya-mode=19200,8,n,8,- + + To use C-Kermit on a bidirectional port in this environment, do not + use admintool to configure the port. Use admintool to delete any + services running on the port and then quit admintool and issue the + following command: + + pmadm -a -p zsmon -s ttyb -i root -fu -v 1 -m "`ttyadm -b -d /dev/term/b \ + -l conttyH -m ldterm,ttcompat -s /usr/bin/login -S n`" + + [NOTE: This was copied from a blurry fax, so please check it + carefully] where: + + -a = Add service + -p = pmtag (zsmon) + -s = service tag (ttyb) + -i = id to be associated with service tag (root) + -fu = create utmp entry + -v = version of ttyadm + -m = port monitor-specific portion of the port monitor administrative file + entry for the service + -b = set up port for bidirectional use + -d = full path name of device + -l = which ttylabel in the /etc/ttydefs file to use + -m = a list of pushable STREAMS modules + -s = pathname of service to be invoked when connection request received + -S = software carrier detect on or off (n = off) + + "This is exactly how I was able to get Kermit to work on a + bi-directional port without crashing the system." + + On the Solaris problem, also see SunSolve Bug ID 1150457 ("Using + C-Kermit, get Bad Trap on receiving prompt from remote system"). + Another user reported "So, I have communicated with the Sun tech + support person that submitted this bug report [1150457]. Apparently, + this bug was fixed under one of the jumbo kernel patches. It would seem + that the fix did not live on into 101318-45, as this is EXACTLY the + error that I see when I attempt to use kermit on my system." + + Later (Aug 94)... C-Kermit dialout successfully tested on a Sun4m with + a heavily patched Solaris 2.3. The patches most likely to have been + relevant: + + * 101318-50: SunOS 5.3: Jumbo patch for kernel (includes libc, lockd) + * 101720-01: SunOS 5.3: ttymon - prompt not always visible on a modem + connection + * 101815-01: SunOS 5.3: Data fault in put() NULL queue passed from + ttycommon_qfull() + * 101328-01: SunOS 5.3: Automation script to properly setup tty ports + prior to PCTS execution + + Still later (Nov 94): another user (Bo Kullmar in Sweden) reports that + after using C-Kermit to dial out on a bidirectional port, the port + might not answer subsequent incoming calls, and says "the problem is + easy enough to fix with the Serial Port Manager; I just delete the + service and install it again using the graphical interface, which + underneath uses commands like sacadm and pmadm." Later Bo reports, "I + have found that if I run Kermit with the following script then it + works. This script is for /dev/cua/a, "-s a" is the last a in + /dev/cua/a: + + #! /bin/sh + kermit + sleep 2 + surun pmadm -e -p zsmon -s a + +3.8. C-KERMIT AND SUNOS + + [ [456]Top ] [ [457]Contents ] [ [458]Section Contents ] [ [459]Next ] + [ [460]Previous ] + + For additional information, see "Celeste's Tutorial on SunOS 4.1.3+ + Modems and Terminals": + + [461]http://www.stokely.com/ + + For FAQs, etc, from Sun, see: + * [462]http://access1.sun.com/ + + For history of Sun models and SunOS versions, see (should be all the + same): + * [463]http://www.ludd.luth.se/~bear/project/sun/sun.hardware.txt + * [464]ftp://ftp.netcom.com/pub/ru/rubicon/sun.hdwr.ref + * [465]ftp://ftp.intnet.net/pub/SUN/Sun-Hardware-Ref + + Sun SPARCstation users should read the section "Setting up Modem + Software" in the Desktop SPARC Sun System & Network Manager's Guide. If + you don't set up your serial ports correctly, Kermit (and other + communications software) won't work right. + + Also, on certain Sun models like IPC, the serial port hardware might + need to have a jumper changed to make it an RS-232 port rather than + RS-423. + + Reportedly, C-Kermit does not work correctly on a Sun SPARCstation in + an Open Windows window with scrolling enabled. Disable scrolling, or + else invoke Kermit in a terminal emulation window (xterm, crttool, + vttool) under SunView (this might be fixed in later SunOS releases). + + On the Sun with Open Windows, an additional symptom has been reported: + outbound SunLink X.25 connections "magically" translate CR typed at the + keyboard into LF before transmission to the remote host. This doesn't + happen under SunView. + + SET CARRIER ON, when used on the SunOS 4.1 version of C-Kermit + (compiled in the BSD universe), causes the program to hang + uninterruptibly when SET LINE is issued for a device that is not + asserting carrier. When Kermit is built in the Sys V universe on the + same computer, there is no problem (it can be interrupted with Ctrl-C). + This is apparently a limitation of the BSD-style tty driver. + + SunOS 4.1 C-Kermit has been observed to dump core when running a + complicated script program under cron. The dump invariably occurs in + ttoc(), while trying to output a character to a TCP/IP TELNET + connection. ttoc() contains a write() call, and when the system or the + network is very busy, the write() call can get stuck for long periods + of time. To break out of deadlocks caused by stuck write() calls, there + is an alarm around the write(). It is possible that the core dump + occurs when this alarm signal is caught. (This one has not been + observed recently -- possibly fixed in edit 190.) + + On Sun computers with SunOS 4.0 or 4.1, SET FLOW RTS/CTS works only if + the carrier signal is present from the communication device at the time + when C-Kermit enters packet mode or CONNECT mode. If carrier is not + sensed (e.g. when dialing), C-Kermit does not attempt to turn on + RTS/CTS flow control. This is because the SunOS serial device driver + does not allow characters to be output if RTS/CTS is set (CRTSCTS) but + carrier (and DSR) are not present. Workaround (maybe): SET CARRIER OFF + before giving the SET LINE command, establish the connection, then SET + FLOW RTS/CTS + + It has also been reported that RTS/CTS flow control under SunOS 4.1 + through 4.1.3 works only on INPUT, not on output, and that there is a + patch from Sun to correct this problem: Patch-ID# T100513-04, 20 July + 1993 (this patch might apply only to SunOS 4.1.3). It might also be + necessary to configure the eeprom parameters of the serial port; e.g. + do the following as root at the shell prompt: + + eeprom ttya-ignore-cd=false + eeprom ttya-rts-dtr-off=true + + There have been reports of file transfer failures on Sun-3 systems when + using long packets and/or large window sizes. One user says that when + this happens, the console issues many copies of this message: + + chaos vmunix: zs1: ring buffer overflow + + This means that SunOS is not scheduling Kermit frequently enough to + service interrupts from the zs serial device (Zilog 8350 SCC serial + communication port) before its input silo overflows. Workaround: use + smaller packets and/or a smaller window size, or use "nice" to increase + Kermit's priority. Use hardware flow control if available, or remove + other active processes before running Kermit. + + SunLink X.25 support in C-Kermit 5A(190) was built and tested + successfully under SunOS 4.1.3b and SunLink X.25 7.00. + +3.9. C-KERMIT AND ULTRIX + + [ [466]Top ] [ [467]Contents ] [ [468]Section Contents ] [ [469]Next ] + [ [470]Previous ] + + See also: The [471]comp.unix.ultrix and [472]comp.sys.dec newsgroups. + + There is no hardware flow control in Ultrix. That's not a Kermit + deficiency, but an Ultrix one. + + When sending files to C-Kermit on a Telnet connection to a remote + Ultrix system, you must SET PREFIXING ALL (or at least prefix more + control characters than are selected by SET PREFIXING CAUTIOUS). + + Reportedly, DEC ULTRIX 4.3 is immune to C-Kermit's disabling of + SIGQUIT, which is the signal that is generated when the user types + Ctrl-\, which kills the current process (i.e. C-Kermit) and dumps core. + Diagnosis and cure unknown. Workaround: before starting C-Kermit -- or + for that matter, when you first log in because this applies to all + processes, not just Kermit -- give the following Unix command: + + stty quit undef + + Certain operations driven by RS-232 modem signal do not work on + DECstations or other DEC platforms whose serial interfaces use MMP + connectors (DEC version of RJ45 telephone jack with offset tab). These + connectors convey only the DSR and DTR modem signals, but not carrier + (CD), RTS, CTS, or RI. Use SET CARRIER OFF to enable communication, or + "hotwire" DSR to CD. + + The maximum serial speed on the DECstation 5000 is normally 19200, but + various tricks are available (outside Kermit) to enable higher rates. + For example, on the 5000/200, 19200 can be remapped (somehow, something + to do with "a bit in the SIR", whatever that is) to 38400, but in + software you must still refer to this speed as 19200; you can't have + 19200 and 38400 available at the same time. + + 19200, reportedly, is also the highest speed supported by Ultrix, but + NetBSD reportedly supports speeds up to 57600 on the DECstation, + although whether and how well this works is another question. + + In any case, given the lack of hardware flow control in Ultrix, high + serial speeds are problematic at best. + +3.10. C-KERMIT AND UNIXWARE + + [ [473]Top ] [ [474]Contents ] [ [475]Section Contents ] [ [476]Next ] + [ [477]Previous ] + + See also: + * The Freebird Project (Unixware software repository) + [478]http://www.freebird.org/ + * The UnixWare FAQ: [479]http://www.freebird.org/faq/ + * The following newsgroups: + + [480]comp.unix.unixware.misc + + [481]comp.unix.sco.misc. + + Also see general comments on PC-based Unixes in [482]Section 3.0. By + the way, this section is separate from the SCO (Caldera) section + because at the time this section was started, Unixware was owned by a + company called Univel. Later it was sold to Novell, and then to SCO. + Still later, SCO was sold to Caldera. + + In Unixware 2.0 and later, the preferred serial device names (drivers) + are /dev/term/00 (etc), rather than /dev/tty00 (etc). Note the + following correspondence of device names and driver characteristics: + + New name Old name Description + /dev/term/00 /dev/tty00 ??? + /dev/term/00h /dev/tty00h Modem signals and hardware flow control + /dev/term/00m /dev/tty00m Modem signals(?) + /dev/term/00s /dev/tty00s Modem signals and software flow control + /dev/term/00t /dev/tty00t ??? + + Lockfile names use device.major.minor numbers, e.g.: + + /var/spool/locks/LK.7679.003.005 + + The minor number varies according to the device name suffix (none, h, + m, s, or t). Only the device and major number are compared, and thus + all of the different names for the same physical device (e.g. all of + those shown in the table above) interlock effectively. + + Prior to UnixWare 7, serial speeds higher than 38400 are not supported. + In UnixWare 7, we also support 57600 and 115200, plus some unexpected + ones like 14400, 28800, and 76800, by virtue of a strange new + interface, evidently peculiar to UnixWare 7, discovered while digging + through the header files: tcsetspeed(). Access to this interface is + allowed only in POSIX builds, and thus the UnixWare 7 version of + C-Kermit is POSIX-based, unlike C-Kermit for Unixware 1.x and 2.x + (since the earlier UnixWare versions did not support high serial + speeds, period). + + HOWEVER, turning on POSIX features engages all of the "#if + (!_POSIX_SOURCE)" clauses in the UnixWare header files, which in turn + prevent us from having modem signals, access to the hardware flow + control APIs, select(), etc -- in short, all the other things we need + in communications software, especially when high speeds are used. Oh + the irony. And so C-Kermit must be shamelessly butchered -- as it has + been so many times before -- to allow us to have the needed features + from the POSIX and non-POSIX worlds. See the UNIXWAREPOSIX sections of + [483]ckutio.c. + + After the butchery, we wind up with Unixware 2.x having full + modem-signal capability, but politically-correct Unixware 7.x lacking + the ability to automatically detect a broken connection when carrier + drops. + + Meanwhile the Unixware tcsetspeed() function allows any number at all + (any long, 0 or positive) as an argument and succeeds if the number is + a legal bit rate for the serial device, and fails otherwise. There is + no list anywhere of legal speeds. Thus the SET SPEED keyword table + ("set speed ?" to see it) is hardwired based on trial and error with + all known serial speeds, the maximum being 115200. However, to allow + for the possibility that other speeds might be allowed in the future + (or with different port drivers), the SET SPEED command for UnixWare 7 + only allows you to specify any number at all; a warning is printed if + the number is not in the list, but the number is accepted anyway; the + command succeeds if tcsetspeed() accepts the number, and fails + otherwise. + + In C-Kermit 8.0 testing, it was noticed that the POSIX method for + hanging up the phone by dropping DTR (set speed 0, pause, restore + speed) did not actually drop DTR. The APIs do not return any error + indication, but nothing happens. I changed tthang() to skip the special + case I had made for Unixware and instead follow the normal path: if + TIOCSDTR is defined use that, otherwise blah blah... It turns out + TIOCSDTR *is* defined, and it works. + + So in Unixware (at least in 2.1.3) we can read modem signals, hangup by + toggling DTR, and so on, BUT... But once the remote hangs up and + Carrier drops, the API for reading modem signals ceases to function; + although the device is still open, the TIOCMGET ioctl always raises + errno 6 = ENXIO, "No such device or address". + + Old business: + + Using C-Kermit 6.0 on the UnixWare 1.1 Application Server, one user + reported a system panic when the following script program is executed: + + set line /dev/tty4 + set speed 9600 + output \13 + connect + + The panic does not happen if a PAUSE is inserted: + + set line /dev/tty4 + set speed 9600 + pause 1 + output \13 + connect + + This is using a Stallion EasyIO card installed as board 0 on IRQ 12 on + a Gateway 386 with the Stallion-supplied driver. The problem was + reported to Novell and Stallion and (reportedly) is now fixed. + +3.11. C-KERMIT AND APOLLO SR10 + + [ [484]Top ] [ [485]Contents ] [ [486]Section Contents ] [ [487]Next ] + [ [488]Previous ] + + Reportedly, version 5A(190), when built under Apollo SR10 using "make + sr10-bsd", compiles, links, and executes OK, but leaves the terminal + unusable after it exits -- the "cs7" or "cs8" (character size) + parameter has become cs5. The terminal must be reset from another + terminal. Cause and cure unknown. Suggested workaround: Wrap Kermit in + a shell script something like: + + kermit @* + stty sane + +3.12. C-KERMIT AND TANDY XENIX 3.0 + + [ [489]Top ] [ [490]Contents ] [ [491]Section Contents ] [ [492]Next ] + [ [493]Previous ] + + C-Kermit 7.0 was too big to be built on Tandy Xenix, even in a minimum + configuration; version 6.0 is the last one that fits. + + Reportedly, in C-Kermit 6.0, if you type lots of Ctrl-C's during + execution of the initialization file, ghost Kermit processes will be + created, and will compete for the keyboard. They can only be removed + via "kill -9" from another terminal, or by rebooting. Diagnosis -- + something strange happening with the SIGINT handler while the process + is reading the directory (it seems to occur during the SET PROMPT + [\v(dir)] ... sequence). Cure: unknown. Workaround: don't interrupt + C-Kermit while it is executing its init file on the Tandy 16/6000. + +3.13. C-KERMIT AND OSF/1 (DIGITAL UNIX) (TRU64 UNIX) + + [ [494]Top ] [ [495]Contents ] [ [496]Section Contents ] [ [497]Next ] + [ [498]Previous ] + + While putting together and testing C-Kermit 8.0, it was discovered that + binaries built for one version of Tru64 Unix (e.g. 4.0G) might exhibit + very strange behavior if run on a different version of Tru64 Unix (e.g. + 5.1A). The typical symptom was that a section of the initialization + file would be skipped, notably locating the dialing and/or network + directory as well as finding and executing the customization file, + ~/.mykermrc. This problem also is reported to occur on Tru64 Unix 5.0 + (Rev 732) even when running a C-Kermit binary that was built there. + However, the Tru64 5.1A binary works correctly on 5.0. Go figure. + + When making Telnet connections to a Digital Unix or Tru64 system, and + your Telnet client forwards your user name, the Telnet server evidently + stuffs the username into login's standard input, and you see: + + login: ivan + Password: + + This is clearly going to play havoc with scripts that look for + "login:". Workaround (when Kermit is your Telnet client): SET LOGIN + USER to nothing, to prevent Kermit from sending your user ID. + + Before you can use a serial port on a new Digital Unix system, you must + run uucpsetup to enable or configure the port. Evidently the /dev/tty00 + and 01 devices that appear in the configuration are not usable; + uucpsetup turns them into /dev/ttyd00 and 01, which are. Note that + uucpsetup and other uucp-family programs are quite primitive -- they + only know about speeds up to 9600 bps and their selection of modems + dates from the early 1980s. None of this affects Kermit, though -- with + C-Kermit, you can use speeds up to 115200 bps (at least in DU4.0 and + later) and modern modems with hardware flow control and all the rest. + + Reportedly, if a modem is set for &S0 (assert DSR at all times), the + system resets or drops DTR every 30 seconds; reportedly DEC says to set + &S1. + + Digital Unix 3.2 evidently wants to believe your terminal is one line + longer than you say it is, e.g. when a "more" or "man" command is + given. This is has nothing to do with C-Kermit, but tends to annoy + those who use Kermit or other terminal emulators to access Digital Unix + systems. Workaround: tell Unix to "stty rows 23" (or whatever). + + Reportedly, there is some bizarre behavior when trying to use a version + of C-Kermit built on one Digital Unix 4.0 system on another one, + possibly due to differing OS or library revision levels; for example, + the inability to connect to certain TCP/IP hosts. Solution: rebuild + C-Kermit from source code on the system where you will be using it. + + Digital Unix tgetstr() causes a segmentation fault. C-Kermit 7.0 added + #ifdefs to avoid calling this routine in Digital Unix. As a result, the + SCREEN commands always send ANSI escape sequences -- even though curses + knows your actual terminal type. + + Reportedy the Tru64 Unix 4.0E 1091 Telnet server does not tolerate + streaming transfers into itself, at least not when the sending Kermit + is on the same local network. Solution: tell one Kermit or the other + (or both) to "set streaming off". This might or might be the case with + earlier and/or later Tru64, Digital Unix, and OSF/1 releases. + +3.14. C-KERMIT AND SGI IRIX + + [ [499]Top ] [ [500]Contents ] [ [501]Section Contents ] [ [502]Next ] + [ [503]Previous ] + + See also: + * The [504]comp.sys.sgi.misc and [505]comp.sys.sgi.admin newsgroups. + [506]The SGI website + * The SGI FAQ: + + [507]http://www-viz.tamu.edu/~sgi-faq/ + + [508]ftp://viz.tamu.edu/pub/sgi/faq/ + + About IRIX version numbers: "uname -a" tells the "two-digit" version + number, such as "5.3" or "6.5". The three-digit form can be seen with + "uname -R". (this information is unavailable at the simple API level). + Supposedly all three-digit versions within the same two-digit version + (e.g. 6.5.2, 6.5.3) are binary compatible; i.e. a binary built on any + one of them should run on all others. The "m" suffix denotes just + patches; the "f" suffix indicates that features were added. + + An IRIX binary built on lower MIPS model (Instruction Set Architecture, + ISA) can run on higher models, but not vice versa: + + MIPS1 R3000 and below + MIPS2 R4000 + MIPS3 R4x00 + MIPS4 R5000 and above + + Furthermore, there are different Application Binary Inferfaces (ABIs): + + COFF 32 bits, IRIX 5.3, 5.2, 5.1, 4.x and below + o32 ELF 32 bits, IRIX 5.3, 6.0 - 6.5 + N32 ELF 32 bits, IRIX 6.2 - 6.5 + N64 ELF 64 bits, IRIX 6.2 - 6.5 + + Thus a prebuilt IRIX binary works on a particular machine only if (a) + the machine's IRIX version (to one decimal place) is equal to or + greater than the version under which the binary was built; (b) the + machine's MIPS level is greater or equal to that of the binary; and (c) + the machine supports the ABI of the binary. If all three conditions are + not satisfied, of course, you can build a binary yourself from source + code since, unlike some other Unix vendors, SGI does supply a C + compiler and libraries. + + SGI did not supply an API for hardware flow control prior to IRIX 5.2. + C-Kermit 6.1 and higher for IRIX 5.2 and higher supports hardware flow + control in the normal way, via "set flow rts/cts". + + For hardware flow control on earlier IRIX and/or C-Kermit versions, use + the ttyf* (modem control AND hardware flow control) devices and not the + ttyd* (direct) or ttym* (modem control but no hardware flow control) + ones, and obtain the proper "hardware handshaking" cable from SGI, + which is incompatible with the ones for the Macintosh and NeXT even + though they look the same ("man serial" for further info) and tell + Kermit to "set flow keep" and "set modem flow rts/cts". + + Serial speeds higher than 38400 are available in IRIX 6.2 and later, on + O-class machines (e.g. Origin, Octane) only, and are supported by + C-Kermit 7.0 and later. Commands such as "set speed 115200" may be + given on other models (e.g. Iris, Indy, Indigo) but will fail because + the OS reports an invalid speed for the device. + + Experimentation with both IRIX 5.3 and 6.2 shows that when logged in to + IRIX via Telnet, that remote-mode C-Kermit can't send files if the + packet length is greater than 4096; the Telnet server evidently has + this restriction (or bug), since there is no problem sending long + packets on serial or rlogin connections. However, it can receive files + with no problem if the packet length is greater than 4096. As a + workaround, the FAST macro for IRIX includes "set send packet-length + 4000". IRIX 6.5.1 does not have this problem, so evidently it was fixed + some time after IRIX 6.2. Tests show file-transfer speeds are better + (not worse) with 8K packets than with 4K packets from IRIX 6.5.1. + + Reportedly some Indys have bad serial port hardware. IRIX 5.2, for + example, needs patch 151 to work around this; or upgrade to a later + release. Similarly, IRIX 5.2 has several problems with serial i/o, flow + control, etc. Again, patch or upgrade. + + Reportedly on machines with IRIX 4.0, Kermit cannot be suspended by + typing the suspend ("swtch") character if it was started from csh, even + though other programs can be suspended this way, and even though the Z + and SUSPEND commands still work correctly. This is evidently because + IRIX's csh does not deliver the SIGTSTP signal to Kermit. The reason + other programs can be suspended in the same environment is probably + that they do not trap SIGTSTP themselves, so the shell is doing the + suspending rather than the application. + + Also see notes about IRIX 3.x in the [509]C-Kermit for Unix + Installation Instructions. + + If you have problems making TCP/IP connections in versions of IRIX + built with GCC 2.95.2, see the bugs section of: + + [510]http://freeware.sgi.com/Installable/gcc-2.95.2.html. + + Reportedly, if you allow gcc to compile C-Kermit on Irix you should be + aware that there might be problems with some of the network code. The + specifics are at + [511]http://freeware.sgi.com/Installable/gcc-2.95.2.html; scroll down + to the "known bugs" section at the end of the document. + +3.15. C-KERMIT AND THE BEBOX + + [ [512]Top ] [ [513]Contents ] [ [514]Section Contents ] [ [515]Next ] + [ [516]Previous ] + + See also: The [517]comp.sys.be newsgroup. + + The BeBox has been discontinued and BeOS repositioned for PC platforms. + The POSIX parts of BeOS are not finished, nor is the sockets library, + therefore a fully functional version of C-Kermit is not possible. In + version 6.0 of C-Kermit, written for BeOS DR7, it was possible to: + + * set line /dev/serial2 (and probably the other serial ports) + * set speed 115200 (and at least some of the lower baud rates) + * connect + * set modem type hayes (and likely others, too) + * dial phone-number + * set send packet-length 2048 (other lengths for both send and + receive) + * set receive packet length 2048 + * set file type binary (text mode works, too) (with remote kermit + session in server mode) + * put bedrop.jpg + * get bedrop.jpg + * get bedrop.jpg bedrop.jpg2 + * finish, bye + + The following do not work: + * kermit does not detect modem hangup + * !/RUN/PUSH [commandline command] + * Running kermit in remote mode + * Using other protocols (x/y/zmodem) + * TCP networking interface (Be's TCP/IP API has a ways to go, still) + + C-Kermit does not work on BeOS DR8 because of changes in the underlying + APIs. Unfortunately not enough changes were made to allow the regular + POSIX-based C-Kermit to work either. Note: the lack of a fork() service + requires the select()-based CONNECT module, but there is no select(). + There is a select() in DR8, but it doesn't work. + + C-Kermit 7.0 was built for BeOS 4.5 and works in remote mode. It does + not include networking support since the APIs are still not there. It + is not known if dialing out works, but probably not. Be experts are + welcome to lend a hand. + +3.16. C-KERMIT AND DG/UX + + [ [518]Top ] [ [519]Contents ] [ [520]Section Contents ] [ [521]Next ] + [ [522]Previous ] + + Somebody downloaded the C-Kermit 6.0 binary built under DG/UX 5.40 and + ran it under DG/UX 5.4R3.10 -- it worked OK except that file dates for + incoming files were all written as 1 Jan 1970. Cause and cure unknown. + Workaround: SET ATTRIBUTE DATE OFF. Better: Use a version of C-Kermit + built under and for DG/UX 5.4R3.10. + +3.17. C-KERMIT AND SEQUENT DYNIX + + [ [523]Top ] [ [524]Contents ] [ [525]Section Contents ] [ [526]Next ] + [ [527]Previous ] + + Reportedly, when coming into a Sequent Unix (DYNIX) system through an + X.25 connection, Kermit doesn't work right because the Sequent's + FIONREAD ioctl returns incorrect data. To work around, use the + 1-character-at-a-time version of myread() in ckutio.c (i.e. undefine + MYREAD in ckutio.c and rebuild the program). This is unsatisfying + because two versions of the program would be needed -- one for use over + X.25, and the other for serial and TCP/IP connections. + +3.18. C-KERMIT AND FREEBSD, OPENBSD, and NETBSD + + [ [528]Top ] [ [529]Contents ] [ [530]Section Contents ] [ [531]Next ] + [ [532]Previous ] + + Some NebBSD users have reported difficulty escaping back from CONNECT + mode, usually when running NetBSD on non-PC hardware. Probably a + keyboard issue. + + NetBSD users have also reported that C-Kermit doesn't pop back to the + prompt if the modem drops carrier. This needs to be checked out & fixed + if possible. + + (All the above seems to work properly in C-Kermit 7.0 and later.) + +3.19. C-KERMIT AND MAC OS X + + [ [533]Top ] [ [534]Contents ] [ [535]Section Contents ] [ [536]Next ] + [ [537]Previous ] + + Mac OS X is Apple's 4.4BSD Unix variety, closely related to FreeBSD, + but different. "uname -a" is singularly uninformative, as in Linux, + giving only the Darwin kernel version number. The way to find out the + actual Mac OS X version is with + + /usr/bin/sw_vers -productName + /usr/bin/sw_vers -productVersion + + or: + + fgrep -A 1 'ProductVersion' + /System/Library/CoreServices/SystemVersion.plist + + Here are some points to be aware of: + + * A big gotcha for Kermit users is that Mac OS X does not support + serial ports and, as far as I can tell, doesn't support its + built-in modem either, for anything other than making Internet + connections. Macintoshes capable of running Mac OS X, such as the + G5 and later, come without serial ports and without any APIs to + support them, and also without the UUCP family of programs + (including cu), nor any standard for serial-port lockfile + directory. + * Early versions of Mac OS X came without Curses, Termlib, or + Terminfo libraries. Later versions seem to have ncurses (it would + seem that Mac OS X 10.3.9 was the first mature and complete version + of Mac OS X). Kermit uses curses for its file-transfer display. See + elsewhere about curses-vs-ncurses confusion. + * In the HFS+ file system, filenames are case-folded. Thus "makefile" + and "Makefile" are the same file. So, for example, suppose you are + sending two distinct files, Foo and FOO, from (say) Linux to Mac OS + X. This will produce a file collision that will be handled + according to Mac OS X C-Kermit's FILE COLLISION setting, which by + default is BACKUP, so the Mac will wind up with files called FOO + and Foo.~1~. + * HSF+ files that are composed of a resource fork and a data fork... + I doubt that C-Kermit does anything useful with them. There is no + code in C-Kermit for traditional two-forked Macintosh files, but it + could be added if there is any demand (code for this existed in + [538]Mac Kermit, the old pre-Mac-OS-X Macintosh version of + C-Kermit). + * In case you want to transfer a traditional Macintosh text file (or + data fork of a file that is plain text), you can use these C-Kermit + commands: + +set file eol cr +set file character-set apple-quickdraw +send /text filename + + * File or pathnames that include spaces must be enclosed in either + doublequotes or curly braces in C-Kermit commands. + * Mac OS X can use a third-party package manager called "fink". + Various fink packages for C-Kermit are floating around that are not + standard releases. For example, there's a C-Kermit 8.0.201 package + in which C-Kermit was modifed (at least) to use a UUCP lockfile + directory that does not exist on vanilla Mac OS X systems. + +Mac OS X and Serial Ports + + Apple is in the forefront of companies that believe serial ports have + no use in the modern world and so has simply eliminated all traces of + them from its machines and OS. But of course serial ports are still + needed to connect not only to external modems, but also to the control + ports of hubs, routers, terminal servers, PBXs, and similar devices, + not to mention barcode readers, POS systems and components, speaking + devices, hand calculators such as the HP48, automated factory-floor + equipment, and scientific, medical, and lab equipment (to name a few). + Among workers in these areas, there is a need to add serial ports back + onto this platform, which is being filled by third-party products such + as the [539]Keyspan High Speed USB Serial Adapter USA-19HS, which has a + DB-9 male connector. To use the Keyspan device, you must install the + accompanying device drivers, which winds up giving you serial ports + with names like /dev/cu.USA19H3b1P1.1, /dev/cu.KeySerial1, + /dev/tty.KeySerial1. + + C-Kermit 9.0 works "out of the box" with third-party serial ports on + Mac OS X, because it is built by default ("make macosx") without the + "UUCP lockfile" feature. If you have C-Kermit 9.0 on a personal + Macintosh, you can skip the next section. + +Mac OS X Serial Ports with C-Kermit 8.0 and earlier + + In earlier versions of C-Kermit, you'll need to either build a special + -DNOUUCP version, or deal with the UUCP port contention sytem in + [540]all its glory (this is usually an exercise in futility because any + other applications on your Mac that use the serial port will not + necessarily follow the same conventions): + + 1. su (or sudo -s) + chgrp xxxx /var/spool/lock + chmod g+w /var/spool/lock + chgrp xxxx /dev/cu.* + (where xxxx is the name of the group for users to whom serial-port + access is to be granted). Use "admin" or other existing group, or + create a new group if desired. NB: + + In the absence of official guidance from Apple or anyone else, we + choose /var/spool/lock as the lockfile directory because this + directory (a) already exists on vanilla Mac OS X installations, and + (b) it is the directory used for serial-port lockfiles on many other + platforms. + 2. Put all users who need access to the serial port in the same group. + 3. Make sure the serial device files that are to be used by C-Kermit + have group read-write permission and (if you care) lack world + read-write permission, e.g.: + + chmod g+rw,o-rw /dev/cu.* + + If you do the above, then there's no need to become root to use Kermit, + or to make Kermit suid or sgid. Just do this: + +chmod 775 wermit +mv wermit /usr/local/kermit + + (or whatever spot is more appropriate, e.g. /usr/bin/). For greater + detail about installation, [541]CLICK HERE. + + Alternatively, to build a pre-9.0 version of C-Kermit without UUCP + lockfile support, set the NOUUCP flag; e.g. (for Mac OS 10.4): + + make macosx10.4 KFLAGS=-DNOUUCP + + This circumvents the SET PORT failure "?Access to lockfile directory + denied". But it also sacrifices Kermit's ability to ensure that only + one copy of Kermit can have the device open at a time, since Mac OS X + is the same as all other varieties of Unix in that exclusive access to + serial ports is not enforced in any way. But if it's for your own + desktop machine that nobody else uses, a -DNOUUCP version might be + adequate and preferable to the alternatives. + + To build C-Kermit 9.0 with UUCP support, do: + + make macosx KFLAGS=-UNOUUCP + + (note: "-U", not "-D). + +RS-232 versus RS-422 + + Meanwhile, back when Macs had serial ports, they were not RS-232 (the + standard for connecting computers with nearby modems) but rather RS-422 + or -423 (a standard for connecting serial devices over longer + distances). Macintosh serial ports do not support modems well because + they do not have enough wires (or more properly in the case RS-422/423, + wire pairs) to convey a useful subset of modem signals. + + Keyspan also sells a [542]USB Twin Serial Adapter that gives you two + Mini-Din8 RS-422 ports, that are no better (or worse) for communicating + with modems or serial devices than a real Mac Din-8 port was. In + essense, you get Data In, Data Out, and two modem signals. It looks to + me as if the signals chosen by Keyspan are RTS and CTS. This gives you + hardware flow control, but at the expense of Carrier Detect. Thus to + use C-Kermit with a Keyspan USB serial port, you must tell C-Kermit to: + +set modem type none ; (don't expect a modem) +set carrier-watch off ; (ignore carrier signal) +set port /dev/cu.USA19H3b1P1.1 ; (open the port) +set flow rts/cts ; (this is the default) +set speed 57600 ; (or whatever) +connect ; (or DIAL or whatever) + + Use Ctrl-\C in the normal manner to escape back to the C-Kermit> + prompt. Kermit can't pop back to its prompt automatically when Carrier + drops because there is no Carrier signal in the physical interface. + + Here's a typical sequence for connecting to Cisco devices (using a + mixture of command-line options and interactive commands at the + prompt): + +$ ckermit -l /dev/cu.USA19H3b1P1.1 -b 9600 +C-Kermit> set carrier-watch off +C-Kermit> connect + + Instructions for the built-in modem (if any) remain to be written due + to lack of knowledge. If you can contribute instructions, hints, or + tips, please [543]send them in. + +3.20. C-KERMIT AND COHERENT + + [ [544]Top ] [ [545]Contents ] [ [546]Section Contents ] [ + [547]Previous ] + + Also see: + + [548]http://www.uni-giessen.de/faq/archiv/coherent-faq.general/msg000 + 00.html + + Mark Williams COHERENT was perhaps the first commercial Unix-based + operating system for PCs, first appearing about 1983 or -84 for the + PC/XT (?), and popular until about 1993, when Linux took over. + C-Kermit, as of version 8.0, is still current for COHERENT 386 4.2 + (i.e. only for i386 and above). Curses is included, but lots of other + features are omitted due to lack of the appropriate OS features, APIs, + libraries, hardware, or just space: e.g. TCP/IP, floating-point + arithmetic, learned scripts. Earlier versions of COHERENT ran on 8086 + and 80286, but these are to small to build or run C-Kermit, but + G-Kermit should be OK (as might be ancient versions of C-Kermit). + + You can actually build a version with floating point support -- just + take -DNOFLOAT out of CFLAGS and add -lm to LIBS; NOFLOAT is the + default because COHERENT tends to run on old PCs that don't have + floating-point hardware. You can also add "-f" to CFLAGS to have it + link in the floating-point emulation library. Also I'm not sure why + -DNOLEARN is included, since it depends on select(), which COHERENT + has. + +4. GENERAL UNIX-SPECIFIC HINTS, LIMITATIONS, AND BUGS + + [ [549]Top ] [ [550]Contents ] [ [551]Next ] [ [552]Previous ] + +4.1. Modem Signals + + There seems to be an escalating demand for the ability to control "dumb + serial devices" (such as "smartcard readers", barcode readers, etc) by + explicitly manipulating modem signals, particularly RTS. This might + have been easy to do in DOS, where there is no operating system + standing between the application and the serial device, but it is + problematic in Unix, where modem signals are controlled by the serial + device driver. If the driver does not provide an API for doing this, + then the application can't do it. If it does provide an API, expect it + to be totally different on each Unix platform, since there is no + standard for this. + +4.2. NFS Troubles + + Beginning with C-Kermit 6.0, the default C-Kermit prompt includes your + current (working) directory; for example: + + [/usr/olga] C-Kermit> + + (In C-Kermit 7.0 the square braces were replaced by round parentheses + to avoid conflicts with ISO 646 national character sets.) + + If that directory is on an NFS-mounted disk, and NFS stops working or + the disk becomes unavailable, C-Kermit will hang waiting for NFS and/or + the disk to come back. Whether you can interrupt C-Kermit when it is + hung this way depends on the specific OS. Kermit has called the + operating systems's getcwd() function, and is waiting for it to return. + Some versions of Unix (e.g. HP-UX 9.x) allow this function to be + interrupted with SIGINT (Ctrl-C), others (such as HP-UX 8.x) do not. To + avoid this effect, you can always use SET PROMPT to change your prompt + to something that does not involve calling getcwd(), but if NFS is not + responding, C-Kermit will still hang any time you give a command that + refers to an NFS-mounted directory. Also note that in some cases, the + uninterruptibility of NFS-dependent system or library calls is + considered a bug, and sometimes there are patches. For HP-UX, for + example: + + replaced by: + HP-UX 10.20 libc PHCO_8764 PHCO_14891/PHCO_16723 + HP-UX 10.10 libc PHCO_8763 PHCO_14254/PHCO_16722 + HP-UX 9.x libc PHCO_7747 S700 PHCO_13095 + HP-UX 9.x libc PHCO_6779 S800 PHCO_11162 + +4.3. C-Kermit as Login Shell + + You might have reason to make C-Kermit the login shell for a specific + user, by entering the pathname of Kermit (possibly with command-line + switches, such as -x to put it in server mode) into the shell field of + the /etc/passwd file. This works pretty well. In some cases, for + "ultimate security", you might want to use a version built with + -DNOPUSH (see the [553]Configurations Options document for this, but + even if you don't, then PUSHing or shelling out from C-Kermit just + brings up a new copy of C-Kermit (but warning: this does not prevent + the user from explicitly running a shell; e.g. "run /bin/sh"; use + NOPUSH to prevent this). + +4.4. C-Kermit versus screen and splitvt + + C-Kermit file transfers will probably not work if attemped through the + "splitvt" or GNU "screen" programs because the screen optimization (or + at least, line wrapping, control-character absorption) done by this + package interferes with Kermit's packets. + + The same can apply to any other environment in which the user's session + is captured, monitored, recorded, or manipulated. Examples include the + 'script' program (for making a typescript of a session), the + Computronics PEEK package and pksh (at least versions of it prior to + 1.9K), and so on. + + You might try the following -- what we call "doomsday Kermit" -- + settings to push packets through even the densest and most obstructive + connections, such as "screen" and "splitvt" (and certain kinds of 3270 + protocol emulators): Give these commands to BOTH Kermit programs: + + SET FLOW NONE + SET CONTROL PREFIX ALL + SET RECEIVE PACKET-LENGTH 70 + SET RECEIVE START 62 + SET SEND START 62 + SET SEND PAUSE 100 + SET BLOCK B + + If it works, it will be slow. + +4.5. C-Kermit versus DOS Emulators + + On Unix workstations equipped with DOS emulators like SoftPC, watch out + for what these emulators do to the serial port drivers. After using a + DOS emulator, particularly if you use it to run DOS communications + software, you might have to reconfigure the serial ports for use by + Unix. + +4.6. C-Kermit versus Job Control + + Interruption by Ctrl-Z makes Unix C-Kermit try to suspend itself with + kill(0,SIGTSTP), but only on platforms that support job control, as + determined by whether the symbol SIGTSTP is defined (or on POSIX or + SVR4 systems, if syconf(_SC_JOB_CONTROL) or _POSIX_JOB_CONTROL in + addition to SIGTSTP). However, if Kermit is running under a login shell + (such as the original Bourne shell) that does not support job control, + the user's session hangs and must be logged out from another terminal, + or hung up on. There is no way Kermit can defend itself against this. + If you use a non-job control shell on a computer that supports job + control, give a command like "stty susp undef" to fix it so the suspend + signal is not attached to any particular key, or give the command SET + SUSPEND OFF to C-Kermit, or build C-Kermit with -DNOJC. + +4.7. Dates and Times + + Unix time conversion functions typically apply locale rules to return + local time in terms of any seasonal time zone change in effect for the + given date. The diffdate function assumes that the same timezone rules + are in effect for both dates, but a date with timezone information will + be converted to the local time zone in effect at the given time, e.g., + a GMT specification will produce either a Standard Time or Daylight + Savings Time, depending on which applies at the given time. An example + using the 2001 seasonal change from EDT (-0400) to EST (-0500): + + C-Kermit> DATE 20011028 05:01:02 GMT ; EDT + 20011028 01:01:02 + C-Kermit> DATE 20011028 06:01:02 GMT ; EST + 20011028 01:01:02 + C-Kermit> + + but the implicit change in timezone offset is not recognized: + + C-Kermit> echo \fdiffdate(20011028 05:01:02 GMT, 20011028 06:01:02 GMT) + +0:00 + C-Kermit> + + Date/time arithmetic, offsets, delta times, and timezone support are + new to C-Kermit 8.0, and might be expected to evolve and improve in + subsequent releases. + + On some platforms, files downloaded with HTTP receive the current + timestamp, rather than the HTTP "Last Modified" time (this can be fixed + by including utime.h, e.g. in SunOS and Tru64...). + +4.8. Pseudoterminals + + The SSH and PTY commands work by assigning a pseudoterminal and reading + and writing from it. Performance varies according to the specific + platform ranging from very fast to very flow. + + SSH and PTY commands can fail if (a) all pseudoterminals are in use; or + (b) you do not have read/write access to the pseudoterminal that was + assigned. An example of (b) was reported with the Zipslack Slackware + Linux distribution, in which the pseudoterminals were created with + crw-r--r-- permission, instead of crw-rw-rw-. + +4.9. Miscellaneous + + * Reportedly, the Unix C-Kermit server, under some conditions, on + certain particular systems, fails to log out its login session upon + receipt of a BYE command. Before relying on the BYE command + working, test it a few times to make sure it works on your system: + there might be system configuration or security mechanisms to + prevent an inferior process (like Kermit) from killing a superior + one (like the login shell). + * On AT&T 7300 (3B1) machines, you might have to "stty nl1" before + starting C-Kermit. Do this if characters are lost during + communications operations. + * Under the bash shell (versions prior to 1.07 from CWRU), "pushing" + to an inferior shell and then exiting back to Kermit leaves Kermit + in the background such that it must be explicitly fg'd. This is + reportedly fixed in version 1.07 of bash (and definitely in modern + bash versions). + +5. INITIALIZATION AND COMMAND FILES + + [ [554]Top ] [ [555]Contents ] [ [556]Next ] [ [557]Previous ] + + C-Kermit's initialization file for Unix is .kermrc (lowercase, starts + with period) in your home directory, unless Kermit was built with the + system-wide initialization-file option (see the [558]C-Kermit for Unix + Installation Instructions). + + C-Kermit identifies your home directory based on the environment + variable, HOME. Most Unix systems set this variable automatically when + you log in. If C-Kermit can't find your initialization file, check your + HOME variable: + + echo $HOME (at the Unix prompt) + + or: + + echo \$(HOME) (at the C-Kermit prompt) + + If HOME is not defined, or is defined incorrectly, add the appropriate + definition to your Unix .profile or .login file, depending on your + shell: + + setenv HOME full-pathname-of-your-home-directory (C-Shell, .login file) + + or: + + HOME=full-pathname-of-your-home-directory (sh, ksh, .profile file) + export HOME + + NOTE: Various other operations depend on the correct definition of + HOME. These include the "tilde-expansion" feature, which allows you to + refer to your home directory as "~" in filenames used in C-Kermit + commands, e.g.: + + send ~/.kermrc + + as well as the \v(home) variable. + + Prior to version 5A(190), C-Kermit would look for its initialization + file in the current directory if it was not found in the home + directory. This feature was removed from 5A(190) because it was a + security risk. Some people, however, liked this behavior and had + .kermrc files in all their directories that would set up things + appropriately for the files therein. If you want this behavior, you can + accomplish it in various ways, for example: + + * Create a shell alias, for example: + alias kd="kermit -Y ./.kermrc" + + * Create a .kermrc file in your home directory, whose contents are: + take ./.kermrc + + Suppose you need to pass a password from the Unix command line to a + C-Kermit script program, in such a way that it does not show up in "ps" + or "w" listings. Here is a method (not guaranteed to be 100% secure, + but definitely more secure than the more obvious methods): + + echo mypassword | kermit myscript + + The "myscript" file contains all the commands that need to be executed + during the Kermit session, up to and including EXIT, and also includes + an ASK or ASKQ command to read the password from standard input, which + has been piped in from the Unix 'echo' command, but it must not include + a CONNECT command. Only "kermit myscript" shows up in the ps listing. + +6. COMMUNICATION SPEED SELECTION + + [ [559]Top ] [ [560]Contents ] [ [561]Next ] [ [562]Previous ] + + Version-7 based Unix implementations, including 4.3 BSD and earlier and + Unix systems based upon BSD, use a 4-bit field to record a serial + device's terminal speed. This leaves room for 16 speeds, of which the + first 14 are normally: + + 0, 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 4800, + and 9600 + + The remaining two are usually called EXTA and EXTB, and are defined by + the particular Unix implementation. C-Kermit determines which speeds + are available on your system based on whether symbols for them are + defined in your terminal device header files. EXTA is generally assumed + to be 19200 and EXTB 38400, but these assumptions might be wrong, or + they might not apply to a particular device that does not support these + speeds. Presumably, if you try to set a speed that is not legal on a + particular device, the driver will return an error, but this can not be + guaranteed. + + On these systems, it is usually not possible to select a speed of 14400 + bps for use with V.32bis modems. In that case, use 19200 or 38400 bps, + configure your modem to lock its interface speed and to use RTS/CTS + flow control, and tell C-Kermit to SET FLOW RTS/CTS and SET DIAL + SPEED-MATCHING OFF. + + The situation is similar, but different, in System V. SVID Third + Edition lists the same speeds, 0 through 38400. + + Some versions of Unix, and/or terminal device drivers that come with + certain third-party add-in high-speed serial communication interfaces, + use the low "baud rates" to stand for higher ones. For example, SET + SPEED 50 gets you 57600 bps; SET SPEED 75 gets you 76800; SET SPEED 110 + gets 115200. + + SCO ODT 3.0 is an example where a "baud-rate-table patch" can be + applied that can rotate the tty driver baud rate table such that + 600=57600 and 1800=115k baud. Similarly for Digiboard + multiport/portservers, which have a "fastbaud" setting that does this. + Linux has a "setserial" command that can do it, etc. + + More modern Unixes support POSIX-based speed setting, in which the + selection of speeds is not limited by a 4-bit field. C-Kermit 6.1 + incorporates a new mechanism for finding out (at compile time) which + serial speeds are supported by the operating system that does not + involve editing of source code by hand; on systems like Solaris 5.1, + IRIX 6.2, and SCO OSR5.0.4, "set speed ?" will list speeds up to 460800 + or 921600. In C-Kermit 7.0 and later: + + 1. If a symbol for a particular speed (say B230400 for 230400 bps) + appears in whatever header file defines acceptable serial speeds + (e.g. or or , etc), the + corresponding speed will appear in C-Kermit's "set speed ?" list. + 2. The fact that a given speed is listed in the header files and + appears in C-Kermit's list does not mean the driver will accept it. + For example, a computer might have some standard serial ports plus + some add-on ones with different drivers that accept a different + repertoire of speeds. + 3. The fact that a given speed is accepted by the driver does not + guarantee the underlying hardware can accept it. + + When Kermit is given a "set speed" command for a particular device, the + underlying system service is called to set the speed; its return code + is checked and the SET SPEED command fails if the return code indicates + failure. Regardless of the system service return status, the device's + speed is then read back and if it does not match the speed that was + requested, an error message is printed and the command fails. + + Even when the command succeeds, this does not guarantee successful + operation at a particular speed, especially a high one. That depends on + electricity, information theory, etc. How long is the cable, what is + its capacitance, how well is it shielded, etc, not to mention that + every connection has two ends and its success depends on both of them. + (With the obvious caveats about internal modems, is the cable really + connected, interrupt conflicts, etc etc etc). + + Note, in particular, that there is a certain threshold above which + modems can not "autobaud" -- i.e. detect the serial interface speed + when you type AT (or whatever else the modem's recognition sequence + might be). Such modems need to be engaged at a lower speed (say 2400 or + 9600 or even 115200 -- any speed below their autobaud threshold) and + then must be given a modem-specific command (which can be found in the + modem manual) to change their interface speed to the desired higher + speed, and then the software must also be told to change to the new, + higher speed. + + For additional information, read [563]Section 9.5 of the Installation + Instructions, plus any platform-specific notes in [564]Section 3 above. + +7. COMMUNICATIONS AND DIALING + + [ [565]Top ] [ [566]Contents ] [ [567]Next ] [ [568]Previous ] + +7.1. Serial Ports and Modems + + If you SET LINE to a serial port modem-control device that has nothing + plugged in to it, or has a modem connected that is powered off, and you + have not given a prior SET MODEM TYPE or SET CARRIER-WATCH OFF command, + the SET LINE command is likely to hang. In most cases, you can Ctrl-C + out. If not, you'll have to kill C-Kermit from another terminal. + + Similarly, if you give a SET MODEM TYPE HAYES (or USR, or any other + modem type besides DIRECT, NONE, or UNKNOWN) and then SET LINE to an + empty port, the subsequent close (implicit or explicit) is liable to + hang or even crash (through no fault of Kermit's -- the hanging or + crashing is inside a system call such as cfsetospeed() or close()). + + The SET CARRIER-WATCH command works as advertised only if the + underlying operating system and device drivers support this feature; in + particular only if a read() operation returns immediately with an error + code if the carrier signal goes away or, failing that, if C-Kermit can + obtain the modem signals from the device driver (you can tell by giving + a "set line" command to a serial device, and then a "show + communications" command -- if modem signals are not listed, C-Kermit + won't be able to detect carrier loss, the WAIT command will not work, + etc). Of course, the device itself (e.g. modem) must be configured + appropriately and the cables convey the carrier and other needed + signals, etc. + + If you dial out from Unix system, but then notice a lot of weird + character strings being stuck into your session at random times + (especially if they look like +++ATQ0H0 or login banners or prompts), + that means that getty is also trying to control the same device. You'll + need to dial out on a device that is not waiting for a login, or else + disable getty on the device. + + As of version 7.0, C-Kermit makes explicit checks for the Carrier + Detect signal, and so catches hung-up connections much better than 6.0 + and earlier. However, it still can not be guaranteed to catch every + ever CD on-to-off transition. For example, when the HP-UX version of + C-Kermit is in CONNECT mode on a dialed connection and CARRIER-WATCH ON + or AUTO, and you turn off the modem, HP-UX is stuck in a read() that + never returns. (C-Kermit does not pop back to its prompt automatically, + but you can still escape back.) + + If, on the other hand, you log out from the remote system, and it hangs + up, and CD drops on the local modem, C-Kermit detects this and pops + back to the prompt as it should. (Evidently there can be a difference + between CD and DSR turning off at the same time, versus CD turning off + while DSR stays on; experimentation with &S0/&S1/&S2 on your modem + might produce the desired results). + + When Unix C-Kermit exits, it closes (and must close) the communications + device. If you were dialed out, this will most likely hang up the + connection. If you want to get out of Kermit and still use Kermit's + communication device, you have several choices: + + 1. Shell out from Kermit or suspend Kermit, and refer to the device + literally (as in "term -blah -blah < /dev/cua > /dev/cua"). + 2. Shell out from Kermit and use the device's file descriptor which + Kermit makes available to you in the \v(ttyfd) variable. + 3. Use C-Kermit's REDIRECT command. + 4. Use C-Kermit new EXEC /REDIRECT command. + + If you are having trouble dialing: + + 1. Make sure the dialout line is configured correctly. More about this + below. + 2. Make sure all necessary patches are installed for your operating + system. + 3. If you can't dial on a "bidirectional" line, then configure it for + outbound-only (remove the getty) and try again. (The mechanisms -- + if any -- for grabbing bidirectional lines for dialout vary wildly + among Unix implementations and releases, and C-Kermit -- which runs + on well over 300 different Unix variations -- makes no effort to + keep up with them; the recommended method for coping with this + situation is to wrap C-Kermit in a shell script that takes the + appropriate actions.) + 4. Make sure C-Kermit's SET DIAL and SET MODEM parameters agree with + the modem you are actually using -- pay particular attention to SET + DIAL SPEED-MATCHING. + 5. If MODEM HANGUP-METHOD is set to RS232-SIGNAL, change it to + MODEM-COMMAND. Or vice-versa. + 6. Try SET DIAL HANGUP OFF before the DIAL command. Also, SET DIAL + DISPLAY ON to watch what's happening. See [569]Section 8 of the + [570]Installation Instructions. + 7. Read pages 50-67 of [571]Using C-Kermit. + 8. As a last resort, don't use the DIAL command at all; SET CARRIER + OFF and CONNECT to the modem and dial interactively, or write a + script program to dial the modem. + + Make sure your dialout line is correctly configured for dialing out (as + opposed to login). The method for doing this is different for each kind + of Unix system. Consult your system documentation for configuring lines + for dialing out (for example, Sun SparcStation IPC users should read + the section "Setting up Modem Software" in the Desktop SPARC Sun System + & Network Manager's Guide; HP-9000 workstation users should consult the + manual Configuring HP-UX for Peripherals, etc). + + Symptom: DIAL works, but a subsequent CONNECT command does not. + Diagnosis: the modem is not asserting Carrier Detect (CD) after the + connection is made, or the cable does not convey the CD signal. Cure: + Reconfigure the modem, replace the cable. Workaround: SET CARRIER OFF + (at least in System-V based Unix versions). + + For Berkeley-Unix-based systems (4.3BSD and earlier), Kermit includes + code to use LPASS8 mode when parity is none, which is supposed to allow + 8-bit data and Xon/Xoff flow control at the same time. However, as of + edit 174, this code is entirely disabled because it is unreliable: even + though the host operating system might (or might not) support LPASS8 + mode correctly, the host access protocols (terminal servers, telnet, + rlogin, etc) generally have no way of finding out about it and + therefore render it ineffective, causing file transfer failures. So as + of edit 174, Kermit once again uses rawmode for 8-bit data, and so + there is no Xon/Xoff flow control during file transfer or terminal + emulation in the Berkeley-based versions (4.3 and earlier, not 4.4). + + Also on Berkeley-based systems (4.3 and earlier), there is apparently + no way to configure a dialout line for proper carrier handling, i.e. + ignore carrier during dialing, require carrier thereafter, get a fatal + error on any attempt to read from the device after carrier drops (this + is handled nicely in System V by manipulation of the CLOCAL flag). The + symptom is that carrier loss does not make C-Kermit pop back to the + prompt automatically. This is evident on the NeXT, for example, but not + on SunOS, which supports the CLOCAL flag. This is not a Kermit problem, + but a limitation of the underlying operating system. For example, the + cu program on the NeXT doesn't notice carrier loss either, whereas cu + on the Sun does. + + On certain AT&T Unix systems equipped with AT&T modems, DIAL and HANGUP + don't work right. Workarounds: (1) SET DIAL HANGUP OFF before + attempting to dial; (2) If HANGUP doesn't work, SET LINE, and then SET + LINE to totally close and reopen the device. If all else + fails, SET CARRIER OFF. + + C-Kermit does not contain any particular support for AT&T DataKit + devices. You can use Kermit software to dial in to a DataKit line, but + C-Kermit does not contain the specialized code required to dial out + from a DataKit line. If the Unix system is connected to DataKit via + serial ports, dialout should work normally (e.g. set line /dev/ttym1, + set speed 19200, connect, and then see the DESTINATION: prompt, from + which you can connect to another computer on the DataKit network or to + an outgoing modem pool, etc). But if the Unix system is connected to + the DataKit network through the special DataKit interface board, then + SET LINE to a DataKit pseudodevice (such as /dev/dk031t) will not work + (you must use the DataKit "dk" or "dkcu" program instead). In C-Kermit + 7.0 and later, you can make Kermit connections "though" dk or dkcu + using "set line /pty". + + In some BSD-based Unix C-Kermit versions, SET LINE to a port that has + nothing plugged in to it with SET CARRIER ON will hang the program (as + it should), but it can't be interrupted with Ctrl-C. The interrupt trap + is correctly armed, but apparently the Unix open() call cannot be + interrupted in this case. When SET CARRIER is OFF or AUTO, the SET LINE + will eventually return, but then the program hangs (uninterruptibly) + when the EXIT or QUIT command (or, presumably, another SET LINE + command) is given. The latter is probably because of the attempt to + hang up the modem. (In edit 169, a timeout alarm was placed around this + operation.) + + With SET DIAL HANGUP OFF in effect, the DIAL command might work only + once, but not again on the same device. In that case, give a CLOSE + command to close the device, and then another SET LINE command to + re-open the same device. Or rebuild your version of Kermit with the + -DCLSOPN compile-time switch. + + The DIAL command says "To cancel: Type your interrupt character + (normally Ctrl-C)." This is just one example of where program messages + and documentation assume your interrupt character is Ctrl-C. But it + might be something else. In most (but not necessarily all) cases, the + character referred to is the one that generates the SIGINT signal. If + Ctrl-C doesn't act as an interrupt character for you, type the Unix + command "stty -a" or "stty all" or "stty everything" to see what your + interrupt character is. (Kermit could be made to find out what the + interrupt character is, but this would require a lot of + platform-dependent coding and #ifdefs, and a new routine and interface + between the platform-dependent and platform-independent parts of the + program.) + + In general, the hangup operation on a serial communication device is + prone to failure. C-Kermit tries to support many, many different kinds + of computers, and there seems to be no portable method for hanging up a + modem connection (i.e. turning off the RS-232 DTR signal and then + turning it back on again). If HANGUP, DIAL, and/or Ctrl-\H do not work + for you, and you are a programmer, look at the tthang() function in + ckutio.c and see if you can add code to make it work correctly for your + system, and send the code to the address above. (NOTE: This problem has + been largely sidestepped as of edit 188, in which Kermit first attempts + to hang up the modem by "escaping back" via +++ and then giving the + modem's hangup command, e.g. ATH0, when DIAL MODEM-HANGUP is ON, which + is the default setting.) + + Even when Kermit's modem-control software is configured correctly for + your computer, it can only work right if your modem is also configured + to assert the CD signal when it is connected to the remote modem and to + hang up the connection when your computer drops the DTR signal. So + before deciding Kermit doesn't work with your modem, check your modem + configuration AND the cable (if any) connecting your modem to the + computer -- it should be a straight-through [572]modem cable conducting + the signals FG, SG, TD, RD, RTS, CTS, DSR, DTR, CD, and RI. + + Many Unix systems keep aliases for dialout devices; for example, + /dev/acu might be an alias for /dev/tty00. But most of these Unix + systems also use UUCP lockfile conventions that do not take this + aliasing into account, so if one user assigns (e.g.) /dev/acu, then + another user can still assign the same device by referring to its other + name. This is not a Kermit problem -- Kermit must follow the lockfile + conventions used by the vendor-supplied software (cu, tip, uucp). + + The SET FLOW-CONTROL KEEP option should be given *before* any + communication (dialing, terminal emulation, file transfer, + INPUT/OUTPUT/TRANSMIT, etc) is attempted, if you want C-Kermit to use + all of the device's preexisting flow-control related settings. The + default flow-control setting is XON/XOFF, and it will take effect when + the first communication-related command is given, and a subsequent SET + FLOW KEEP command will not necessarily know how to restore *all* of the + device's original flow-control settings. + +7.2. Network Connections + + C-Kermit tries to use the 8th bit for data when parity is NONE, and + this generally works on real Unix terminal (tty) devices, but it often + does not work when the Unix system is accessed over a network via + telnet or rlogin protocols, including (in many cases) through terminal + servers. For example, an Encore computer with Annex terminal servers + only gives a 7-bit path if the rlogin protocol is selected in the + terminal server but it gives the full 8 bits if the proprietary RDP + protocol is used. + + If file transfer does not work through a host to which you have + rlogin'd, use "rlogin -8" rather than "rlogin". If that doesn't work, + tell both Kermit programs to "set parity space". + + The Encore TELNET server does not allow long bursts of input. When you + have a TELNET connection to an Encore, tell C-Kermit on the Encore to + SET RECEIVE PACKET-LENGTH 200 or thereabouts. + +8. HARDWARE FLOW CONTROL + + [ [573]Top ] [ [574]Contents ] [ [575]Next ] [ [576]Previous ] + + SET FLOW RTS/CTS is available in Unix C-Kermit only when the underlying + operating system provides an Application Program Interface (API) for + turning this feature on and off under program control, which turns out + to be a rather rare feature among Unix systems. To see if your Unix + C-Kermit version supports hardware flow control, type "set flow ?" at + the C-Kermit prompt, and look for "rts/cts" among the options. Other + common situations include: + + 1. The API is available, so "set flow rts/cts" appears as a valid + C-Kermit command, but it doesn't do anything because the device + driver (part of the operating system) was never coded to do + hardware flow control. This is common among System V R4 + implementations (details below). + 2. The API is not available, so "set flow rts/cts" does NOT appear as + a valid C-Kermit command, but you can still get RTS/CTS flow + control by selecting a specially named device in your SET LINE + command. Examples: + + NeXTSTEP: /dev/cufa instead of /dev/cua, /dev/cufb instead of + /dev/cub (68040 only; "man zs" for further info). + + IRIX: /dev/ttyf2 instead of /dev/ttyd2 or /dev/ttym2 ("man 7 + serial"). + 3. The API is available, doesn't work, but a workaround as in (2) can + be used. + 4. The API is available, but Kermit doesn't know about it. In these + cases, you can usually use an stty command to enable RTS/CTS on the + device, e.g. "stty crtscts" or "stty ctsflow", "stty rtsflow", + before starting Kermit, and then tell Kermit to SET FLOW KEEP. + 5. No API and no special device drivers. Hardware flow control is + completely unavailable. + + System V R4 based Unixes are supposed to supply a file, + which gives Kermit the necessary interface to command the terminal + driver to enable/disable hardware flow control. Unfortunately, but + predictably, many implementations of SVR4 whimsically place this file + in /usr/include/sys rather than /usr/include (where SVID clearly + specifies it should be; see SVID, Third Edition, V1, termiox(BA_DEV). + Thus if you build C-Kermit with any of the makefile entries that + contain -DTERMIOX or -DSTERMIOX (the latter to select ), + C-Kermit will have "set flow rts/cts" and possibly other hardware + flow-control related commands. BUT... That does not necessarily mean + that they will work. In some cases, the underlying functions are simply + not coded into the operating system. + + WARNING: When hardware flow control is available, and you enable in + Kermit on a device that is not receiving the CTS signal, Kermit can + hang waiting for CTS to come up. This is most easily seen when the + local serial port has nothing plugged in to it, or is connected to an + external modem that is powered off. + +9. TERMINAL CONNECTION AND KEY MAPPING + + [ [577]Top ] [ [578]Contents ] [ [579]Next ] [ [580]Previous ] + + C-Kermit is not a terminal emulator. Refer to page 147 of [581]Using + C-Kermit, 2nd Edition: "Most versions of C-Kermit -- Unix, VMS, AOS/VS, + VOS, etc -- provide terminal connection without emulation. These + versions act as a 'semitransparent pipe' between the remote computer + and your terminal, terminal emulator, console driver, or window, which + in turn emulates (or is) a specific kind of terminal." The environment + in which you run C-Kermit is up to you. + + If you are an X Windows user, you should be aware of an alternative to + xterm that supports VT220 emulation, from Thomas E. Dickey: + + [582]http://dickey.his.com/xterm/xterm.html + + Unix C-Kermit's SET KEY command currently can not be used with keys + that generate "wide" scan codes or multibyte sequences, such as + workstation function or arrow keys, because Unix C-Kermit does not have + direct access to the keyboard. + + However, many Unix workstations and/or console drivers provide their + own key mapping feature. With xterm, for example, you can use 'xmodmap' + ("man xmodmap" for details); here is an xterm mapping to map the Sun + keyboard to DEC VT200 values for use with VT-terminal oriented + applications like VMS EVE: + + keycode 101=KP_0 + keycode 119=KP_1 + keycode 120=KP_2 + keycode 121=KP_3 + keycode 98=KP_4 + keycode 99=KP_5 + keycode 100=KP_6 + keycode 75=KP_7 + keycode 76=KP_8 + keycode 77=KP_9 + keycode 52=KP_F1 + keycode 53=KP_F2 + keycode 54=KP_F3 + keycode 57=KP_Decimal + keycode 28=Left + keycode 29=Right + keycode 30=KP_Separator + keycode 105=KP_F4 + keycode 78=KP_Subtract + keycode 8=Left + keycode 10=Right + keycode 32=Up + keycode 33=Down + keycode 97=KP_Enter + + Users of Linux consoles can use loadkeys ("man dumpkeys loadkeys + keytables" for details. The format used by loadkeys is compatible with + that used by Xmodmap, although it is not definitely certain that the + keycodes are compatible for different keyboard types (e.g. Sun vs HP vs + PC, etc). + +10. FILE TRANSFER + + [ [583]Top ] [ [584]Contents ] [ [585]Next ] [ [586]Previous ] + + On most platforms, C-Kermit can not handle files longer than 2^31 or + 2^32 bytes long, because it uses the traditional file i/o APIs that use + 32-bit words to represent the file size. To accommodate longer files, + we would have to switch to a new and different API. Unfortunately, each + platform has a different one, a nightmare to handle in portable code. + The C-Kermit file code was written in the days long before files longer + than 2GB were supported or even contemplated in the operating systems + where C-Kermit ran. + + If uploads (or downloads) fail immediately, give the CAUTIOUS command + to Kermit and try again. If they still fail, then try SET PREFIXING + ALL. If they still fail, try SET PARITY SPACE. If they still fail, try + ROBUST. + + If reception (particularly of large files and/or binary files) begins + successfully but then fail constently after a certain amount of bytes + have been sent, check: + + * Your ulimit ("ulimit -a") + * The amount of available space on the target disk ("df ." or "df -k + .") + * Your personal disk quota (platform- and site-dependent) + * The maximum file size on the receiver's file system (e.g. 2GB in + old verions the Linux VFS file system, and/or in applications that + have not been recoded to use new "large file" APIs). + * If it's an NFS-mounted disk (if so, try uploading to a local disk) + * Is there an "idle limit" on the receiving end? + + If none of these seem to explain it, then the problem is not size + related, but reflects some clash between the file contents and the + characteristics of the connection, in which case follow the + instructions in the first paragraph of this section. + + Suppose two copies of Kermit are receiving files into the same + directory, and the files have the same name, e.g. "foo.bar". Whichever + one starts first opens an output file called "foo.bar". The second one + sees there is already a foo.bar file, and so renames the existing + foo.bar to foo.bar.~1~ (or whatever). When the first file has been + received completely, Kermit goes to change its modification time and + permissions to those given by the file sender in the Attribute packet. + But in Unix, the APIs for doing this take a filename, not a file + descriptor. Since the first Kermit's file has been renamed, and the + second Kermit is using the original name, the first Kermit changes the + modtime and permissions of the second Kermit's file, not its own. + Although there might be a way to work around this in the code, e.g. + using inode numbers to keep track of which file is which, this would be + tricky and most likely not very portable. It's better to set up your + application to prevent such things from happening, which is easy enough + using the script language, filename templates, etc. + + Suppose you start C-Kermit with a command-line argument to send or + receive a file (e.g. "kermit -r") and then type Ctrl-\c immediately + afterwards to escape back and initiate the other end of the transfer, + BUT your local Kermit's escape character is not Ctrl-\. In this case, + the local Kermit passes the Ctrl-\ to the remote system, and if this is + Unix, Ctrl-\ is likely to be its SIGQUIT character, which causes the + current program to halt and dump core. Well, just about the first thing + C-Kermit does when it starts is to disable the SIGQUIT signal. However, + it is still possible for SIGQUIT to cause Kermit to quit and dump core + if it is delivered while Kermit is being loaded or started, before the + signal can be disabled. There's nothing Kermit itself can do about + this, but you can prevent it from happening by disabling SIGQUIT in + your Unix session. The command is usually something like: + + stty quit undef + + Unix C-Kermit does not reject incoming files on the basis of size. + There appears to be no good (reliable, portable) way to determine in + advance how much disk space is available, either on the device, or + (when quotas or other limits are involved) to the user. + + Unix C-Kermit discards all carriage returns from incoming files when in + text mode. + + If C-Kermit has problems creating files in writable directories when it + is installed setuid or setgid on BSD-based versions of Unix such as + NeXTSTEP 3.0, it probably needs to be rebuilt with the -DSW_ACC_ID + compilation switch. + + If you SET FILE DISPLAY FULLSCREEN, and C-Kermit complains "Sorry, + terminal type not supported", it means that the terminal library + (termcap or termlib) that C-Kermit was built with does not know about a + terminal whose name is the current value of your TERM environment + variable. If this happens, but you want to have the fullscreen file + transfer display, EXIT from C-Kermit and set a Unix terminal type from + among the supported values that is also supported by your terminal + emulator, or else have an entry for your terminal type added to the + system termcap and/or terminfo database. + + If you attempt to suspend C-Kermit during local-mode file transfer and + then continue it in the background (via bg), it will block for "tty + output" if you are using the FULLSCREEN file transfer display. This is + apparently a problem with curses. Moving a local-mode file transfer + back and forth between foreground and background works correctly, + however, with the SERIAL, CRT, BRIEF, or NONE file transfer displays. + + If C-Kermit's command parser no longer echoes, or otherwise acts + strangely, after returning from a file transfer with the fullscreen + (curses) display, and the curses library for your version of Unix + includes the newterm() function, then try rebuilding your version of + C-Kermit with -DCK_NEWTERM. Similarly if it echoes doubly, which might + even happen during a subsequent CONNECT session. If rebuilding with + -DCK_NEWTERM doesn't fix it, then there is something very strange about + your system's curses library, and you should probably not use it. Tell + C-Kermit to SET FILE DISPLAY CRT, BRIEF, or anything else other than + FULLSCREEN, and/or rebuild without -DCK_CURSES, and without linking + with (termlib and) curses. Note: This problem seemed to have escalated + in C-Kermit 7.0, and -DCK_NEWTERM had to be added to many builds that + previously worked without it: Linux, AIX 4.1, DG/UX, etc. In the Linux + case, it is obviously because of changes in the (n)curses library; the + cause in the other cases is not known. + + C-Kermit creates backup-file names (such as "oofa.txt.~1~") based on + its knowledge of the maximum filename length on the platform where it + is running, which is learned at compile time, based on MAXNAMLEN or + equivalent symbols from the system header files. But suppose C-Kermit + is receiving files on a Unix platform that supports long filenames, but + the incoming files are being stored on an NFS-mounted file system that + supports only short names. NFS maps the external system to the local + APIs, so C-Kermit has no way of knowing that long names will be + truncated. Or that C-Kermit is running on a version of Unix that + supports both long-name and short-name file systems simultaneously + (such as HP-UX 7.00). This can cause unexpected behavior when creating + backup files, or worse. For example, you are sending a group of files + whose names are differentiated only by characters past the point at + which they would be truncated, each file will overwrite the previous + one upon arrival. + +11. EXTERNAL FILE TRANSFER PROTOCOLS + + [ [587]Top ] [ [588]Contents ] [ [589]Next ] [ [590]Previous ] + + SECTION CONTENTS + + 11.1. [591]C-Kermit as an External Protocol + 11.2. [592]Invoking External Protocols from C-Kermit + + Unix C-Kermit can be used in conjunction with other communications + software in various ways. C-Kermit can be invoked from another + communications program as an "external protocol", and C-Kermit can also + invoke other communication software to perform external protocols. + + This sort of operation makes sense only when you are dialing out from + your Unix system (or making a network connection from it). If the Unix + system is the one you have dialed in to, you don't need any of these + tricks. Just run the desired software on your Unix system instead of + Kermit. When dialing out from a Unix system, the difficulty is getting + two programs to share the same communication device in spite of the + Unix UUCP lockfile mechanism, which would normally prevent any sharing, + and preventing the external protocol from closing (and therefore + hanging up) the device when it exits back to the program that invoked + it. + +11.1. C-KERMIT AS AN EXTERNAL PROTOCOL + + [ [593]Top ] [ [594]Contents ] [ [595]Section Contents ] [ [596]Next ] + + (This section deleted; see [597]Using C-Kermit, 2nd Ed, Chapter 14.) + + "pcomm" is a general-purpose terminal program that provides file + transfer capabilities itself (X- and YMODEM variations) and the ability + to call on external programs to do file transfers (ZMODEM and Kermit, + for example). You can tell pcomm the command to send or receive a file + with an external protocol: + Send Receive + ZMODEM sz filename rz + Kermit kermit -s filename kermit -r + + pcomm runs external programs for file transfer by making stdin and + stdout point to the modem port, and then exec-ing "/bin/sh -c xxx" + (where xxx is the appropriate command). However, C-Kermit does not + treat stdin and stdout as the communication device unless you instruct + it: + + + Send Receive + Kermit kermit -l 0 -s filename kermit -l 0 -r + + The "-l 0" option means to use file descriptor 0 for the communication + device. + + In general, any program can pass any open file descriptor to C-Kermit + for the communication device in the "-l" command-line option. When + Kermit is given a number as the argument to the "-l" option, it simply + uses it as a file descriptor, and it does not attempt to close it upon + exit. + + Here's another example, for Seyon (a Linux communication program). + First try the technique above. If that works, fine; otherwise... If + Seyon does not give you a way to access and pass along the file + descriptor, but it starts up the Kermit program with its standard i/o + redirected to its (Seyon's) communications file descriptor, you can + also experiment with the following method, which worked here in brief + tests on SunOS. Instead of having Seyon use "kermit -r" or "kermit -s + filename" as its Kermit protocol commands, use something like this + (examples assume C-Kermit 6.0): + + For serial connections: + + kermit -YqQl 0 -r <-- to receive + kermit -YqQl 0 -s filename(s) <-- to send one or more files + + For Telnet connections: + + kermit -YqQF 0 -r <-- to receive + kermit -YqQF 0 -s filename(s) <-- to send one or more files + + Command line options: + + Y - skip executing the init file + Q - use fast file transfer settings (default in 8.0) + l 0 - transfer files using file descriptor 0 for a serial connection + F 0 - transfer files using file descriptor 0 for a Telnet connection + q - quiet - no messages + r - receive + s - send + +11.2. INVOKING EXTERNAL PROTOCOLS FROM C-KERMIT + + [ [598]Top ] [ [599]Contents ] [ [600]Section Contents ] [ + [601]Previous ] + + (This section is obsolete, but not totally useless. See Chapter 14 + of [602]Using C-Kermit, 2nd Edition). + + After you have opened a communication link with C-Kermit's SET LINE + (SET PORT) or SET HOST (TELNET) command, C-Kermit makes its file + descriptor available to you in the \v(ttyfd) variable so you can pass + it along to other programs that you RUN from C-Kermit. Here, for + example, C-Kermit runs itself as an external protocol: + + C-Kermit>set modem type hayes + C-Kermit>set line /dev/acu + C-Kermit>set speed 2400 + C-Kermit>dial 7654321 + Call complete. + C-Kermit>echo \v(ttyfd) + 3 + C-Kermit>run kermit -l \v(ttyfd) + + Other programs that accept open file descriptors on the command line + can be started in the same way. + + You can also use your shell's i/o redirection facilities to assign + C-Kermit's open file descriptor (ttyfd) to stdin or stdout. For + example, old versions of the Unix ZMODEM programs, sz and rz, when + invoked as external protocols, expect to find the communication device + assigned to stdin and stdout with no option for specifying any other + file descriptor on the sz or rz command line. However, you can still + invoke sz and rz as exterior protocols from C-Kermit if your current + shell ($SHELL variable) is ksh (the Korn shell) or bash (the + Bourne-Again shell), which allows assignment of arbitrary file + descriptors to stdin and stdout: + + C-Kermit> run rz <&\v(ttyfd) >&\v(ttyfd) + + or: + + C-Kermit> run sz oofa.zip <&\v(ttyfd) >&\v(ttyfd) + + In version 5A(190) and later, you can use C-Kermit's REDIRECT command, + if it is available in your version of C-Kermit, to accomplish the same + thing without going through the shell: + + C-Kermit> redirect rz + + or: + + C-Kermit> redirect sz oofa.zip + + A complete set of rz,sz,rb,sb,rx,sx macros for Unix C-Kermit is defined + in the file ckurzsz.ini. It automatically chooses the best redirection + method (but is redundant since C-Kermit 6.0, which now has built-in + support for external protocols via its SET PROTOCOL command). + + Note that external protocols can be used on C-Kermit SET LINE or SET + HOST connections only if they operate through standard input and + standard output. If they open their own connections, Kermit can't + redirect them over its own connection. + +12. SECURITY + + [ [603]Top ] [ [604]Contents ] [ [605]Next ] [ [606]Previous ] + + As of version 7.0, C-Kermit supports a wide range of security options + for authentication and encryption: Kerberos 4, Kerberos 5 / GSSAPI, + SSL/TLS, and SRP. See the separate [607]security document for details. + +13. MISCELLANEOUS USER REPORTS + + [ [608]Top ] [ [609]Contents ] [ [610]Next ] [ [611]Previous ] + +Date: Thu, 12 Mar 92 1:59:25 MEZ +From: Walter Mecky +Subject: Help.Unix.sw +To: svr4@pcsbst.pcs.com, source@usl.com + +PRODUCT: Unix +RELEASE: Dell SVR4 V2.1 (is USL V3.0) +MACHINE: AT-386 +PATHNAME: /usr/lib/libc.so.1 + /usr/ccs/lib/libc.a +ABSTRACT: Function ttyname() does not close its file descriptor +DESCRIPTION: + ttyname(3C) opens /dev but never closes it. So if it is called + often enough the open(2) in ttyname() fails. Because the broken + ttyname() is in the shared lib too all programs using it can + fail if they call it often enough. One important program is + uucico which calls ttyname for every file it transfers. + + + Here is a little test program if your system has the bug: + +#include +#include +main() { + int i = 0; + while (ttyname(0) != NULL) + i++; + perror("ttyname"); + printf("i=%d\n", i); +} + + If this program runs longer than some seconds you don't have the bug. + + WORKAROUND: None FIX: Very easy if you have source code. + + Another user reports some more explicit symptoms and recoveries: + +> What happens is when invoking ckermit we get one of the following +> error messages: +> You must set line +> Not a tty +> No more processes. +> One of the following three actions clears the peoblem: +> shutdown -y -g0 -i6 +> kill -9 the ttymon with the highest PID +> Invoke sysadm and disable then enable the line you want to use. +> Turning off respawn of sac -t 300 and going to getty's and uugetty's +> does not help. +> +> Also C-Kermit reports "?timed out closing /dev/ttyxx". +> If this happens all is well. + +------------------------------ + + (Note: the following problem also occurs on SGI and probably many other + Unix systems): + + From: James Spath + To: Info-Kermit-Request@cunixf.cc.columbia.edu + Date: Wed, 9 Sep 1992 20:20:28 -0400 + Subject: C-Kermit vs uugetty (or init) on Sperry 5000 + + We have successfully compiled the above release on a Unisys/Sperry + 5000/95. We used the sys5r3 option, rather than sys5r2 since we have + VR3 running on our system. In order to allow dialout access to + non-superusers, we had to do "chmod 666 /dev/tty###, where it had been + -rw--w--w- (owned by uucp), and to do "chmod +w /usr/spool/locks". We + have done text and binary file transfers through local and remote + connections. + + The problem concerning uucp ownership and permissions is worse than I + thought at first. Apparently init or uugetty changes the file + permissions after each session. So I wrote the following C program to + open a set of requested tty lines. I run this for any required outgoing + line prior to a Kermit session. + + ------ cut here ------- +/* opentty.c -- force allow read on tty lines for modem i/o */ +/* idea from: restrict.c -- System 5 Admin book Thomas/Farrow p. 605 */ +/* /jes jim spath {spath@jhunix.hcj.jhu.edu } */ +/* 08-Sep-92 NO COPYRIGHT. */ +/* this must be suid to open other tty lines */ + +/* #define DEBUG */ +#define TTY "/dev/tty" +#define LOK "/usr/spool/locks/LCK..tty" +#include + +/* allowable lines: */ +#define TOTAL_LINES 3 +static char allowable[TOTAL_LINES][4] = { "200", "201", "300" }; +static int total=TOTAL_LINES; +int allow; + +/* states: */ +#define TTY_UNDEF 0 +#define TTY_LOCK 1 +#define TTY_OKAY 2 + +main(argc, argv) +int argc; char *argv[]; { + char device[512]; + char lockdev[512]; + int i; + if (argc == 1) { + fprintf(stderr, "usage: open 200 [...]\n"); + } + while (--argc > 0 && (*++argv) != NULL ) { +#ifdef DEBUG + fprintf(stderr, "TRYING: %s%s\n", TTY, *argv); +#endif + sprintf(device, "%s%s", TTY, *argv); + sprintf(lockdev, "%s%s", LOK, *argv); + allow = TTY_UNDEF; i = 0; + while (i <= total) { /* look at all defined lines */ +#ifdef DEBUG + fprintf(stderr, "LOCKFILE? %s?\n", lockdev); +#endif + if (access(lockdev, 00) == 0) { + allow=TTY_LOCK; + break; + } +#ifdef DEBUG + fprintf(stderr, "DOES:%s==%s?\n", allowable[i], *argv); +#endif + if (strcmp(allowable[i], *argv) == 0) + allow=TTY_OKAY; + i++; + } +#ifdef DEBUG + fprintf(stderr, "allow=%d\n", allow); +#endif + switch (allow) { + case TTY_UNDEF: + fprintf (stderr, "open: not allowed on %s\n", *argv); + break; + case TTY_LOCK: + fprintf (stderr, "open: device locked: %s\n", lockdev); + break; + case TTY_OKAY: + /* attempt to change mode on device */ + if (chmod (device, 00666) < 0) + fprintf (stderr, "open: cannot chmod on %s\n", device); + break; + default: + fprintf (stderr, "open: FAULT\n"); + } + } + exit (0); +} + +14. THIRD-PARTY DRIVERS + + [ [612]Top ] [ [613]Contents ] [ [614]Next ] [ [615]Previous ] + + Unix versions, especially those for PCs (SCO, Unixware, etc) might be + augmented by third-party communication-board drivers from Digiboard, + Stallion, etc. These can sometimes complicate matters for Kermit + considerably since Kermit has no way of knowing that it is going + through a possibly nonstandard driver. Various examples are listed in + the earlier sections of this document; search for Stallion, Digiboard, + etc. Additionally: + + * The Stallion Technologies EasyConnection serial board driver does + not always report the state of DSR as low. From Stallion (October + 1997): "Unfortunately, this is a bug in our driver. We have + implemented all of the other TIOMC functions, eg DTR, DCD, RTS and + CTS, but not DSR. Our driver should report the actual state of DSR + on those of our cards that have a DSR signal. That the driver + always reports DSR as not asserted (0), is a bug in the driver. The + driver should be either reporting the state of DSR correctly on + those cards that support DSR or as always asserted (1) on those + cards that do not have a DSR signal. This will be fixed in a future + version of our drivers; at this time I cannot say when this will + be." And later, "As far as I can tell, we don't support the + termios/termiox ioctls that relate specifically to DSR and RI; all + the rest are supported. This will, as I mentioned earlier, be fixed + in the next release of our ATA software." + - World Wide Escalation Support, Stallion Technologies, Toowong + QLD, [616]support@stallion.oz.au. + + Later (December 1997, from the same source): + + * We have now released a new version of the ATA software, version + 5.4.0. This version fixes the problem with the states of the DSR + and RI signals and how they were being reported by the driver. This + is the problem that you reported in October. The DSR signal is + reported correctly on those cards that support the DSR signal, such + as the early revision of the EasyIO card and the EasyConnection 8D4 + panel, and as always asserted on those cards that do not support + the DSR signal in the hardware. The new driver is available from + our Web site, [617]www.stallion.com, in the /drivers/ata5/UnixWare + directory. + + [ [618]Top ] [ [619]Contents ] [ [620]C-Kermit Home ] [ [621]C-Kermit + 8.0 Overview ] [ [622]Kermit Home ] + __________________________________________________________________ + + C-Kermit 8.0 Unix Hints and Tips / [623]The Kermit Project / + [624]Columbia University / [625]kermit@columbia.edu + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ + 12. http://www.columbia.edu/ + 13. http://www.columbia.edu/kermit/ckubwr.html + 14. mailto:kermit-support@columbia.edu + 15. http://www.columbia.edu/kermit/ckermit.html + 16. http://www.columbia.edu/kermit/ckuins.html + 17. http://www.columbia.edu/kermit/ckututor.html + 18. http://www.columbia.edu/kermit/ckubwr.html#x1 + 19. http://www.columbia.edu/kermit/ckubwr.html#x2 + 20. http://www.columbia.edu/kermit/ckubwr.html#x3 + 21. http://www.columbia.edu/kermit/ckubwr.html#x4 + 22. http://www.columbia.edu/kermit/ckubwr.html#x5 + 23. http://www.columbia.edu/kermit/ckubwr.html#x6 + 24. http://www.columbia.edu/kermit/ckubwr.html#x7 + 25. http://www.columbia.edu/kermit/ckubwr.html#x8 + 26. http://www.columbia.edu/kermit/ckubwr.html#x9 + 27. http://www.columbia.edu/kermit/ckubwr.html#x10 + 28. http://www.columbia.edu/kermit/ckubwr.html#x11 + 29. http://www.columbia.edu/kermit/ckubwr.html#x12 + 30. http://www.columbia.edu/kermit/ckubwr.html#x13 + 31. http://www.columbia.edu/kermit/ckubwr.html#x14 + 32. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 33. http://www.columbia.edu/kermit/ckubwr.html#x3.18 + 34. http://www.columbia.edu/kermit/ckubwr.html#x3.19 + 35. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 36. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 37. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 38. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 39. http://www.columbia.edu/kermit/ckubwr.html#x3.13 + 40. http://www.columbia.edu/kermit/ckubwr.html#top + 41. http://www.columbia.edu/kermit/ckubwr.html#contents + 42. http://www.columbia.edu/kermit/ckubwr.html#x2 + 43. http://www.columbia.edu/kermit/ckubwr.html#x1.1 + 44. http://www.columbia.edu/kermit/ckubwr.html#x1.2 + 45. http://www.columbia.edu/kermit/ckubwr.html#x1.3 + 46. http://www.columbia.edu/kermit/ckubwr.html#x1.4 + 47. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 48. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 49. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 50. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 51. http://www.columbia.edu/kermit/ckcbwr.html + 52. mailto:kermit-support@columbia.edu + 53. http://www.columbia.edu/kermit/ckubwr.html#top + 54. http://www.columbia.edu/kermit/ckubwr.html#contents + 55. http://www.columbia.edu/kermit/ckubwr.html#x1.2 + 56. http://www.columbia.edu/kermit/ck60manual.html + 57. http://www.columbia.edu/kermit/ckermit70.html + 58. http://www.columbia.edu/kermit/ckermit80.html + 59. http://www.columbia.edu/kermit/ckermit90.html + 60. http://www.columbia.edu/kermit/ckubwr.html#top + 61. http://www.columbia.edu/kermit/ckubwr.html#contents + 62. http://www.columbia.edu/kermit/ckubwr.html#x1 + 63. http://www.columbia.edu/kermit/ckubwr.html#x1.3 + 64. http://www.columbia.edu/kermit/ckubwr.html#x1.1 + 65. http://www.columbia.edu/kermit/support.html + 66. http://www.columbia.edu/kermit/ckubwr.html#top + 67. http://www.columbia.edu/kermit/ckubwr.html#contents + 68. http://www.columbia.edu/kermit/ckubwr.html#x1 + 69. http://www.columbia.edu/kermit/ckubwr.html#x1.4 + 70. http://www.columbia.edu/kermit/ckubwr.html#x1.2 + 71. http://www.columbia.edu/kermit/ckubwr.html#top + 72. http://www.columbia.edu/kermit/ckubwr.html#contents + 73. http://www.columbia.edu/kermit/ckubwr.html#x1 + 74. http://www.columbia.edu/kermit/ckubwr.html#x1.3 + 75. http://www.columbia.edu/kermit/ckubwr.html#top + 76. http://www.columbia.edu/kermit/ckubwr.html#contents + 77. http://www.columbia.edu/kermit/ckubwr.html#x3 + 78. http://www.columbia.edu/kermit/ckubwr.html#x1 + 79. http://www.columbia.edu/kermit/ckubwr.html#top + 80. http://www.columbia.edu/kermit/ckubwr.html#contents + 81. http://www.columbia.edu/kermit/ckubwr.html#x4 + 82. http://www.columbia.edu/kermit/ckubwr.html#x2 + 83. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 84. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 85. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 86. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 87. http://www.columbia.edu/kermit/ckubwr.html#x3.4 + 88. http://www.columbia.edu/kermit/ckubwr.html#x3.5 + 89. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 90. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 91. http://www.columbia.edu/kermit/ckubwr.html#x3.8 + 92. http://www.columbia.edu/kermit/ckubwr.html#x3.9 + 93. http://www.columbia.edu/kermit/ckubwr.html#x3.10 + 94. http://www.columbia.edu/kermit/ckubwr.html#x3.11 + 95. http://www.columbia.edu/kermit/ckubwr.html#x3.12 + 96. http://www.columbia.edu/kermit/ckubwr.html#x3.13 + 97. http://www.columbia.edu/kermit/ckubwr.html#x3.14 + 98. http://www.columbia.edu/kermit/ckubwr.html#x3.15 + 99. http://www.columbia.edu/kermit/ckubwr.html#x3.16 + 100. http://www.columbia.edu/kermit/ckubwr.html#x3.17 + 101. http://www.columbia.edu/kermit/ckubwr.html#x3.18 + 102. http://www.columbia.edu/kermit/ckubwr.html#x3.19 + 103. http://www.columbia.edu/kermit/ckubwr.html#x3.20 + 104. http://www.faqs.org/ + 105. http://aplawrence.com/Unixart/newtounix.html + 106. http://www.columbia.edu/kermit/ckubwr.html#x3 + 107. mailto:kermit-support@columbia.edu + 108. http://www.columbia.edu/kermit/support.html + 109. http://www.columbia.edu/kermit/ckubwr.html#top + 110. http://www.columbia.edu/kermit/ckubwr.html#contents + 111. http://www.columbia.edu/kermit/ckubwr.html#x3 + 112. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 113. http://www.pcunix.com/ + 114. http://www.columbia.edu/kermit/ckubwr.html#x3.0.1 + 115. http://www.columbia.edu/kermit/ckubwr.html#x3.0.2 + 116. http://www.columbia.edu/kermit/ckubwr.html#x3.0.3 + 117. http://www.columbia.edu/kermit/ckubwr.html#x3.0.4 + 118. http://www.columbia.edu/kermit/ckubwr.html#x3.0.5 + 119. http://www.columbia.edu/kermit/ckubwr.html#x3.0.6 + 120. http://www.columbia.edu/kermit/ckubwr.html#top + 121. http://www.columbia.edu/kermit/ckubwr.html#contents + 122. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 123. http://www.columbia.edu/kermit/ckubwr.html#x3.0.2 + 124. http://www.columbia.edu/kermit/ckubwr.html#top + 125. http://www.columbia.edu/kermit/ckubwr.html#contents + 126. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 127. http://www.columbia.edu/kermit/ckubwr.html#x3.0.3 + 128. http://www.columbia.edu/kermit/ckubwr.html#x3.0.1 + 129. http://www.linmodems.org/ + 130. http://www.microsoft.com/hwdev/platform/PCdesign/LR/default.asp + 131. http://www.columbia.edu/kermit/ckubwr.html#top + 132. http://www.columbia.edu/kermit/ckubwr.html#contents + 133. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 134. http://www.columbia.edu/kermit/ckubwr.html#x3.0.4 + 135. http://www.columbia.edu/kermit/ckubwr.html#x3.0.2 + 136. http://www.idir.net/~gromitkc/winmodem.html + 137. http://www.digi.com/ + 138. http://www.columbia.edu/kermit/ckubwr.html#top + 139. http://www.columbia.edu/kermit/ckubwr.html#contents + 140. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 141. http://www.columbia.edu/kermit/ckubwr.html#x3.0.5 + 142. http://www.columbia.edu/kermit/ckubwr.html#x3.0.3 + 143. http://www.columbia.edu/kermit/ckubwr.html#top + 144. http://www.columbia.edu/kermit/ckubwr.html#contents + 145. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 146. http://www.columbia.edu/kermit/ckubwr.html#x3.0.6 + 147. http://www.columbia.edu/kermit/ckubwr.html#x3.0.4 + 148. http://www.columbia.edu/kermit/ckubwr.html#top + 149. http://www.columbia.edu/kermit/ckubwr.html#contents + 150. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 151. http://www.columbia.edu/kermit/ckubwr.html#x3.0.5 + 152. http://www.columbia.edu/kermit/ckubwr.html#top + 153. http://www.columbia.edu/kermit/ckubwr.html#contents + 154. http://www.columbia.edu/kermit/ckubwr.html#x3 + 155. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 156. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 157. http://www.columbia.edu/kermit/ckubwr.html#x3.1.1 + 158. http://www.columbia.edu/kermit/ckubwr.html#x3.1.2 + 159. http://www.columbia.edu/kermit/ckubwr.html#x3.1.3 + 160. http://www.columbia.edu/kermit/ckubwr.html#x3.1.4 + 161. http://www.columbia.edu/kermit/ckubwr.html#x3.1.5 + 162. http://www.emerson.emory.edu/services/aix-faq/ + 163. http://www.faqs.org/faqs/by-newsgroup/comp/comp.unix.aix.html + 164. http://www.cis.ohio-state.edu/hypertext/faq/usenet/aix-faq/top.html + 165. http://aixpdslib.seas.ucla.edu/ + 166. http://www.rootvg.net(AIXhistory)/ + 167. ftp://rtfm.mit.edu/pub/usenet/news.answers/aix-faq/part1 + 168. ftp://mirrors.aol.com/pub/rtfm/usenet-by-hierarchy/comp/unix/aix + 169. news:comp.unix.aix + 170. http://www.columbia.edu/kermit/ckubwr.html#top + 171. http://www.columbia.edu/kermit/ckubwr.html#contents + 172. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 173. http://www.columbia.edu/kermit/ckubwr.html#x3.1.2 + 174. http://www.columbia.edu/kermit/ckubwr.html#top + 175. http://www.columbia.edu/kermit/ckubwr.html#contents + 176. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 177. http://www.columbia.edu/kermit/ckubwr.html#x3.1.3 + 178. http://www.columbia.edu/kermit/ckubwr.html#x3.1.1 + 179. http://www.columbia.edu/kermit/security.html#servers + 180. http://www.columbia.edu/kermit/ckubwr.html#top + 181. http://www.columbia.edu/kermit/ckubwr.html#contents + 182. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 183. http://www.columbia.edu/kermit/ckubwr.html#x3.1.4 + 184. http://www.columbia.edu/kermit/ckubwr.html#x3.1.2 + 185. http://service.software.ibm.com/rs6000/ + 186. http://www.columbia.edu/kermit/ckubwr.html#top + 187. http://www.columbia.edu/kermit/ckubwr.html#contents + 188. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 189. http://www.columbia.edu/kermit/ckubwr.html#x3.1.5 + 190. http://www.columbia.edu/kermit/ckubwr.html#x3.1.3 + 191. http://www.columbia.edu/kermit/ckubwr.html#top + 192. http://www.columbia.edu/kermit/ckubwr.html#contents + 193. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 194. http://www.columbia.edu/kermit/ckubwr.html#x3.1.4 + 195. http://www.columbia.edu/kermit/ckubwr.html#top + 196. http://www.columbia.edu/kermit/ckubwr.html#contents + 197. http://www.columbia.edu/kermit/ckubwr.html#x3 + 198. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 199. http://www.columbia.edu/kermit/ckubwr.html#x3.1 + 200. http://www.columbia.edu/kermit/ckubwr.html#x3.2.0 + 201. http://www.columbia.edu/kermit/ckubwr.html#x3.2.1 + 202. http://www.columbia.edu/kermit/ckubwr.html#x3.2.2 + 203. http://www.columbia.edu/kermit/ckubwr.html#x3.2.3 + 204. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 205. http://www.columbia.edu/kermit/ckubwr.html#x3.2.5 + 206. news:comp.sys.hp.hpux + 207. http://www.columbia.edu/kermit/ckubwr.html#top + 208. http://www.columbia.edu/kermit/ckubwr.html#contents + 209. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 210. http://www.columbia.edu/kermit/ckubwr.html#x3.2.1 + 211. http://www.columbia.edu/kermit/ckubwr.html#top + 212. http://www.columbia.edu/kermit/ckubwr.html#contents + 213. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 214. http://www.columbia.edu/kermit/ckubwr.html#x3.2.2 + 215. http://www.columbia.edu/kermit/ckubwr.html#x3.2.0 + 216. ftp://kermit.columbia.edu/kermit/f/makefile + 217. http://www.columbia.edu/kermit/ckubwr.html#top + 218. http://www.columbia.edu/kermit/ckubwr.html#contents + 219. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 220. http://www.columbia.edu/kermit/ckubwr.html#x3.2.3 + 221. http://www.columbia.edu/kermit/ckubwr.html#x3.2.1 + 222. http://www.columbia.edu/kermit/ckubwr.html#top + 223. http://www.columbia.edu/kermit/ckubwr.html#contents + 224. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 225. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 226. http://www.columbia.edu/kermit/ckubwr.html#x3.2.2 + 227. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.1 + 228. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.2 + 229. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.3 + 230. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.4 + 231. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.5 + 232. http://www.columbia.edu/kermit/ckubwr.html#top + 233. http://www.columbia.edu/kermit/ckubwr.html#contents + 234. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 235. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.2 + 236. http://www.columbia.edu/kermit/ckubwr.html#x3.2.2 + 237. http://www.columbia.edu/kermit/ckubwr.html#top + 238. http://www.columbia.edu/kermit/ckubwr.html#contents + 239. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 240. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.3 + 241. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.1 + 242. http://www.columbia.edu/kermit/ckubwr.html#top + 243. http://www.columbia.edu/kermit/ckubwr.html#contents + 244. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 245. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.4 + 246. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.2 + 247. http://www.columbia.edu/kermit/ckubwr.html#top + 248. http://www.columbia.edu/kermit/ckubwr.html#contents + 249. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 250. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.5 + 251. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.3 + 252. http://www.columbia.edu/kermit/ckubwr.html#top + 253. http://www.columbia.edu/kermit/ckubwr.html#contents + 254. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 255. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4.4 + 256. http://www.columbia.edu/kermit/ckubwr.html#top + 257. http://www.columbia.edu/kermit/ckubwr.html#contents + 258. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 259. http://www.columbia.edu/kermit/ckubwr.html#x3.2.4 + 260. http://www.columbia.edu/kermit/ckubwr.html#top + 261. http://www.columbia.edu/kermit/ckubwr.html#contents + 262. http://www.columbia.edu/kermit/ckubwr.html#x3 + 263. http://www.columbia.edu/kermit/ckubwr.html#x3.4 + 264. http://www.columbia.edu/kermit/ckubwr.html#x3.2 + 265. http://www.columbia.edu/kermit/ckubwr.html#x3.3.1 + 266. http://www.columbia.edu/kermit/ckubwr.html#x3.3.2 + 267. http://www.columbia.edu/kermit/ckubwr.html#x3.3.3 + 268. http://www.columbia.edu/kermit/ckubwr.html#x3.3.4 + 269. http://www.columbia.edu/kermit/ckubwr.html#x3.3.5 + 270. http://www.columbia.edu/kermit/ckubwr.html#x3.3.6 + 271. http://en.wikipedia.org/wiki/Avahi_(software) + 272. news:comp.os.linux.misc + 273. news:comp.os.linux.answers + 274. http://www.tldp.org/ + 275. http://www.tldp.org/FAQ/Linux-FAQ.html + 276. http://www.tldp.org/HOWTO/Serial-HOWTO.html + 277. http://tldp.org/HOWTO/Modem-HOWTO.html + 278. ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO + 279. ftp://tsx-11.mit.edu/pub/linux/docs/HOWTO + 280. http://www.tldp.org/HOWTO/ + 281. http://www.tldp.org/hmirrors.html + 282. http://www.redhat.com/apps/support/ + 283. http://www.debian.org/support + 284. http://www.slackware.com/support/ + 285. http://www.caldera.com/support/ + 286. http://www.novell.com/support/microsites/microsite.do + 287. http://www.mandrake.com/support/ + 288. http://www.turbolinux.com/support/ + 289. http://www.linmodems.org/ + 290. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 291. http://linux.dreamtime.org/decnet/ + 292. mailto:kermit-support@columbia.edu + 293. http://www.linmodems.org/ + 294. http://www.columbia.edu/kermit/ckubwr.html#x3.0.2 + 295. http://www.columbia.edu/kermit/security.html#servers + 296. http://www.columbia.edu/kermit/sshclient.html + 297. http://www.columbia.edu/kermit/ckubwr.html#top + 298. http://www.columbia.edu/kermit/ckubwr.html#contents + 299. http://www.columbia.edu/kermit/ckubwr.html#x3 + 300. http://www.columbia.edu/kermit/ckubwr.html#x3.3.2 + 301. http://www.columbia.edu/kermit/ckubwr.html#top + 302. http://www.columbia.edu/kermit/ckubwr.html#contents + 303. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 304. http://www.columbia.edu/kermit/ckubwr.html#x3.3.3 + 305. http://www.columbia.edu/kermit/ckubwr.html#x3.3.1 + 306. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 307. http://www.columbia.edu/kermit/ckubwr.html#x6 + 308. http://www.columbia.edu/kermit/ckubwr.html#x7 + 309. http://www.columbia.edu/kermit/ckubwr.html#x8 + 310. http://www.columbia.edu/kermit/ckuins.html#x10 + 311. http://www.columbia.edu/kermit/ckuins.html#x11 + 312. http://www.columbia.edu/kermit/ckuins.html + 313. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 314. http://linuxwww.db.erau.edu/mail_archives/linux-kernel/Mar_98/1441.html + 315. http://www.columbia.edu/kermit/ckubwr.html#top + 316. http://www.columbia.edu/kermit/ckubwr.html#contents + 317. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 318. http://www.columbia.edu/kermit/ckubwr.html#x3.3.4 + 319. http://www.columbia.edu/kermit/ckubwr.html#x3.3.2 + 320. http://www.columbia.edu/kermit/ckubwr.html#x3.0.5 + 321. http://www.columbia.edu/kermit/ckfaq.html#term + 322. http://dickey.his.com/xterm/xterm.html + 323. http://dickey.his.com/xterm/xterm.html + 324. ftp://kermit.columbia.edu/kermit/f/xmodmap.txt + 325. http://www.columbia.edu/kermit/ckubwr.html#top + 326. http://www.columbia.edu/kermit/ckubwr.html#contents + 327. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 328. http://www.columbia.edu/kermit/ckubwr.html#x3.3.5 + 329. http://www.columbia.edu/kermit/ckubwr.html#x3.3.3 + 330. http://www.columbia.edu/kermit/ckubwr.html#top + 331. http://www.columbia.edu/kermit/ckubwr.html#contents + 332. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 333. http://www.columbia.edu/kermit/ckubwr.html#x3.3.6 + 334. http://www.columbia.edu/kermit/ckubwr.html#x3.3.4 + 335. http://www.columbia.edu/kermit/ckermit.html + 336. mailto:kermit-support@columbia.edu + 337. http://www.redhat.com/support/errata/RHBA-2001-153.html + 338. news:comp.protocols.kermit.misc + 339. http://www.columbia.edu/kermit/ckubwr.html#top + 340. http://www.columbia.edu/kermit/ckubwr.html#contents + 341. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 342. http://www.columbia.edu/kermit/ckubwr.html#x3.3.5 + 343. http://www.columbia.edu/kermit/ckubwr.html#top + 344. http://www.columbia.edu/kermit/ckubwr.html#contents + 345. http://www.columbia.edu/kermit/ckubwr.html#x3 + 346. http://www.columbia.edu/kermit/ckubwr.html#x3.5 + 347. http://www.columbia.edu/kermit/ckubwr.html#x3.3 + 348. http://www.columbia.edu/kermit/ckubwr.html#top + 349. http://www.columbia.edu/kermit/ckubwr.html#contents + 350. http://www.columbia.edu/kermit/ckubwr.html#x3 + 351. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 352. http://www.columbia.edu/kermit/ckubwr.html#x3.4 + 353. news:comp.os.qnx + 354. http://www.columbia.edu/kermit/gkermit.html + 355. http://www.columbia.edu/kermit/ckuins.html#x10 + 356. http://www.columbia.edu/kermit/ckuins.html + 357. http://www.columbia.edu/kermit/ckubwr.html#top + 358. http://www.columbia.edu/kermit/ckubwr.html#contents + 359. http://www.columbia.edu/kermit/ckubwr.html#x3 + 360. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 361. http://www.columbia.edu/kermit/ckubwr.html#x3.5 + 362. http://www.columbia.edu/kermit/ckubwr.html#x3.6.1 + 363. http://www.columbia.edu/kermit/ckubwr.html#x3.6.2 + 364. http://www.columbia.edu/kermit/ckubwr.html#x3.6.3 + 365. http://www.columbia.edu/kermit/ckubwr.html#x3.6.4 + 366. http://www.columbia.edu/kermit/ckubwr.html#x3.10 + 367. http://aplawrence.com/SCOFAQ/ + 368. http://www.zenez.com/cgi-bin/scoprogfaq/faq.pl + 369. http://www.zenez.com/cgi-bin/scouw7faq/faq.pl + 370. http://zenez.pcunix.com/cgi-bin/scouw7faq/faq.pl + 371. http://pcunix.com/Unixart/modems.html + 372. http://www.freebird.org/faq/ + 373. http://www.freebird.org/faq/developer.html + 374. http://support.caldera.com/caldera + 375. http://stage.caldera.com/ta/ + 376. http://aplawrence.com/newtosco.html + 377. http://www.columbia.edu/kermit/ckubwr.html#x3.0.5 + 378. http://www.columbia.edu/kermit/ckfaq.html#term + 379. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 380. http://www.columbia.edu/kermit/ckubwr.html#top + 381. http://www.columbia.edu/kermit/ckubwr.html#contents + 382. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 383. http://www.columbia.edu/kermit/ckubwr.html#x3.6.1 + 384. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 385. http://www.columbia.edu/kermit/ckubwr.html#top + 386. http://www.columbia.edu/kermit/ckubwr.html#contents + 387. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 388. http://www.columbia.edu/kermit/ckubwr.html#x3.6.3 + 389. http://www.columbia.edu/kermit/ckubwr.html#x3.6.1 + 390. http://www.digi.com/ + 391. ftp://ftp.fu-berlin.de/pub/unix/driver/fas + 392. http://www.columbia.edu/kermit/ckubwr.html#x14 + 393. http://www.sco.com/ + 394. ftp://ftp.sco.com/ + 395. http://www.columbia.edu/kermit/ckubwr.html#top + 396. http://www.columbia.edu/kermit/ckubwr.html#contents + 397. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 398. http://www.columbia.edu/kermit/ckubwr.html#x3.6.4 + 399. http://www.columbia.edu/kermit/ckubwr.html#x3.6.2 + 400. http://www.columbia.edu/kermit/ckubwr.html#x3.10 + 401. http://www.columbia.edu/kermit/ckubwr.html#top + 402. http://www.columbia.edu/kermit/ckubwr.html#contents + 403. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 404. http://www.columbia.edu/kermit/ckubwr.html#x3.6.3 + 405. http://www.columbia.edu/kermit/ckubwr.html#top + 406. http://www.columbia.edu/kermit/ckubwr.html#contents + 407. http://www.columbia.edu/kermit/ckubwr.html#x3 + 408. http://www.columbia.edu/kermit/ckubwr.html#x3.8 + 409. http://www.columbia.edu/kermit/ckubwr.html#x3.6 + 410. http://www.columbia.edu/kermit/ckubwr.html#x3.7.1 + 411. http://www.columbia.edu/kermit/ckubwr.html#x3.7.2 + 412. http://www.columbia.edu/kermit/ckubwr.html#x3.7.3 + 413. http://www.columbia.edu/kermit/ckubwr.html#x3.7.4 + 414. http://www.columbia.edu/kermit/ckubwr.html#x3.7.5 + 415. news:comp.unix.solaris + 416. http://access1.sun.com/ + 417. http://docs.sun.com/ + 418. http://www.sunhelp.com/ + 419. http://www.wins.uva.nl/pub/solaris/solaris2/ + 420. http://www.wins.uva.nl/cgi-bin/sfaq.cgi + 421. ftp://ftp.wins.uva.nl/pub/solaris + 422. http://www.science.uva.nl/pub/solaris/solaris2.html + 423. http://www.stokely.com/ + 424. http://www.stokely.com/unix.sysadm.resources/faqs.sun.html + 425. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 426. http://www.columbia.edu/kermit/ckubwr.html#top + 427. http://www.columbia.edu/kermit/ckubwr.html#contents + 428. http://www.columbia.edu/kermit/ckubwr.html#x3 + 429. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 430. http://www.columbia.edu/kermit/ckubwr.html#x3.7.2 + 431. http://www.columbia.edu/kermit/ckubwr.html#top + 432. http://www.columbia.edu/kermit/ckubwr.html#contents + 433. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 434. http://www.columbia.edu/kermit/ckubwr.html#x3.7.3 + 435. http://www.columbia.edu/kermit/ckubwr.html#x3.7.1 + 436. http://www.columbia.edu/kermit/ckubwr.html#top + 437. http://www.columbia.edu/kermit/ckubwr.html#contents + 438. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 439. http://www.columbia.edu/kermit/ckubwr.html#x3.7.4 + 440. http://www.columbia.edu/kermit/ckubwr.html#x3.7.2 + 441. http://www.columbia.edu/kermit/ckubwr.html#top + 442. http://www.columbia.edu/kermit/ckubwr.html#contents + 443. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 444. http://www.columbia.edu/kermit/ckubwr.html#x3.7.5 + 445. http://www.columbia.edu/kermit/ckubwr.html#x3.7.3 + 446. news:comp.os.vms + 447. http://www.columbia.edu/kermit/ckubwr.html#top + 448. http://www.columbia.edu/kermit/ckubwr.html#contents + 449. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 450. http://www.columbia.edu/kermit/ckubwr.html#x3.7.6 + 451. http://www.columbia.edu/kermit/ckubwr.html#x3.7.4 + 452. http://www.columbia.edu/kermit/ckubwr.html#top + 453. http://www.columbia.edu/kermit/ckubwr.html#contents + 454. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 455. http://www.columbia.edu/kermit/ckubwr.html#x3.7.5 + 456. http://www.columbia.edu/kermit/ckubwr.html#top + 457. http://www.columbia.edu/kermit/ckubwr.html#contents + 458. http://www.columbia.edu/kermit/ckubwr.html#x3 + 459. http://www.columbia.edu/kermit/ckubwr.html#x3.9 + 460. http://www.columbia.edu/kermit/ckubwr.html#x3.7 + 461. http://www.stokely.com/ + 462. http://access1.sun.com/ + 463. http://www.ludd.luth.se/~bear/project/sun/sun.hardware.txt + 464. ftp://ftp.netcom.com/pub/ru/rubicon/sun.hdwr.ref + 465. ftp://ftp.intnet.net/pub/SUN/Sun-Hardware-Ref + 466. http://www.columbia.edu/kermit/ckubwr.html#top + 467. http://www.columbia.edu/kermit/ckubwr.html#contents + 468. http://www.columbia.edu/kermit/ckubwr.html#x3 + 469. http://www.columbia.edu/kermit/ckubwr.html#x3.10 + 470. http://www.columbia.edu/kermit/ckubwr.html#x3.8 + 471. news:comp.unix.ultrix + 472. news:comp.sys.dec + 473. http://www.columbia.edu/kermit/ckubwr.html#top + 474. http://www.columbia.edu/kermit/ckubwr.html#contents + 475. http://www.columbia.edu/kermit/ckubwr.html#x3 + 476. http://www.columbia.edu/kermit/ckubwr.html#x3.11 + 477. http://www.columbia.edu/kermit/ckubwr.html#x3.9 + 478. http://www.freebird.org/ + 479. http://www.freebird.org/faq/ + 480. news:comp.unix.unixware.misc + 481. news:comp.unix.sco.misc + 482. http://www.columbia.edu/kermit/ckubwr.html#x3.0 + 483. ftp://kermit.columbia.edu/kermit/f/ckutio.c + 484. http://www.columbia.edu/kermit/ckubwr.html#top + 485. http://www.columbia.edu/kermit/ckubwr.html#contents + 486. http://www.columbia.edu/kermit/ckubwr.html#x3 + 487. http://www.columbia.edu/kermit/ckubwr.html#x3.12 + 488. http://www.columbia.edu/kermit/ckubwr.html#x3.10 + 489. http://www.columbia.edu/kermit/ckubwr.html#top + 490. http://www.columbia.edu/kermit/ckubwr.html#contents + 491. http://www.columbia.edu/kermit/ckubwr.html#x3 + 492. http://www.columbia.edu/kermit/ckubwr.html#x3.13 + 493. http://www.columbia.edu/kermit/ckubwr.html#x3.11 + 494. http://www.columbia.edu/kermit/ckubwr.html#top + 495. http://www.columbia.edu/kermit/ckubwr.html#contents + 496. http://www.columbia.edu/kermit/ckubwr.html#x3 + 497. http://www.columbia.edu/kermit/ckubwr.html#x3.14 + 498. http://www.columbia.edu/kermit/ckubwr.html#x3.12 + 499. http://www.columbia.edu/kermit/ckubwr.html#top + 500. http://www.columbia.edu/kermit/ckubwr.html#contents + 501. http://www.columbia.edu/kermit/ckubwr.html#x3 + 502. http://www.columbia.edu/kermit/ckubwr.html#x3.15 + 503. http://www.columbia.edu/kermit/ckubwr.html#x3.13 + 504. news:comp.sys.sgi.misc + 505. news:comp.sys.sgi.admin + 506. http://www.sgi.com/ + 507. http://www-viz.tamu.edu/~sgi-faq/ + 508. ftp://viz.tamu.edu/pub/sgi/faq/ + 509. http://www.columbia.edu/kermit/ckuins.html + 510. http://freeware.sgi.com/Installable/gcc-2.95.2.html + 511. http://freeware.sgi.com/Installable/gcc-2.95.2.html + 512. http://www.columbia.edu/kermit/ckubwr.html#top + 513. http://www.columbia.edu/kermit/ckubwr.html#contents + 514. http://www.columbia.edu/kermit/ckubwr.html#x3 + 515. http://www.columbia.edu/kermit/ckubwr.html#x3.16 + 516. http://www.columbia.edu/kermit/ckubwr.html#x3.14 + 517. news:comp.sys.be + 518. http://www.columbia.edu/kermit/ckubwr.html#top + 519. http://www.columbia.edu/kermit/ckubwr.html#contents + 520. http://www.columbia.edu/kermit/ckubwr.html#x3 + 521. http://www.columbia.edu/kermit/ckubwr.html#x3.17 + 522. http://www.columbia.edu/kermit/ckubwr.html#x3.15 + 523. http://www.columbia.edu/kermit/ckubwr.html#top + 524. http://www.columbia.edu/kermit/ckubwr.html#contents + 525. http://www.columbia.edu/kermit/ckubwr.html#x3 + 526. http://www.columbia.edu/kermit/ckubwr.html#x3.18 + 527. http://www.columbia.edu/kermit/ckubwr.html#x3.16 + 528. http://www.columbia.edu/kermit/ckubwr.html#top + 529. http://www.columbia.edu/kermit/ckubwr.html#contents + 530. http://www.columbia.edu/kermit/ckubwr.html#x3 + 531. http://www.columbia.edu/kermit/ckubwr.html#x3.19 + 532. http://www.columbia.edu/kermit/ckubwr.html#x3.17 + 533. http://www.columbia.edu/kermit/ckubwr.html#top + 534. http://www.columbia.edu/kermit/ckubwr.html#contents + 535. http://www.columbia.edu/kermit/ckubwr.html#x3 + 536. http://www.columbia.edu/kermit/ckubwr.html#x3.20 + 537. http://www.columbia.edu/kermit/ckubwr.html#x3.18 + 538. http://www.columbia.edu/kermit/mac.html + 539. http://www.amazon.com/gp/product/B0000VYJRY?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B0000VYJRY + 540. http://www.columbia.edu/kermit/ckuins.html#x10 + 541. http://www.columbia.edu/kermit/ckuins.html + 542. http://www.amazon.com/gp/product/B000FX61MS?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B000FX61MS + 543. mailto:kermit@columbia.edu + 544. http://www.columbia.edu/kermit/ckubwr.html#top + 545. http://www.columbia.edu/kermit/ckubwr.html#contents + 546. http://www.columbia.edu/kermit/ckubwr.html#x3 + 547. http://www.columbia.edu/kermit/ckubwr.html#x3.19 + 548. http://www.uni-giessen.de/faq/archiv/coherent-faq.general/msg00000.html + 549. http://www.columbia.edu/kermit/ckubwr.html#top + 550. http://www.columbia.edu/kermit/ckubwr.html#contents + 551. http://www.columbia.edu/kermit/ckubwr.html#x5 + 552. http://www.columbia.edu/kermit/ckubwr.html#x3 + 553. http://www.columbia.edu/kermit/ckccfg.html + 554. http://www.columbia.edu/kermit/ckubwr.html#top + 555. http://www.columbia.edu/kermit/ckubwr.html#contents + 556. http://www.columbia.edu/kermit/ckubwr.html#x6 + 557. http://www.columbia.edu/kermit/ckubwr.html#x4 + 558. http://www.columbia.edu/kermit/ckuins.html + 559. http://www.columbia.edu/kermit/ckubwr.html#top + 560. http://www.columbia.edu/kermit/ckubwr.html#contents + 561. http://www.columbia.edu/kermit/ckubwr.html#x7 + 562. http://www.columbia.edu/kermit/ckubwr.html#x5 + 563. http://www.columbia.edu/kermit/ckuins.html#9.5 + 564. http://www.columbia.edu/kermit/ckubwr.html#x3 + 565. http://www.columbia.edu/kermit/ckubwr.html#top + 566. http://www.columbia.edu/kermit/ckubwr.html#contents + 567. http://www.columbia.edu/kermit/ckubwr.html#x8 + 568. http://www.columbia.edu/kermit/ckubwr.html#x6 + 569. http://www.columbia.edu/kermit/ckuins.html#x8 + 570. http://www.columbia.edu/kermit/ckuins.html + 571. http://www.columbia.edu/kermit/ck60manual.html + 572. http://www.columbia.edu/kermit/cable.html + 573. http://www.columbia.edu/kermit/ckubwr.html#top + 574. http://www.columbia.edu/kermit/ckubwr.html#contents + 575. http://www.columbia.edu/kermit/ckubwr.html#x9 + 576. http://www.columbia.edu/kermit/ckubwr.html#x7 + 577. http://www.columbia.edu/kermit/ckubwr.html#top + 578. http://www.columbia.edu/kermit/ckubwr.html#contents + 579. http://www.columbia.edu/kermit/ckubwr.html#x10 + 580. http://www.columbia.edu/kermit/ckubwr.html#x8 + 581. http://www.columbia.edu/kermit/ck60manual.html + 582. http://dickey.his.com/xterm/xterm.html + 583. http://www.columbia.edu/kermit/ckubwr.html#top + 584. http://www.columbia.edu/kermit/ckubwr.html#contents + 585. http://www.columbia.edu/kermit/ckubwr.html#x11 + 586. http://www.columbia.edu/kermit/ckubwr.html#x9 + 587. http://www.columbia.edu/kermit/ckubwr.html#top + 588. http://www.columbia.edu/kermit/ckubwr.html#contents + 589. http://www.columbia.edu/kermit/ckubwr.html#x12 + 590. http://www.columbia.edu/kermit/ckubwr.html#x10 + 591. http://www.columbia.edu/kermit/ckubwr.html#x11.1 + 592. http://www.columbia.edu/kermit/ckubwr.html#x11.2 + 593. http://www.columbia.edu/kermit/ckubwr.html#top + 594. http://www.columbia.edu/kermit/ckubwr.html#contents + 595. http://www.columbia.edu/kermit/ckubwr.html#x11 + 596. http://www.columbia.edu/kermit/ckubwr.html#x11.2 + 597. http://www.columbia.edu/kermit/ck60manual.html + 598. http://www.columbia.edu/kermit/ckubwr.html#top + 599. http://www.columbia.edu/kermit/ckubwr.html#contents + 600. http://www.columbia.edu/kermit/ckubwr.html#x11 + 601. http://www.columbia.edu/kermit/ckubwr.html#x11.1 + 602. http://www.columbia.edu/kermit/ck60manual.html + 603. http://www.columbia.edu/kermit/ckubwr.html#top + 604. http://www.columbia.edu/kermit/ckubwr.html#contents + 605. http://www.columbia.edu/kermit/ckubwr.html#x13 + 606. http://www.columbia.edu/kermit/ckubwr.html#x11 + 607. http://www.columbia.edu/kermit/security.html + 608. http://www.columbia.edu/kermit/ckubwr.html#top + 609. http://www.columbia.edu/kermit/ckubwr.html#contents + 610. http://www.columbia.edu/kermit/ckubwr.html#x14 + 611. http://www.columbia.edu/kermit/ckubwr.html#x12 + 612. http://www.columbia.edu/kermit/ckubwr.html#top + 613. http://www.columbia.edu/kermit/ckubwr.html#contents + 614. http://www.columbia.edu/kermit/ckubwr.html#x15 + 615. http://www.columbia.edu/kermit/ckubwr.html#x14 + 616. mailto:support@stallion.oz.au + 617. http://www.stallion.com/ + 618. http://www.columbia.edu/kermit/ckubwr.html#top + 619. http://www.columbia.edu/kermit/ckubwr.html#contents + 620. http://www.columbia.edu/kermit/ckermit.html + 621. http://www.columbia.edu/kermit/ck80.html + 622. http://www.columbia.edu/kermit/index.html + 623. http://www.columbia.edu/kermit/index.html + 624. http://www.columbia.edu/ + 625. mailto:kermit@columbia.edu diff --git a/ckuins.txt b/ckuins.txt new file mode 100644 index 0000000..5670616 --- /dev/null +++ b/ckuins.txt @@ -0,0 +1,3575 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + +C-Kermit 9.0 Installation Instructions and Options for Unix + + [ [11]Contents ] [ [12]C-Kermit ] [ [13]Kermit Home ] + + Frank da Cruz + The Kermit Project + Columbia University + + As of C-Kermit version: 9.0.300, 30 June 2011 + This file last updated: Tue Jun 28 08:28:08 2011 (New York City + time) + + IF YOU ARE READING A PLAIN-TEXT version of this document, it is a + plain-text copy of a Web page. You can visit the original (and possibly + more up-to-date) Web page here: + +[14]http://www.columbia.edu/kermit/ckuins.html + +CONTENTS + + [15]OVERVIEW + 1. [16]INTERNET QUICK START + 2. [17]INSTALLING FROM PACKAGES + 3. [18]INSTALLING PREBUILT BINARIES + 4. [19]BUILDING FROM SOURCE CODE + 5. [20]INSTALLING THE KERMIT FILES + 6. [21]INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES + 7. [22]CHECKING THE RESULTS + 8. [23]REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE + 9. [24]UNIX VERSIONS + 10. [25]DIALING OUT AND COORDINATING WITH UUCP + 11. [26]RUNNING UNIX C-KERMIT SETUID OR SETGID + 12. [27]CONFIGURING UNIX WORKSTATIONS + 13. [28]BIZARRE BEHAVIOR AT RUNTIME + 14. [29]CRASHES AND CORE DUMPS + 15. [30]SYSLOGGING + 16. [31]BUILDING SECURE VERSIONS OF C-KERMIT 9.0 + 17. [32]INSTALLING C-KERMIT AS AN SSH SERVER SUBSYSTEM + +OVERVIEW + + [ [33]Top ] [ [34]Contents ] [ [35]Next ] + + WARNING: This document contains notes that have been accumulating + since the mid 1980s. Many of the products and Unix versions + mentioned here have not been heard of in a long while, but that does + not necessarily mean they are not still running in some obscure + nook. + + This file contains Unix-specific information. A lot of it. Unlike most + other packages, C-Kermit tries very hard to be portable to every Unix + variety (and every release of each one) known to exist, including many + that are quite old, as well as to other platforms like VMS, AOS/VS, + VOS, OS-9, the BeBox, the Amiga, etc. + + Since C-Kermit gets so deeply into the file system, i/o system, and + other areas that differ radically from one Unix platform to the next, + this means that a lot can go wrong when you try to install C-Kermit on + (for example) a new release of a particular variety of Unix, in which + certain things might have changed that C-Kermit depended upon. + + This file concentrates on installation. For a description of general + configuration options for C-Kermit, please read the [36]Configurations + Options document. For troubleshooting after installation, see the + [37]General Hints and Tips and [38]Unix-Specific Hints and Tips + documents. The latter, in particular, contains lots of information on + lots of specific Unix platforms. If you want to work on the source + code, see the [39]C-Kermit Program Logic Manual + + You may install C-Kermit: + + * From an "[40]install package", if one is available. + * As a [41]prebuilt binary, if available, plus accompanying text + files. + * By building from [42]source code. + +1. INTERNET QUICK START + + [ [43]Top ] [ [44]Contents ] [ [45]Next ] [ [46]Previous ] + + If your Unix computer is on the Internet and it has a C compiler, + here's how to download, build, and install C-Kermit directly from the + "tarballs" or Zip archives: + + 1. Make a fresh directory and cd to it. + 2. Download the C-Kermit source code: + [47]ftp://www.columbia.edu/kermit/archives/cku211.tar.Z (compress + format) or [48]ftp://www.columbia.edu/kermit/archives/cku211.tar.gz + (gunzip format). If those links don't work, FTP transfers are being + blocked; try these HTTP links instead: + [49]http://kermit.columbia.edu/ftp/archives/cku211.tar.Z (compress + format) or + [50]http://kermit.columbia.edu/ftp/archives/cku211.tar.gz (gunzip + format). + 3. Uncompress the compressed tar file with "uncompress" or "gunzip", + according to which type of compressed file you downloaded. (If you + don't understand this, you could download a (much larger) + uncompressed tar archive directly: + [51]ftp://www.columbia.edu/kermit/archives/cku211.tar or + [52]http://kermit.columbia.edu/ftp/archives/cku211.tar + 4. Now type "tar xvf cku211.tar" to unpack the individual files from + the tar archive. + 5. Type "rm cku211.tar" to get rid of the tar archive, which is no + longer needed. + 6. Read the comments at the top of the makefile to find out which + target to use and then type the appropriate "make" command, such as + "make linux", "make solaris8", etc. + 7. This produces a binary in your current directory called "wermit". + Start it by typing "./wermit" and [53]try it out to make sure it + works. Then read [54]Section 5 for how to install it, or simply + copy the wermit binary to the desired public directory, rename it + to kermit, and give it the needed permissions (and, if it is going + to be used to dial out, give it the same group and owner and + permissions as the cu, tip, or minicom program). + + For secure installations, see [55]Sections 5 and [56]16. + +2. INSTALLING FROM PACKAGES + + [ [57]Top ] [ [58]Contents ] [ [59]Next ] [ [60]Previous ] + + Various Unix varieties -- Linux, Solaris, AIX, etc -- now incorporate + the idea of "install packages", and many users expect to find all new + applications in this format. A selection of install packages might be + available for any given release of C-Kermit, but there is a tradeoff + between convenience and safety. Unix presents several notable problems + to the builder of install packages: + + a. Since C-Kermit is portable to many non-Unix platforms (VMS, VOS, + AOS/VS, etc), some of the files in the C-Kermit distribution do not + fit into the Unix application model. In particular, C-Kermit + includes some plain text files (described in [61]Section 5) and + Unix has no standard place to put such files. Typical Unix package + managers do not allow for them. Where should they go, and how will + the user know where to find them? + b. Installation of any program that will be used to make modem calls + requires some important decisions from the installer regarding + security and privilege. + + Item (b) is discussed at length in [62]Sections 10 and [63]11 of this + document, but the package-related aspects are also given here. The + basic problem is that Unix dialout devices and the UUCP "lock files" + that regulate contention for them (described in [64]Section 10) are + usually protected against "world". Therefore, the install procedure + must either run as root in order to give the Kermit binary the required + permissions, group, and/or owner, or else the dialout devices and + associated directories must be open for group or world reading and + writing. Otherwise, the Kermit program just installed WILL NOT WORK for + dialing out. + + Thus, a well-crafted installation procedure should present the options + and allow the installer to choose the method, if any, for regulating + access to the dialout devices: + + a. Check the permissions of the lockfile directory and the dialout + devices. If they do not allow group or world R/W access, then: + b. "Your UUCP lockfile directory and/or dialout devices require + privilege to access. You must either change their permissions or + install Kermit with privileges." + c. "If you wish to install Kermit with privileges, it will be given + the same owner, group, and permissions as the cu program so it can + use the dialout devices." (This is increasingly problematic as some + newer Unix systems like Mac OS X don't have a cu program, or even a + serial port!) + d. If they choose (c) but the user is not root, give a message that + the install procedure can be run only by root and then quit. + + It should go without saying, of course, that any binaries that are to + be included in an install package should be built fresh on the exact + platform (e.g. Red Hat 8.0 on Intel) for which the package is targeted; + prebuilt binaries ([65]next section) from other sites are likely to + have library mismatches. [66]CLICK HERE for more about building + C-Kermit install packages. + + The Kermit Project does not have the resources or the expertise to make + install packages for every platform. Most install packages, therefore, + are contributed by others, and they do not necessarily follow the + guidelines given above. Pay attention to what they do. + + If you are an end user who has obtained a C-Kermit install package for + a particular platform, you should be aware that some additional steps + might needed if you want to use Kermit to dial out. Read [67]Section 10 + for details. + +3. INSTALLING PREBUILT BINARIES + + [ [68]Top ] [ [69]Contents ] [ [70]Next ] [ [71]Previous ] + + Hundreds of prebuilt C-Kermit binaries are available on the CDROM in + the BINARY tree [NOTE: The C-Kermit CDROM is still for version 7.0], + and at our ftp site in the [72]kermit/bin area (with names starting + with "ck"), also accessible on the [73]C-Kermit website. To install a + prebuilt binary: + + a. Rename the binary to "wermit". + b. Make sure it works; some tests are suggested in [74]Section 7. + c. Follow steps (b) through (e) in [75]Section 4. + d. Install related files as described in [76]Section 5. + + But first... Please heed the following cautions: + + a. If you pick the wrong binary, it won't work (or worse). + b. Even when you pick the appropriate binary, it still might not work + due to shared-library mismatches, etc. (see [77]Section 4.0). + c. Don't expect a binary built on or for version n of your OS to work + on version n - x (where x > 0). However, it is supposed to be safe + to run a binary built on (or for) an older OS release on a newer + one (but is [78]increasingly less so as time-honored principles of + stability and backwards compatibility go fading into obscurity). + + Therefore, it is always better to build your own binary from source + code ([79]next section) if you can. But since it is increasingly common + for Unix systems (not to mention VMS and other OS's) to be delivered + without C compilers, it is sometimes not possible. In such cases, try + the most appropriate prebuilt binary or binaries, and if none of them + work, [80]contact us and we'll see what we can do to help. + +4. BUILDING FROM SOURCE CODE + + [ [81]Top ] [ [82]Contents ] [ [83]Next ] [ [84]Previous ] + + Also see: [85]Section 8 and [86]Section 9. + + C-Kermit is designed to be built and used on as many platforms as + possible: Unix and non-Unix, old and new (and ancient), ANSI C and K&R. + The Unix version does not use or depend on any external tools for + building except the "make" utility, the C compiler, the linker, and the + shell. It does not use any external automated configuration tools such + as configure, autoconf, automake, libtool, etc. Everything in C-Kermit + has been built by hand based on direct experience or reports or + contributions from users of each platform. + + The [87]C-Kermit makefile contains the rules for building the program + for each of the hundreds of different kinds of Unix systems that + C-Kermit attempts to support. It covers all Unix variations since about + 1980 -- pretty much everything after Unix V6. Separate makefiles are + used for [88]Plan 9 and [89]2.x BSD. + + Prerequisites: + + * The C compiler, linker, and make program must be installed. + * The C libraries and header files must be installed (*). + * The C-Kermit source code and makefile in your current directory. + * The C-Kermit text files ([90]Section 5) in your current directory. + + * This is becoming problematic in this new age of "selective + installs" e.g. of Linux packages. C-Kermit builds will often fail + because replying "no" to some obscure Linux installation option + will result in missing libraries or header files. Ditto on + platforms like AIX and Solaris that don't come with C compilers, + and then later have gcc installed, but are still missing crucial + libraries, like libm (math). + + Plus: + + * For TCP/IP networking support, the sockets library and related + header files must be installed. + * The math library for floating-point arithmetic support (can be + deselected by adding -DNOFLOAT to CFLAGS and removing -lm from + LIBS). + * Many and varied security libraries for building a secure version + (Kerberos, SSL/TLS, SRP, Zlib,...) These are required only if you + select a secure target. + * For the curses-based fullscreen file-ransfer display, the curses or + ncurses header file(s) and library, and probably also the termcap + and/or termlib library. Note that the names and locations of these + files and libraries are likely to change capriciously with every + new release of your Unix product. If you discover that the C-Kermit + build procedure fails because your curses and/or termxxx headers or + libraries are not named or located as expected, please [91]let us + know. In the meantime, work around by installing symlinks. + * IMPORTANT: Modern Linux distributions might give you the choice + during installation of whether to install the "ncurses development + package" (perhaps called "ncurses-devel"). If you did not install + it, you won't be able to build C-Kermit with curses support + included. In this case, either go back and install ncurses, or else + choose (or create) a non-curses makefile target for your platform. + To install the ncurses developers tools in Red Hat Linux, do + "apt-get install ncurses-developer" or if you have the CD: + +mount redhat cdrom +goto RedHat/RPMS +rpm -ivh ncurses-devel*.rpm +or to have the exact name ls ncurse* and load as +rpm -ivh filename +then leave the cdrom and unmount it. + + * In AIX you might have to go back and install any or all of: + +bos.adt.base +bos.adt.include +bos.adt.lib +bos.adt.libm +bos.adt.utils + + from the first installation CD. + + Depending on where you got it, the makefile might need to be renamed + from ckuker.mak to makefile. Directions: + + a. Type "make xxx" where xxx is the name of the makefile target most + appropriate to your platform, e.g. "make linux", "make aix43", etc. + Read the [92]comments at the top of the makefile for a complete + list of available targets (it's a long list). + b. Test the resulting 'wermit' file (see [93]Section 7 for + suggestions). If it's OK, proceed; otherwise [94]notify us. + + NOTE: steps (c) through (e) can be accomplished using the + [95]makefile 'install' target as described in [96]Section 5.4. + c. Rename the 'wermit' file to 'kermit', copy it to the desired binary + directory (such as /usr/local/bin or /opt/something), and if it is + to be used for dialing out, give it the same owner, group, and + permissions as the 'cu' program (IMPORTANT: read [97]Sections 10 + and [98]11 for details). + d. Install the man page, ckuker.nr, with your other man pages. + e. Install the accompanying text files (see [99]Section 5). + f. If you want C-Kermit to also offer a Telnet command-line + personality, make a symbolic link as follows: + +cd directory-where-kermit-binary-is +ln -s kermit telnet + + If you want C-Kermit to be the default Telnet client, make sure the + directory in which you created the symlink is in the PATH ahead of + the where the regular Telnet client is. + g. If you want C-Kermit to also offer an FTP command-line personality, + make a symlink called "ftp" as in (f). + h. If you want C-Kermit to also offer an FTTP command-line + personality, make a symlink called "http" as in (f). + i. If you want to offer an Internet Kermit Service, follow the + directions in the [100]IKSD Administrator's Guide. + +4.0. Special Considerations for C-Kermit 8.0-9.0 + + [ [101]Top ] [ [102]Contents ] [ [103]Next ] + + Also see: [104]C-Kermit Configuration Options + + SECTION CONTENTS + +4.1. [105]The Unix Makefile +4.2. [106]The C-Kermit Initialization File +4.3. [107]The 2.x BSD Makefile +4.4. [108]The Plan 9 Makefile +4.5. [109]Makefile Failures + + (Also see the [110]Configurations Options document, [111]Section 8). + + Lots of new features have been added in versions 7.0 and 8.0 that + require access to new symbols, APIs, libraries, etc, and this will no + doubt cause problems in compiling, linking, or execution on platforms + where 6.0 and earlier built without incident. This section contains + what we know as of the date of this file. + + The first category concerns the new Kermit Service Daemon (IKSD; see + the [112]IKSD Administrator's Guide for details): + + The wtmp File + When C-Kermit is started as an IKSD (under inetd), it makes + syslog and wtmp entries, and also keeps its own ftpd-like log. + The code assumes the wtmp log is /var/log/wtmp on Linux and + /usr/adm/wtmp elsewhere. No doubt this assumption will need + adjustment. Use -DWTMPFILE=path to override at compile time + (there is also a runtime override). See [113]iksd.html for + details. + + UTMP, utsname(), etc + C-Kermit 7.0 gets as much info as it can about its job -- mainly + for IKSD logging -- from utmp. But of course utmp formats and + fields differ, and for that matter, there can be two different + header files, and . Look for HAVEUTMPX and + HAVEUTHOST in [114]ckufio.c and let me know of any needed + adjustments. + + Password lookup + IKSD needs to authenticate incoming users against the password + list. In some cases, this requires the addition of -lcrypt (e.g. + in Unixware 2.x). In most others, the crypt functions are in the + regular C library. If you get "crypt" as an unresolved symbol at + link time, add -lcrypt to LIBS. If your site has local + replacement libraries for authentication, you might need a + special LIBS clause such as "LIBS=-L/usr/local/lib -lpwent". + + These days most Unix systems take advantage of shadow password + files or Pluggable Authentication Modules (PAM). If your system + uses shadow passwords you must add -DCK_SHADOW to the CFLAGS + list. If your system requires PAM you must add -DCK_PAM to the + CFLAGS and -lpam -ldl to LIBS. + + getusershell() + This is called by the IKSD at login time to see if a user has + been "turned off". But many Unix platforms lack this function. + In that case, you will get unresolved symbol reports at link + time for _getusershell, _endusershell; to work around, add + -DNOGETUSERSHELL. + + initgroups() + This is called by IKSD after successful authentication. But some + platforms do not have this function, so obviously it can't be + called there, in which case add -DNOINITGROUPS. + + setreuid(), setreuid(), setregid() not found or "deprecated" + Find out what your Unix variety wants you to use instead, and + make appropriate substitutions in routine zvpass(), module + [115]ckufio.c, and [116]let us know. + + printf() + IKSD installs a printf() substitute to allow redirection of + printf-like output to the connection. However, this can conflict + with some curses libraries. In this case, separate binaries must + be built for IKSD and non-IKSD use. + + If you encounter difficulties with any of the above, and you are not + interested in running C-Kermit as an IKSD, then simply add NOIKSD to + CFLAGS and rebuild. Example: + +make sco286 +(get lots of errors) +make clean +make sco286 "KFLAGS=-DNOIKSD" + + Some non-IKSD things to watch out for: + + Return type of main() + The main() routine is in [117]ckcmai.c. If you get complaints + about "main: return type is not blah", define MAINTYPE on the CC + command line, e.g.: + +make xxx "KFLAGS=-DMAINTYPE=blah + + (where blah is int, long, or whatever). If the complaint is + "Attempt to return a value from a function of type void" then + add -DMAINISVOID: + +make xxx "KFLAGS=-DMAINISVOID=blah + + DNS Service Records + This feature allows a remote host to redirect C-Kermit to the + appropriate socket for the requested service; e.g. if C-Kermit + requests service "telnet" and the host offers Telnet service on + port 999 rather than the customary port 23. If you get + compile-time complaints about not being able to find , + , or , add -DNO_DNS_SRV to CFLAGS. If + you get link-time complaints about unresolved symbols res_search + or dn_expand, try adding -lresolve to LIBS. + + \v(ipaddress) + If "echo \v(ipaddress)" shows an empty string rather than your + local IP address, add -DCKGHNLHOST to CFLAGS and rebuild. + + + If this file can't be found at compile time, add -DNOREDIRECT to + CFLAGS. This disables the REDIRECT and PIPE commands and + anything else that needs the wait() system service. + + syslog() + C-Kermit can now write syslog records. Some older platforms + might not have the syslog facility. In that case, add + -DNOSYSLOG. Others might have it, but require addition of + -lsocket to LIBS (SCO OSR5 is an example). See [118]Section 15. + + putenv() + If "_putenv" comes up as an undefined symbol, add -DNOPUTENV to + CFLAGS and rebuild. + + "Passing arg1 of 'time' from incompatible pointer" + This is a mess. See the mass of #ifdefs in the appropriate + module, [119]ckutio.c or [120]ckufio.c. + + gettimeofday() + Wrong number of arguments. On most platforms, gettimeofday() + takes two arguments, but on a handful of others (e.g. Motorola + System V/88 V4, SNI Reliant UNIX 5.43, etc) it takes one. If + your version of gettimeofday() is being called with two args but + wants one, add -DGTODONEARG. + + "Assignment makes pointer from integer without a cast" + This warning might appear in [121]ckutio.c or [122]ckufio.c. (or + elsewhere), and usually can be traced to the use of a system or + library function that returns a pointer but that is not declared + in the system header files even though it should be. Several + functions are commonly associated with this error: + + + getcwd(): Add -DDCLGETCWD to CFLAGS and rebuild. + + popen() : Add -DDCLPOPEN to CFLAGS and rebuild. + + fdopen(): Add -DDCLFDOPEN to CFLAGS and rebuild. + + "Operands of = have incompatible types" + "Incompatible types in assignment" + If this comes from [123]ckcnet.c and comes from a statement + involving inet_addr(), try adding -DINADDRX to CFLAGS. If that + doesn't help, then try adding -DNOMHHOST. + + Complaints about args to get/setsockopt(), getpeername(), getsockname() + These are all in [124]ckcnet.c. Different platforms and OS's and + versions of the same OS change this all the time: int, size_t, + unsigned long, etc. All the affected variables are declared + according to #ifdefs within ckcnet.c, so find the declarations + and adjust the #ifdefs accordingly. + + size_t + In case of complaints about "unknown type size_t", add + -DSIZE_T=int (or other appropriate type) to CFLAGS. + + 'tz' undefined + Use of undefined enum/struct/union 'timezone' + Left of 'tv_sec' specifies undefined struct/union 'timeval' And + similar complaints in [125]ckutio.c: Add -DNOGFTIMER and/or + -DNOTIMEVAL. + + Symlinks + The new built-in DIRECTORY command should show symlinks like "ls + -l" does. If it does not, check to see if your platform has the + lstat() and readlink() functions. If so, add -DUSE_LSTAT and + -DCKSYMLINK to CFLAGS and rebuild. On the other hand, if lstat() + is unresolved at link time, add -DNOLSTAT to CFLAGS. If + readlink() is also unresolved, add -DNOSYMLINK. + + realpath() + Link-time complains about realpath() -- find the library in + which it resides and add it to LIBS (example for Unixware 7.1: + "-lcudk70") or add -DNOREALPATH to CFLAGS and rebuild. If built + with realpath() but debug log file is truncated or mangled, + ditto (some realpath() implementations behave differently from + others). If built with realpath() and seemingly random core + dumps occur during file path resolution, ditto. + + Failure to locate header file + Usually happens on Linux systems that have the C compiler + installed, but not the ncurses package (see comments about + selective installs above). Go back and install ncurses, or use + "make linuxnc" (Linux No Curses). + + "Can't find shared library libc.so.2.1" + "Can't find shared library libncurses.so.3.0", etc... + You are trying to run a binary that was built on a computer that + has different library versions than your computer, and your + computer's loader is picky about library version numbers. + Rebuild from source on your computer. + + Time (struct tm) related difficulties: + Errors like the following: + +"ckutio.c", line 11994: incomplete struct/union/enum tm: _tm +"ckutio.c", line 11995: error: cannot dereference non-pointer type +"ckutio.c", line 11995: error: assignment type mismatch +"ckutio.c", line 11997: warning: using out of scope declaration: localtime +"ckutio.c", line 11997: error: unknown operand size: op "=" +"ckutio.c", line 11997: error: assignment type mismatch +"ckutio.c", line 11998: error: undefined struct/union member: tm_year +"ckutio.c", line 12000: error: undefined struct/union member: tm_mon +"ckutio.c", line 12001: error: undefined struct/union member: tm_mday +"ckutio.c", line 12002: error: undefined struct/union member: tm_hour +"ckutio.c", line 12003: error: undefined struct/union member: tm_min +"ckutio.c", line 12004: error: undefined struct/union member: tm_sec + + are due to failure to include the appropriate time.h header + files. Unix platforms generally have one or more of the + following: , , and . Any + combination of these might be required. Defaults are set up for + each makefile target. The defaults can be corrected on the CC + command line by adding the appropriate definition from the + following list to CFLAGS: + +-DTIMEH Include +-DNOTIMEH Don't include +-DSYSTIMEH Include +-DNOSYSTIMEH Don't include +-DSYSTIMEBH Include +-DNOSYSTIMEBH Don't include + + Note that is relatively scarce in the System V and + POSIX environments; the only platform of recent vintage where it + was/is used is OSF/1 and its derivatives (Digital Unix and Tru64 + Unix). + + Struct timeval and/or timezone not declared: + In some cases, merely including the appropriate time.h header + files is still not enough. POSIX.1 does not define the timeval + struct, and so the items we need from the header are protected + against us by #ifndef _POSIX_SOURCE or somesuch. In this case, + we have to declare the timeval (and timezone) structs ourselves. + To force this, include -DDCLTIMEVAL in CFLAGS. + + Warnings about dn_expand() Argument #4 + WARNING: argument is incompatible with prototyp. It's the old + char versus unsigned char stupidity again. Try to find a + compiler switch like GCC's "-funsigned-char". Failing that, add + -DCKQUERYTYPE=xxx to CFLAGS, where xxx is whatever 'man + dn_expand' tells you the type of the 4th argument should be + (presumably either char or unsigned char; in the latter case use + CHAR to avoid confusion caused by multiple words. + + Switch Table Overflow (in [126]ckcuni.c) + Add -DNOUNICODE to CFLAGS. + + Compile-time warnings about ck_out() or tgetstr() or tputs(): + Easy solution: Add -DNOTERMCAP to CFLAGS. But then you lose the + SCREEN function. Real solution: Try all different combinations + of the following CFLAGS: + +-DTPUTSARGTYPE=char -DTPUTSFNTYPE=int +-DTPUTSARGTYPE=int -DTPUTSFNTYPE=void + + Until the warnings go away, except maybe "ck_outc: return with a + value in a function returning void", and in that case also add + -DTPUTSISVOID. + + "Passing arg 1 of to tputs() makes pointer from integer without a + cast": + Add -DTPUTSARG1CONST to CFLAGS. + + "Undefined symbol: dup2" + Add -DNOZEXEC to CFLAGS. + + "header file 'termcap.h' not found" + Add -DNOHTERMCAP to CFLAGS. + + Other difficulties are generally of the "where is curses.h and what is + it called this week?" variety (most easily solved by making symlinks in + the include and lib directories), or overzealous complaints regarding + type mismatches in function calls because of the totally needless and + silly signed versus unsigned char conflict (*), etc. In any case, + please send any compilation or linking warnings or errors to the + author, preferably along with fixes. + + * C-Kermit does not use the signed property of chars at all anywhere, + ever. So if all chars and char *'s can be made unsigned at compile + time, as they can in gcc with "-funsigned-char", they should be. + + IMPORTANT: If you find any of these hints necessary for a particular + make target (or you hit upon others not listed here), PLEASE SEND A + REPORT TO: + +[127]kermit-support@columbia.edu + +4.1. The Unix Makefile + + [ [128]Top ] [ [129]Contents ] [ [130]Section Contents ] [ [131]Next ] + [ [132]Previous ] + + If your distribution does not contain a file with the name "makefile" + or "Makefile", then rename the file called ckuker.mak to makefile: + +mv ckuker.mak makefile + + Then type "make xxx", where xxx is the platform you want to build + C-Kermit for. These are listed in the [133]comments at the top of the + makefile. For example, to build C-Kermit for Linux, type: + +make linux + + Here are some typical examples: + + Target Description + linux Linux, any version on any hardware platform + openbsd OpenBSD, any version on any hardware platform + aix43 AIX 4.3 + aix43g AIX 4.3, built with gcc + solaris9 Solaris 9 + solaris9g Solaris 9 built with gcc + hpux1100 HP-UX 11-point-anything + + The makefile is quite long, and at least two versions of Unix, SCO + Xenix/286 and 2.x BSD, cannot cope with its length. An attempt to "make + sco286" gives the message "Make: Cannot alloc mem for env.. Stop". + Solution: edit away some or all of the nonrelevant material from the + makefile. (A separate version of the makefile is provided for BSD 2.x: + ckubs2.mak but C-Kermit 8.0 can't be built for BSD 2.x -- it has simply + grown too large.) + + Some make programs reportedly cannot handle continued lines (lines + ending in backslash (\)). If you have a problem with the makefile, try + editing the makefile to join the continued lines (remove the + backslashes and the following linefeed). + + Other makefile troubles may occur because tabs in the makefile have + somehow been converted to spaces. Spaces and tabs are distinct in Unix + makefiles. + + Similarly, carriage returns might have been added to the end of each + line, which also proves confusing to most Unix versions of make. + + Check to see if there are comments about your particular version in its + makefile target itself. In a text editor such as EMACS or VI, search + for the make entry name followed by a colon, e.g. "linux:" (if you + really are building C-Kermit for Linux, do this now). + + Check to see if there are comments about your particular version in the + [134]ckubwr.txt file ([135]CLICK HERE for the Web version). + + If you have trouble with building [136]ckwart.c, or running the + resulting wart preprocessor program on [137]ckcpro.w: + + 1. Just "touch" the [138]ckcpro.c file that comes in the distribution + and then give the "make" command again, or: + 2. Compile ckwart.c "by hand": cc -o wart ckwart.c, or: + 3. Try various other tricks. E.g. one Linux user reported that that + adding the "static" switch to the rule for building wart fixed + everything: + +wart: ckwart.$(EXT) + $(CC) -static -o wart ckwart.$(EXT) $(LIBS) + + If your compiler supports a compile-time option to treat ALL chars (and + char *'s, etc) as unsigned, by all means use it -- and send me email to + let me know what it is (I already know about gcc -funsigned-char). + + To add compilation options (which are explained later in this document) + to your makefile target without editing the makefile, include + "KFLAGS=..." on the make command line, for example: + +make linux KFLAGS=-DNODEBUG +make bsd "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET" + + Multiple options must be separated by spaces. Quotes are necessary if + the KFLAGS= clause includes spaces. The KFLAGS are added to the end of + the CFLAGS that are defined in the selected makefile target. For + example, the "bsd" entry includes -DBSD4 -DTCPSOCKET, so the second + example above compiles Kermit with the following options: + +-DBSD4 -DTCPSOCKET -DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET + + (Notice how "-UTCPSOCKET" is used to negate the effect of the + "-DTCPSOCKET" option that is included in the makefile target.) + + WARNING: Be careful with KFLAGS. If you build C-Kermit, change some + files, and then run make again using the same make entry but specifying + different KFLAGS than last time, make won't detect it and you could + easily wind up with inconsistent object modules, e.g. some of them + built with a certain option, others not. When in doubt, "make clean" + first to make sure all your object files are consistent. Similarly, if + you change CFLAGS, LIBS, or any other items in the makefile, or you + rebuild using a different makefile target, "make clean" first. + + If you create a new makefile target, use static linking if possible. + Even though this makes your C-Kermit binary bigger, the resulting + binary will be more portable. Dynamically linked binaries tend to run + only on the exact configuration and version where they were built; on + others, invocation tends to fail with a message like: + +Can't find shared library "libc.so.2.1" + +4.2. The C-Kermit Initialization File + + [ [139]Top ] [ [140]Contents ] [ [141]Section Contents ] [ [142]Next ] + [ [143]Previous ] + + (This section is obsolete.) Read [144]Section 5 about the + initialization file. + +4.3. The 2.x BSD Makefile + + [ [145]Top ] [ [146]Contents ] [ [147]Section Contents ] [ [148]Next ] + [ [149]Previous ] + + This section is obsolete. C-Kermit 6.0 was the last release that + could be built on PDP-11 based BSD versions. + +4.4. The Plan 9 Makefile + + [ [150]Top ] [ [151]Contents ] [ [152]Section Contents ] [ [153]Next ] + [ [154]Previous ] + + Use the separate makefile [155]ckpker.mk. NOTE: The Plan 9 version of + C-Kermit 8.0 has not yet been built. There should be no impediment to + building it. However, even when built successfully, certain key + features are missing, notably TCP/IP networking. + +4.5. Makefile Failures + + [ [156]Top ] [ [157]Contents ] [ [158]Section Contents ] [ + [159]Previous ] + + First, be sure the source files are stored on your current disk and + directory with the right names (in lowercase). Second, make sure that + the makefile itself does not contain any lines with leading spaces: + indented lines must all start with horizontal TAB, and no spaces. + + Then make sure that your Unix PATH is defined to find the appropriate + compiler for your makefile target. For example, on SunOS systems, "make + sunos41" builds C-Kermit for the BSD environment, and assumes that + /usr/ucb/cc will be used for compilation and linking. If your PATH has + /usr/5bin ahead of /usr/ucb, you can have problems at compile or link + time (a commonly reported symptom is the inability to find "ftime" + during linking). Fix such problems by redefining your Unix PATH, or by + specifying the appropriate "cc" in CC= and CC2= statements in your + makefile target. + + During edits 166-167, considerable effort went into making C-Kermit + compilable by ANSI C compilers. This includes prototyping all of + C-Kermit's functions, and including the ANSI-defined system header + files for system and library functions, as defined in K&R, second + edition: , , (except in NeXTSTEP this is + ), and . If you get warnings about any of these + header files not being found, or about argument mismatches involving + pid_t, uid_t, or gid_t, look in ckcdeb.h and make amendments. C-Kermit + assumes it is being compiled by an ANSI-compliant C compiler if + __STDC__ is defined, normally defined by the compiler itself. You can + force ANSI compilation without defining __STDC__ (which some compilers + won't let you define) by including -DCK_ANSIC on the cc command line. + + On the other hand, if your compiler defines __STDC__ but still + complains about the syntax of Kermit's function prototypes, you can + disable the ANSI-style function prototyping by including -DNOANSI on + the command line. + + For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick + the most appropriate [160]makefile target, and be sure you have + installed an SCO development system that is keyed to your exact SCO + operating system release, down to the minor version (like 2.3.1). + + Also note that SCO distributes some of its libraries in encrypted form, + and they must be decrypted before C-Kermit can be linked with them. If + not, you might see a message like: + +ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365 + + To decrypt, you must supply a key (password) that came with your + license. Call SCO for further info. + + If your compiler uses something other than int for the pid (process id) + data type, put -DPID_T=pid_t or whatever in your CFLAGS. + + If you get complaints about unknown data types uid_t and gid_t, put + -DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the + appropriate types. + + If your compilation fails because of conflicting or duplicate + declarations for sys_errlist, add -DUSE_STRERROR or -DNDSYSERRLIST to + CFLAGS. + + If your compilation dies because getpwnam() is being redeclared (or + because of "conflicting types for getwpnam"), add -DNDGPWNAM to your + CFLAGS. If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see + ckufio.c around line 440). + + If the compiler complains about the declaration of getpwnam() during an + ANSI C compilation, remove the declaration from ckufio.c or change the + argument in the prototype from (char *) to (const char *). + + If you get complaints that getpwuid() is being called with an improper + type, put -DPWID_T=xx in your CFLAGS. + + If you get compile-time warnings that t_brkc or t_eofc (tchars + structure members, used in BSD-based versions) are undefined, or + structure-member- related warnings that might be traced to this fact, + add -DNOBRKC to CFLAGS. + + If you get a linker message to the effect that _setreuid or _setregid + is not defined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=blah to + CFLAGS to make C-Kermit read the right -kind-of-file to pick + up these definitions. + + If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS. + + If you get a complaint at compile time about an illegal pointer-integer + combination in ckufio.c involving popen(), or at link time that _popen + is an undefined symbol, add the declaration "FILE *popen();" to the + function zxcmd() in ckufio.c (this declaration is supposed to be in + ). If making this change does not help, then apparently your + Unix does not have the popen() function, so you should add -DNOPOPEN to + your make entry, in which case certain functions involving "file" i/o + to the standard input and output of subprocesses will not be available. + + If your linker complains that _getcwd is undefined, you can add a + getcwd() function to ckufio.c, or add it to your libc.a library using + ar: + +#include + +char * +getcwd(buf,size) char *buf; int size; { +#ifndef NOPOPEN +#ifdef DCLPOPEN + FILE *popen(); +#endif + FILE *pfp; + + if (!buf) return(NULL); + if (!(pfp = popen("pwd","r"))) return(NULL); + fgets(buf,size-2,pfp); + pclose(pfp); + buf[strlen(buf)-1] = '\0'; + return((char *)buf); +#else + buf[0] = '\0'; + return(NULL); +#endif /* NOPOPEN */ +} + +#ifdef NOPOPEN +FILE *popen(s,t) char *s,*t; { + return(NULL); +} +#endif /* NOPOPEN */ + + If you get complaints about NPROC having an invalid value, add a valid + definition for it (depends on your system), as in the cray entry. + + If you get some symbol that's multiply defined, it probably means that + a variable name used by Kermit is also used in one of your system + libraries that Kermit is linked with. For example, under PC/IX some + library has a variable or function called "data", and the variable + "data" is also used extensively by Kermit. Rather than edit the Kermit + source files, just put a -D in the make entry CFLAGS to change the + Kermit symbol at compile time. In this example, it might be + -Ddata=xdata. + + Some symbol is defined in your system's header files, but it produces + conflicts with, or undesired results from, Kermit. Try undefining the + symbol in the makefile target's CFLAGS, for example -UFIONREAD. + + Some well-known symbol is missing from your system header files. Try + defining in the makefile target's CFLAGS, for example -DFREAD=1. + + You get many warnings about pointer mismatches. This probably means + that Kermit is assuming an int type for signal() when it should be + void, or vice-versa. Try adding -DSIG_I (for integer signal()) or + -DSIG_V (for void) to CFLAGS. Or just include KFLAGS=-DSIG_V (or + whatever) in your "make" command, for example: + +make bsd KFLAGS=-DSIG_V + + You get many messages about variables that are declared and/or set but + never used. It is difficult to avoid these because of all the + conditional compilation in the program. Ignore these messages. + + Some of C-Kermit's modules are so large, or contain so many character + string constants, or are so offensive in some other way, that some C + compilers give up and refuse to compile them. This is usually because + the -O (optimize) option is included in the make entry. If this happens + to you, you can (a) remove the -O option from the make entry, which + will turn off the optimizer for ALL modules; or (b) compile the + offending module(s) by hand, including all the switches from make entry + except for -O, and then give the appropriate "make" command again; or + (c) increase the value of the -Olimit option, if your compiler supports + this option; or (d) change the [161]makefile target to first compile + each offending module explicitly without optimization, then compile the + others normally (with optimization), for example: + +#Fortune 32:16, For:Pro 2.1 (mostly like 4.1bsd) +ft21: + @echo 'Making C-Kermit $(CKVER) for Fortune 32:16 For:Pro 2.1...' + $(MAKE) ckuusx.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \ + -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" + $(MAKE) ckuxla.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \ + -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" + $(MAKE) ckudia.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \ + -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" + $(MAKE) wermit "CFLAGS= -O -DNODEBUG -DBSD4 -DFT21 -DNOFILEH -SYM 800 \ + -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" \ + "LNKFLAGS= -n -s" "LIBS= -lcurses -ltermcap -lv -lnet" + + As an extreme example, some compilers (e.g. gcc on the DG AViiON) have + been known to dump core when trying to compile ckwart.c with + optimization. So just do this one "by hand": + +cc -o wart ckwart.c + + or: + +touch ckcpro.c + + and then give the "make" command again. + + Speaking of wart, it is unavoidable that some picky compilers might + generate "statement unreachable" messages when compiling ckcpro.c. + Unreachable statements can be generated by the wart program, which + generates ckcpro.c automatically from [162]ckcpro.w, which translates + lex-like state/input constructions into a big switch/case construction. + + Some function in Kermit wreaks havoc when it is called. Change all + invocations of the function into a macro that evaluates to the + appropriate return code that would have been returned by the function + had it been called and failed, for example: -Dzkself()=0. Obviously not + a good idea if the function is really needed. + + If you have just installed SunOS 4.1.2 or 4.1.3, you might find that + C-Kermit (and any other C program) fails to link because of unresolved + references from within libc. This is because of a mistake in Sun's + /usr/lib/shlib.etc files for building the new libc. Change the libc + Makefile so that the "ld" lines have "-ldl" at the end. Change the + README file to say "mv xccs.multibyte. xccs.multibyte.o" and follow + that instruction. + +5. INSTALLING THE KERMIT FILES + + [ [163]Top ] [ [164]Contents ] [ [165]Next ] [ [166]Previous ] + + SECTION CONTENTS + +5.1. [167]The C-Kermit Initialization File +5.2. [168]Text Files +5.3. [169]Installing the Kermit Files +5.4. [170]The Makefile Install Target + + The C-Kermit executable does not need any external files to run. + Unlike, say, the cu program, which on most platforms is useless unless + you (as root) edit the /usr/spool/uucp/Systems and + /usr/spool/uucp/Devices files to supply whatever obscure and + undocumented syntax is required to match some supposedly user-friendly + mnemonic to the real pathname of whatever device you want to use, + Kermit runs on its own without needing any external configuration + files, and lets you refer to device (and network hosts and services) by + their own natural undisguised names. + + Nevertheless, a number of external files can be installed along with + the C-Kermit executable if you wish. These include configuration and + customization files that are read by Kermit as well as documentation + files to be read by people. All of this material is (a) optional, and + (b) available on the Kermit website: + +[171]http://www.columbia.edu/kermit/ + + and usually in a more pleasant form, perhaps also with updated content. + So if your computer is on the Internet, there is no need to install + anything but the Kermit executable if users know how to find the Kermit + website (and if they don't, Kermit's "help" command tells them). + +5.1. The C-Kermit Initialization File + + In C-Kermit 7.0 and earlier, the standard initialization file was a key + C-Kermit component because: + + a. It "loaded" the dialing and network directories. + b. It defined all the macros and variables for the services directory. + c. It defined macros for quickly changing Kermit's file-transfer + performance tuning. + + The standard initialization file is quite long (more than 600 lines) + and requires noticeable processing time (the slower the computer, the + more noticeable), yet few people actually use the services directory, + whose definition takes up most of its bulk. Meanwhile, in C-Kermit 8.0, + many of the remaining functions of the standard initialization file are + now built in; for example, the FAST, CAUTIOUS, and ROBUST commands. + + More to the point, many of the settings that could be made only in the + initialization and customization files can now be picked up from + environment variables. The first group identifies initialization and + directory files: + + CKERMIT_INI + The path of your Kermit initialization file, if any. This + overrides the built-in search for $HOME/.kermrc. + + K_CHARSET + The character set used for encoding local text files. Equivalent + to SET FILE CHARACTER-SET. + + K_DIAL_DIRECTORY + The full pathname of one or more Kermit dialing directory files. + Equivalent to SET DIAL DIRECTORY. + + K_NET_DIRECTORY + The full pathname of one or more Kermit network directory files. + Equivalent to SET NETWORK DIRECTORY. + + K_INFO_DIRECTORY + K_INFO_DIR + The full pathname of a directory containing Kermit (if any) + containing ckubwr.txt and other Kermit text files. Overrides + Kermit's built-in search for this directory. + + The next group is related to dialing modems: + + K_COUNTRYCODE + The telephonic numeric country code for this location, e.g. 1 + for North America or 39 for Italy. It is recommended that this + one be set for all users, system-wide. Not only is it used to + process portable-format dialing directory entries, but it is + also compared against Kermit's built-in list of "tone countries" + to see if tone dialing can be used. Equivalent to Kermit's SET + DIAL COUNTRY-CODE command. + + K_AREACODE + The telephonic numeric area code for this location, e.g. 212 for + Manhattan, New York, USA. Recommend this one also be set + system-wide, so shared portable-format dialing directories will + work automatically for everybody. Equivalent to Kermit's SET + DIAL AREA-CODE command. + + K_DIAL_METHOD + TONE or PULSE. Equivalent to Kermit's SET DIAL METHOD command. + If a dial method is not set explicitly (or implicitly from the + country code), Kermit does not specify a dialing method, and + uses the modem's default method, which tends to be pulse. + + K_INTL_PREFIX + The telephonic numeric international dialing prefix for this + location. Equivalent to Kermit's SET DIAL INTL-PREFIX command. + + K_LD_PREFIX + The telephonic numeric long-distance dialing prefix for this + location. Equivalent to Kermit's SET DIAL LD-PREFIX command. + + K_PBX_ICP + The telephonic numeric PBX internal call prefix for this + location. Equivalent to Kermit's SET DIAL PBX-INSIDE-PREFIX + command. + + K_PBX_OCP + The telephonic numeric PBX external call prefix for this + location. Equivalent to Kermit's SET DIAL PBX-OUTSIDE-PREFIX + command. + + K_PBX_XCH + The telephonic numeric PBX exchange (first part of the + subscriber number). Equivalent to Kermit's SET DIAL PBX-EXCHANGE + command. + + K_TF_AREACODE + A list of one or more telephonic numeric toll-free area codes. + + K_TF_PREFIX + The telephonic numeric toll-free dialing prefix, in case it is + different from the long-distance prefix. Equivalent to Kermit's + SET DIAL TF-PREFIX command. + + The final group includes well-known environment variables that are also + used by Kermit: + + CDPATH + Where the CD command should look for relative directory names. + + SHELL + The path of your Unix shell. Used by the RUN (!) command to + choose the shell to execute its arguments. + + USER + Your Unix username. + + EDITOR + The name or path of your preferred editor (used by the EDIT + command). Equivalent to SET EDITOR. + + BROWSER + The name or path of your preferred web browser (used by the + BROWSE command). Equivalent to Kermit's SET BROWSER command. + + Does this mean the initialization file can be abolished? I think so. + Here's why: + + * Kermit already does everything most people want it to do without + one. + * Important site-specific customizations can be done with global + environment variables. + * There is no longer any need for everybody to have to use the + standard initialization file. + * This means that your initialization file, if you want one, can + contain your own personal settings, definitions, and preferences, + rather than 600 lines of "standard" setups. + * If you still want the services directory, you can either TAKE the + standard initialization file (which must be named anything other + than $HOME/.kermrc to avoid being executed automatically every time + you start Kermit), or you can make it a kerbang script and execute + it "directly" (the [172]makefile install target does this for you + by putting ckermit.ini in the same directory as the Kermit binary, + adding the appropriate Kerbang line to the top, and giving it + execute permission). + + In fact, you can put any number of kerbang scripts in your PATH to + start up C-Kermit in different ways, to have it adopt certain settings, + make particular connections, execute complicated scripts, whatever you + want. + +5.2. Text Files + + These are entirely optional. Many of them are to be found at the Kermit + website in HTML form (i.e. as Web pages with clickable links, etc), and + very likely also more up to date. Plain-text files that correspond to + Web pages were simply "dumped" by Lynx from the website to plain ASCII + text. The format is whatever Lynx uses for this purpose. If you wish, + you can install them on your computer as described in the [173]next + section. + + [174]COPYING.TXT + Copyright notice, permissions, and disclaimer. + + [175]ckermit.ini + The standard initialization file, intended more for reference + (in most cases) than actual use; see [176]Section 5.1. + + [177]ckermod.ini + A sample customization file. + + [178]ckermit70.txt + Supplement to [179]Using C-Kermit for version 7.0. Available on + the Kermit website as: + [180]http://www.columbia.edu/kermit/ckermit70.html + + [181]ckermit80.txt + Supplement to [182]Using C-Kermit for version 8.0. Available on + the Kermit website as: + [183]http://www.columbia.edu/kermit/ckermit80.html + + [184]ckcbwr.txt + The general C-Kermit hints and tips ("beware") file. Available + on the Kermit website as: + [185]http://www.columbia.edu/kermit/ckcbwr.html + + [186]ckubwr.txt + The Unix-specific C-Kermit hints and tips file. Available on the + Kermit website as: + [187]http://www.columbia.edu/kermit/ckubwr.html + + [188]ckuins.txt + Unix C-Kermit Installation Instructions (this file). Available + on the Kermit website as: + [189]http://www.columbia.edu/kermit/ckuins.html + + [190]ckccfg.txt + C-Kermit compile-time configuration options. Available on the + Kermit website as: + [191]http://www.columbia.edu/kermit/ckccfg.html + + [192]ckcplm.txt + The C-Kermit program logic manual. Available on the Kermit + website as: + [193]http://www.columbia.edu/kermit/ckcplm.html + + [194]ca_certs.pem + Certificate Authority certificates for secure connections (see + [195]Section 16). + +5.3. Installing the Kermit Files + + There is an "install" target in the [196]makefile that you can use if + you wish. However, since every site has its own layout and + requirements, it is often better to install the Kermit files by hand. + You don't have to use the makefile install target to install C-Kermit. + This is especially true since not all sites build C-Kermit from source, + and therefore might not even have the makefile. But you should read + this section in any case. + + If your computer already has an older version of C-Kermit installed, + you should rename it (e.g. to "kermit6" or "kermit7") so in case you + have any trouble with the new version, the old one is still + available. + + In most cases, you need to be root to install C-Kermit, if only to gain + write access to directories in which the binary and manual page are to + be copied. The C-Kermit binary should be installed in a directory that + is in the users' PATH, but that is not likely to be overwritten when + you install a new version of the operating system. A good candidate + would be the /usr/local/bin/ directory, but the specific choice is site + dependent. Example (assuming the appropriate Kermit binary is stored in + your current directory as "wermit", e.g. because you just built it from + source and that's the name the makefile gave it): + +mv wermit /usr/local/bin/kermit +chmod 755 /usr/local/bin/kermit + + or (only after you finish reading this section!) simply: + +make install + + IMPORTANT: IF C-KERMIT IS TO BE USED FOR DIALING OUT, you must also do + something to give it access to the dialout devices and lockfile + directories. The 'install' target does not attempt to set Kermit's + owner, group, and permissions to allow dialing out. This requires + privileges, open eyes, and human decision-making. Please read + [197]Sections 10 and [198]11 below, make the necessary decisions, and + then implement them by hand as described in those sections. + + You should also install the man page, which is called ckuker.nr, in the + man page directory for local commands, such as /usr/man/man1/, renamed + appropriately, e.g. to kermit.1. This is also taken care of by "make + install". + + Optionally, the text files listed in the [199]previous section can be + placed in a publicly readable directory. Suggested directory names are: + +/usr/local/doc/kermit/ +/usr/local/lib/kermit/ +/usr/share/lib/kermit/ +/opt/kermit/doc/ + + (or any of these without the "/kermit"). Upon startup, C-Kermit checks + the following environment variables whose purpose is to specify the + directory where the C-Kermit text files are, in the following order: + +K_INFO_DIRECTORY +K_INFO_DIR + + If either of these is defined, C-Kermit checks for the existence of the + ckubwr.txt file (Unix C-Kermit Hints and Tips). If not found, it checks + the directories listed above (both with and without the "/kermit") plus + several others to see if they contain the ckubwr.txt file. If found, + various C-Kermit messages can refer the user to this directory. + + Finally, if you want to put the source code files somewhere for people + to look at, you can do that too. + +5.4. The Makefile Install Target + + The makefile "install" target does almost everything for you if you + give it the information it needs by setting the variables described + below. You can use this target if: + + * You downloaded the [200]complete C-Kermit archive and built + C-Kermit from source; or: + * You downloaded an [201]individual C-Kermit binary and the + [202]C-Kermit text-file archive, and your computer has a "make" + command. + + Here are the parameters you need to know: + + BINARY + Name of the binary you want to install as "kermit". Default: + "wermit". + + prefix + (lower case) If you define this variable, its value is prepended + to all the following xxxDIR variables (8.0.211 and later). + + DESTDIR + If you want to install the Kermit files in a directory structure + like /opt/kermit/bin/, /opt/kermit/doc/, /opt/kermit/src/, then + define DESTIR as the root of this structure; for example, + /opt/kermit. The DESTDIR string should not end with a slash. By + default, DESTDIR is not defined. If it is defined, but the + directory does not exist, the makefile attempts to create it, + which might require you to be root. Even so, this can fail if + any segments in the path except the last one do not already + exist. WARNING: If the makefile creates any directories, it + gives them a mode of 755, and the default owner and group. + Modify these by hand if necessary. + + BINDIR + Directory in which to install the Kermit binary (and the + standard C-Kermit initialization file, if it is found, as a + Kerbang script). If DESTDIR is defined, BINDIR must start with a + slash. BINDIR must not end with a slash. If DESTDIR is defined, + BINDIR is a subdirectory of DESTDIR. If BINDIR does not exist, + the makefile attempts to create it as with DESTDIR. Default: + /usr/local/bin. + + MANDIR + Directory in which to install the C-Kermit manual page as + "kermit" followed by the manual-chapter extension (next item). + Default: /usr/man/man1. If MANDIR is defined, the directory must + already exist. + + MANEXT + Extension for the manual page. Default: 1 (digit one). + + SRCDIR + Directory in which to install the C-Kermit source code. If + DESTDIR is defined, this is a subdirectory of DESTDIR. Default: + None. + + CERTDIR + For secure builds only: Directory in which to install the + ca_certs.pem file. This must be the verification directory used + by programs that use the SSL libraries at your site. Default: + none. Possibilities include: /usr/local/ssl, /opt/ssl, + /usr/lib/ssl, . . . If CERTDIR is defined, the directory + must already exist. + + INFODIR + Directory in which to install the C-Kermit text files. If + DESTDIR is defined, this is a subdirectory of DESTDIR. Default: + None. If INFODIR is defined but does not exist, the makefile + attempts to create it, as with DESTDIR. + + Examples: + + make install + Installs "wermit" as /usr/local/bin/kermit with permissions 755, + the default owner and group, and no special privileges. The + manual page is installed as /usr/man/man1/kermit.1. Text files + are not copied anywhere, nor are the sources. + + make MANDIR= install + Just like "make install" but does not attempt to install the + manual page. + + make DESTDIR=/opt/kermit BINDIR=/bin SRCDIR=/src INFODIR=/doc install + Installs the Kermit binary "wermit" as /opt/kermit/bin/kermit, + puts the source code in /opt/kermit/src, and puts the text files + in /opt/kermit/doc, creating the directories if they don't + already exist, and puts the man page in the default location. + + make BINDIR=/usr/local/bin CERTDIR=/usr/local/ssl install + Installs the Kerberized Kermit binary "wermit" as + /usr/local/bin/kermit, puts the CA Certificates file in + /usr/local/ssl/, and the man page in the normal place. + + For definitive information, see the makefile. The following is + excerpted from the 8.0.211 makefile: + +# The following symbols are used to specify library and header file locations +# Redefine them to the values used on your system by: +# . editing this file +# . defining the values on the command line +# . defining the values in the environment and use the -e option +# +prefix = /usr/local +srproot = $(prefix) +sslroot = $(prefix) +manroot = $(prefix) + +K4LIB=-L/usr/kerberos/lib +K4INC=-I/usr/kerberos/include +K5LIB=-L/usr/kerberos/lib +K5INC=-I/usr/kerberos/include +SRPLIB=-L$(srproot)/lib +SRPINC=-I$(srproot)/include +SSLLIB=-L$(sslroot)/ssl/lib +SSLINC=-I$(sslroot)/ssl/include +... +WERMIT = makewhat +BINARY = wermit +DESTDIR = +BINDIR = $(prefix)/bin +MANDIR = $(manroot)/man/man1 +MANEXT = 1 +SRCDIR = +INFODIR = +CERTDIR = + +6. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES + + [ [203]Top ] [ [204]Contents ] [ [205]Next ] [ [206]Previous ] + + This section is obsolete. We don't distribute C-Kermit on diskettes + any more because (a)there is no demand, and (b) it no longer fits. + + If you received a DOS-format diskette containing a binary executable + C-Kermit program plus supporting text files, be sure to chmod +x the + executable before attempting to run it. + + In version 5A(190) and later, all the text files on the C-Kermit + DOS-format diskettes are in Unix format: LF at the end of each line + rather than CRLF. This means that no conversions are necessary when + copying to your Unix file system, and that all the files on the + diskette, text and binary, can be copied together. The following + comments apply to the DOS-format diskettes furnished with version + 5A(189) and earlier or to other DOS-format diskettes you might have + obtained from other sources. + + If you have received C-Kermit on MS-DOS format diskettes (such as those + distributed by Columbia University), you should make sure that your + DOS-to-Unix conversion utility (such as "dosread") both: (1) changes + line terminators in all files from carriage-return linefeed (CRLF) to + just linefeed (LF) (such as "dosread -a") and remove any Ctrl-Z's, and + (2) that all filenames are converted from uppercase to lowercase. If + these conversions were not done, you can use the following shell script + on your Unix system to do them: + +---(cut here)--- +#!/bin/sh +# +# Shell script to convert C-Kermit DOS-format files into Unix format. +# Lowercases the filenames, strips out carriage returns and Ctrl-Z's. +# +x=$1 # the name of the source directory +y=$2 # the name of the target directory if [ $# -lt 2 ]; then + echo "usage: $0 source-directory target-directory" + exit 1 +fi +if cd $1 ; then + echo "Converting files from $1 to $2" +else + echo "$0: cannot cd to $1" + exit 1 +fi +for i in *; do + j=`echo $i | tr 'A-Z' 'a-z'` + echo $x/$i =\> $y/$j + tr -d '\015\032' < $i > $y/$j +done +---(cut here)--- + + Cut out this shell script, save it as "convert.sh" (or any other name + you prefer), then "chmod +x convert.sh". Then, create a new, empty + directory to put the converted files in, and then "convert.sh /xxx + /yyy" where /xxx is the name of the directory where the PC-format files + are, and /yyy is the name of the new, empty directory. The converted + files will appear in the new directory. + +7. CHECKING THE RESULTS + + [ [207]Top ] [ [208]Contents ] [ [209]Next ] [ [210]Previous ] + + First some quick checks for problems that can be easily corrected by + recompiling with different options: + + DIRECTORY listing is garbage + Permissions, size, and date are random garbage (but the + filenames are correct) in a C-Kermit DIRECTORY listing. On some + platforms, the lstat() function is present but simply doesn't + work; try adding -DNOLSTAT to CFLAGS and rebuild. If that + doesn't fix it, also add -DNOLINKBITS. If it's still not fixed, + remove -DNOLSTAT and -DNOLINKBITS and add -DNOSYMLINK. + + curses + When you make a connection with C-Kermit and transfer files + using the fullscreen (curses) file-transfer display, and then + get the C-Kermit> prompt back afterwards, do characters echo + when you type them? If not, the curses library has altered the + buffering of /dev/tty. Try rebuilding with KFLAGS=-DCK_NEWTERM. + If it already has -DCK_NEWTERM in CFLAGS, try removing it. If + that doesn't help, then rebuild with -DNONOSETBUF (yes, two + NO's). If none of this works (and you can't fix the code), then + either don't use the fullscreen display, or rebuild with + -DNOCURSES. + + Ctrl-L or any SCREEN command crashes C-Kermit: + Rebuild with -DNOTERMCAP. + + No prompt after CONNECT: + After escaping back from CONNECT mode, does your C-Kermit> + prompt disappear? (Yet, typing "?" still produces a command + list, etc) In that case, add -DCKCONINTB4CB to CFLAGS and + rebuild. + + Here is a more thorough checklist can use to tell whether your version + of C-Kermit was built correctly for your Unix system, with hints on how + to fix or work around problems: + + a. Start C-Kermit (usually by typing "./wermit" in the directory where + you ran the makefile). Do you see the C-Kermit> prompt? If not, + C-Kermit incorrectly deduced that it was running in the background. + The test is in conbgt() in [211]ckutio.c. If you can fix it for + your system, please send in the fix (Hint: read about "PID_T" + below). Otherwise, you can force C-Kermit to foreground mode by + starting it with the -z command line option, as in "kermit -z", or + giving the interactive command SET BACKGROUND OFF. + b. When you type characters at the C-Kermit prompt, do they echo + immediately? If not, something is wrong with concb() and probably + the other terminal mode settings routines in [212]ckutio.c. Be sure + you have used the most appropriate make entry. + c. At the C-Kermit> prompt, type "send ./?". C-Kermit should list all + the files in the current directory. If not, it was built for the + wrong type of Unix file system. Details below. In the meantime, try + SET WILDCARD-EXPANSION SHELL as a workaround. + d. CD to a directory that contains a variety of files, symlinks, and + subdirectories and give a DIRECTORY command at the C-Kermit> + prompt. Do the permissions, size, and date appear correct? If not + see [213]Section 4.0. + e. Assuming your platform supports long file names, create a file with + a long name in your current directory, e.g.: + +$ touch thisisafilewithaveryveryveryveryveryveryveryverylooooooooongname + + (you might need to make it longer than this, perhaps as long as 257 + or even 1025 characters). + Check with ls to see if your version of Unix truncated the name. + Now start C-Kermit and type "send thisis". Does Kermit + complete the name, showing the same name as ls did? If not, wrong + filesystem. Read on. + f. Make sure that Kermit has the maximum path length right. Just type + SHOW FILE and see what it says about this. If it is too short, + there could be some problems at runtime. To correct, look in + [214]ckcdeb.h to see how the symbol CKMAXPATH is set and make any + needed adjustments. + g. Send a file to your new Kermit program from a different Kermit + program that is known to work. Is the date/timestamp of the new + file identical to the original? If not, adjustments are needed in + zstrdt() in [215]ckufio.c. + h. Go to another computer (Computer B) from which you can send files + to C-Kermit. Connect Computer B to the computer (A) where you are + testing C-Kermit. Then: + i. Send a file from B to A. Make sure it transferred OK and was + created with the the right name. + j. Send a file from B to A, specifying an "as-name" that is very, very + long (longer than the maximum name length on computer A). Check to + make sure that the file was received OK and that its name was + truncated to Computer A's maximum length. If not, check the + MAXNAMLEN definition in [216]ckufio.c. + k. Tell C-Kermit on Computer A to "set receive pathnames relative" and + then send it a file from Computer B specifying an as-name that + contains several directory segments: + +send foo dir1/dir2/dir3/foo + + Check to make sure that dir1/dir2/dir3/foo was created in Computer + A's current directory (i.e. that three levels of directories were + created). + l. Repeat step k, but make each path segment in the pathname longer + than Computer A's maximum name length. Make sure each directory + name, and the final filename, were truncated properly. + m. Type Ctrl-C (or whatever your Unix interrupt character is) at the + prompt. Do you get "^C..." and a new prompt? If instead, you get a + core dump (this shouldn't happen any more) "rm core" and then + rebuild with -DNOCCTRAP added to your CFLAGS. If it did work, then + type another Ctrl-C. If this does the same thing as the first one, + then Ctrl-C handling is OK. Otherwise, the SIGINT signal is either + not getting re-armed (shouldn't happen) or is being masked off + after the first time it is caught, in which case, if your Unix is + POSIX-based, try rebuilding C-Kermit with -DCK_POSIX_SIG. + n. Type Ctrl-Z (or whatever your Unix suspend character is) to put + C-Kermit in the background. Did it work? If nothing happened, then + (a)your version of Unix does not support job control, or (b) your + version of C-Kermit was probably built with -DNOJC. If your session + became totally frozen, then you are probably running C-Kermit on a + Unix version that supports job control, but under a shell that + doesn't. If that's not the case, look in the congm() and psuspend() + routines in [217]ckutio.c and see if you can figure out what's + wrong. If you can't, rebuild with -DNOJC. + o. Give a SET LINE command for a dialout device, e.g. "set line + /dev/tty00". If you got some kind of permission or access denied + message, go read [218]Section 10 and then come back here. + p. After giving a successful SET LINE command, type "show comm" to see + the communication parameters. Do they make sense? + q. Type "set speed ?" and observe the list of available speeds. Is it + what you expected? If not, see [219]Section 2) of the + [220]Configurations Options document. + r. Give a SET SPEED command to change the device's speed. Did it work? + (Type "show comm" again to check.) + s. Try dialing out: SET MODEM TYPE , SET LINE , SET SPEED , DIAL . If + it doesn't work, keep reading. After dialing, can you REDIAL? + t. If your version was built with TCP/IP network support, try the + TELNET command. + u. Transfer some files in remote mode on incoming asynchronous serial + (direct or modem) connections, and on incoming network (telnet, + rlogin, terminal server) connections. If you get lots of errors, + try different SET FLOW settings on the remote Kermit program. + v. Establish a serial connection from C-Kermit to another computer + (direct or dialed) and transfer some files. If you have network + support, do the same with a network connection. + w. If your version was built with fullscreen file transfer display + support, check that it works during local-mode file transfer. Also, + check C-Kermit's operation afterwards: is the echoing funny? etc + etc. If there are problems, see [221]Section 4. + x. If your version was built with script programming language support, + TAKE the ckedemo.ksc file to give it a workout. + y. Does C-Kermit interlock correctly with UUCP-family programs (cu, + tip, uucp, etc)? If not, read the section [222]DIALING OUT AND + COORDINATING WITH UUCP below. + z. Modem signals... Give a SET LINE command to a serial device and + then type the SHOW MODEM command. If it says "Modem signals + unavailable in this version of Kermit", then you might want to look + at the ttgmdm() routine in [223]ckutio.c and add the needed code -- + if indeed your version of Unix provides a way to get modem signals + (some don't; e.g. modem signals are a foreign concept to POSIX, + requiring politically incorrect workarounds). + aa. If it says "Modem signals unavailable", then it is likely that the + API for getting modem signals is provided, but it doesn't actually + do anything (e.g. ioctl(ttyfd,TIOCMGET,&x) returns EINVAL). + ab. In any case, it still should be able to manipulate the DTR signal. + To test, SET LINE , SET MODEM NONE, and HANGUP. The DTR light + should go out momentarily. If it doesn't, see if you can add the + needed code for your system to the tthang() routine in + [224]ckutio.c. + ac. If your version of Kermit has the SET FLOW RTS/CTS command, check + to see if it works: give Kermit this command, set your modem for + RTS/CTS, transfer some files (using big packet and window sizes) + and watch the RTS and CTS lights on the modem. If they go on and + off (and Kermit does not get packet errors), then it works. If your + version of Kermit does not have this command, but your version of + Unix does support hardware flow control, take a look at the + tthflow() command in [225]ckutio.c and see if you can add the + needed code (see the section on [226]HARDWARE FLOW CONTROL below). + (And please [227]send back any added code, so that others can + benefit from it and it can be carried forward into future + releases.) + ad. If C-Kermit starts normally and issues its prompt, echoing is + normal, etc, but then after returning from a CONNECT session, the + prompt no longer appears, try rebuilding with -DCKCONINTB4CB. + ae. (8.0.206 or later) Type some commands at the C-Kermit prompt. Can + you use the Up-arrow and Down-arrow keys on your keyboard to access + Kermit's command history? If not, and you're a programmer, take a + look at the USE_ARROWKEYS sections of ckucmd.c. + +8. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE + + [ [228]Top ] [ [229]Contents ] [ [230]Next ] [ [231]Previous ] + + Also see: [232]C-Kermit Configuration Options + + a. Many of C-Kermit's options and features can be deselected at + compile time. The greatest savings at the least sacrifice in + functionality is to disable the logging of debug information by + defining NODEBUG during compilation. See the [233]Configurations + Options document for further information. + b. Use shared libraries rather than static linking. This is the + default on many Unix systems anyway. However, executables built for + dynamic linking with shared libraries are generally not portable + away from the machine they were built on, so this is recommended if + the binary is for your use only. + c. Most Unix systems have a "strip" command to remove symbol table + information from an executable program image. "man strip" for + further information. The same effect can be achieved by including + "-s" among the link flags when building C-Kermit. + d. SCO, Interactive, and some other Unix versions have an "mcs" + command. "mcs -d wermit" can be used to delete the contents of the + ".comment" section from the executable program image. + e. Many modern optimizers can be instructed to optimize for space + rather than execution efficiency. Check the CFLAGS in the makefile + target, adjust as desired. + +9. UNIX VERSIONS + + [ [234]Top ] [ [235]Contents ] [ [236]Next ] [ [237]Previous ] + + SECTION CONTENTS + +9.1 [238]Standards + 9.1.1. [239]POSIX + 9.1.2. [240]ANSI C + 9.1.3. [241]Other Standards +9.2. [242]Library Issues +9.3. [243]Unix File System Peculiarities +9.4. [244]Hardware Flow Control +9.5. [245]Terminal Speeds +9.6. [246]Millisecond Sleeps +9.7. [247]Nondestructive Input Buffer Peeking +9.8. [248]Other System-Dependent Features +9.9. [249]Terminal Interruption + + There are several major varieties of Unix: Bell Laboratories Seventh + Edition, AT&T System V, Berkeley Standard Distribution (BSD), and + POSIX. Each has many, many subvarieties and descendents, and there are + also hybrids that exhibit symptoms of two or more varieties, plus + special quirks of their own. + + Seventh edition versions of C-Kermit include the compile-time option + -DV7 in the CFLAGS string in the makefile target. Various V7-based + implementations are also supported: -DCOHERENT, -DMINIX, etc. + + AT&T-based versions of Unix Kermit include the compile-time option + -DATTSV (standing for AT∓T Unix System V). This applies to System + III and to System V up to and including Release 2. For System V Release + 3, the flag -DSVR3 should be used instead (which also implies -DATTSV). + This is because the data type of signal() and several other functions + was changed between SVR2 and SVR3. For System V Release 4, include + -DSVR4 because of changes in UUCP lockfile conventions; this also + implies -DSVR3 and -DATTSV. + + For BSD, the flag -BSDxx must be included, where xx is the BSD version + number, for example BSD4 (for version 4.2 or later, using only 4.2 + features), -DBSD41 (for BSD 4.1 only), -DBSD43 (for 4.3), -DBSD29 (BSD + 2.9 for DEC PDP-11s). -DBSD44 is for 4.4BSD, which is the basis of + FreeBSD, NetBSD, OpenBSD, BSDI, and Mac OS X, and which contains many + POSIX features, and has little relation to 4.3BSD and earlier. + + For POSIX, include the flag -DPOSIX. POSIX defines a whole new set of + terminal i/o functions that are not found in traditional AT&T or + Berkeley implementations, and also defines the symbol _POSIX_SOURCE, + which is used in many system and library header files, mainly to + disable non-POSIX (i.e. useful) features. + + Note (circa 1997): In order to enable serial speeds higher than 38400 + bps, it is generally necessary to add -DPOSIX (among other things), + since the older terminal APIs can not accommodate the new speeds -- out + o' bits. But this often also means wholesale conversion to POSIX APIs. + In general, just try adding -DPOSIX and then see what goes wrong. Be + wary of features disappearing: when _POSIX_SOURCE is defined, all sorts + of things that were perfectly OK before suddenly become politically + incorrect -- like reading modem signals, doing hardware flow control, + etc. POSIX was evidently not designed with serial communication in + mind! + + Case in point: In UnixWare 7.0, #define'ing POSIX causes strictness + clauses in the header files to take effect. These prevent + from defining the timeval and timezone structs, which are needed for + all sorts of things (like select()). Thus, if we want the high serial + speeds, we have to circumvent the POSIX clauses. + + Similarly in SCO OpenServer R5.0.4 where, again, we must use the POSIX + APIs to get at serial speeds higher than 38400, but then doing so + removes hardware flow control -- just when we need it most! In cases + like this, dirty tricks are the only recourse (search for SCO_OSR504 in + [250]ckutio.c for examples). + + For reasons like this, Unix implementations tend to be neither pure + AT&T nor pure BSD nor pure POSIX, but a mixture of two or more of + these, with "compatibility features" allowing different varieties of + programs to be built on the same computer. In general, Kermit tries not + to mix and match but to keep a consistent repertoire throughout. + However, there are certain Unix implementations that only work when you + mix and match. For example, the Silicon Graphics IRIX operating system + (prior to version 3.3) is an AT&T Unix but with a BSD file system. The + only way you can build Kermit successfully for this configuration is to + include -DSVR3 plus the special option -DLONGFN, meaning "pretend I was + built with -DBSDxx when it's time to compile file-related code". See + the "iris" makefile target. + +9.1. Standards + + [ [251]Top ] [ [252]Section Contents ] [ [253]Contents ] [ [254]Next ] + + SUBSECTION CONTENTS + +9.1.1. [255]POSIX +9.1.2. [256]ANSI C +9.1.3. [257]Other Standards + + In edits 166-167 (1988-89), C-Kermit was heavily modified to try to + keep abreast of new standards while still remaining compatible with old + versions of C and Unix. There are two new standards of interest: ANSI C + (as described in Kernighan and Ritchie, "The C Programming Language", + Second Edition, Prentice Hall, 1988) and POSIX.1 (IEEE Standard 1003.1 + and ISO/IEC 9945-1, 1990, "Portable Operating System Interface"). These + two standards have nothing to do with each other: you can build + C-Kermit with a non-ANSI compiler for a POSIX system, or for a + non-POSIX system with with an ANSI compiler. + +9.1.1. POSIX + + POSIX.1 defines a repertoire of system functions and header files for + use by C language programs. Most notably, the ioctl() function is not + allowed in POSIX; all ioctl() functions have been replaced by + device-specific functions like tcsetattr(), tcsendbreak(), etc. + + Computer systems that claim some degree of POSIX compliance have made + some attempt to put their header files in the right places and give + them the right names, and to provide system library functions with the + right names and calling conventions. Within the header files, + POSIX-compliant functions are supposed to be within #ifdef + _POSIX_SOURCE..#endif conditionals, and non-POSIX items are not within + these conditionals. + + If Kermit is built with neither -D_POSIX_SOURCE nor -DPOSIX, the + functions and header files of the selected version of Unix (or VMS, + etc) are used according to the CFLAGS Kermit was built with. + + If Kermit is built with -D_POSIX_SOURCE but not -DPOSIX, then one of + the -DBSD or -DATTSV flags (or one that implies them) must also be + defined, but it still uses only the POSIX features in the system header + files. This allows C-Kermit to be built on BSD or AT&T systems that + have some degree of POSIX compliance, but still use BSD or AT&T + specific features. + + The dilimma is this: it is often necessary to define _POSIX_SOURCE to + get at new or modern features, such as high serial speeds and the APIs + to deal with them. But defining _POSIX_SOURCE also hides other APIs + that Kermit needs, for example the ones dealing with modem signals + (others are listed just below). Thus all sorts of hideous contortions + are often required to get a full set of features. + + The POSIX standard does not define anything about uucp lockfiles. "make + posix" uses NO (repeat, NO) lockfile conventions. If your + POSIX-compliant Unix version uses a lockfile convention such as HDBUUCP + (see below), use the "posix" entry, but include the appropriate + lockfile option in your KFLAGS on the "make" command line, for example: + +make posix "KFLAGS=-DHDBUUCP" + + POSIX.1 also lacks certain other features that Kermit needs. For + example: + + * There is no defined way for an application to do wildcard matching + of filenames. Kermit uses the inode in the directory structure, but + POSIX.1 does not include this concept. (Later POSIX revisions + include functions named (I think) glob() and fnmatch(), but these + functions are not yet in Kermit, and might not be appropriate in + any case.) + * There is no POSIX mechanism for sensing or controlling modem + signals, nor to enable RTS/CTS or other hardware flow control. + * There is no select() for multiplexing i/o, and therefore no TCP/IP. + * There is no way to check if characters are waiting in a + communications device (or console) input buffer, short of trying to + read them -- no select(), ioctl(fd,FIONREAD,blah), rdchk(), etc. + This is bad for CONNECT mode and bad for sliding windows. + * No way to do a millisecond sleep (no nap(), usleep(), select(), + etc). + * There is no popen(). + + So at this point, there cannot be one single fully functional POSIX + form of C-Kermit unless it also has "extensions", as do Linux, QNX, + etc. + + More on POSIX (quoting from a newsgroup posting by Dave Butenhof): + + Standards tend to look at themselves as "enabling". So POSIX + standards say that, in order to use POSIX functions, a program must + define some macro that will put the development environment in + "POSIX mode". For the ancient POSIX 1003.1-1990, the symbol is + _POSIX_SOURCE. For recent revisions, it's _POSIX_C_SOURCE with an + appropriate value. POSIX 1003.1-1996 says that, to use its features + in a portable manner, you must define _POSIX_C_SOURCE=199506L before + including any header files. + + But for Solaris, or Digital Unix, the picture is different. POSIX is + one important but small part of the universe. Yet POSIX + unconditionally and unambiguously REQUIRES that, when + _POSIX_C_SOURCE=199506L, ALL of the functions and definitions + required by the standard, and NO others (except in specific + restricted namespaces, specifically "_" followed by an uppercase + letter or "__" followed by a lowercase letter) shall be visible. + That kinda puts a cramp on BSD and SVID support, because those + require names that are not in the "protected" POSIX namespaces. It's + ILLEGAL to make those symbols visible, unless you've done something + else that's beyond the scope of POSIX to allow the system to infer + that you didn't really mean it. + + In most cases, you should just compile, with no standards-related + macros defined. The system will make available every interface and + definition that isn't incompatible with the "main stream". There may + indeed be cases where two standards cross, and you really can't use + both together. But, in general, they play nicely together as long as + you don't do anything rash -- like telling the system that it's not + allowed to let them. + + In the area of threads, both Solaris and Digital Unix support + incompatible thread APIs. We have POSIX and DCE, they have POSIX and + UI. The nasty areas are in the _r routines and in some aspects of + signal behavior. You cannot compile a single source file that uses + both semantics. That's life. It sounds as if Solaris defaults to the + UI variants, but allows you to define this _POSIX_THREAD_SEMANTICS + to get around it. We default to POSIX, and allow you to define + _PTHREAD_USE_D4 (automatically defined by the cc "-threads" switch) + to select the DCE thread variants. That default, because you're + operating outside of any individual standard, is really just a + marketing decision. + +9.1.2. ANSI C + + [ [258]Top ] [ [259]Contents ] [ [260]Section Contents ] [ + [261]Subsection Contents ] [ [262]Next ] [ [263]Previous ] + + The major difference between ANSI C and earlier C compilers is function + prototyping. ANSI C allows function arguments to be checked for type + agreement, and (when possible) type coercion in the event of a + mismatch. For this to work, functions and their arguments must be + declared before they are called. The form for function declarations is + different in ANSI C and non-ANSI C (ANSI C also accepts the earlier + form, but then does not do type checking). + + As of edit 167, C-Kermit tries to take full advantage of ANSI C + features, especially function prototyping. This removes many bugs + introduced by differing data types used or returned by the same + functions on different computers. ANSI C features are automatically + enabled when the symbol __STDC__ is defined. Most ANSI C compilers, + such as GNU CC and the new DEC C compiler define this symbol + internally. + + On the downside, ANSI C compilation increases the + administrative/bureacratic burden, spewing out countless unneeded + warnings about mismatched types, especially when we are dealing with + signed and unsigned characters, requiring casts everywhere to shut up + the mindless complaints -- there is no use for signed chars in Kermit + (or probably anywhere else). Some compilers, mercifully, include a + "treat all chars as unsigned" option, and when available it should be + used -- not only to stop the warnings, but also to avoid unhelpful sign + extension on high-bit characters. + + To force use of ANSI C prototypes, include -DCK_ANSIC on the cc command + line. To disable the use of ANSI prototypes, include -DNOANSI. + +9.1.3. Other Standards + + [ [264]Top ] [ [265]Contents ] [ [266]Section Contents ] [ + [267]Subsection Contents ] [ [268]Next ] [ [269]Previous ] + + As the years go by, standards with-which-all-must-comply continue to + pile up: AES, XPG2, XPG3, XPG4, FIPS 151-2, successive generations of + POSIX, OSF/1, X/Open, Spec 1170, UNIX95, Open Group UNIX98, ISO/IEC + 9945 parts 1-4, ISO 9899, 88Open, OS 99, Single Unix Specification + (SUS, [270]IEEE 1003.1-2001, not to mention "mature standards" like V7, + 4.2/4.3BSD, System V R3 and R4 (SVID2 and SVID3), 4.4BSD (the basis for + BSDI, OpenBSD, NetBSD, FreeBSD, Mac OS X etc), /usr/group, plus + assorted seismic pronouncements of the neverending series of ephemeral + corporate consortia, not to mention the libc-vs-glibc turmoil in the + Linux arena and who knows what else. + + None of these standards simplifies life for portable applications like + C-Kermit -- each one is simply one more environment to support (or + circumvent, as in many cases these standards do more harm than good by + denying access to facilities we need, e.g. as noted in above in + [271]9.1.1). + +9.2. Library Issues + + [ [272]Top ] [ [273]Contents ] [ [274]Section Contents ] [ + [275]Subsection Contents ] [ [276]Next ] [ [277]Previous ] + + On most modern platforms, applications are -- and often must be -- + dynamically linked. This has numerous advantages (smaller executables, + ability to patch a library and thereby patch all applications that use + it, etc), but also causes some headaches: most commonly, the library ID + built into the executable at link time does not match the ID of the + corresponding library on the target system, and so the loader refuses + to let the application run. + + This problem only gets worse over time. In the Linux and *BSD world, we + also have totally different libraries (each with their own names and + numbering systems) that cover the same territory; for example, curses + vs ncurses, libc versus glibc. Combinations proliferate and any given + Unix computer might have any combination. For this reason it is + becoming increasingly difficult to produce a "Linux binary" for a given + architecture (e.g. PC or Alpha). There has to be a separate binary for + (at least) every combination of curses vs ncurses and libc vs glibc. + + In such cases, the best advice is for every user to build C-Kermit from + source code on the system where it will run. Too bad most commercial + Unix vendors have stopped including C compilers with the operating + system! + +9.3. Unix File System Peculiarities + + [ [278]Top ] [ [279]Contents ] [ [280]Section Contents ] [ [281]Next ] + [ [282]Previous ] + + Normally, including a BSD, System-V, POSIX, or DIRENT flag in the make + entry selects the right file system code. But some versions of Unix are + inconsistent in this regard, and building in the normal way either + gives compiler or linker errors, or results in problems at runtime, + typically failure to properly expand wildcard file specifications when + you do something like "send *.*", or failure to recognize long + filenames, as in "send filewithaveryveryveryveryverylongname". + + C-Kermit is supposed to know about all the various styles of Unix file + systems, but it has to be told which one to use when you build it, + usually in the makefile target CFLAGS as shown below, but you might + also have to add something like -I/usr/include/bsd to CFLAGS, or + something like -lbsd to LIBS. + + C-Kermit gives you the following CFLAGS switches to adapt to your file + system's peculiarities: + +-DDIRENT - #include +-DSDIRENT - #include +-DNDIR - #include +-DXNDIR - #include +-DRTU - #include "/usr/lib/ndir.h", only if NDIR and XNDIR not defined. +-DSYSUTIMH - #include for setting file creation dates. +-DUTIMEH - #include for setting file creation dates. + + (Note, RTU should only be used for Masscomp RTU systems, because it + also selects certain other RTU-specific features.) + + If none of these is defined, then is used. IMPORTANT: If + your system has the file /usr/include/dirent.h then be sure to add + -DDIRENT to your makefile target's CFLAGS. "dirent" should be used in + preference to any of the others, because it supports all the features + of your file system, and the others probably don't. + + Having selected the appropriate directory header file, you might also + need to tell Kermit how to declare the routines and variables it needs + to read the directory. This happens most commonly on AT&T System-V + based UNIXes, particularly System V R3 and earlier, that provide long + file and directory names (longer than 14 characters). Examples include + certain releases of HP-UX, DIAB DNIX, older versions of Silicon + Graphics IRIX, and perhaps also MIPS. In this case, try adding -DLONGFN + to your makefile target. + + Another problem child is . Most Unix C-Kermit versions need + to #include this file from within [283]ckufio.c and [284]ckutio.c, but + some not only do not need to include it, but MUST not include it + because (a) it doesn't exist, or (b) it has already been included by + some other header file and it doesn't protect itself against multiple + inclusion, or (c) some other reason that prevents successful + compilation. If you have compilation problems that seem to stem from + including this file, then add the following switch to CFLAGS in your + makefile target: + +-DNOFILEH + + There are a few odd cases where must be included in one of + the cku[ft]io.c files, but not the other. In that case, add the + aforementioned switch, but go into the file that needs and + add something like this: + +#ifdef XXX /* (where XXX is a symbol unique to your system) */ +#undef NOFILEH +#endif /* XXX */ + + before the section that includes . + + Kermit's SEND command expands wildcard characters "?" and "*" itself. + Before version 5A, commands like "send *" would send all regular + (non-directory) files, including "hidden files" (whose names start with + "."). In version 5A, the default behavior is to match like the Bourne + shell or the ls command, and not include files whose names start with + dot. Such files can still be sent if the dot is included explicitly in + the SEND command: "send .oofa, send .*". To change back to the old way + and let leading wildcard characters match dot files, include the + following in your CFLAGS: + +-DMATCHDOT + + (In C-Kermit 6.0, there is also a command to control this at runtime.) + + Complaints about data-type mismatches: + + * If you get compile-time complaints about data type mismatches for + process-ID related functions like getpid(), add -DPID_T=pid_t. + * If you get compile-time complaints about data type mismatches for + user ID related functions like getuid(), add -DUID_T=uid_t. + * If you get compile-time complaints about data type mismatches for + user-ID related functions like getgid(), add -DGID_T=gid_t. + * If you get compile-time complaints about data type mismatches for + getpwuid(), add -DPWID_T=uid_t (or whatever it should be). + + File creation dates: C-Kermit attempts to set the creation date/time of + an incoming file according to the date/time given in the file's + attribute packet, if any. If you find that the dates are set + incorrectly, you might need to build Kermit with the -DSYSUTIMEH flag, + to tell it to include . If that doesn't help, look at the + code in zstrdt() in [285]ckufio.c. + +9.4. Hardware Flow Control + + [ [286]Top ] [ [287]Contents ] [ [288]Section Contents ] [ [289]Next ] + [ [290]Previous ] + + Hardware flow control is a problematic concept in many popular Unix + implementations. Often it is lacking altogether, and when available, + the application program interface (API) to it is inconsistent from + system to system. Here are some examples: + + a. POSIX does not support hardware flow control. + b. RTS/CTS flow control support MIGHT be available for System V R3 and + later if /usr/include/termiox.h exists (its successful operation + also depends on the device driver, and the device itself, not to + mention the [291]cable, etc, actually supporting it). If your + SVR3-or-later Unix system does have this file, add: + +-DTERMIOX + + to your CFLAGS. If the file is in /usr/include/sys instead, add: + +-DSTERMIOX + + Note that the presence of this file does not guarantee that RTS/CTS + will actually work -- that depends on the device-driver + implementation (reportedly, many Unix versions treat + hardware-flow-control related ioctl's as no-ops). + c. Search ("grep -i") through /usr/include/*.h and + /usr/include/sys/*.h for RTS or CTS and see what turns up. For + example, in SunOS 4.x we find "CRTSCTS". Figuring out how to use it + is another question entirely! In IBM AIX RS/6000 3.x, we have to + "add" a new "line discipline" (and you won't find uppercase RTS or + CTS symbols in the header files). + d. NeXTSTEP and IRIX, and possibly others, support hardware flow + control, but do not furnish an API to control it, and thus on these + systems Kermit has no command to select it -- instead, a special + device name must be used. (NeXTSTEP: /dev/cufa instead of /dev/cua; + IRIX: /dev/ttyf00) + + See the routine tthflow() in [292]ckutio.c for details. If you find + that your system offers hardware flow control selection under program + control, you can add this capability to C-Kermit as follows: + + a. See if it agrees with one of the methods already used in tthflow(). + if not, add new code, appropriately #ifdef'd. + b. Add -DCK_RTSCTS to the compiler CFLAGS in your makefile target or + define this symbol within the appropriate #ifdefs in [293]ckcdeb.h. + + To illustrate the difficulties with RTS/CTS, here is a tale from Jamie + Watson , who added the RTS/CTS code for the RS/6000, + about his attempts to do the same for DEC ULTRIX: + + "The number and type of hardware signals available to/from a serial + port vary between different machines and different types of serial + interfaces on each machine. This means that, for example, there are + virtually no hardware signals in or out available on the DECsystem + 3000/3100 series; on the DECsystem 5000/2xx series all modem signals + in/out are present on both built-in serial ports; on the DECsystem + 5100 some ports have all signals and some only have some; and so + on... It looks to me as if this pretty well rules out any attempt to + use hardware flow control on these platforms, even if we could + figure out how to do it. The confusion on the user level about + whether or not it should work for any given platform or port would + be tremendous. And then it isn't clear how to use the hardware + signals even in the cases where the device supports them." + + 9.5. Terminal Speeds + + [ [294]Top ] [ [295]Contents ] [ [296]Section Contents ] [ [297]Next ] + [ [298]Previous ] + + The allowable speeds for the SET SPEED command are defined in + [299]ckcdeb.h. If your system supports speeds that are not listed in + "set speed ?", you can add definitions for them to ckcdeb.h. + + Then if the speed you are adding is one that was never used before in + Kermit, such as 921600, you'll also need to add the appropriate + keywords to spdtab[] in [300]ckuus3.c, and the corresponding case to + ttsspd() in [301]ckutio.c. + + 9.6. Millisecond Sleeps + + [ [302]Top ] [ [303]Contents ] [ [304]Section Contents ] [ [305]Next ] + [ [306]Previous ] + + There is no standard for millisecond sleeps, but at least five + different functions have appeared in various Unix versions that can be + used for this purpose: nap() (mostly in System V), usleep() (found at + least in SunOS and NeXT OS), select() (found in 4.2BSD and later, and + part of any TCP/IP sockets library), nanosleep(), and sginap(). If you + have any of these available, pick one (in this order of preference, if + you have more than one): + +-DSELECT: Include this in CFLAGS if your system has the select() function. +-DNAP: Include this in CFLAGS if your system has the nap() function. +-USLEEP: Include this in CFLAGS if your system has the usleep() function. + + NOTE: The nap() function is assumed to be a function that puts the + process to sleep for the given number of milliseconds. If your system's + nap() function does something else or uses some other units of time + (like the NCR Tower 32, which uses clock-ticks), do not include -DNAP. + + Reportedly, all versions of System V R4 for Intel-based computers, and + possibly also SVR3.2, include nap() as a kernel call, but it's not in + the library. To include code to use it via syscall(3112,x), without + having to include Xenix compatibility features, include the following + compile-time option: + +-DNAPHACK + + 9.7. Nondestructive Input Buffer Peeking + + [ [307]Top ] [ [308]Contents ] [ [309]Section Contents ] [ [310]Next ] + [ [311]Previous ] + + Some AT&T Unix versions have no way to check if input is waiting on a + tty device, but this is a very important feature for Kermit. Without + it, sliding windows might not work very well (or at all), and you also + have to type your escape character to get Kermit's attention in order + to interrupt a local-mode file transfer. If your system offers an + FIONREAD ioctl, the build procedure should pick that up automatically + and use it, which is ideal. + + If your system lacks FIONREAD but has a select() function, this can be + used instead. If the build procedure fails to include it (SHOW FEATURES + will list SELECT), then you can add it to your CFLAGS: + +-DSELECT + + Conversely, if the build procedure tries to use select() when it really + is not there, add: + +-DNOSELECT + + Note: select() is not part of System V nor of POSIX, but it has been + added to various System-V- and POSIX-based systems as an extension. + + Some System-V variations (SCO Xenix/UNIX/ODT and DIAB DNIX) include a + rdchk() function that can be used for buffer peeking. It returns 0 if + no characters are waiting and 1 if characters are waiting (but unlike + FIONREAD, it does not tell the actual number). If your system has + rdchk(), add: + +-DRDCHK: Include this in CFLAGS if your system has the rdchk() function. + + Otherwise, if your version of Unix has the poll() function (and the + /usr/include/poll.h file) -- which appears to be a standard part of + System V going back to at least SVR3, include: + +-DCK_POLL + + 9.8. Other System-Dependent Features + + [ [312]Top ] [ [313]Contents ] [ [314]Section Contents ] [ [315]Next ] + [ [316]Previous ] + + Systems with might have the symbol IEXTEN defined. This is + used to turn "extended features" in the tty device driver on and off, + such as Ctrl-O to toggle output flushing, Ctrl-V to quote input + characters, etc. + + In most Unix implementations, it should be turned off during Kermit + operation, so if [317]ckutio.c finds this symbol, it uses it. This is + necessary, at least, on BSDI. On some systems, however, IEXTEN is + either misdefined or misimplemented. The symptom is that CR, when typed + to the command processor, is echoed as LF, rather than CRLF. This + happens (at least) on Convex/OS 9.1. The solution is to add the + following symbol to the makefile target's CFLACS: + +-DNOIEXTEN + + However, in at least one Unix implementation, QNX 4.21, IEXTEN must be + set before hardware flow control can be used. + + In edits 177 and earlier, workstation users noticed a "slow screen + writing" phenomenon during interactive command parsing. This was traced + to a setbuf() call in [318]ckutio.c that made console (stdout) writes + unbuffered. This setbuf() call has been there forever, and could not be + removed without some risk. Kermit's operation was tested on the NeXT in + edit 178 with the setbuf() call removed, and the slow-writing symptom + was cured, and everything else (command parsing, proper wakeup on ?, + ESC, Ctrl-U, and other editing characters, terminal emulation, + remote-mode and local-mode file transfer, etc) seemed to work as well + as or better than before. In subsequent edits, this change was made to + many other versions too, with no apparent ill effects. To remove the + setbuf() call for your version of Kermit, add: + +-DNOSETBUF + + Later reports indicate that adding -DNOSETBUF has other beneficial + effects, like cutting down on swapping when Kermit is run on + workstations with small memories. But BEWARE: on certain small Unix + systems, notably the AT&T 6300 and 3B1 (the very same ones that benefit + from NOSETBUF), NOSETBUF seems to conflict with CK_CURSES. The program + builds and runs OK, but after once using the curses display, echoing is + messed up. In this case, we use a System-V specific variation in the + curses code, using newterm() to prevent System V from altering the + buffering. See makefile entries for AT&T 6300 and 3B1. + + The Unix version of C-Kermit includes code to switch to file descriptor + zero (stdin) for remote-mode file transfer. This code is necessary to + prevent Kermit from giving the impression that it is "idle" during file + transfers, which, at some sites, can result in the job being logged out + in the middle of an active file transfer by idle-job monitors. + + However, this feature can interfere with certain setups; for example, + there is a package which substitutes a pty/tty pair for /dev/tty and + sets file descriptor 0 to be read-only, preventing Kermit from sending + packets. Or... When a Unix shell is invoked under the PICK environment, + file descriptor 0 is inoperative. + + To remove this feature and allow Kermit to work in such environments, + add the compile-time option: + +-DNOFDZERO + + On some versions of Unix, earlier releases of C-Kermit were reported to + render a tty device unusable after a hangup operation. Examples include + IBM AIX on the RT PC and RS/6000. A typical symptom of this phenomenon + is that the DIAL command doesn't work, but CONNECTing to the device and + dialing manually do work. A further test is to SET DIAL HANGUP OFF, + which should make dialing work once by skipping the pre-dial hangup. + However, after the connection is broken, it can't be used any more: + subsequent attempts to DIAL the same device don't work. The cure is + usually to close and reopen the device as part of the hangup operation. + To do this, include the following compile-time option: + +-DCLSOPN + + Similarly, there is a section of code in ttopen(), which does another + close(open()) to force the O_NDELAY mode change. On some systems, the + close(open()) is required to make the mode change take effect, and + apparently on most others it does no harm. But reportedly on at least + one System V R4 implementation, and on SCO Xenix 3.2, the close(open()) + operation hangs if the device lacks carrier, EVEN THOUGH the CLOCAL + characteristic has just been set to avoid this very problem. If this + happens to you, add this to your CFLAGS: + +-DNOCOTFMC + + or, equivalently, in your KFLAGS on the make command line. It stands + for NO Close(Open()) To Force Mode Change. + + C-Kermit renames files when you give a RENAME command and also + according to the current SET FILE COLLISION option when receiving + files. The normal Unix way to rename a file is via two system calls: + link() and unlink(). But this leaves open a window of vulnerability. + Some Unix systems also offer an atomic rename(oldname,newname) + function. If your version of Unix has this function, add the following + to your CFLAGS: + +-DRENAME + + C-Kermit predefines the RENAME for several Unix versions in + [319]ckcdeb.h (SVR4, SUNOS41, BSD44, AIXRS, etc). You can tell if + rename() is being used if the SHOW FEATURES command includes RENAME in + the compiler options list. If the predefined RENAME symbol causes + trouble, then add NORENAME to your CFLAGS. Trouble includes: + + a. Linker complains that _rename is an unresolved symbol. + b. Linking works, but Kermit's RENAME command doesn't work (which + happens because older versions of rename() might have their + arguments reversed). + + If rename() is not used, then Kermit uses link()/unlink(), which is + equivalent except it is not atomic: there is a tiny interval in which + some other process might "do something" to one of the files or links. + + Some Unix systems (Olivetti X/OS, Amdahl UTS/V, ICL SVR3, etc) define + the S_ISREG and S_ISDIR macros incorrectly. This is compensated for + automatically in [320]ckufio.c. Other systems might have this same + problem. If you get a compile-time error message regarding S_ISREG + and/or S_ISDIR, add the following to your CFLAGS: + +-DISDIRBUG + + Finally, here's a symbol you should NEVER define: + +-DCOMMENT + + It's used for commenting out blocks of code. If for some reason you + find that your compiler has COMMENT defined, then add -UCOMMENT to + CFLAGS or KFLAGS! Similarly, some header files have been known to + define COMMENT, in which case you must add "#undef COMMENT" to each + C-Kermit source module, after all the #includes. + + 9.9. Terminal Interruption + + [ [321]Top ] [ [322]Contents ] [ [323]Section Contents ] [ [324]Next ] + [ [325]Previous ] + + When C-Kermit enters interactive command mode, it sets a Control-C + (terminal keyboard interrupt = SIGINT) trap to allow it to return to + the command prompt whenever the user types Control-C (or whatever is + assigned to be the interrupt character). This is implemented using + setjmp() and longjmp(). On some systems, depending on the machine + architecture and C compiler and who knows what else, you might get + "Memory fault (coredump)" or "longjmp botch" instead of the desired + effect (this should not happen in 5A(190) and later). In that case, add + -DNOCCTRAP to your CFLAGS and rebuild the program. + + Job control -- the ability to "suspend" C-Kermit on a Unix system by + typing the "susp" character (normally Ctrl-Z) and then resume execution + later (with the "fg" command) -- is a tricky business. C-Kermit must + trap suspend signals so it can put the terminal back into normal mode + when you suspend it (Kermit puts the terminal into various strange + modes during interactive command parsing, CONNECT, and file transfer). + Supporting code is compiled into C-Kermit automatically if + includes a definition for the SIGTSTP signal. HOWEVER... some systems + define this signal without supporting job control correctly. You can + build Kermit to ignore SIGTSTP signals by including the -DNOJC option + in CFLAGS. (You can also do this at runtime by giving the command SET + SUSPEND OFF.) + + NOTE: As of version 5A(190), C-Kermit makes another safety check. + Even if job control is available in the operating system (according + to the numerous checks made in congm()), it will still disable the + catching of SIGTSTP signals if SIGTSTP was set to SIG_IGN at the + time C-Kermit was started. + + System V R3 and earlier systems normally do not support job control. If + you have an SVR3 system that does, include the following option in your + CFLAGS: + +-DSVR3JC + + On systems that correctly implement POSIX signal handling, signals can + be handled more reliably than in Bell, Berkeley, or AT&T Unixes. On + systems (such as QNX) that are "strictly POSIX", POSIX signal handling + *must* be used, otherwise no signal will work more than once. If you + have POSIX-based system and you find that your version of Kermit + responds to Ctrl-C (SIGINT) or Ctrl-Z (SIGTSTP) only once, then you + should add the following option to your CFLAGS: + +-DCK_POSIX_SIG + + But be careful; some POSIX implementations, notably 4.4BSD, include + POSIX signal handling symbols and functions as "stubs" only, which do + nothing. Look in for sigsetjmp and siglongjmp and read the + comments. + +10. DIALING OUT AND COORDINATING WITH UUCP + + [ [326]Top ] [ [327]Contents ] [ [328]Next ] [ [329]Previous ] + + The short version (general): + + In order for C-Kermit to be able to dial out from your Unix + computer, you need to give it the same owner, group, and permissions + as your other dialout programs, such as cu, tip, minicom, uucp, + seyon, etc. + + The short version for Linux only: + + Since Red Hat 7.2, about 2002, Linux does not leave the lockfile + handling to each application, but instead provides an external + application, /usr/sbin/lockdev, that all applications should invoke + when they need to access a serial port; lockdev locks and unlocks + the port without requiring the application to have privileges, since + the privileges on the lockfile directory are assigned to lockdev. + C-Kermit 8.0.211 and later support this method. But C-Kermit still + needs to be able to open the port itself, and therefore if the + port's permissions do not allow read/write access to the general + public, the general rule must still be followed: in the most common + case, it must be SETGID to the group uucp (explained below). If a + pre-8.0.211 version of C-Kermit is to be installed for use with + serial ports on any version of Linux, it must still be installed as + described in the following sections. + + The long version: + + Make sure your dialout line is correctly configured for dialing out (as + opposed to login). The method for doing this is different for each kind + of Unix. Consult your system documentation for configuring lines for + dialing out (for example, Sun SPARCstation IPC users should read the + section "Setting up Modem Software" in the Desktop SPARC Sun System and + Network Manager's Guide, or the Terminals and Modems section of the HP + manual, "Configuring HP-UX for Peripherals" (e.g. /usr/sbin/sam => + Peripheral Devices => Terminals and Modems => Add Modem). + + Unlike most other multiuser, multitasking operating systems, Unix + allows multiple users to access the same serial device at the same + time, even though there is no earthly reason why two users should do + this. When they do, user A will read some of the incoming characters, + and user B will read the others. In all likelihood, neither user will + see them all. Furthermore, User B can hang up User A's call, and so + one. + + Rather than change Unix to enforce exclusive access to serial devices + such as ttys, when it might still have been possible, Unix developers + opted for a "lock file" mechanism. Any process that wants to open a tty + device should first check to see if a file of a certain name exists, + and if so, not to open the device. If the file does not exist, the + process creates the file and then opens the device. When the process + closes the device, it destroys the lockfile. This procedure was + originated for use with Unix's UUCP, CU, and TIP programs, and so these + lockfiles are commonly called "UUCP lockfiles" (UUCP = Unix-to-Unix + Copy Program). + + As you can imagine, this method is riddled with pitfalls: + + * If a process does not observe the prevailing lockfile convention, + then it can interfere with other "polite" processes. And in fact, + very few Unix applications or commands handle lockfiles at all; an + original design goal of Unix was that "everything is a file", and + countless utilities operate on files directly (by opening them) or + indirectly through redirection of standard i/o, without creating or + looking for lockfiles. + * If a process crashes while it has the device open, the lockfile is + left behind, preventing further processes from using the device. + * Various versions of Unix use different names for the lockfiles, put + them in different directories, with different owners and groups and + permissions, and specify their contents differently. + * On a given platform, the lockfile conventions may change from one + Unix release to the next (for example, SunOS 4.0 to 4.1) or, in the + case of Linux, across different distributions. + * The same tty device might have more than one name, and most + lockfile conventions don't allow for this. Similarly for symbolic + links. + + In an attempt to address the problem of "stale" lockfiles, most UUCP + implementations put the PID (Process ID) of the creating process in the + lockfile. Thus, another process that wants to open the corresponding + device can check not only for the lockfile itself, but also can check + the PID for validity. But this doesn't work well either: + + * PIDs are stored in diverse formats that change with every new + release (short, integer, long, or string in any of various + formats). If the reading program does not follow the same + convention as the writing program, it can diagnose a valid PID to + be invalid, and therefore not honor the lock. + * PIDs recycle. If the lockfile was created by PID 1234, which later + crashed without removing the lockfile, and then a new process 1234 + exists a the time the lockfile is checked, the lockfile will be + improperly taken as valid, and access to the device denied + unnecessarily. + + Several techniques address the problem of multiple names for the same + device: + + * Multiple lockfiles. For example, if the user opens a device through + a symlink, a lockfile is created for both the symlink name and the + true name (obtained from readlink()). However, when multiple + drivers are installed for the same device (e.g. /dev/cua, + /dev/cufa, etc), this approach won't work unless all applications + *know* all the different names for the same device and make + lockfiles for all of them, which is obviously not practical. + * Lockfiles whose names are not based on the device name. These + lockfiles generally have names like LK.inode/major/minor, where + inode, major, and minor are numbers, which will always be the same + for any physical device, no matter what its name. This form of + lockfile is used in System V R4 and its derivatives, such as + Solaris, UnixWare, etc. If lockfiles must be used (as opposed to, + say, kernel-based locks), this would seem to be the most effective + form. + + Most versions of Unix were not designed to accommodate third-party + communications software; thus vendors of these Unix products feel no + compunction about changing lockfile conventions from release to + release, since they also change their versions of the cu, uucp, tip, + etc, programs at the same time to match. And since the source code to + these programs might not be published, it is difficult for makers of + third-party products like C-Kermit to find out what the new conventions + are. It also forces release of new versions of C-Kermit whenever the OS + vendor makes a change like this. + + Some Unix vendors have taken a small step to simplify communications + application development for their products: the inclusion of lockfile + routines in the standard system C runtime libraries to shield the + application from the details of lockfile management (IBM AIX is an + example). When such routines are used, communications applications do + not need modification when lockfile conventions change (although they + will need recompiling if the routines are statically linked into the + application). In the AIX example, the simple function calls ttylock(), + ttyunlock(), and ttylocked() replace hundreds of lines of ugly code in + C-Kermit that attempts to keep pace with every release of every Unix + product over the last 20 years. Inclusion of ttylock() code occurs + when: + +-DUSETTYLOCK + + is included in the CFLAGS. + + If such routines are available, they should be used. The rest of this + section applies when they are not. + + To fit in with UUCP and other Unix-based serial-port communication + software, C-Kermit must have the same idea as your system's uucp, cu, + and tip programs about what the UUCP lock directory is called, what the + lockfile itself is called, and what its contents should be. In most + cases, C-Kermit preprocessor flags create the appropriate configuration + at compile time if the appropriate makefile target was used (see + [330]ckutio.c). The following CFLAGS options can be used to override + the built-in configuration: + + -DLCKDIR + Tells Kermit that the UUCP lock directory is + /usr/spool/uucp/LCK. + + -DACUCNTRL + Tells Kermit to use the BSD 4.3 acucntrl() program to turn off + getty (login) on the line before using it, and restore getty + when done. + + -DHDBUUCP + Include this if your system uses Honey DanBer UUCP, in which the + lockfile directory and format are relatively standardized. + + -DLOCK_DIR=\\\"/xxx/yyy\\\" + Gives the lock directory name explicitly. The triple quoting is + necessary. For example: + +CFLAGS= -DBSD4 -DLOCK_DIR=\\\"/usr/local/locks\\\" -DNODEBUG + + (NOTE: The triple quoting assumes this is a "top-level" make + entry, and not a make entry that calls another one.) + + -DLFDEVNO The lockfile name uses the tty device inode and major and + minor + numbers: LK.dev.maj.min, as in Sys V R4, e.g. LK.035.044.008. + + When the LK.inode.major.minor form is used, a single lockfile is + enough. Otherwise, a single lockfile rarely suffices. For example, in + Linux, it is common to have a /dev/modem symbolic link to an actual + dialout device, like /dev/cua0 or /dev/ttyS0, whose purpose is to hide + the details of the actual driver from the user. So if one user opens + /dev/modem, a lockfile called LCK..modem is created, which does not + prevent another user from simulataneously opening the same device by + its real name. + + On SCO Unix platforms, we have a slightly different problem: the same + device is, by convention, known by "lowercase" and "uppercase" names, + depending on whether it has modem control. So by convention, + communications programs are supposed to create the lockfiles based on + the lowercase name. But some programs don't follow this convention. In + HP-UX, we have several different names for each serial device. And so + on. + + For this reason, on platforms where the LK.inode.major.minor form is + not used, C-Kermit also creates a secondary lockfile (which is simply a + link to the first) if: + + a. The given device name is a symbolic link. The secondary link is + based on the device's real name. + b. On SCO: The device name is not a symbolic link, but it contains + uppercase letters. The primary link is based on the lowercase name; + the secondary link is based on the name that was given. + c. On HP-UX: The device name starts with "cu". The primary link is + based on the name that was given; the secondary link is based on + the corresponding "ttyd" device, e.g. "LCK..cua0p0" and + "LCK..ttyd0p0". + + NOTE: symlinks are not handled in HP-UX. + + Honey DanBer (HDB) UUCP, the basis of many UUCP implementations, has + two characteristics: + + a. Lockfiles are kept in /usr/spool/locks/ (usually). + b. A lockfile contains the process id (pid) in ASCII, rather than as + an int. + + Non-HDB selections assume the lockfile contains the pid in int form + (or, more precisely, in PID_T form, where PID_T is either int or pid_t, + depending on your system's C library and header files). (b), by the + way, is subject to interpretation: the numeric ASCII string may or may + not be terminated by a newline, it may or may not have leading spaces + (or zeros), and the number of leading spaces or zeros can differ, and + the differences can be significant. + + Even if you build the program with the right lockfile option, you can + still have problems when you try to open the device. Here are the error + messages you can get from SET LINE, and what they mean: + + a. "Timed out, no carrier." This one is not related to lockfiles. It + means that you have SET CARRIER ON xx, where xx is the number of + seconds to wait for carrier, and carrier did not appear within xx + seconds. Solution: SET CARRIER AUTO or OFF. + b. "Sorry, access to lock denied." Kermit has been configured to use + lockfiles, but (a)the lockfile directory is write-protected against + you, or (b) it does not exist. The "access to lock denied" message + will tell you the reason. If the directory does not exist, check to + make sure Kermit is using the right name. Just because version n of + your Unix used a certain lockfile directory is no gurantee that + version n.1 does not use a different one. Workaround: ask the + system administrator to install a symbolic link from the old name + to the new name. Other solutions: (see below) + c. "Sorry, access to tty device denied." The tty device that you + specified in your SET LINE command is read/write protected against + you. Solution: (see below) + d. "Sorry, device is in use." The tty device you have specified is + currently being used by another user. A prefatory message gives you + an "ls -l" listing of the lockfile, which should show the username + of the person who created it, plus a message "pid = nnn" to show + you the process id of the user's program. Solutions: try another + device, wait until the other user is finished, ask the other user + to hurry up, or ask the system manager for help. + e. "Sorry, can't open connection: reason". The device cannot be opened + for some other reason, which is listed. + f. "sh: /usr/lib/uucp/acucntrl: not found". This means your Kermit + program was built with the -DACUCNTRL switch, but your computer + system does not have the BSD 4.3 acucntrl program. Solution: + install the acucntrl program if you have it, or rebuild Kermit + without the -DACUCNTRL switch. + + There are two solutions for problems (b) and (c), both of which involve + intervention by your Unix system administrator (superuser): + + a. Have the superuser change the permission of the lockfile directory + and to the tty devices so that everyone on the system has + read/write permission. + +su% chmod 777 /usr/spool/locks (or whatever the path is) +su% chmod 666 /dev/ttyXX + + One risk here is that people can write lots of junk into the + lockfile directory, delete other people's files in the lockfile + directory, and intercept other people's data as it goes in and out + of the tty device. The major danger here would be intercepting a + privileged password. Of course, any user could write a short, + ordinary, unprivileged program to do exactly the same thing if the + tty device was world read/writeable. The other risk as that + telephone calls are not controlled -- anybody on your system can + make them, without having to belong to any particular group, and + this could run up your phone bill. + b. Use groups to regulate access. Normally the lockfile directory and + and the dialout devices will have the same group (such as uucp). If + so, then put everybody who's allowed to dial out into that group, + and make sure that the lockfile directory and the tty devices have + group read AND write permission. Example: + +su% chmod 770 /usr/spool/locks (or whatever the path is) +su% chmod 660 /dev/ttyXX + + User whatever tool is available on your platform to add users to + the appropropriate group (e.g. edit the /etc/group file). + c. Have the superuser change Kermit to run setuid and/or setgid to the + owner and/or group of the lockfile directory and the tty devices if + necessary), typically uucp (see [331]next section), but NOT root. + Example: + +su% chown uucp kermit - or - chgrp uucp kermit +su% chmod u+s kermit (setuid) - or - chmod g+s kermit (setgid) + + and then make sure the lockfile directory, and the tty devices, + have owner (setuid) and/or group (setgid) write permission. For + example: + +su% chmod o+rwx /usr/spool/uucp +su% chown uucp /dev/ttyXX ; chmod 600 /dev/ttyXX + + In some cases, the owner and group must be distinct; the key point + is that read/write access is required to both the UUCP lockfile + directory and the tty itself. + + If you make C-Kermit setuid or setgid to root, it refuses to run: + +Fatal: C-Kermit setuid to root! + + Example: + +crw-r----- 1 uucp uucp 5, 67 Feb 11 06:23 /dev/cua3 +drwxrwxr-x 3 root uucp 1024 Feb 11 06:22 /var/lock + + requires suid uucp to get read/write access on /dev/cua3 and sgid to + get read/write access on /var/lock (since you can't set Kermit's uid or + gid to root). + + The reason Kermit can't be setuid or setgid to root has to do with + the fact that some Unix OS's can't switch user or group IDs in that + case. Unfortunately, the prohibition against making Kermit setuid or + setgid to root means that Unix C-Kermit can't be used to make rlogin + connections by non-root users. (The rlogin port is privileged, which + is why the regular rlogin command is setuid root -- which is safe + because the rlogin program never has to create or access files like + Kermit does.) + + For the lockfile mechanism to achieve its desired purpose -- prevention + of access to the same tty device by more than one process at a time -- + ALL programs on a given computer that open, read or write, and close + tty devices must use the SAME lockfile conventions. Unfortunately, this + is often not the case. Here is a typical example of how this can go + wrong: In SunOS 4.0 and earler, the lockfile directory was + /usr/spool/uucp; in 4.1 it was changed to /var/spool/locks in the quest + for political correctness. Consequently, any third-party programs (such + as C-Kermit) that were not modified to account for this change, + recompiled, and reinstalled, did not use the same lockfiles as uucp, + tip, etc, and so the entire purpose of the lockfile is defeated. + + What if your Unix system does not have UUCP installed? For example, you + have a Unix workstation, and you do not use uucp, cu, or tip, or UUCP + was not even supplied with your version of Unix (QNX is an example). In + this case, you have two choices: + + a. If there may be more than one person running Kermit at the same + time, competing for the same tty device, then create a special + lockfile directory just for Kermit, for example, /usr/spool/kermit, + and make sure you have read/write access to it. Then add the + following to your makefile target CFLAGS, as shown earlier: + +-DLOCK_DIR=\\\"/usr/spool/kermit\\\" + + b. If you are the only user on your workstation, and no other + processes will ever be competing with Kermit for the dialout tty + device, then add -DNOUUCP to your makefile target's CFLAGS and + rebuild Kermit. + +11. RUNNING UNIX C-KERMIT SETUID OR SETGID + + [ [332]Top ] [ [333]Contents ] [ [334]Next ] [ [335]Previous ] + + Even if you don't intend to run C-Kermit setuid, somebody else might + come along and chown and chmod it after it has been built. You should + be sure that it is built correctly to run setuid on your system. For + POSIX and AT&T Unix based versions, you don't have to do anything + special. + + For 4.2 and 4.3 BSD-based Unix versions, you normally need not add + anything special to the makefile. The program assumes that the + setreuid() and setregid() functions are available, without which we + cannot switch back and forth between real and effective uids. If "make" + complains that _setreuid or _setregid is/are not defined, add + -DNOSETREU to CFLAGS. In this case it is very likely (but not certain) + that you cannot protect ttys and lockfiles against people and have them + run Kermit setuid. + + If make does not complain about this, you should find out whether your + BSD version (4.3 or other systems like SunOS 4.x that claim to include + BSD 4.3 compatibility) includes the saved-setuid feature (see long + notes under edit 146 in ckc178.upd). If it does, then add -DSAVEDUID to + CFLAGS. + + IMPORTANT NOTE: Most Unix system documentation will not give you the + required information. To determine whether your Unix system supplies + the the saved-original-effective-user/group-id feature, use the + ckuuid.c program. Read and follow the instructions in the comments + at the beginning. + + C-Kermit for 4.4BSD-based systems automatically use sete[ug]id(). See + [336]ckutio.c. + + If you have a version of Unix that is not BSD-based, but which supplies + the setreuid() and setregid() functions, and these are the only way to + switch between real and effective uid, add -DSETREUID to your makefile + target. + + WARNING: There are two calls to access() in [337]ckufio.c, by which + Kermit checks to see if it can create an output file. These calls + will not work correctly when (a)you have installed C-Kermit setuid + or setgid on a BSD-based Unix system, and (b) the + saved-original-effective-uid/gid feature is not present, and (c) the + access() function always checks what it believes to be the real ID + rather than the effective ID. This is the case, for example, in + Olivetti X/OS and in NeXTSTEP. In such cases, you can force correct + operation of access() calls by defining the symbol SW_ACC_ID at + compile time in CFLAGS. + + If you have a version of Unix that does not allow a process to switch + back and forth between its effective and real user and group ids + multiple times, you probably should not attempt to run Kermit setuid, + because once having given up its effective uid or gid (which it must do + in order to transfer files, fork a shell, etc) it can never get it + back, and so it can not use the original effective uid or gid to create + or delete uucp lockfiles. In this case, you'll either have to set the + permissions on your lockfile directory to make them publicly + read/writable, or dispense with locking altogether. + + MORAL: Are you thoroughly sickened and/or frightened by all that you + have just read? You should be. What is the real answer? Simple. Serial + devices -- such as ttys and magnetic tapes -- in Unix should be opened + with exclusive access only, enforced by the Unix kernel. Shared access + has no conceivable purpose, legitimate or otherwise, except by + privileged system programs such as getty. The original design dates + from the late 1960s, when Unix was developed for laboratory use under a + philosophy of trust by people within shouting distance of each other -- + but even then, no useful purpose was served by this particular form of + openness; it was probably more of a political statement. Since the + emergence of Unix from the laboratory into the commercial market, we + have seen every vestige of openness -- but this one -- stripped away. + I'd like to see some influential Unix maker take the bold step of + making the simple kernel change required to enforce exclusive access to + serial devices. (Well, perhaps not so simple when bidirectionality must + also be a goal -- but then other OS's like VMS solved this problem + decades ago.) + +12. CONFIGURING UNIX WORKSTATIONS + + [ [338]Top ] [ [339]Contents ] [ [340]Next ] [ [341]Previous ] + + On desktop workstations that are used by only the user at the console + keyboard, C-Kermit is always used in local mode. But as delivered, + C-Kermit runs in remote mode by default. To put it in local mode at + startup, you can put a SET LINE command in your .mykermrc. + + You can also build C-Kermit to start up in local mode by default. To do + this, include the following in the CFLAGS in your makefile target: + +-DDFTTY=\\\"/dev/ttyxx\\\" + + where ttyxx is the name of the device you will be using for + communications. Presently there is no way of setting the default modem + type at compile time, so use this option only for direct lines. + + C-Kermit does not work well on certain workstations if it is not run + from within a terminal window. For example, you cannot start C-Kermit + on a NeXT by launching it directly from NeXTstep. Similarly for Sun + workstations in the Open Windows environment. Run Kermit in a terminal + window. + +13. BIZARRE BEHAVIOR AT RUNTIME + + [ [342]Top ] [ [343]Contents ] [ [344]Next ] [ [345]Previous ] + + See the "beware file", + + [346]ckubwr.txt, for hints about runtime misbehavior. This section + lists some runtime problems that can be cured by rebuilding C-Kermit. + + The program starts, but there is no prompt, and certain operations + don't work (you see error messages like "Kermit command error in + background execution"). This is because Kermit thinks it is running in + the background. See conbgt() in [347]ckutio.c. Try rebuilding Kermit + with: + + -DPID_T=pid_t + + added to your CFLAGS. If that doesn't help, find out the actual data + type for pids (look in types.h or similar file) and use it in place of + "pid_t", for example: + + -DPID_T=short + + Unexplainable and inappropriate error messages ("Sockets not supported + on this device", etc) have been traced in at least one case to a lack + of agreement between the system header files and the actual kernel. + This happened because the GNU C compiler (gcc) was being used. gcc + wants to have ANSI-C-compliant header files, and so part of the + installation procedure for gcc is (or was) to run a shell script called + "fixincludes", which translates the system's header files into a + separate set of headers that gcc likes. So far so good. Later, a new + version of the operating system is installed and nobody remembers to + run fixincludes again. From that point, any program compiled with gcc + that makes use of header files (particularly ioctl.h) is very likely to + misbehave. Solution: run fixincludes again, or use your system's + regular C compiler, libraries, and header files instead of gcc. + +14. CRASHES AND CORE DUMPS + + [ [348]Top ] [ [349]Contents ] [ [350]Next ] [ [351]Previous ] + + If C-Kermit constitently dumps core at the beginning of a file + transfer, look in SHOW FEATURES for CKREALPATH. If found, rebuild with + -DNOREALPATH and see if that fixes the problem (some UNIXes have + realpath() but it doesn't work). + + Total failure of the Kermit program can occur because of bad memory + references, bad system calls, or problems with dynamic memory + allocation. First, try to reproduce the problem with debugging turned + on: run Kermit with the -d command-line option (for example, "wermit + -d") and then examine the resulting debug.log file. The last entry + should be in the vicinity of the crash. In VMS, a crash automatically + produces a "stack dump" which shows the routine where the crash occurs. + In some versions of Unix, you can get a stack dump with "adb" -- just + type "adb wermit core" and then give the command "$c", then Ctrl-D to + quit (note: replace "wermit" by "kermit" or by the full pathname of the + executable that crashed if it is not in the current directory). Or use + gdb to get a backtrace, etc. + + In edit 186, one implementation, UNISYS 5000/95 built with "make + sys5r3", has been reported to run out of memory very quickly (e.g. + while executing a short initialization file that contains a SET DIAL + DIRECTORY command). Debug logs show that malloc calls are failing, + reason unknown. For this and any other implementation that gives error + messages about "malloc failure" or "memory allocation failure", rebuild + the program *without* the -DDYNAMIC CFLAGS definition, for example: + +make sys5r3 KFLAGS=-UDYNAMIC + + As of edit 169, C-Kermit includes a malloc() debugging package which + you may link with the Kermit program to catch runtime malloc errors. + See the makefile entries for sunos41md and nextmd for examples of how + to select malloc debugging. Once you have linked Kermit with the malloc + debugger, it will halt with an informative message if a malloc-related + error occurs and, if possible, dump core. For this reason, + malloc-debugging versions of Kermit should be built without the "-s" + link option (which removes symbols, preventing analysis of the core + dump). You have several ways to track down the malloc error: Analyze + the core dump with adb. Or reproduce the problem with "log debug" and + then look at the code around the last debug.log entry. If you have gcc, + build the program with "-g" added to CFLAGS and then debug it with gdb, + e.g. + +gdb wermit +break main +run +.. set other breakpoints or watchpoints +continue + + Watchpoints are especially useful for finding memory leaks, but they + make the program run about a thousand times slower than usual, so don't + set them until the last possible moment. When a watchpoint is hit, you + can use the "where" command to find out which C-Kermit source statement + triggered it. + + If you have the Pure Software Inc "Purify" product, see the sunos41cp + makefile entry for an example of how to use it to debug C-Kermit. + +15. SYSLOGGING + + [ [352]Top ] [ [353]Contents ] [ [354]Next ] [ [355]Previous ] + + "Syslogging" means recording selected information in the system log via + the Unix syslog() facility, which is available in most Unix versions. + Syslogging is not done unless C-Kermit is started with: + +--syslog:n + + on the command-line, where n is a number greater than 0 to indicate the + level of syslogging. See [356]Section 4.2 of the [357]IKSD + Administrator's Guide for details. + + Obviously you can't depend on users to include --syslog:3 (or whatever) + on the command line every time they start C-Kermit, so if you want + certain kinds of records to be recorded in the system log, you can + build C-Kermit with forced syslogging at the desired level; for + example, to record logins and dialouts: + +make linux KFLAGS=-DSYSLOGLEVEL=2 + + Levels 2 and 3 are the most likely candidates for this treatment. Level + 2 forces logging of all successful dialout calls (e.g. for checking + against or phone bills), and level 3 records all connections (SET LINE + or SET HOST / TELNET / RLOGIN, etc) so you can see who is connecting + out from your system, and to where, e.g. for security auditing. + + Level 2 and 3 records are equivalent to those in the connection log; + see the [358]C-Kermit 7.0 Supplement) for a detailed description of the + connection log. + +16. BUILDING SECURE VERSIONS OF C-KERMIT 8.0 + + [ [359]Top ] [ [360]Contents ] [ [361]Next ] [ [362]Previous ] + + C-Kermit 7.0 and later may be built with Kerberos(TM) and/or SRP(TM) + (Secure Remote Password) and/or SSL/TLS security for strong + authentication and encryption of Internet connections. These security + methods require external libraries that, in their binary forms, are + restricted from export by USA law. See the [363]Kermit Security + Reference) for details. C-Kermit binaries themselves are likewise + restricted; the C-Kermit binaries that are available for public + download on the Internet are not allowed to contain the security + options. + + Sample makefile entries are provided for Linux and many other operating + systems. A list of secure makefile entries is included in the Makefile. + Complete instructions on building C-Kermit 8.0 with MIT Kerberos; + Secure Remote Password; and/or OpenSSL can be found in the [364]Kermit + Security Reference. + + SSL/TLS and Kerberos builds are increasingly problematic with the + "deprecation" of DES. There is code to detect the presence or absence + of DES in the OpenSSL builds, but it doesn't always work because + sometimes the SSL libraries are present but routines are missing from + them. + + * First of all remember that if your SSL and/or Kerberos header files + and libraries are not in the default place, you'll need to override + the assumed paths. To find out what the default places are type + "make show", e.g.: + +[~/kermit] make show +prefix=/usr/local +srproot=/usr/local +sslroot=/usr/local +manroot=/usr/local +K4LIB=-L/usr/kerberos/lib +K4INC=-I/usr/kerberos/include +K5LIB=-L/usr/kerberos/lib +K5INC=-I/usr/kerberos/include +SRPLIB=-L/usr/local/lib +SRPINC=-I/usr/local/include +SSLLIB=-L/usr/local/ssl/lib +SSLINC=-I/usr/local/ssl/include +[~/kermit] + + * You can override any or all of these by putting assignments on the + 'make' command line; examples: + +make linux+krb5 \ + "K5INC=-I/usr/include/" \ + "K5LIB=-L/usr/lib64/" + +make solaris9g+ssl \ + "SSLLIB=-L/opt/openssl-0.9.8q/lib" \ + "SSLINC=-I/opt/openssl-0.9.8q/include" + + Or by setting and exporting environment variables prior to giving + the 'make' command, as in this example in which (after Beta.01 was + uploaded) C-Kermit was successfully linked with OpenSSL 1.0.0d, + which was installed alongside OpenSSL 0.9.8r on the same computer. + Note the use of the '-i' option instead of '-I' to force gcc to + include the right header files (thanks to Nelson Beebe for this): + +export PATH=/usr/bin:$PATH +export SSLINC=-isystem/usr/include +export "SSLLIB=-L/usr/lib -Wl,-rpath,/usr/lib" +make linux+ssl + + -i is explained in 'man gcc'; there is a change in what -I does + that could have ramifications for many makefile targets, not just + Kermit. And -Wl and -rpath are explained in 'man ld'; the idea is + build a binary from which useful reports can be obtained with ldd. + * Building with OpenSSL versions prior to 0.9.7 doesn't work, even + though C-Kermit is designed to work with both the old and new + versions. This could probably be fixed if anybody cares. + * If a Kerberos or SSL build fails at link time because + des_ecb3_encrypt, des_random_seed, and/or des_set_odd_parity come + up missing, redo the build with -UCK_DES: + +make netbsd+krb5+ssl \ + "K5INC=-I/usr/local/include" \ + "K5LIB=-L/usr/local/kerblib" KFLAGS=-UCK_DES + + I suppose all the SSL and Kerberos targets could be recoded to + figure this out automatically (i.e. that DES is installed but with + some entry points missing), but it wouldn't be pretty. + * Different Kerberos and OpenSSL distributions can be installed with + different options; certain libraries might be missing or named + differently (for example, libgssapi vs libgssapi_krb5). Some, but + not all, of the C-Kermit makefile targets have been fixed to take + some of these variations into account by testing for them, most + notably the linux ones, linux+ssl, linux+krb5, and linux+krb5+ssl. + Probably every target that builds with OpenSSL or Kerberos needs + the same treatment but I won't have time. + * Why doesn't C-Kermit just use Autoconf? Mainly because the makefile + is full of targets for platforms that don't have Autoconf or any + other tool like it. (Another reason is that I've always preferred + that Kermit have the least dependencies possible on external + toolsets.) Perhaps certain targets could be converted to use them, + especially Linux because there are so many variations among + distributions and versions. Anybody who wants to make, say, an + Autonf-based Linux target, be my guest, but bear in mind that one + Linux target is supposed to work for all versions and distributions + of Linux on all platforms. Well, one target for Linux by itself, + another for Linux with OpenSSL, another for Linux with Kerberos 5, + and another for Linux with Kerberos 5 and OpenSSL. Each of these is + supposed to work on any Linux version with any version of + Kerberos 5 or OpenSSL. + + Also note that Kerberos support is for the MIT version only, Heimdal + and others are not supported (never have been). Of course anybody can + pitch in and add or improve support for whatever they want. + +17. INSTALLING C-KERMIT AS AN SSH SERVER SUBSYSTEM + + [ [365]Top ] [ [366]Contents ] [ [367]Previous ] + + This requires C-Kermit 8.0.206 or later and an SSH v2 server. If you + list C-Kermit as a Subsystem in the SSH v2 server configuration file + (as, for example, SFTP is listed), users can make SSH connections + direct to a Kermit server as explained here: + +[368]http://www.columbia.edu/kermit/skermit.html + + The name and location of the SSH server configuration file depends on + your platform, which SSH product(s) you have, etc. C-Kermit itself must + be referred to in this file as "kermit-sshsub". On the host, install + the C-Kermit 8.0.211 binary in the normal way. Then, in the same + directory as the C-Kermit binary, make a symbolic link: + +ln -s kermit kermit-sshsub + + (Note: the "make install" makefile target does this for you.) Then in + the sshd configuration file, add a line: + +Subsystem kermit /some/path/kermit-sshsub + + (where /some/path is the fully specified directory where the symlink + is.) This is similar to the line that sets up the SFTP susbsystem. + Example: + +Subsystem sftp /usr/local/libexec/sftp-server +Subsystem kermit /usr/local/bin/kermit-sshsub + + The mechanics might vary for other SSH servers; "man sshd" for details. + The method shown here is used because the OpenSSH server does not + permit the subsystem invocation to include command-line options. + C-Kermit would have no way of knowing that it should enter Server mode + if it were not called by a special name. + + [ [369]Top ] [ [370]Contents ] [ [371]C-Kermit Home ] [ [372]C-Kermit + 9.0 Overview ] [ [373]Kermit Home ] + __________________________________________________________________ + + + C-Kermit 9.0 Unix Installation Instructions / The Kermit Project / + Columbia University / 30 June 2011 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/faq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ckuins.html#contents + 12. http://www.columbia.edu/kermit/ckermit.html + 13. http://www.columbia.edu/kermit/index.html + 14. http://www.columbia.edu/kermit/ckuins.html + 15. http://www.columbia.edu/kermit/ckuins.html#x0 + 16. http://www.columbia.edu/kermit/ckuins.html#x1 + 17. http://www.columbia.edu/kermit/ckuins.html#x2 + 18. http://www.columbia.edu/kermit/ckuins.html#x3 + 19. http://www.columbia.edu/kermit/ckuins.html#x4 + 20. http://www.columbia.edu/kermit/ckuins.html#x5 + 21. http://www.columbia.edu/kermit/ckuins.html#x6 + 22. http://www.columbia.edu/kermit/ckuins.html#x7 + 23. http://www.columbia.edu/kermit/ckuins.html#x8 + 24. http://www.columbia.edu/kermit/ckuins.html#x9 + 25. http://www.columbia.edu/kermit/ckuins.html#x10 + 26. http://www.columbia.edu/kermit/ckuins.html#x11 + 27. http://www.columbia.edu/kermit/ckuins.html#x12 + 28. http://www.columbia.edu/kermit/ckuins.html#x13 + 29. http://www.columbia.edu/kermit/ckuins.html#x14 + 30. http://www.columbia.edu/kermit/ckuins.html#x15 + 31. http://www.columbia.edu/kermit/ckuins.html#x16 + 32. http://www.columbia.edu/kermit/ckuins.html#x17 + 33. http://www.columbia.edu/kermit/ckuins.html#top + 34. http://www.columbia.edu/kermit/ckuins.html#contents + 35. http://www.columbia.edu/kermit/ckuins.html#x1 + 36. http://www.columbia.edu/kermit/ckccfg.html + 37. http://www.columbia.edu/kermit/ckcbwr.html + 38. http://www.columbia.edu/kermit/ckubwr.html + 39. http://www.columbia.edu/kermit/ckcplm.html + 40. http://www.columbia.edu/kermit/ckuins.html#x2 + 41. http://www.columbia.edu/kermit/ckuins.html#x3 + 42. http://www.columbia.edu/kermit/ckuins.html#x4 + 43. http://www.columbia.edu/kermit/ckuins.html#top + 44. http://www.columbia.edu/kermit/ckuins.html#contents + 45. http://www.columbia.edu/kermit/ckuins.html#x2 + 46. http://www.columbia.edu/kermit/ckuins.html#x0 + 47. ftp://www.columbia.edu/kermit/archives/cku211.tar.Z + 48. ftp://www.columbia.edu/kermit/archives/cku211.tar.gz + 49. http://kermit.columbia.edu/ftp/archives/cku211.tar.Z + 50. http://kermit.columbia.edu/ftp/archives/cku211.tar.gz + 51. ftp://www.columbia.edu/kermit/archives/cku211.tar + 52. http://kermit.columbia.edu/ftp/archives/cku211.tar + 53. http://www.columbia.edu/kermit/ckuins.html#x7 + 54. http://www.columbia.edu/kermit/ckuins.html#x5 + 55. http://www.columbia.edu/kermit/ckuins.html#x5 + 56. http://www.columbia.edu/kermit/ckuins.html#x16 + 57. http://www.columbia.edu/kermit/ckuins.html#top + 58. http://www.columbia.edu/kermit/ckuins.html#contents + 59. http://www.columbia.edu/kermit/ckuins.html#x3 + 60. http://www.columbia.edu/kermit/ckuins.html#x1 + 61. http://www.columbia.edu/kermit/ckuins.html#x5 + 62. http://www.columbia.edu/kermit/ckuins.html#X10 + 63. http://www.columbia.edu/kermit/ckuins.html#x11 + 64. http://www.columbia.edu/kermit/ckuins.html#x10 + 65. http://www.columbia.edu/kermit/ckuins.html#x3 + 66. http://www.columbia.edu/kermit/ck80packages.html + 67. http://www.columbia.edu/kermit/ckuins.html#x10 + 68. http://www.columbia.edu/kermit/ckuins.html#top + 69. http://www.columbia.edu/kermit/ckuins.html#contents + 70. http://www.columbia.edu/kermit/ckuins.html#x4 + 71. http://www.columbia.edu/kermit/ckuins.html#x2 + 72. ftp://www.columbia.edu/kermit/bin/ + 73. http://www.columbia.edu/kermit/ck80binaries.html + 74. http://www.columbia.edu/kermit/ckuins.html#x7 + 75. http://www.columbia.edu/kermit/ckuins.html#build + 76. http://www.columbia.edu/kermit/ckuins.html#x5 + 77. http://www.columbia.edu/kermit/ckuins.html#x4 + 78. http://www.columbia.edu/kermit/ckfaq.html#version + 79. http://www.columbia.edu/kermit/ckuins.html#x4 + 80. mailto:kermit@columbia.edu + 81. http://www.columbia.edu/kermit/ckuins.html#top + 82. http://www.columbia.edu/kermit/ckuins.html#contents + 83. http://www.columbia.edu/kermit/ckuins.html#x5 + 84. http://www.columbia.edu/kermit/ckuins.html#x3 + 85. http://www.columbia.edu/kermit/ckuins.html#x8 + 86. http://www.columbia.edu/kermit/ckuins.html#x9 + 87. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 88. ftp://kermit.columbia.edu/kermit/c-kermit/ckpker.mk + 89. ftp://kermit.columbia.edu/kermit/c-kermit/ckubsd.mak + 90. http://www.columbia.edu/kermit/ckuins.html#x5 + 91. mailto:kermit-support@columbia.edu + 92. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 93. http://www.columbia.edu/kermit/ckuins.html#x7 + 94. mailto:kermit-support@columbia.edu + 95. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 96. http://www.columbia.edu/kermit/ckuins.html#x5.4 + 97. http://www.columbia.edu/kermit/ckuins.html#x10 + 98. http://www.columbia.edu/kermit/ckuins.html#x11 + 99. http://www.columbia.edu/kermit/ckuins.html#x5 + 100. http://www.columbia.edu/kermit/iksd.html + 101. http://www.columbia.edu/kermit/ckuins.html#top + 102. http://www.columbia.edu/kermit/ckuins.html#contents + 103. http://www.columbia.edu/kermit/ckuins.html#x4.1 + 104. http://www.columbia.edu/kermit/ckccfg.html + 105. http://www.columbia.edu/kermit/ckuins.html#x4.1 + 106. http://www.columbia.edu/kermit/ckuins.html#x4.2 + 107. http://www.columbia.edu/kermit/ckuins.html#x4.3 + 108. http://www.columbia.edu/kermit/ckuins.html#x4.4 + 109. http://www.columbia.edu/kermit/ckuins.html#x4.5 + 110. http://www.columbia.edu/kermit/ckccfg.html + 111. http://www.columbia.edu/kermit/ckccfg.html#x8 + 112. http://www.columbia.edu/kermit/iksd.html + 113. http://www.columbia.edu/kermit/iksd.html + 114. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 115. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 116. mailto:kermit-support@columbia.edu + 117. ftp://kermit.columbia.edu/kermit/c-kermit/ckcmai.c + 118. http://www.columbia.edu/kermit/ckuins.html#x15 + 119. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 120. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 121. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 122. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 123. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.c + 124. ftp://kermit.columbia.edu/kermit/c-kermit/ckcnet.c + 125. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 126. ftp://kermit.columbia.edu/kermit/c-kermit/ckcuni.c + 127. mailto:kermit-support@columbia.edu + 128. http://www.columbia.edu/kermit/ckuins.html#top + 129. http://www.columbia.edu/kermit/ckuins.html#contents + 130. http://www.columbia.edu/kermit/ckuins.html#x4 + 131. http://www.columbia.edu/kermit/ckuins.html#x4.2 + 132. http://www.columbia.edu/kermit/ckuins.html#x4.0 + 133. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 134. ftp://kermit.columbia.edu/kermit/c-kermit/ckubwr.txt + 135. http://www.columbia.edu/kermit/ckubwr.html + 136. ftp://kermit.columbia.edu/kermit/c-kermit/ckwart.c + 137. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w + 138. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.c + 139. http://www.columbia.edu/kermit/ckuins.html#top + 140. http://www.columbia.edu/kermit/ckuins.html#contents + 141. http://www.columbia.edu/kermit/ckuins.html#x4 + 142. http://www.columbia.edu/kermit/ckuins.html#x4.3 + 143. http://www.columbia.edu/kermit/ckuins.html#x4.1 + 144. http://www.columbia.edu/kermit/ckuins.html#x5 + 145. http://www.columbia.edu/kermit/ckuins.html#top + 146. http://www.columbia.edu/kermit/ckuins.html#contents + 147. http://www.columbia.edu/kermit/ckuins.html#x4 + 148. http://www.columbia.edu/kermit/ckuins.html#x4.4 + 149. http://www.columbia.edu/kermit/ckuins.html#x4.2 + 150. http://www.columbia.edu/kermit/ckuins.html#top + 151. http://www.columbia.edu/kermit/ckuins.html#contents + 152. http://www.columbia.edu/kermit/ckuins.html#x4 + 153. http://www.columbia.edu/kermit/ckuins.html#x4.5 + 154. http://www.columbia.edu/kermit/ckuins.html#x4.3 + 155. ftp://kermit.columbia.edu/kermit/c-kermit/ckpker.mk + 156. http://www.columbia.edu/kermit/ckuins.html#top + 157. http://www.columbia.edu/kermit/ckuins.html#contents + 158. http://www.columbia.edu/kermit/ckuins.html#x4 + 159. http://www.columbia.edu/kermit/ckuins.html#x4.4 + 160. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 161. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 162. ftp://kermit.columbia.edu/kermit/c-kermit/ckcpro.w + 163. http://www.columbia.edu/kermit/ckuins.html#top + 164. http://www.columbia.edu/kermit/ckuins.html#contents + 165. http://www.columbia.edu/kermit/ckuins.html#x6 + 166. http://www.columbia.edu/kermit/ckuins.html#x4 + 167. http://www.columbia.edu/kermit/ckuins.html#x5.1 + 168. http://www.columbia.edu/kermit/ckuins.html#x5.2 + 169. http://www.columbia.edu/kermit/ckuins.html#x5.3 + 170. http://www.columbia.edu/kermit/ckuins.html#x5.4 + 171. http://www.columbia.edu/kermit/ + 172. http://www.columbia.edu/kermit/ckuins.html#x5.4 + 173. http://www.columbia.edu/kermit/ckuins.html#x5.3 + 174. ftp://kermit.columbia.edu/kermit/c-kermit/COPYING.TXT + 175. ftp://kermit.columbia.edu/kermit/c-kermit/ckermit.ini + 176. http://www.columbia.edu/kermit/ckuins.html#x5.1 + 177. ftp://kermit.columbia.edu/kermit/c-kermit/ckermod.ini + 178. ftp://kermit.columbia.edu/kermit/c-kermit/ckermit70.txt + 179. http://www.columbia.edu/kermit/ck60manual.html + 180. http://www.columbia.edu/kermit/ckermit70.html + 181. ftp://kermit.columbia.edu/kermit/c-kermit/ckermit80.txt + 182. http://www.columbia.edu/kermit/ck60manual.html + 183. http://www.columbia.edu/kermit/ckermit80.html + 184. ftp://kermit.columbia.edu/kermit/c-kermit/ckcbwr.txt + 185. http://www.columbia.edu/kermit/ckcbwr.html + 186. ftp://kermit.columbia.edu/kermit/c-kermit/ckubwr.txt + 187. http://www.columbia.edu/kermit/ckubwr.html + 188. ftp://kermit.columbia.edu/kermit/c-kermit/ckuins.txt + 189. http://www.columbia.edu/kermit/ckuins.html + 190. ftp://kermit.columbia.edu/kermit/c-kermit/ckccfg.txt + 191. http://www.columbia.edu/kermit/ckccfg.html + 192. ftp://kermit.columbia.edu/kermit/c-kermit/ckcplm.txt + 193. http://www.columbia.edu/kermit/ckcplm.html + 194. ftp://kermit.columbia.edu/kermit/c-kermit/ca_certs.pem + 195. http://www.columbia.edu/kermit/ckuins.html#x16" + 196. ftp://kermit.columbia.edu/kermit/c-kermit/makefile + 197. http://www.columbia.edu/kermit/ckuins.html#x? + 198. http://www.columbia.edu/kermit/ckuins.html#x11 + 199. http://www.columbia.edu/kermit/ckuins.html#x5.2 + 200. http://www.columbia.edu/kermit/ckermit.html#download + 201. http://www.columbia.edu/kermit/ck80binaries.html + 202. http://www.columbia.edu/kermit/ckermit.html#download + 203. http://www.columbia.edu/kermit/ckuins.html#top + 204. http://www.columbia.edu/kermit/ckuins.html#contents + 205. http://www.columbia.edu/kermit/ckuins.html#x7 + 206. http://www.columbia.edu/kermit/ckuins.html#x5 + 207. http://www.columbia.edu/kermit/ckuins.html#top + 208. http://www.columbia.edu/kermit/ckuins.html#contents + 209. http://www.columbia.edu/kermit/ckuins.html#x8 + 210. http://www.columbia.edu/kermit/ckuins.html#x6 + 211. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 212. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 213. http://www.columbia.edu/kermit/ckuins.html#x4.0 + 214. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 215. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 216. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 217. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 218. http://www.columbia.edu/kermit/ckuins.html#x10 + 219. http://www.columbia.edu/kermit/ckccfg.html#x2 + 220. http://www.columbia.edu/kermit/ckccfg.html + 221. http://www.columbia.edu/kermit/ckuins.html#x4 + 222. http://www.columbia.edu/kermit/ckuins.html#x10 + 223. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 224. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 225. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 226. http://www.columbia.edu/kermit/ckuins.html#x9.4 + 227. mailto:kermit-support@columbia.edu + 228. http://www.columbia.edu/kermit/ckuins.html#top + 229. http://www.columbia.edu/kermit/ckuins.html#contents + 230. http://www.columbia.edu/kermit/ckuins.html#x9 + 231. http://www.columbia.edu/kermit/ckuins.html#x7 + 232. http://www.columbia.edu/kermit/ckccfg.html + 233. http://www.columbia.edu/kermit/ckccfg.html + 234. http://www.columbia.edu/kermit/ckuins.html#top + 235. http://www.columbia.edu/kermit/ckuins.html#contents + 236. http://www.columbia.edu/kermit/ckuins.html#x10 + 237. http://www.columbia.edu/kermit/ckuins.html#x8 + 238. http://www.columbia.edu/kermit/ckuins.html#x9.1 + 239. http://www.columbia.edu/kermit/ckuins.html#x9.1.1 + 240. http://www.columbia.edu/kermit/ckuins.html#x9.1.2 + 241. http://www.columbia.edu/kermit/ckuins.html#x9.1.3 + 242. http://www.columbia.edu/kermit/ckuins.html#x9.2 + 243. http://www.columbia.edu/kermit/ckuins.html#x9.3 + 244. http://www.columbia.edu/kermit/ckuins.html#x9.4 + 245. http://www.columbia.edu/kermit/ckuins.html#x9.5 + 246. http://www.columbia.edu/kermit/ckuins.html#x9.6 + 247. http://www.columbia.edu/kermit/ckuins.html#x9.7 + 248. http://www.columbia.edu/kermit/ckuins.html#x9.8 + 249. http://www.columbia.edu/kermit/ckuins.html#x9.9 + 250. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 251. http://www.columbia.edu/kermit/ckuins.html#top + 252. http://www.columbia.edu/kermit/ckuins.html#x9 + 253. http://www.columbia.edu/kermit/ckuins.html#contents + 254. http://www.columbia.edu/kermit/ckuins.html#x9.2 + 255. http://www.columbia.edu/kermit/ckuins.html#x9.1.1 + 256. http://www.columbia.edu/kermit/ckuins.html#x9.1.2 + 257. http://www.columbia.edu/kermit/ckuins.html#x9.1.3 + 258. http://www.columbia.edu/kermit/ckuins.html#top + 259. http://www.columbia.edu/kermit/ckuins.html#contents + 260. http://www.columbia.edu/kermit/ckuins.html#x9 + 261. http://www.columbia.edu/kermit/ckuins.html#x9.1 + 262. http://www.columbia.edu/kermit/ckuins.html#x9.1.3 + 263. http://www.columbia.edu/kermit/ckuins.html#x9.1.1 + 264. http://www.columbia.edu/kermit/ckuins.html#top + 265. http://www.columbia.edu/kermit/ckuins.html#contents + 266. http://www.columbia.edu/kermit/ckuins.html#x9 + 267. http://www.columbia.edu/kermit/ckuins.html#x9.1 + 268. http://www.columbia.edu/kermit/ckuins.html#x9.2 + 269. http://www.columbia.edu/kermit/ckuins.html#x9.1.2 + 270. http://www.opengroup.org/onlinepubs/007904975/ + 271. http://www.columbia.edu/kermit/ckuins.html#x9.1.1 + 272. http://www.columbia.edu/kermit/ckuins.html#top + 273. http://www.columbia.edu/kermit/ckuins.html#contents + 274. http://www.columbia.edu/kermit/ckuins.html#x9 + 275. http://www.columbia.edu/kermit/ckuins.html#x9.1 + 276. http://www.columbia.edu/kermit/ckuins.html#x9.3 + 277. http://www.columbia.edu/kermit/ckuins.html#x9.1 + 278. http://www.columbia.edu/kermit/ckuins.html#top + 279. http://www.columbia.edu/kermit/ckuins.html#contents + 280. http://www.columbia.edu/kermit/ckuins.html#x9 + 281. http://www.columbia.edu/kermit/ckuins.html#x9.4 + 282. http://www.columbia.edu/kermit/ckuins.html#x9.2 + 283. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 284. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 285. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 286. http://www.columbia.edu/kermit/ckuins.html#top + 287. http://www.columbia.edu/kermit/ckuins.html#contents + 288. http://www.columbia.edu/kermit/ckuins.html#x9 + 289. http://www.columbia.edu/kermit/ckuins.html#x9.5 + 290. http://www.columbia.edu/kermit/ckuins.html#x9.3 + 291. http://www.columbia.edu/kermit/cable.html + 292. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 293. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 294. http://www.columbia.edu/kermit/ckuins.html#top + 295. http://www.columbia.edu/kermit/ckuins.html#contents + 296. http://www.columbia.edu/kermit/ckuins.html#x9 + 297. http://www.columbia.edu/kermit/ckuins.html#x9.6 + 298. http://www.columbia.edu/kermit/ckuins.html#x9.4 + 299. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 300. ftp://kermit.columbia.edu/kermit/c-kermit/ckuus3.c + 301. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 302. http://www.columbia.edu/kermit/ckuins.html#top + 303. http://www.columbia.edu/kermit/ckuins.html#contents + 304. http://www.columbia.edu/kermit/ckuins.html#x9 + 305. http://www.columbia.edu/kermit/ckuins.html#x9.7 + 306. http://www.columbia.edu/kermit/ckuins.html#x9.5 + 307. http://www.columbia.edu/kermit/ckuins.html#top + 308. http://www.columbia.edu/kermit/ckuins.html#contents + 309. http://www.columbia.edu/kermit/ckuins.html#x9 + 310. http://www.columbia.edu/kermit/ckuins.html#x9.8 + 311. http://www.columbia.edu/kermit/ckuins.html#x9.6 + 312. http://www.columbia.edu/kermit/ckuins.html#top + 313. http://www.columbia.edu/kermit/ckuins.html#contents + 314. http://www.columbia.edu/kermit/ckuins.html#x9 + 315. http://www.columbia.edu/kermit/ckuins.html#x9.9 + 316. http://www.columbia.edu/kermit/ckuins.html#x9.7 + 317. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 318. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 319. ftp://kermit.columbia.edu/kermit/c-kermit/ckcdeb.h + 320. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 321. http://www.columbia.edu/kermit/ckuins.html#top + 322. http://www.columbia.edu/kermit/ckuins.html#contents + 323. http://www.columbia.edu/kermit/ckuins.html#x9 + 324. http://www.columbia.edu/kermit/ckuins.html#x10 + 325. http://www.columbia.edu/kermit/ckuins.html#x9.8 + 326. http://www.columbia.edu/kermit/ckuins.html#top + 327. http://www.columbia.edu/kermit/ckuins.html#contents + 328. http://www.columbia.edu/kermit/ckuins.html#x11 + 329. http://www.columbia.edu/kermit/ckuins.html#x9 + 330. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 331. http://www.columbia.edu/kermit/ckuins.html#x11 + 332. http://www.columbia.edu/kermit/ckuins.html#top + 333. http://www.columbia.edu/kermit/ckuins.html#contents + 334. http://www.columbia.edu/kermit/ckuins.html#x12 + 335. http://www.columbia.edu/kermit/ckuins.html#x10 + 336. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 337. ftp://kermit.columbia.edu/kermit/c-kermit/ckufio.c + 338. http://www.columbia.edu/kermit/ckuins.html#top + 339. http://www.columbia.edu/kermit/ckuins.html#contents + 340. http://www.columbia.edu/kermit/ckuins.html#x13 + 341. http://www.columbia.edu/kermit/ckuins.html#x11 + 342. http://www.columbia.edu/kermit/ckuins.html#top + 343. http://www.columbia.edu/kermit/ckuins.html#contents + 344. http://www.columbia.edu/kermit/ckuins.html#x14 + 345. http://www.columbia.edu/kermit/ckuins.html#x12 + 346. ftp://kermit.columbia.edu/kermit/c-kermit/ckubwr.txt + 347. ftp://kermit.columbia.edu/kermit/c-kermit/ckutio.c + 348. http://www.columbia.edu/kermit/ckuins.html#top + 349. http://www.columbia.edu/kermit/ckuins.html#contents + 350. http://www.columbia.edu/kermit/ckuins.html#x15 + 351. http://www.columbia.edu/kermit/ckuins.html#x13 + 352. http://www.columbia.edu/kermit/ckuins.html#top + 353. http://www.columbia.edu/kermit/ckuins.html#contents + 354. http://www.columbia.edu/kermit/ckuins.html#x16 + 355. http://www.columbia.edu/kermit/ckuins.html#x14 + 356. http://www.columbia.edu/kermit/uiksd.html#x4.2 + 357. http://www.columbia.edu/kermit/uiksd.html + 358. http://www.columbia.edu/kermit/ckermit2.html + 359. http://www.columbia.edu/kermit/ckuins.html#top + 360. http://www.columbia.edu/kermit/ckuins.html#contents + 361. http://www.columbia.edu/kermit/ckuins.html#x17 + 362. http://www.columbia.edu/kermit/ckuins.html#x15 + 363. http://www.columbia.edu/kermit/security.html + 364. http://www.columbia.edu/kermit/security80.html + 365. http://www.columbia.edu/kermit/ckuins.html#top + 366. http://www.columbia.edu/kermit/ckuins.html#contents + 367. http://www.columbia.edu/kermit/ckuins.html#x16 + 368. http://www.columbia.edu/kermit/skermit.html + 369. http://www.columbia.edu/kermit/ckuins.html#top + 370. http://www.columbia.edu/kermit/ckuins.html#contents + 371. http://www.columbia.edu/kermit/ckermit.html + 372. http://www.columbia.edu/kermit/ck90updates.html + 373. http://www.columbia.edu/kermit/index.html diff --git a/ckuker.nr b/ckuker.nr index b93227d..6e86049 100644 --- a/ckuker.nr +++ b/ckuker.nr @@ -129,8 +129,8 @@ platforms. For example, C\(hyKermit can't be built with TCP/IP support on a platform that does not have TCP/IP header files and libraries (and even if Kermit does include TCP/IP support, it can't be used to make TCP/IP connections on a computer that does -not have a TCP/IP stack installed). If your version of lacks -C\(hyKermit a feature mentioned here, use its SHOW FEATURES command to +not have a TCP/IP stack installed). If your version of +C\(hyKermit lacks a feature mentioned here, use its SHOW FEATURES command to see what might have been excluded. .PP C\(hyKermit has three kinds of commands: regular single\(hyletter command\(hyline diff --git a/ckututor.txt b/ckututor.txt new file mode 100644 index 0000000..450ab89 --- /dev/null +++ b/ckututor.txt @@ -0,0 +1,1912 @@ + + [1]The Columbia Crown The Kermit Project | Columbia University + 612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu + ...since 1981 + [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ + [10]Support + + C-KERMIT 9.0 UNIX MANUAL PAGE AND TUTORIAL + + Frank da Cruz + [11]The Kermit Project, [12]Columbia University + + [ [13]PDF version ] [ [14]Nroff version ] + + This document is intended to give the beginner sufficient + information to make basic (if not advanced) use of C-Kermit 9.0. + Although it might be rather long for a Unix manual page (about 1600 + lines), it's still far shorter than the [15]C-Kermit manual, which + should be consulted for advanced topics such as customization, + character-sets, scripting, etc. We also attempt to provide a clear + structural overview of C-Kermit's many capabilities, functional + areas, states, and modes and their interrelation, that should be + helpful to beginners and veterans alike, as well as to those + upgrading to the new release. Thanks to Christine Gianone for her + work on this document before she was laid off in 2005. + + Most recent update: Tue Jun 28 09:02:45 2011 + +CONTENTS + + * [16]DESCRIPTION + * [17]SYNOPSIS + * [18]OPTIONS + * [19]COMMAND LANGUAGE + * [20]INITIALIZATION FILE + * [21]MODES OF OPERATION + * [22]MAKING CONNECTIONS + * [23]TRANSFERRING FILES WITH KERMIT + * [24]KERMIT CLIENT/SERVER CONNECTIONS + + * [25]KERMIT'S BUILT-IN FTP AND HTTP CLIENTS + * [26]INTERNET KERMIT SERVICE + * [27]SECURITY + * [28]ALTERNATIVE COMMAND-LINE PERSONALITIES + * [29]LICENSE + * [30]OTHER TOPICS + * [31]DOCUMENTATION AND UPDATES + * [32]FILES + * [33]AUTHORS + +DESCRIPTION [34]Top [35]Contents [36]Next + +[37]C-Kermit is an all-purpose communications software package from the +[38]Kermit Project at [39]Columbia University that: + + * Is portable to many platforms, Unix and non-Unix alike. + * Can make both serial and network connections. + * Can conduct interactive terminal sessions over its connection. + * Can transfer text or binary files over the same connection. + * Can convert text-file character sets in terminal mode or file + transfer. + * Is customizable in every aspect of its operation. + + C-Kermit is a modem program, a Telnet client, an Rlogin client, an FTP + client, an HTTP client, and on selected platforms, also an X.25 client. + It can make its own secure Internet connections using IETF-approved + security methods including Kerberos IV, Kerberos V, SSL/TLS, and SRP + and it can also make SSH (Secure Shell) connections through your + external SSH client application. It can be the far-end file-transfer or + client/server partner of your desktop Kermit client. It can also accept + incoming dialed and network connections. It can even be installed as an + Internet service on its own standard TCP socket, 1649 [[40]RFC2839, + [41]RFC2840]. + + And perhaps most important, everything you can do "by hand" + (interactively) with C-Kermit, can be "scripted" (automated) using its + built-in cross-platform transport-independent script programming + language, which happens to be identical to its interactive command + language. + + This manual page offers an overview of C-Kermit 9.0 for Unix ("Unix" is + an operating system family that includes AIX, DG/UX, FreeBSD, HP-UX, + IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Open Server, Open Unix, QNX, + Solaris, SunOS, System V R3, System V R4, Tru64 Unix, Unixware, Xenix, + and many others). For thorough coverage, please consult the published + C-Kermit manual and supplements (see [42]DOCUMENTATION below). For + further information about C-Kermit, Kermit software for other + platforms, and Kermit manuals, visit the Kermit Project website: + + [43]http://www.columbia.edu/kermit/ + + This is a longer-than-average manual page, and yet it barely scratches + the surface. Don't be daunted. C-Kermit is a large and complex package, + evolving over decades of practice and experience, but that doesn't mean + it's hard to learn or use. Its most commonly used functions are + explained here with pointers to additional information elsewhere. + + [44]Kermit Home [45]C-Kermit Home [46]C-Kermit FAQ + +SYNOPSIS [47]Top [48]Contents [49]Next [50]Previous + +Usage: kermit [filename] [-x arg [-x arg]...[-yyy]..] [ {=,--,+} text ] ] +Or: kermit URL + + * -x is an option requiring an argument; + * -y is an option with no argument. + + If the first command-line argument is the name of a file, + interactive-mode commands are executed from the file. The '=' (or "--") + argument tells Kermit not to parse the remainder of the command line, + but to make the words following '=' available as \%1, \%2, ... \%9. The + "+" argument is like "=" but for use in "kerbang scripts" (explained + [51]below). A second command-line format allows the one and only + argument to be a [52]Telnet, FTP, HTTP, or IKSD URL. + + Order of execution: + + 1. [53]The command file (if any). + 2. [54]The initialization file, if any, unless suppressed with -Y. + 3. [55]The customization file (if it is executed by the initialization + file). + 4. [56]The command-line URL (if any, and if so, execution stops here). + 5. [57]Command-line options (if any). + 6. [58]Interactive commands. + + Some command-line options can cause actions (such as -s to send a + file); others just set parameters. If any action options are included + on the command line, Kermit exits when finished unless also given the + -S ("stay") option. If no action options are given, no initialization + or command files contained an EXIT or QUIT command, and no fatal errors + occurred, Kermit issues its prompt and waits for you to type commands. + + Bear in mind that C-Kermit can be built with selected features + disabled, and also that certain features are not available on all + platforms. For example, C-Kermit can't be built with TCP/IP support + on a platform that does not have TCP/IP header files and libraries + (and even if Kermit does include TCP/IP support, it can't be used to + make TCP/IP connections on a computer that does not have a TCP/IP + stack installed). If your version of C-Kermit lacks a feature + mentioned here, use its SHOW FEATURES command to see what might have + been excluded. + + C-Kermit has three kinds of commands: regular single-letter + command-line options, extended-format command-line options, and + interactive commands. + + [59]Kermit Home [60]C-Kermit Home [61]C-Kermit FAQ + +OPTIONS [62]Top [63]Contents [64]Next [65]Previous <- (Most people should +click Next to skip around this section...) + +Like most Unix commands, C-Kermit can be be given options on the command +line. But C-Kermit also can be used interactively by giving it [66]commands +composed of words, which are more intuitive than cryptic command-line +options, and more flexible too. In other words, you don't have to use +C-Kermit's command-line options, but they are available if you want to. (By +the same token, you don't have to use its interactive commands either -- you +can use either or both in any combination.) + +C-Kermit is generally installed in the PATH as "kermit", and therefore is +invoked by typing the word "kermit" (lowercase) at the shell prompt, and then +pressing the Return or Enter key. If you wish to include command-line +options, put them after the word "kermit" but before pressing Return or +Enter, separated by spaces, for example: + + $ kermit -s ckermit.tar.gz + + ('$' is the shell prompt; "kermit -s ckermit.tar.gz" is what you type, + followed by Return or Enter.) + + Here is a list of C-Kermit's single-letter command-line options, which + start with a single dash (-), in ASCII ("alphabetical") order. + Alphabetic case is significant (-A is not the same as -a). The Action? + column contains Y for action options and N for non-action options. + + Option Action? Description + -0 N (digit zero) 100% transparent Connect state for "in-the-middle" + operation: 8 bits, no parity, no escape character, everything passes + through. + -8 N (digit eight) Connection is 8-bit clean (this is the default in + C-Kermit 9.0). Equivalent to the EIGHTBIT command, which in turn is a + shortcut for SET TERMINAL BYTESIZE 8, SET COMMAND BYTESIZE 8, SET + PARITY NONE. + -9 arg N (digit nine) Make a connection to an FTP server. Equivalent to + the FTP OPEN command. + Argument: IP-address-or-hostname[:optional-TCP-port]. + NOTE: C-Kermit also has a separate FTP command-line personality, with + regular FTP-like command-line syntax. [67]More about this below. + -A N Kermit is to be started as an Internet service (IKSD) (only from + inetd.conf). + -B N Kermit is running in Batch or Background (no controlling + terminal). To be used in case Kermit doesn't automatically sense its + background status. Equivalent to the SET BACKGROUND ON command. + -C arg N Interactive-mode Commands to be executed. + Argument: Commands separated by commas, list in doublequotes. + -D arg N Delay before starting to send in Remote mode. Equivalent to + the SET DELAY command. + Argument: Number of seconds. + -E N Exit automatically when connection closes. Equivalent to SET EXIT + ON-DISCONNECT ON. + -F arg N Use an open TCP connection. + Argument: Numeric file descriptor of open TCP connection. + Also see: -j, -J. + -G arg Y Get file(s) from server, send contents to standard output, + which normally would be piped to another process. + Argument: Remote file specification, in quotes if it contains + metacharacters. + Also see: -g, -k. + -H N Suppress program startup Herald and greeting. + -I N Tell Kermit it has a reliable connection, to force streaming to be + used where it normally would not be. Equivalent to the SET RELIABLE ON + command. + -J arg N "Be like Telnet." Like -j but implies -E. + Argument: IP hostname/address optionally followed by service. + NOTE: C-Kermit also has a separate Telnet command-line personality, + with regular Telnet-like command-line syntax. [68]More about this + below. + -L N Recursive directory descent for files in -s option. + -M arg N My user name (for use with Telnet, Rlogin, FTP, etc). + Equivalent to the SET LOGIN USER command. + Argument: Username string. + -O Y (Uppercase letter O) Be a server for One command only. Also see: + -x. + -P N Don't convert file (Path) names of transferred files. Equivalent + to SET FILE NAMES LITERAL. + -Q N Quick Kermit protocol settings. Equivalent to the FAST command. + This is the default in C-Kermit 7.0 and later. + -R N Remote-only (this just makes IF REMOTE true). + -S N Stay (enter command parser after action options). + -T N Force Text mode for file transfer; implies -V. Equivalent to SET + TRANSFER MODE MANUAL, SET FILE TYPE TEXT. + -V N Disable automatic per-file text/binary switching. Equivalent to + SET TRANSFER MODE MANUAL. + -Y N Skip (don't execute) the initialization file. + -a arg N As-name for file(s) in -s, -r, or -g. + Argument: As-name string (alternative filename). When receiving files, + this can be a directory name. + -b arg N Speed for serial device. Equivalent to SET SPEED. + Argument: Numeric Bits per second for serial connections. + -c Y Enter Connect state before transferring files. + -d N Create a debug.log file with detailed debugging information (a + second -d adds timestamps). Equivalent to LOG DEBUG but takes effect + sooner. + -e arg N Maximum length for incoming Kermit file-transfer packets. + Equivalent to SET RECEIVE PACKET-LENGTH. + Argument: Length in bytes. + -f Y Send a FINISH command to a Kermit server. + -g arg N Get file(s) from a Kermit server. + Argument: File specification on other computer, in quotes if it + contains metacharacters. Equivalent to GET. + Also see: -a, -G, -r. + -h Y Print Help text for single-letter command-line options (pipe thru + 'more' to prevent scrolling). + -i N Force binary (Image) mode for file transfer; implies -V. + Equivalent to SET TRANSFER MODE MANUAL, SET FILE TYPE BINARY. + -j arg N Make a TCP/IP connection. + Argument: IP host name/address and optional service name or number. + Equivalent to the TELNET command. + Also see: -J, -F. + -k Y Receive file(s) to standard output, which normally would be piped + to another process. + Also see: -r, -G. + -l arg N (Lowercase letter L) Make a connection on the given serial + communications device. Equivalent to the SET LINE (SET PORT) command. + Argument: Serial device name, e.g. /dev/ttyS0. + -m arg N Modem type for use with the -l device. Equivalent to the SET + MODEM TYPE command. + Argument: Modem name as in SET MODEM TYPE command, e.g. "usrobotics". + -n Y Enter Connect state after transferring files (historical). + -p arg N Parity. Equivalent to the SET PARITY command. + Argument: One of the following: e(ven), o(dd), m(ark), n(one), s(pace). + -q N Quiet (suppress most messages). Equivalent to SET QUIET ON. + -r Y Receive file(s). Equivalent to the RECEIVE command. + Argument: (none, but see -a) + -s arg N Send file(s). + Argument: One or more local file specifications. Equivalent to the SEND + command. + Also see: -a. + -t N (Historical) Xon (Ctrl-Q) Turnaround character for half-duplex + connections (used on serial linemode connections to old mainframes). + Equivalent to SET DUPLEX HALF, SET HANDSHAKE XON. + -v arg N Window size for Kermit protocol (ignored when streaming). + Equivalanet to SET WINDOW-SIZE. + Argument: Number, 1 to 32. + -w N Incoming files Write over existing files. Equivalent to SET FILE + COLLISION OVERWRITE. + -x Y Enter server mode. Equivalent to the SERVER command. Also see: -O. + -y arg N Alternative initialization file. + Argument: Filename. + -z N Force foreground behavior. To be used in case Kermit doesn't + automatically sense its foreground status. Equivalent to the SET + BACKGROUND OFF command. + + Extended command-line options (necessary because single-letter ones are + about used up) start with two dashes (--), with words rather than + single letters as option names. If an extended option takes an + argument, it is separated from the option word by a colon (:). Extended + options include: + + Option + Description + + --bannerfile:filename File to display upon startup or IKSD login. + --cdfile:filename File to be sent for display to the client when server + changes directory (filename is relative to the changed-to directory). + --cdmessage:{on,off} Enable/disable the server CD message feature. + --help Prints usage message for extended options. + --helpfile:filename Designates a file containing custom text to replace + the top-level HELP command. + --nointerrupts Disables keyboard interrupts. + --noperms Disables the Kermit protocol file Permissions attribute, to + prevent transmission of file permissions (protection) from sender to + receiver. + + Plus several other [69]IKSD-Only options. + + See the [70]file-transfer section for examples of command-line + invocation. + + COMMAND LANGUAGE [71]Top [72]Contents [73]Next [74]Previous + + * [75]Command Files, Macros, and Scripts + * [76]Command List + + C-Kermit's interactive command language is the subject of a + [77]622-page book and another several hundred pages of updates, far too + much for a manual page. But it's not hard to get started. At the shell + prompt, just type "kermit" to get C-Kermit's interactive command + prompt: + + $ kermit + (/current/directory) C-Kermit> + + Begin by typing "help" (and then press the Return or Enter key) for a + top-level overview, read it, and go from there. Your second command + should probably be "intro" (introduction). Note the prompt shows your + current directory (unless you tell Kermit to prompt you with something + else). + + Interactive commands are composed mainly of regular English words, + usually in the form of imperative sentences, such as: + + send oofa.txt + + which tells Kermit to send (transfer) the file whose name is oofa.txt, + or: + + set transfer mode automatic + + which sets Kermit's "transfer mode" to "automatic" (whatever that + means). + + While typing commands, you can abbreviate, ask for help (by pressing + the "?" key anywhere in a command), complete keywords or filenames + (with the Tab or Esc key), and edit your typing with Backspace or + Delete, Ctrl-W, Ctrl-U, etc. You can also recall previous commands, + save your command history, and who knows what else. Give the INTRO + command for details. + + C-Kermit has hundreds of commands, and they can be issued in infinite + variety and combinations, including commands for: + + * Making connections (SET LINE, DIAL, TELNET, SSH, FTP, CONNECT, ...) + * Breaking connections (HANGUP, CLOSE) + * Transferring files (SEND, GET, RECEIVE, MOVE, RESEND, ...) + * Establishing preferences (SET) + * Displaying preferences (SHOW) + * Managing local files (CD, DELETE, MKDIR, DIRECTORY, RENAME, TYPE, + ...) + * Managing remote files (RCD, RDEL, RMKDIR, RDIR, ...) + * Using local files (FOPEN, FCLOSE, FREAD, FWRITE) + * Programming (TAKE, DEFINE, IF, FOR, WHILE, SWITCH, DECLARE, ...) + * Interacting with the user (ECHO, ASK, ...) + * Interacting with a remote computer (INPUT, OUTPUT, ...) + * Interacting with local programs (RUN, EXEC, PTY, ...) + * Logging things (LOG SESSION, LOG PACKETS, LOG DEBUG, ...) + + And of course QUIT or EXIT to get out and HELP to get help, and for + programmers: loops, decision making, variables, arrays, associative + arrays, integer and floating point arithmetic, macros, built-in and + user-defined functions, string manipulation, pattern matching, block + structure, scoping, recursion, and all the rest. To get a list of all + C-Kermit's commands, type a question mark (?) at the prompt. To get a + description of any command, type HELP followed by the name of the + command, for example: + + help send + + The command interruption character is Ctrl-C (hold down the Ctrl key + and press the C key). + + The command language "escape character", used to introduce variable + names, function invocations, and so on, is backslash (\). If you need + to include a literal backslash in a command, type two of them, e.g.: + + get c:\\k95\\k95custom.ini + + Command Files, Macros, and Scripts + + A file containing Kermit commands is called a Kermit command file or + Kermit script. It can be executed with Kermit's TAKE command: + + (/current/dir) C-Kermit> take commandfile + + (where "commandfile" is the name of the command file). Please don't + pipe a command file into Kermit's standard input (which might or might + not work); if you have Kermit commands in a file, tell Kermit to TAKE + the file. + + In Unix only, a Kermit command file can also be executed directly by + including a "kerbang" line as the first line of the file: + + #!/usr/local/bin/kermit + + + That is, a top line that starts with "#!", followed immediately by the + full path of the Kermit executable, and then, if the Kermit script is + to be given arguments on the command line, a space and a plus sign. The + script file must also have execute permission: + + chmod +x commandfile + + Except for the " +" part, this is exactly the same as you would do for + a shell script, a Perl script, etc. Here's a simple but useless example + script that regurgitates its arguments (up to three of them): + + #!/usr/local/bin/kermit + + if defined \%1 echo "Argument 1: \%1" + if defined \%2 echo "Argument 2: \%2" + if defined \%3 echo "Argument 3: \%3" + if defined \%4 echo "etc..." + exit + + If this file is stored in your current directory as "commandfile", + then: + + ./commandfile one two three four five + + prints: + + Argument 1: one + Argument 2: two + Argument 3: three + etc... + + This illustrates the basic structure of a standalone Kermit script: the + "kerbang line", then some commands. It should end with "exit" unless + you want the Kermit prompt to appear when it is finished. \%1 is the + first argument, \%2 the second, and so on. + + You can also create your own commands by defining named macros composed + of other Kermit commands (or macros). Here's a simple example: + + define mydial { + set modem type usrobotics + set port /dev/ttyS0 + if fail end 1 + set speed 57600 + dial \%1 + if success connect + } + + This shows how you can combine many commands into one command, "mydial" + in this case (you can use any name you like, provided it does not clash + with the name of a built-in command). When this macro definition is in + effect, you can type commands like: + + mydial 7654321 + + and it executes all the commands in macro definition, substituting the + first operand ("7654321") for the formal parameter ("\%1") in the + definition. This saves you from having to type lots of commands every + time you want to make a modem call. + + One way to have the macro definition in effect is to type the + definition at the Kermit prompt. Another way is to store the definition + in a file and TAKE the file. If you want the the definition to be in + effect automatically every time you start Kermit, put the definition in + your initialization or customization file (explained [78]below). + + Here's a somewhat more ambitious example: + + define mydelete { + local trash + assign trash \v(home)trashcan/ + if not defined \%1 end 1 "Delete what?" + if wild \%1 end 1 "Deleting multiple files is too scary" + if not exist \%1 end 1 "I can't find \%1" + if not directory \m(trash) { + mkdir \m(trash) + if fail end 1 "No trash can" + } + rename /list \%1 \m(trash) + } + define myundelete { + local trash + assign trash \v(home)trashcan/ + if not defined \%1 end 1 "Undelete what?" + if wild \%1 end 1 "Undeleting multiple files is too hard" + if not directory \m(trash) end 1 "No trash can" + if not exist \m(trash)\%1 end 1 "I can't find \%1 in trash can" + rename /list \m(trash)\%1 . + } + + These macros are not exactly production quality (they don't handle + filenames that include path segments, they don't handle multiple files, + etc), but you get the idea: you can pass arguments to macros, they can + check them and make other kinds of decisions, and the commands + themselves are relatively intuitive and intelligible. + + If you put the above lines into your initialization or customization + file, you'll have MYDELETE and MYUNDELETE commands available every time + you start Kermit, at least as long as you don't suppress execution of + the initialization file. (Exercise for the reader: Make these macros + generally useful: remove limitations, add trashcan display, browsing, + emptying, etc.) + + Kerbang scripts execute without the initialization file. This to keep + them portable and also to make them start faster. If you want to write + Kerbang scripts that depend on the initialization file, include the + command + + take \v(home).kermrc + + at the desired spot in the script. By the way, \v(xxx) is a built-in + variable (xxx is the variable name, "home" in this case). To see what + built-in variables are available, type "show variables" at the C-Kermit + prompt. To see what else you can show, type "show ?". \m(xxx) is a user + defined variable (strictly speaking, it is a macro used as a variable). + + Command List + + C-Kermit has more than 200 top-level commands, and some of these, such + as SET, branch off into hundreds of subcommands of their own, so it's + not practical to describe them all here. Instead, here's a concise list + of the most commonly used top-level commands, grouped by category. To + learn about each command, type "help" followed by the command name, + e.g. "help set". Terms such as Command state and Connect state are + explained in subsequent sections. + + Optional fields are shown in [ italicized brackets ]. filename means + the name of a single file. filespec means a file specification that is + allowed to contain wildcard characters like '*' to match groups of + files. options are (optional) switches like /PAGE, /NOPAGE, /QUIET, + etc, listed in the HELP text for each command. Example: + + send /recursive /larger:10000 /after:-1week /except:*.txt * + + which can be read as "send all the files in this directory and all the + ones underneath it that are larger than 10000 bytes, no more than one + week old, and whose names don't end with ".txt". + + Basic Commands + + HELP Requests top-level help. + HELP command Requests help about the given command. + INTRODUCTION Requests a brief introduction to C-Kermit. + LICENSE Displays the C-Kermit software copyright and license. + VERSION Displays C-Kermit's version number. + EXIT [ number ] Exits from Kermit with the given status code. Synonyms: + QUIT, E, Q. + TAKE filename [ parameters... ] Executes commands from the given file. + LOG item [ filename ] Keeps a log of the given item in the given file. + [ DO ] macro [ parameters... ] Executes commands from the given + macro. + SET parameter value Sets the given parameter to the given value. + SHOW category Shows settings in a given category. + STATUS Tells whether previous command succeeded or failed. + DATE [ date-and/or-time ] Shows current date-time or interprets given + date-time. + RUN [ extern-command [ parameters... ] Runs the given external command. + Synonym: !. + EXEC [ extern-command [ params... ] Kermit overlays itself with the + given command. + SUSPEND Stops Kermit and puts it in the background. Synonym: Z. + + Local File Management + + TYPE [ options ] filename Displays the contents of the given file. + MORE [ options ] filename Equivalent to TYPE /PAGE (pause after each + screenful). + CAT [ options ] filename Equivalent to TYPE /NOPAGE. + HEAD [ options ] filename Displays the first few lines of a given file. + TAIL [ options ] filename Displays the last few lines of a given file. + GREP [ options ] pattern filespec Displays lines from files that match + the pattern. Synonym: FIND. + DIRECTORY [ options ] [ filespec ] Lists files (built-in, many + options). + LS [ options ] [ filespec ] Lists files (runs external "ls" command). + DELETE [ options ] [ filespec ] Deletes files. Synonym: RM. + PURGE [ options ] [ filespec ] Removes backup (*.~n~) files. + COPY [ options ] [ filespecs... ] Copies files. Synonym: CP. + RENAME [ options ] [ filespecs... ] Renames files. Synonym: MV. + CHMOD [ options ] [ filespecs... ] Changes permissions of files. + TRANSLATE filename charsets filename ] Converts file's character set. + Synonym: XLATE. + CD Changes your working directory to your home directory. + CD directory Changes your working directory to the one given. + CDUP Changes your working directory one level up. + PWD Displays your working directory. + BACK Returns to your previous working directory. + MKDIR [ directory ] Creates a directory. + RMDIR [ directory ] Removes a directory. + + Making Connections + + SET LINE [ options ] devicename Opens the named serial port. + Synonym: SET PORT. + OPEN LINE [ options ] devicename Same as SET LINE. Synonym: OPEN PORT. + SET MODEM TYPE [ name ] Tells Kermit what kind of modem is on the port. + DIAL [ number ] Tells Kermit to dial the given phone number with the + modem. + REDIAL Redials the most recently dialed phone number. + ANSWER + Waits for and answers an incoming call on the modem. + AUTHENTICATE [ parameters... ] Performs secure authentication on a + TCP/IP connection. + SET NETWORK TYPE { TCP/IP, X.25, ... } Selects network type for + subsequent SET HOST commands. + SET HOST [ options ] host [ port ] Opens a network connection to the + given host and port. + SET HOST [ options ] * port Waits for an incoming TCP/IP connection on + the given port. + TELNET [ options ] host Opens a Telnet connection to the host and + enters Connect state. + RLOGIN [ options ] host Opens an Rlogin connection to the host and + enters Connect state. + IKSD [ options ] host Opens a connection to an Internet Kermit Service. + SSH [ options ] host Opens an SSH connection to the host and enters + Connect state. + FTP OPEN host [ options ] Opens an FTP connection to the host. + HTTP [ options ] OPEN host Opens an HTTP connection to the host. + PTY external-command Runs the command on a pseudoterminal as if it were + a connection. + PIPE external-command Runs the command through a pipe as if it were a + connection. + + Using Connections + + CONNECT [ options ] Enters Connect (terminal) state. + Synonym: C. + REDIRECT command Redirects the given external command over the + connection. + TELOPT command Sends a Telnet protocol command (Telnet connections + only). + Ctrl-\C "Escapes back" from Connect state to Command state. + Ctrl-\B (In Connect state) Sends a BREAK signal (serial or Telnet). + Ctrl-\! (In Connect state) Enters inferior shell; "exit" to return. + Ctrl-\? (In Connect state) Shows a menu of other escape-level options. + Ctrl-\Ctrl-\ (In Connect state) Type two Ctrl-Backslashes to send one + of them. + SET ESCAPE [ character ] Changes Kermit's Connect-state escape + character. + + Closing Connections + + HANGUP Hangs up the currently open serial-port or network connection. + CLOSE Closes the currently open serial-port or network connection. + SET LINE (with no devicename) Closes the currently open + serial-port or network connection. + SET HOST (with no hostname) Closes the currently open serial-port or + network connection. + FTP CLOSE Closes the currently open FTP connection. + HTTP CLOSE Closes the currently open HTTP connection. + EXIT Also closes all connections. Synonym: QUIT. + SET EXIT WARNING OFF Suppresses warning about open connections on exit + or close. + + File Transfer + + SEND [ options ] filename [ as-name ] Sends the given file. Synonym: + S. + SEND [ options ] filespec Sends all files that match. + RESEND [ options ] filespec Resumes an interupted SEND from the point + of failure. + RECEIVE [ options ] [ as-name ] Waits passively for files to arrive. + Synonym: R. + LOG TRANSACTIONS [ filename ] Keeps a record of file transfers. + FAST Use fast file-transfer settings (default). + CAUTIOUS Use cautious and less fast file-transfer settings. + ROBUST Use ultra-conservative and slow file-transfer settings. + STATISTICS [ options ] Gives statistics about the most recent file + transfer. + WHERE After transfer: "Where did my files go?". + TRANSMIT [ options ] [ filename ] Sends file without protocol. Synonym: + XMIT. + LOG SESSION [ filename ] Captures remote text or files without + protocol. + SET PROTOCOL [ name... ] Tells Kermit to use an external file-transfer + protocol. + FTP { PUT, MPUT, GET, MGET, ... } FTP client commands. + HTTP { PUT, GET, HEAD, POST, ... } HTTP client commands. + + Kermit Server + + ENABLE, DISABLE Controls which features can be + used by clients. + SET SERVER Sets parameters prior to entering Server state. + SERVER Enters Server state. + + Client of Kermit or FTP Server + + [ REMOTE ] LOGIN [ user password ] Logs in to a Kermit server or IKSD + that requires it. + [ REMOTE ] LOGOUT Logs out from a Kermit server or IKSD. + SEND [ options ] filename [ as-name ] Sends the given file to the + server. Synonyms: S, PUT. + SEND [ options ] filespec Sends all files that match. + RESEND [ options ] filespec Resumes an interupted SEND from the point + of failure. + GET [ options ] remote-filespec Asks the server to send the given + files. Synonym: G. + REGET [ options ] remote-filespec Resumes an interrupted GET from the + point of failure. + REMOTE CD [ directory ] Asks server to change its working directory. + Synonym: RCD. + REMOTE PWD [ directory ] Asks server to display its working directory. + Synonym: RPWD. + REMOTE DIRECTORY [ filespec... ] Asks server to send a directory + listing. Synonym: RDIR. + REMOTE DELETE [ filespec... ] Asks server to delete files. Synonym: + RDEL. + REMOTE [ command... ] (Many other commands: "remote ?" for a list). + MAIL [ options ] filespec Sends file(s) to be delivered as e-mail + (Kermit only). + FINISH Asks the server to exit server state (Kermit only). + BYE Asks the server to log out and close the connection. + + Script Programming + DEFINE, DECLARE, UNDEFINE, UNDECLARE, ASSIGN, EVALUATE, + SEXPRESSION, ARRAY, SORT, INPUT, OUTPUT, IF, FOR, WHILE, SWITCH, + GOTO, ECHO, ASK, GETC, GETOK, ASSERT, WAIT, SLEEP, FOPEN, FREAD, + FWRITE, FCLOSE, STOP, END, RETURN, LEARN, SHIFT, TRACE, VOID, + INCREMENT, DECREMENT, ... For these and many more you'll need to + consult the [79]manual and supplements, and/or visit the + [80]Kermit Script Library, which also includes a brief tutorial. + Hint: HELP LEARN to find out how to get Kermit to write simple + scripts for you. + + Many of Kermit's commands have synonyms, variants, relatives, and so + on. For example, MSEND is a version of SEND that accepts a list of file + specifications to be sent, rather than just one file specification, and + MPUT is a synonym of MSEND. MOVE means to SEND and then DELETE the + source file if successful. MMOVE is like MOVE, but accepts a list of + filespecs, and so on. These are described in the [81]full + documentation. + + Use question mark to feel your way through an unfamiliar command, as in + this example (the part you type is underlined): + + C-Kermit> remote ? One of the following: + assign delete help login print rename space + cd directory host logout pwd rmdir type + copy exit kermit mkdir query set who + C-Kermit> remote set ? One of the following: + attributes file retry transfer + block-check receive server window + C-Kermit> remote set file ? One of the following: + character-set incomplete record-length + collision names type + C-Kermit> remote set file names ? One of the following: + converted literal + C-Kermit> remote set file names literal + C-Kermit> + + This is called menu on demand: you get a menu when you want one, but + menus are not forced on you even when know what you're doing. Note that + you can also abbreviate most keywords, and you can complete them with + the Tab or Esc key. Also note that ? works for filenames too, and that + you can use it in the middle of a keyword or filename, not just at the + beginning. For example, "send x?" lists all the files in the current + directory whose names start with 'x'. + + [82]Kermit Home [83]C-Kermit Home [84]C-Kermit FAQ + + INITIALIZATION FILE [85]Top [86]Contents [87]Next [88]Previous + + In its default configuration, C-Kermit executes commands from a file called + .kermrc in your home directory when it starts, unless it is given the -Y or -y + command-line option. Custom configurations might substitute a shared + system-wide initialization file. The SHOW FILE command tells what + initialization file, if any, was used. The standard initialization file + "chains" to an individual customization file, .mykermc, in the home directory, + in which each user can establish her/his own preferences, define macros, and + so on. + + Since execution of the initialization file (at least the standard one) makes + C-Kermit take longer to start, it might be better not to have an + initialization file, especially now that Kermit's default startup + configuration is well attuned to modern computing and networking -- in other + words, you no longer have do anything special to make Kermit transfers go + fast. So instead of having an initialization file that is executed every time + Kermit starts, you might consider making one or more kerbang scripts (with + names other that .kermrc) that do NOT include an "exit" command, and invoke + those when you need the settings, macro definitions, and/or scripted actions + they contain, and invoke C-Kermit directly when you don't. + + To put it another way... We still distribute the standard initialization file + since it's featured in the manual and backwards compatibility is important to + us. But there's no harm in not using it if you don't need the stuff that's in + it (services directory, dialing directory, network directory, and associated + macro definitions). On the other hand, if there are settings or macros you + want in effect EVERY time you use Kermit, the initialization file (or the + customization file it chains to) is the place to put them, because that's the + only place Kermit looks for them automatically each time you start it. + + [89]Kermit Home [90]C-Kermit Home [91]C-Kermit FAQ + MODES OF OPERATION [92]Top [93]Contents [94]Next [95]Previous + + Kermit is said to be in Local mode if it has made a connection to another + computer, e.g. by dialing it or establishing a Telnet connection to it. The + other computer is remote, so if you start another copy of Kermit on the remote + computer, it is said to be in Remote mode (as long as it has not made any + connections of its own). The local Kermit communicates over the communications + device or network connection, acting as a conduit between the the remote + computer and your keyboard and screen. The remote Kermit is the file-transfer + partner to the local Kermit and communicates only through its standard input + and output. + + At any moment, a Kermit program can be in any of the following states. It's + important to know what they are and how to change from one to the other. + + Command state + + In this state, Kermit reads commands from: + + + Your keyboard; or: + + A file, or: + + A macro definition. + + You can exit from Command state back to Unix with the EXIT or + QUIT command (same thing). You can enter Connect state with any + of various commands (CONNECT, DIAL, TELNET, etc). You can enter + file transfer state with commands like SEND, RECEIVE, and GET. + You can enter Server state with the SERVER command. The TAKE + command tells Kermit to read and execute commands from a file. + The (perhaps implied) DO command tells Kermit to read and + execute commands from a macro definition. While in Command + state, you can interrupt any command, macro, or command file by + typing Ctrl-C (hold down the Ctrl key and press the C key); this + normally brings you back to the prompt. + + Shell state + + You can invoke an inferior shell or external command from the + Kermit command prompt by using the PUSH, RUN (!), EDIT, or + BROWSE command. While the inferior shell or command is active, + Kermit is suspended and does nothing. Return to Kermit Command + state by exiting from the inferior shell or application. + + Connect state + + In this state, which can be entered only when in Local mode + (i.e. when Kermit has made a connection to another computer), + Kermit is acting as a terminal to the remote computer. Your + keystrokes are sent to the remote computer and characters that + arrive over the communication connection are displayed on your + screen. This state is entered when you give a CONNECT, DIAL, + TELNET, RLOGIN, or IKSD command. You can return to command state + by logging out of the remote computer, or by typing: + + Ctrl-\c + + That is: Hold down the Ctrl key and press the backslash key, + then let go of the Ctrl key and press the C key. This is called + escaping back. Certain other escape-level commands are also + provided; type Ctrl-\? for a list. For example, you can enter + Shell state with: + + Ctrl-\! + + To send a Ctrl-\ to the host while in Connect state, type two of + them in a row. See HELP CONNECT and HELP SET ESCAPE for more + info. + + Local file-transfer state + + In this state, Kermit is sending packets back and forth with the + other computer in order to transfer a file or accomplish some + other file-related task. And at the same time, it is displaying + its progress on your screen and watching your keyboard for + interruptions. In this state, the following single-keystroke + commands are accepted: + + X Interrupt the current file and go on to the next (if any). + Z Interrupt the current file and skip all the rest. + E Like Z but uses a "stronger" protocol (use if X or Z don't work). + Ctrl-C Interrupt file-transfer mode (use if Z or E don't work). + + Kermit returns to its previous state (Command or Connect) when + the transfer is complete or when interrupted successfully by X, + Z, E, or Ctrl-C (hold down the Ctrl key and press the C key). + + Remote file-transfer state + + In this state, Kermit is exchanging file-transfer packets with + its local partner over its standard i/o. It leaves this state + automatically when the transfer is complete. In case you find + your local Kermit in Connect state and the remote one in + File-transfer state (in which it seems to ignore your + keystrokes), you can usually return it to command state by + typing three Ctrl-C's in a row. If that doesn't work, return + your local Kermit to Command state (Ctrl-\ C) and type + "e-packet" and then press the Return or Enter key; this forces a + fatal Kermit protocol error. + + Remote Server state + + This is like Remote File-transfer state, except it never returns + automatically to Command state. Rather, it awaits further + instructions from the client program; that is, from your Local + Kermit program. You can return the Remote Server to its previous + state by issuing a "finish" command to the client, or if you are + in Connect state, by typing three Ctrl-C's in a row. You can + tell the server job to log out and break the connection by + issuing a "bye" command to the client. + + Local Server state + + Like Remote-Server state, but in local mode, and therefore with + its file-transfer display showing, and listening for single-key + commands, as in Local File-transfer state. Usually this state is + entered automatically when a remote Kermit program gives a GET + command. + + C-Kermit, Kermit 95, and MS-DOS Kermit all can switch automatically from + Connect state to Local File-transfer state when you initiate a file transfer + from the remote computer by starting Kermit and telling it to send or get a + file, in which case, Connect state is automatically resumed after the file + transfer is finished. + + Note that C-Kermit is not a terminal emulator. It is a communications + application that you run in a terminal window (e.g. console or Xterm). The + specific emulation, such as VT100, VT220, Linux Console, or Xterm, is provided + by the terminal window in which you are running C-Kermit. Kermit 95 and MS-DOS + Kermit, on the other hand, are true terminal emulators. Why is C-Kermit not a + terminal emulator? [96]CLICK HERE to read about it. + + [97]Kermit Home [98]C-Kermit Home [99]C-Kermit FAQ + MAKING CONNECTIONS [100]Top [101]Contents [102]Next [103]Previous + + Here is how to make different kinds of connections using interactive Kermit + commands (as noted above, you can also make connections with command-line + options). Note that you don't have to make connections with Kermit. It can + also be used on the far end of a connection as the remote file transfer and + management partner of your local communications software. + + Making a Telnet Connection + + At the C-Kermit command prompt, simply type: + + telnet foo.bar.com ; Substitute desired host name or address. + telnet xyzcorp.com 3000 ; You can also include a port number. + + If the connection is successful, Kermit automically enters + Connect state. When you logout from the remote host, Kermit + automatically returns to its prompt. More info: HELP TELNET, + HELP SET TELNET, HELP SET TELOPT. Also see the [104]IKSD section + below. + + Making an Rlogin connection + + This is just like Telnet, except you have to be root to do it + because Rlogin uses a privileged TCP port: + + rlogin foo.bar.com ; Substitute desired host name or address. + + More info: HELP RLOGIN. + + Making an SSH Connection + + Unlike Telnet and Rlogin, SSH connections are not built-in, but + handled by running your external SSH client through a + pseudoterminal. Using C-Kermit to control the SSH client gives + you all of Kermit's features (file transfer, character-set + conversion, scripting, etc) over SSH. + + ssh foo.bar.com ; Substitute desired host name or address. + + More info: HELP SSH, HELP SET SSH. + + Dialing with a Modem + + If it's an external modem, make sure it is connected to a usable + serial port on your computer with a regular (straight-through) + [105]modem cable, and to the telephone jack with a telephone + cable, and that it's turned on. Then use these commands: + + set modem type usrobotics ; Or other supported type + set line /dev/ttyS0 ; Specify device name + set speed 57600 ; Or other desired speed + set flow rts/cts ; Most modern modems support this + set dial method tone ; (or pulse) + dial 7654321 ; Dial the desired number + + Type "set modem type ?" for a list of supported modem types. If + you omit the SET MODEM TYPE command, the default type is + "generic-high-speed", which should work for most modern + AT-command-set modems. If the line is busy, Kermit redials + automatically. If the call does not succeed, use "set dial + display on" and try it again to watch what happens. If the call + succeeds, Kermit enters Connect state automatically and returns + to its prompt automatically when you log out from the remote + computer or the connection is otherwise lost. + + You can also dial from a modem that is accessible by Telnet, + e.g. to a reverse terminal server. In this case the command + sequence is: + + set host ts.xxx.com 2000 ; Terminal-server and port + set modem type usrobotics ; Or other supported type + set dial method tone ; (or pulse) + dial 7654321 ; Dial the desired number + + If the terminal server supports the Telnet Com Port Option, + [106]RFC 2217, you can also give serial-port related commands + such as SET SPEED, SET PARITY, and so on, and Kermit relays them + to the terminal server using the protocol specified in the RFC. + + More info: HELP SET MODEM, HELP SET LINE, HELP SET SPEED, HELP + SET FLOW, HELP DIAL, HELP SET DIAL, HELP SET MODEM, HELP SET + CARRIER-WATCH, SHOW COMMUNICATIONS, SHOW MODEM, SHOW DIAL. + + Direct Serial Port + + Connect the two computers, A and B, with a [107]null modem cable + (or two modem cables interconnected with a null-modem adapter or + modem eliminator). From Computer A: + + set modem type none ; There is no modem + set line /dev/ttyS0 ; Specify device name + set carrier-watch off ; If DTR and CD are not cross-connected + set speed 57600 ; Or other desired speed + set flow rts/cts ; If RTS and CTS are cross-connected + set flow xon/xoff ; If you can't use RTS/CTS + set parity even ; (or "mark" or "space", if necessary) + set stop-bits 2 ; (rarely necessary) + connect ; Enter Connect (terminal) state + + This assumes Computer B is set up to let you log in. If it + isn't, you can run a copy of Kermit on Computer B and follow + approximately the same directions. More info: As above plus HELP + CONNECT. + + With modems or direct serial connections, you might also have to "set parity + even" (or "mark" or "space") if it's a 7-bit connection. + + Of the connection types listed above, only one can be open at a time. However, + any one of these can be open concurrently with an [108]FTP or HTTP session. + Each connection type can be customized to any desired degree, scripted, + logged, you name it. See the manual. + + NOTE: On selected platforms, C-Kermit also can make X.25 connections. See the + manual for details. + + [109]Kermit Home [110]C-Kermit Home [111]C-Kermit FAQ + TRANSFERRING FILES WITH KERMIT [112]Top [113]Contents [114]Next [115]Previous + + * [116]Downloading Files + * [117]Uploading Files + * [118]Kermit Transfers the Old-Fashioned Way + * [119]If File Transfer Fails + * [120]Advanced Kermit File Transfer Features + * [121]Non-Kermit File Transfer + + There is a [122]widespread and persistent belief that Kermit is a slow + protocol. This is because, until recently, it used conservative tuning by + default to make sure file transfers succeeded, rather than failing because + they overloaded the connection. Some extra commands (or command-line options, + like -Q) were needed to make it go fast, but nobody bothered to find out about + them. Also, it takes two to tango: most non-Kermit-Project Kermit protocol + implementations really ARE slow. The best file-transfer partners for C-Kermit + are: another copy of [123]C-Kermit (7.0 or later) and [124]Kermit 95. These + combinations work well and they work fast by default. MS-DOS Kermit is good + too, but you have to tell it to go fast (by giving it the FAST command). + + Furthermore, all three of these Kermit programs support "autodownload" and + "autoupload", meaning that when they are in Connect state and a Kermit packet + comes in from the remote, they automatically switch into file transfer mode. + + And plus, C-Kermit and K95 also switch automatically between text and binary + mode for each file, so there is no need to "set file type binary" or "set file + type text", or to worry about files being corrupted because they were + transferred in the wrong mode. + + What all of these words add up to is that now, when you use up-to-date Kermit + software from the Kermit Project, file transfer is not only fast, it's + ridiculously easy. You barely have to give any commands at all. + + Downloading Files + + Let's say you have [125]Kermit 95, [126]C-Kermit, or [127]MS-DOS + Kermit on your desktop computer, with a connection to a Unix + computer that has C-Kermit installed as "kermit". To download a + file (send it from Unix to your desktop computer), just type the + following command at your Unix shell prompt: + + kermit -s oofa.txt + + (where oofa.txt is the filename). If you want to send more than + one file, you can put as many filenames as you want on the + command line, and they can be any combination of text and + binary: + + kermit -s oofa.txt oofa.zip oofa.html oofa.tar.gz + + and/or you can use wildcards to send groups of files: + + kermit -s oofa.* + + If you want to send a file under an assumed name, use: + + kermit -s friday.txt -a today.txt + + This sends the file friday.txt but tells the receiving Kermit + that its name is today.txt. In all cases, as noted, when the + file transfer is finished, your desktop Kermit returns + automatically to Connect state. No worries about escaping back, + re-connecting, text/binary mode switching. Almost too easy, + right? + + Uploading Files + + To upload files (send them from your desktop computer to the + remote Unix computer) do the same thing, but use the -g (GET) + option instead of -s: + + kermit -g oofa.txt + + This causes your local Kermit to enter server mode; then the + remote Kermit program requests the named file and the local + Kermit sends it and returns automatically to Connect state when + done. + + If you want to upload multiple files, you have have use shell + quoting rules, since these aren't local files: + + kermit -g "oofa.txt oofa.zip oofa.html oofa.tar.gz" + kermit -g "oofa.*" + + If you want to upload a file but store it under a different + name, use: + + kermit -g friday.txt -a today.txt + + Kermit Transfers the Old-Fashioned Way + + If your desktop communications software does not support + autoupload or autodownload, or it does not include Kermit server + mode, the procedure requires more steps. + + To download a file, type: + + kermit -s filename + + on the host as before, but if nothing happens automatically in + response to this command, you have to switch your desktop + communications software into Kermit Receive state. This might be + done by escaping back using keyboard characters or hot keys + (Alt-x is typical) and/or with a command (like RECEIVE) or a + menu. When the file transfer is complete, you have to go back to + Connect state, Terminal emulation, or whatever terminology + applies to your desktop communications software. + + To upload a file, type: + + kermit -r + + on the host (rather than "kermit -g"). This tells C-Kermit to + wait passively for a file to start arriving. Then regain the + attention of your desktop software (Alt-x or whatever) and + instruct it to send the desired file(s) with Kermit protocol. + When the transfer is finished, return to the Connect or Terminal + screen. + + If File Transfer Fails + + Although every aspect of Kermit's operation can be finely tuned, + there are also three short and simple "omnibus tuning" commands + you can use for troubleshooting: + + FAST + Use fast file-transfer settings. This has been the default + since C-Kermit 7.0 now that most modern computers and + connections support it. If transfers fail with fast + settings, try . . . + + CAUTIOUS + Use cautious but not paranoid settings. File transfers, if + they work, will go at medium speed. If not, try . . . + + ROBUST + Use the most robust, resilient, conservative, safe, and + reliable settings. File transfers will almost certainly + work, but they will be quite slow (of course this is a + classic tradeoff; ROBUST was C-Kermit's default tuning in + versions 6.0 and earlier, which made everybody think + Kermit protocol was slow). If ROBUST doesn't do the trick, + try again with SET PARITY SPACE first in case it's not an + 8-bit connection. + + Obviously the success and performance of a file transfer also + depends on C-Kermit's file transfer partner. Up-to-date, real + [128]Kermit Project partners are recommended because they + contain the best Kermit protocol implementations and because + [129]we can support them in case of trouble. + + If you still have trouble, consult Chapter 10 of [130]Using + C-Kermit, or send email to [131]kermit-support@columbia.edu. + + Advanced Kermit File-Transfer Features + + Obviously there is a lot more to Kermit file transfer, including + all sorts of interactive commands, preferences, options, + logging, debugging, troubleshooting, and anything else you can + imagine but that's what the [132]manual and updates are for. + Here are a few topics you can explore if you're interested by + Typing HELP for the listed commands: + + Logging transfers: + LOG TRANSACTIONS (HELP LOG) + + Automatic per-file text/binary mode switching: + SET TRANSFER MODE { AUTOMATIC, MANUAL } (HELP SET + TRANSFER). + + Cross-platform recursive directory tree transfer: + SEND /RECURSIVE, GET /RECURSIVE (HELP SEND, HELP GET). + + File collision options: + SET FILE COLLISION { OVERWRITE, BACKUP, DISCARD, ... } + (HELP SET FILE). + + Update mode (only transfer files that changed since last time): + SET FILE COLLISION UPDATE (HELP SET FILE). + + Filename selection patterns: + (HELP WILDCARD). + + Flexible file selection: + SEND (or GET) /BEFORE /AFTER /LARGER /SMALLER /TYPE + /EXCEPT, ... + + Character-set conversion: + SET { FILE, TRANSFER } CHARACTER-SET, ASSOCIATE, ... + + File/Pathname control: + SET { SEND, RECEIVE } PATHNAMES, SET FILE NAMES. + + Atomic file movement: + SEND (or GET) /DELETE /RENAME /MOVE-TO + + Transferring to/from standard i/o of other commands: + SEND (or GET) /COMMAND + + Recovery of interrupted transfer from point of failure: + RESEND, REGET (HELP RESEND, HELP REGET). + + Non-Kermit File Transfer + + You can also use C-Kermit to transfer files with FTP or HTTP + Internet protocols; [133]see below. + + On a regular serial or Telnet connection where the other + computer doesn't support Kermit protocol at all, you have + several options. For example, if your desktop communications + software supports Zmodem, use "rz" and "sz" on the host rather + than Kermit. But if Kermit is your desktop software, and you are + using it to make calls or network connections to other computers + that don't support Kermit protocol (or that don't have a good + implementation of it), then if your computer also has external + X, Y, or Zmodem programs that are redirectable, Kermit can use + them as external protocols. HELP SET PROTOCOL for details. + + You can also capture "raw" data streams from the other computer + with LOG SESSION (HELP LOG and HELP SET SESSION-LOG for + details), and you can upload files without any protocol at all + with TRANSMIT (HELP TRANSMIT, HELP SET TRANSMIT). + + [134]Kermit Home [135]C-Kermit Home [136]C-Kermit FAQ + + KERMIT CLIENT/SERVER CONNECTIONS [137]Top [138]Contents [139]Next + [140]Previous + + On any kind of connection you can make with Kermit -- serial, TCP/IP, X.25, + etc -- you can set up a convenient client/server relationship between your + Kermit client (the one that made the connection) and the Kermit program on the + far end of the connection (the remote Kermit) by putting the remote Kermit in + server mode. This is normally done by giving it a SERVER command, or by + starting it with the -x command-line option. In some cases ([141]Internet + Kermit Service, SSH connections to a Kermit subsystem, or specially configured + hosts), there is already a Kermit server waiting on the far end. Here is a + quick synopsis of the commands you can give to the client for interacting with + the server: + + SEND [ switches ] filename + Sends the named file to the server. The filename can include + wildcards. Lots of switches are available for file selection, + etc. Type HELP SEND at the client prompt for details. + + GET [ switches ] filename + Asks the server to send the named file. The filename can include + wildcards. Type HELP GET at the client prompt for details. + + BYE + Terminates the server and closes your connection to it. + + FINISH + Terminates the server. If you started the server yourself, this + leaves the remote host at its shell prompt. If it was a + dedicated server (such as IKSD or an SSH subsystem), FINISH is + equivalent to BYE. + + SET LOCUS { LOCAL, REMOTE, AUTO } + (C-Kermit 8.0.201 and later, K95 1.1.21 and later) This tells + the client whether file-management commands like CD, PWD, + DIRECTORY, DELETE, MKDIR, etc, should be executed locally or by + the server. In this type of connection, the default is LOCAL. + Use SET LOCUS REMOTE if you want Kermit to behave like an FTP + client, in which case these commands are executed remotely, and + their local versions must have an L prefix: LCD, LPWD, + LDIRECTORY, etc. When LOCUS is LOCAL, then the remote versions + must have an R prefix: RCD, RPWD, RDIRECTORY, etc. HELP SET + LOCUS for details. SHOW COMMAND to see current locus. + + The following commands are affected by SET LOCUS: + + CD, LCD, RCD + Change (working, current) directory. HELP CD for details. + + CDUP, LCDUP, RCDUP + CD one level up. + + DIRECTORY, LDIRECTORY, RDIRECTORY + Produce a directory listing. Many options are available for local + listings. HELP DIRECTORY for details. + + DELETE, LDELETE, RDELETE + Deletes files or directories. Many options available, HELP DELETE. + + RENAME, LRENAME, RRENAME + Renames files or directories. Many options available, HELP RENAME. + + MKDIR, LMKDIR, RMKDIR + Creates a directory. HELP MKDIR. + + RMDIR, LRMDIR, RRMDIR + Removes a directory. HELP RMDIR. There are dozens -- maybe hundreds -- + of other commands, described in the built-in help, on the website, + and/or in the published or online manuals. But even if you don't have + access to documentation, you can "set locus remote" and then use pretty + much the same commands you would use with any FTP client. + + [142]Kermit Home [143]C-Kermit Home [144]C-Kermit FAQ + + KERMIT'S BUILT-IN FTP AND HTTP CLIENTS [145]Top [146]Contents [147]Next + [148]Previous + + Kermit's FTP client is like the regular Unix FTP client that you're used to, + but with some differences: + + * It has lots more commands and features. + * You can have an FTP session and a regular Kermit serial or Telnet + session open at the same time. + * FTP sessions can be fully automated. + + By default Kermit's FTP client tries its best to present the same user + interface as a regular FTP client: PUT, GET, DIR, CD, BYE, etc, should + work the same, even though some of these commands have different + meaning in Kermit-to-Kermit connections; for example, CD, DIR, RENAME, + etc, in Kermit act locally, whereas in FTP they are commands for the + server. This might cause some confusion, but as in all things Kermit, + you have total control: + + * The [149]SET LOCUS command lets you specify where file management + commands should be executed -- locally or remotely -- for any kind + of connection. + * Any FTP command can be prefixed with the word "FTP" to remove any + ambiguity. + + Pending publication of the next edition of the manual, the Kermit FTP + client is thoroughly documented at the Kermit Project website: + + [150]http://www.columbia.edu/kermit/ftpclient.html + + You also can use HELP FTP and HELP SET FTP to get descriptions of + Kermit's FTP-related commands. + + The HTTP client is similar to the FTP one, except you prefix each + command with HTTP instead of FTP: HTTP OPEN, HTTP GET, HTTP PUT, HTTP + CLOSE, etc. Type HELP HTTP for details, or visit the to view the + [151]manual supplements. HTTP connections can be open at the same time + as regular serial or Telnet connections and FTP connections. So Kermit + can manage up to three types connections simultaneously. + + [152]Kermit Home [153]C-Kermit Home [154]C-Kermit FAQ [155]FTP Client + [156]HTTP Client + + INTERNET KERMIT SERVICE [157]Top [158]Contents [159]Next [160]Previous + + C-Kermit can be configured and run as an Internet service (called IKSD), + similar to an FTP server (FTPD) except you can (but need not) interact with it + directly, plus it does a lot more than an FTP server can do. The TCP port for + IKSD is 1649. It uses Telnet protocol. C-Kermit can be an Internet Kermit + Server, or it can be a client of an IKSD. You can make connections from + C-Kermit to an IKSD with any of the following commands: + + telnet foo.bar.edu 1649 + telnet foo.bar.edu kermit ; if "kermit" is listed in /etc/services + iksd foo.bar.edu + + The IKSD command is equivalent to a TELNET command specifying port + 1649. For more information about making and using connections to an + IKSD, see: + + [161]http://www.columbia.edu/kermit/cuiksd.html + + You can run an Internet Kermit Service on your own computer too (if you + are the system administrator). For instructions, see: + + [162]http://www.columbia.edu/kermit/iksd.html + + [163]Kermit Home [164]C-Kermit Home [165]C-Kermit FAQ + + SECURITY [166]Top [167]Contents [168]Next [169]Previous + + All of C-Kermit's built-in TCP/IP networking methods (Telnet, Rlogin, IKSD, + FTP, and HTTP) can be secured by one or more of the following IETF-approved + methods: + + * MIT Kerberos IV + * MIT Kerberos V + * SSL/TLS + * Stanford SRP + + For complete instructions see: + + [170]http://www.columbia.edu/kermit/security.html + + And as noted previously, you can also make SSH connections with + C-Kermit if you already have an SSH client installed. + + [171]Kermit Home [172]C-Kermit Home [173]C-Kermit FAQ + + ALTERNATIVE COMMAND-LINE PERSONALITIES [174]Top [175]Contents [176]Next + [177]Previous + + When invoked as "kermit" or any other name besides any of the special ones, + C-Kermit has the command-line options described above in the [178]OPTIONS + section. However, if you invoke C-Kermit using any of the following names: + + telnet Telnet client + ftp FTP client + http HTTP client + https Secure HTTP client + + Kermit's command-line personality changes to match. This can be done (among + other ways) with symbolic links (symlinks). For example, if you want C-Kermit + to be your regular Telnet client, or the Telnet helper of your Web browser, + you can create a link like the following in a directory that lies in your PATH + ahead of the regular telnet program: + + ln -s /usr/local/bin/kermit telnet + + Now when you give a "telnet" command, you are invoking Kermit instead, + but with its Telnet command-line personality so, for example: + + telnet xyzcorp.com + + Makes a Telnet connection to xyzcorp.com, and Kermit exits + automatically when the connection is closed (just like the regular + Telnet client). Type "telnet -h" to get a list of Kermit's + Telnet-personality command-line options, which are intended to be as + compatible as possible with the regular Telnet client. + + Similarly for FTP: + + ln -s /usr/local/bin/kermit ftp + + And now type "ftp -h" to see its command-line options, and use command + lines just like you would give your regular FTP client: + + ftp -n xyzcorp.com + + but with additional options allowing an entire session to be specified + on the command line, as explained in the C-Kermit [179]FTP client + documentation. + + And similarly for HTTP: + + ln -s /usr/local/bin/kermit http + ./http -h + ./http www.columbia.edu -g kermit/index.html + + Finally, if Kermit's first command-line option is a Telnet, FTP, IKSD, + or HTTP URL, Kermit automatically makes the appropriate kind of + connection and, if indicated by the URL, takes the desired action: + + kermit telnet:xyzcorp.com ; Opens a Telnet session + kermit telnet://olga@xyzcorp.com ; Ditto for user olga + kermit ftp://olga@xyzcorp.com/public/oofa.zip ; Downloads a file + kermit kermit://kermit.columbia.edu/kermit/f/READ.ME ; Ditto for IKSD + kermit iksd://kermit.columbia.edu/kermit/f/READ.ME ; (This works too) + kermit http://www.columbia.edu/kermit/index.html ; Grabs a web page + kermit https://wwws.xyzcorp.com/secret/plan.html ; Grabs a secure web page + + [180]Kermit Home [181]C-Kermit Home [182]C-Kermit FAQ + + LICENSE [183]Top [184]Contents [185]Next [186]Previous + + On or before 30 June 2011, barring unforeseen circumstances, [187]C-Kermit 9.0 + will be released with the [188]Revised 3-Clause BSD License. This is a + certifed [189]Open Source license, and it means that C-Kermit no longer needs + to be licensed for commercial redistribution. Technical support for Kermit + software will not be available from Columbia University after June 30th. + + [190]Kermit Home [191]C-Kermit Home [192]C-Kermit FAQ + OTHER TOPICS [193]Top [194]Contents [195]Next [196]Previous + + There's way more to C-Kermit than we've touched on here -- troubleshooting, + customization, character sets, dialing directories, sending pages, script + writing, and on and on, all of which are covered in the manual and updates and + supplements. For the most up-to-date information on documentation (or updated + documentation itself) visit the Kermit Project website: + + [197]http://www.columbia.edu/kermit/ + + There you will also find [198]Kermit software packages for other platforms: + different Unix varieties, Windows, DOS, VMS, IBM mainframes, and many others: + 20+ years' worth. + + [199]Kermit Home [200]C-Kermit Home [201]C-Kermit FAQ + DOCUMENTATION AND UPDATES [202]Top [203]Contents [204]Next [205]Previous + + The manual for C-Kermit is: + + 1. Frank da Cruz and Christine M. Gianone, [206]Using C-Kermit, Second + Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997, + 622 pages, ISBN 1-55558-164-1. This is a printed book. It covers + C-Kermit 6.0. + 2. The C-Kermit 7.0 Supplement: + [207]http://www.columbia.edu/kermit/ckermit70.html + 3. The C-Kermit 8.0 Supplement: + [208]http://www.columbia.edu/kermit/ckermit80.html + 4. The C-Kermit 9.0 Supplement: + [209]http://www.columbia.edu/kermit/ckermit90.html + + The C-Kermit home page is here: + + [210]http://www.columbia.edu/kermit/ckermit.html + + Visit this page to learn about new versions, Beta tests, and other + news; to read case studies and tutorials; to download source code, + install packages, and [211]prebuilt binaries for many platforms. Also + visit: + + [212]http://www.columbia.edu/kermit/scriptlib.html + The Kermit script library and tutorial + + [213]http://www.columbia.edu/kermit/newfaq.html + The Kermit FAQ (Frequently Asked Questions about Kermit) + + [214]http://www.columbia.edu/kermit/ckfaq.html + The C-Kermit FAQ (Frequently Asked Questions about C-Kermit) + + [215]http://www.columbia.edu/kermit/security.html + The Kermit security reference. + + [216]http://www.columbia.edu/kermit/telnet.html + C-Kermit Telnet client documentation. + + [217]http://www.columbia.edu/kermit/studies.html + Case studies. + + [218]http://www.columbia.edu/kermit/ckcbwr.html + General C-Kermit Hints and Tips. + + [219]http://www.columbia.edu/kermit/ckubwr.html + Unix C-Kermit Hints and Tips. + + [220]http://www.columbia.edu/kermit/ckvbwr.html + VMS C-Kermit Hints and Tips. + + [221]http://www.columbia.edu/kermit/ckuins.html + Unix C-Kermit Installation Instructions + + [222]http://www.columbia.edu/kermit/ckvins.html + VMS C-Kermit Installation Instructions + + [223]http://www.columbia.edu/kermit/support.html + Technical support. + + [224]http://www.columbia.edu/kermit/k95tutorial.html + Kermit 95 tutorial (this document). + + [225]comp.protocols.kermit.misc + The Kermit newsgroup (unmoderated). + + [226]Kermit Home [227]C-Kermit Home [228]C-Kermit FAQ + + FILES [229]Top [230]Contents [231]Next [232]Previous + + [233]The Revised 3-Clause License + C-Kermit license. + + [234]~/.kermrc + Initialization file. + + [235]~/.mykermrc + Customization file. + + ~/.kdd + Kermit dialing directory (see manual). + + ~/.knd + Kermit network directory (see manual). + + ~/.ksd + Kermit services directory (see manual). + + [236]ckuins.html + Installation instructions for Unix. + + [237]ckcbwr.html + General C-Kermit bugs, hints, tips. + + [238]ckubwr.html + Unix-specific C-Kermit bugs, hints, tips. + + [239]ckcplm.html + C-Kermit program logic manual. + + [240]ckccfg.html + C-Kermit compile-time configuration options. + + ssh + (in your PATH) SSH connection helper. + + rz, sz, etc. + (in your PATH) external protocols for XYZmodem. + + /var/spool/locks (or whatever) + UUCP lockfile for dialing out (see [241]installation + instructions). + + [242]Kermit Home [243]C-Kermit Home [244]C-Kermit FAQ + + AUTHORS [245]Top [246]Contents [247]Previous + + Frank da Cruz and Jeffrey E Altman + The Kermit Project - Columbia Univerity + 612 West 115th Street + New York NY 10025-7799 + USA + + 1985-present, with contributions from hundreds of others all over the + world. + __________________________________________________________________ + + + C-Kermit 9.0 Unix Manual Page and Tutorial / [248]kermit@columbia.edu + / 30 June 2011 + +References + + 1. http://www.columbia.edu/ + 2. mailto:kermit@columbia.edu + 3. http://www.columbia.edu/kermit/index.html + 4. http://www.columbia.edu/kermit/k95.html + 5. http://www.columbia.edu/kermit/ckermit.html + 6. http://www.columbia.edu/kermit/ckscripts.html + 7. http://www.columbia.edu/kermit/current.html + 8. http://www.columbia.edu/kermit/whatsnew.html + 9. http://www.columbia.edu/kermit/ckfaq.html + 10. http://www.columbia.edu/kermit/support.html + 11. http://www.columbia.edu/kermit/ + 12. http://www.columbia.edu/ + 13. http://www.columbia.edu/kermit/ckututor.pdf + 14. ftp://kermit.columbia.edu/kermit/test/text/ckuker.nr + 15. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641 + 16. http://www.columbia.edu/kermit/ckututor.html#description + 17. http://www.columbia.edu/kermit/ckututor.html#synopsis + 18. http://www.columbia.edu/kermit/ckututor.html#options + 19. http://www.columbia.edu/kermit/ckututor.html#commands + 20. http://www.columbia.edu/kermit/ckututor.html#initfile + 21. http://www.columbia.edu/kermit/ckututor.html#modes + 22. http://www.columbia.edu/kermit/ckututor.html#connections + 23. http://www.columbia.edu/kermit/ckututor.html#transfer + 24. http://www.columbia.edu/kermit/ckututor.html#server + 25. http://www.columbia.edu/kermit/ckututor.html#ftp + 26. http://www.columbia.edu/kermit/ckututor.html#iksd + 27. http://www.columbia.edu/kermit/ckututor.html#security + 28. http://www.columbia.edu/kermit/ckututor.html#personae + 29. http://www.columbia.edu/kermit/ckututor.html#license + 30. http://www.columbia.edu/kermit/ckututor.html#other + 31. http://www.columbia.edu/kermit/ckututor.html#documentation + 32. http://www.columbia.edu/kermit/ckututor.html#files + 33. http://www.columbia.edu/kermit/ckututor.html#authors + 34. http://www.columbia.edu/kermit/ckututor.html#top + 35. http://www.columbia.edu/kermit/ckututor.html#contents + 36. http://www.columbia.edu/kermit/ckututor.html#synopsis + 37. http://www.columbia.edu/kermit/ckermit.html + 38. http://www.columbia.edu/kermit/ + 39. http://www.columbia.edu/ + 40. ftp://ftp.isi.edu/in-notes/rfc2839.txt + 41. ftp://ftp.isi.edu/in-notes/rfc2840.txt + 42. http://www.columbia.edu/kermit/ckututor.html#documentation + 43. http://www.columbia.edu/kermit/ + 44. http://www.columbia.edu/kermit/ + 45. http://www.columbia.edu/kermit/ckermit.html + 46. http://www.columbia.edu/kermit/ckfaq.html + 47. http://www.columbia.edu/kermit/ckututor.html#top + 48. http://www.columbia.edu/kermit/ckututor.html#contents + 49. http://www.columbia.edu/kermit/ckututor.html#options + 50. http://www.columbia.edu/kermit/ckututor.html#synopsis + 51. http://www.columbia.edu/kermit/ckututor.html#kerbang + 52. http://www.columbia.edu/kermit/ckututor.html#personae + 53. http://www.columbia.edu/kermit/ckututor.html#kerbang + 54. http://www.columbia.edu/kermit/ckututor.html#initfile + 55. http://www.columbia.edu/kermit/ckututor.html#initfile + 56. http://www.columbia.edu/kermit/ckututor.html#personae + 57. http://www.columbia.edu/kermit/ckututor.html#options + 58. http://www.columbia.edu/kermit/ckututor.html#commands + 59. http://www.columbia.edu/kermit/ + 60. http://www.columbia.edu/kermit/ckermit.html + 61. http://www.columbia.edu/kermit/ckfaq.html + 62. http://www.columbia.edu/kermit/ckututor.html#top + 63. http://www.columbia.edu/kermit/ckututor.html#contents + 64. http://www.columbia.edu/kermit/ckututor.html#commands + 65. http://www.columbia.edu/kermit/ckututor.html#description + 66. http://www.columbia.edu/kermit/ckututor.html#commands + 67. http://www.columbia.edu/kermit/ckututor.html#personae + 68. http://www.columbia.edu/kermit/ckututor.html#personae + 69. http://www.columbia.edu/kermit/ckututor.html#iksd + 70. http://www.columbia.edu/kermit/ckututor.html#transfer + 71. http://www.columbia.edu/kermit/ckututor.html#top + 72. http://www.columbia.edu/kermit/ckututor.html#contents + 73. http://www.columbia.edu/kermit/ckututor.html#initfile + 74. http://www.columbia.edu/kermit/ckututor.html#options + 75. http://www.columbia.edu/kermit/ckututor.html#kerbang + 76. http://www.columbia.edu/kermit/ckututor.html#cmdlist + 77. http://www.columbia.edu/kermit/ckututor.html#documentation + 78. http://www.columbia.edu/kermit/ckututor.html#initfile + 79. http://www.columbia.edu/kermit/ckututor.html#documentation + 80. http://www.columbia.edu/kermit/ckscripts.html + 81. http://www.columbia.edu/kermit/ckututor.html#documentation + 82. http://www.columbia.edu/kermit/ + 83. http://www.columbia.edu/kermit/ckermit.html + 84. http://www.columbia.edu/kermit/ckfaq.html + 85. http://www.columbia.edu/kermit/ckututor.html#top + 86. http://www.columbia.edu/kermit/ckututor.html#contents + 87. http://www.columbia.edu/kermit/ckututor.html#modes + 88. http://www.columbia.edu/kermit/ckututor.html#commands + 89. http://www.columbia.edu/kermit/ + 90. http://www.columbia.edu/kermit/ckermit.html + 91. http://www.columbia.edu/kermit/ckfaq.html + 92. http://www.columbia.edu/kermit/ckututor.html#top + 93. http://www.columbia.edu/kermit/ckututor.html#contents + 94. http://www.columbia.edu/kermit/ckututor.html#connections + 95. http://www.columbia.edu/kermit/ckututor.html#initfile + 96. http://www.columbia.edu/kermit/ckfaq.html#term + 97. http://www.columbia.edu/kermit/ + 98. http://www.columbia.edu/kermit/ckermit.html + 99. http://www.columbia.edu/kermit/ckfaq.html + 100. http://www.columbia.edu/kermit/ckututor.html#top + 101. http://www.columbia.edu/kermit/ckututor.html#contents + 102. http://www.columbia.edu/kermit/ckututor.html#transfer + 103. http://www.columbia.edu/kermit/ckututor.html#modes + 104. http://www.columbia.edu/kermit/ckututor.html#iksd + 105. http://www.columbia.edu/kermit/cable.html + 106. ftp://ftp.isi.edu/in-notes/rfc2217.txt + 107. http://www.columbia.edu/kermit/cable.html + 108. http://www.columbia.edu/kermit/ckututor.html#ftp + 109. http://www.columbia.edu/kermit/ + 110. http://www.columbia.edu/kermit/ckermit.html + 111. http://www.columbia.edu/kermit/ckfaq.html + 112. http://www.columbia.edu/kermit/ckututor.html#top + 113. http://www.columbia.edu/kermit/ckututor.html#contents + 114. http://www.columbia.edu/kermit/ckututor.html#server + 115. http://www.columbia.edu/kermit/ckututor.html#connections + 116. http://www.columbia.edu/kermit/ckututor.html#download + 117. http://www.columbia.edu/kermit/ckututor.html#upload + 118. http://www.columbia.edu/kermit/ckututor.html#oldfashioned + 119. http://www.columbia.edu/kermit/ckututor.html#trouble + 120. http://www.columbia.edu/kermit/ckututor.html#advanced + 121. http://www.columbia.edu/kermit/ckututor.html#nonkermit + 122. http://www.columbia.edu/kermit/kermit.html#notslow + 123. http://www.columbia.edu/kermit/ckermit.html + 124. http://www.columbia.edu/kermit/k95.html + 125. http://www.columbia.edu/kermit/k95.html + 126. http://www.columbia.edu/kermit/ckermit.html + 127. http://www.columbia.edu/kermit/mskermit.html + 128. http://www.columbia.edu/kermit/ + 129. http://www.columbia.edu/kermit/support.html + 130. http://www.columbia.edu/kermit/ckmanual.html + 131. mailto:kermit-support@columbia.edu + 132. http://www.columbia.edu/kermit/ckututor.html#documentation + 133. http://www.columbia.edu/kermit/ckututor.html#ftp + 134. http://www.columbia.edu/kermit/ + 135. http://www.columbia.edu/kermit/ckermit.html + 136. http://www.columbia.edu/kermit/ckfaq.html + 137. http://www.columbia.edu/kermit/ckututor.html#top + 138. http://www.columbia.edu/kermit/ckututor.html#contents + 139. http://www.columbia.edu/kermit/ckututor.html#ftp + 140. http://www.columbia.edu/kermit/ckututor.html#transfer + 141. http://www.columbia.edu/kermit/ckututor.html#iksd + 142. http://www.columbia.edu/kermit/ + 143. http://www.columbia.edu/kermit/ckermit.html + 144. http://www.columbia.edu/kermit/ckfaq.html + 145. http://www.columbia.edu/kermit/ckututor.html#top + 146. http://www.columbia.edu/kermit/ckututor.html#contents + 147. http://www.columbia.edu/kermit/ckututor.html#iksd + 148. http://www.columbia.edu/kermit/ckututor.html#transfer + 149. http://www.columbia.edu/kermit/ckututor.html#server + 150. http://www.columbia.edu/kermit/ftpclient.html + 151. http://www.columbia.edu/kermit/ckututor.html#documentation + 152. http://www.columbia.edu/kermit/ + 153. http://www.columbia.edu/kermit/ckermit.html + 154. http://www.columbia.edu/kermit/ckfaq.html + 155. http://www.columbia.edu/kermit/ckermit3.html#x3 + 156. http://www.columbia.edu/kermit/ckermit3.html#x2.2 + 157. http://www.columbia.edu/kermit/ckututor.html#top + 158. http://www.columbia.edu/kermit/ckututor.html#contents + 159. http://www.columbia.edu/kermit/ckututor.html#security + 160. http://www.columbia.edu/kermit/ckututor.html#ftp + 161. http://www.columbia.edu/kermit/cuiksd.html + 162. http://www.columbia.edu/kermit/iksd.html + 163. http://www.columbia.edu/kermit/ + 164. http://www.columbia.edu/kermit/ckermit.html + 165. http://www.columbia.edu/kermit/ckfaq.html + 166. http://www.columbia.edu/kermit/ckututor.html#top + 167. http://www.columbia.edu/kermit/ckututor.html#contents + 168. http://www.columbia.edu/kermit/ckututor.html#personae + 169. http://www.columbia.edu/kermit/ckututor.html#iksd + 170. http://www.columbia.edu/kermit/security.html + 171. http://www.columbia.edu/kermit/ + 172. http://www.columbia.edu/kermit/ckermit.html + 173. http://www.columbia.edu/kermit/ckfaq.html + 174. http://www.columbia.edu/kermit/ckututor.html#top + 175. http://www.columbia.edu/kermit/ckututor.html#contents + 176. http://www.columbia.edu/kermit/ckututor.html#license + 177. http://www.columbia.edu/kermit/ckututor.html#iksd + 178. http://www.columbia.edu/kermit/ckututor.html#options + 179. http://www.columbia.edu/kermit/ckermit3.html#x3.1.2 + 180. http://www.columbia.edu/kermit/ + 181. http://www.columbia.edu/kermit/ckermit.html + 182. http://www.columbia.edu/kermit/ckfaq.html + 183. http://www.columbia.edu/kermit/ckututor.html#top + 184. http://www.columbia.edu/kermit/ckututor.html#contents + 185. http://www.columbia.edu/kermit/ckututor.html#other + 186. http://www.columbia.edu/kermit/ckututor.html#personae + 187. http://www.columbia.edu/kermit/ck90.html + 188. http://www.columbia.edu/kermit/cu-bsd-license.html + 189. http://www.opensource.org/ + 190. http://www.columbia.edu/kermit/ + 191. http://www.columbia.edu/kermit/ckermit.html + 192. http://www.columbia.edu/kermit/ckfaq.html + 193. http://www.columbia.edu/kermit/ckututor.html#top + 194. http://www.columbia.edu/kermit/ckututor.html#contents + 195. http://www.columbia.edu/kermit/ckututor.html#documentation + 196. http://www.columbia.edu/kermit/ckututor.html#license + 197. http://www.columbia.edu/kermit/ + 198. http://www.columbia.edu/kermit/howtoget.html + 199. http://www.columbia.edu/kermit/ + 200. http://www.columbia.edu/kermit/ckermit.html + 201. http://www.columbia.edu/kermit/ckfaq.html + 202. http://www.columbia.edu/kermit/ckututor.html#top + 203. http://www.columbia.edu/kermit/ckututor.html#contents + 204. http://www.columbia.edu/kermit/ckututor.html#files + 205. http://www.columbia.edu/kermit/ckututor.html#other + 206. http://www.columbia.edu/kermit/ckmanual.html + 207. http://www.columbia.edu/kermit/ckermit70.html + 208. http://www.columbia.edu/kermit/ckermit80.html + 209. http://www.columbia.edu/kermit/ckermit90.html + 210. http://www.columbia.edu/kermit/ckermit.html + 211. http://www.columbia.edu/kermit/ck80binaries.html + 212. http://www.columbia.edu/kermit/scriptlib.html + 213. http://www.columbia.edu/kermit/newfaq.html + 214. http://www.columbia.edu/kermit/ckfaq.html + 215. http://www.columbia.edu/kermit/security.html + 216. http://www.columbia.edu/kermit/telnet.html + 217. http://www.columbia.edu/kermit/studies.html + 218. http://www.columbia.edu/kermit/ckcbwr.html + 219. http://www.columbia.edu/kermit/ckubwr.html + 220. http://www.columbia.edu/kermit/ckvbwr.html + 221. http://www.columbia.edu/kermit/ckuins.html + 222. http://www.columbia.edu/kermit/ckvins.html + 223. http://www.columbia.edu/kermit/support.html + 224. http://www.columbia.edu/kermit/k95tutorial.html + 225. news:comp.protocols.kermit.misc + 226. http://www.columbia.edu/kermit/ + 227. http://www.columbia.edu/kermit/ckermit.html + 228. http://www.columbia.edu/kermit/ckfaq.html + 229. http://www.columbia.edu/kermit/ckututor.html#top + 230. http://www.columbia.edu/kermit/ckututor.html#contents + 231. http://www.columbia.edu/kermit/ckututor.html#authors + 232. http://www.columbia.edu/kermit/ckututor.html#documentation + 233. http://www.columbia.edu/kermit/cu-bsd-license.html + 234. ftp://kermit.columbia.edu/kermit/c-kermit/ckermit.ini + 235. ftp://kermit.columbia.edu/kermit/c-kermit/ckermod.ini + 236. http://www.columbia.edu/kermit/ckuins.html + 237. http://www.columbia.edu/kermit/ckcbwr.html + 238. http://www.columbia.edu/kermit/ckubwr.html + 239. http://www.columbia.edu/kermit/ckcplm.html + 240. http://www.columbia.edu/kermit/ckccfg.html + 241. http://www.columbia.edu/kermit/ckuins.html + 242. http://www.columbia.edu/kermit/ + 243. http://www.columbia.edu/kermit/ckermit.html + 244. http://www.columbia.edu/kermit/ckfaq.html + 245. http://www.columbia.edu/kermit/ckututor.html#top + 246. http://www.columbia.edu/kermit/ckututor.html#contents + 247. http://www.columbia.edu/kermit/ckututor.html#files + 248. mailto:kermit@columbia.edu diff --git a/ckuus2.c b/ckuus2.c index b0dfb30..db0dfe9 100644 --- a/ckuus2.c +++ b/ckuus2.c @@ -197,7 +197,7 @@ char *newstxt[] = { #ifdef OS2 "Welcome to Kermit 95 3.x.x. Major new features since 2.1.3 include:", #else -"Welcome to C-Kermit 9.0.299. New features since 8.0.211 include:", +"Welcome to C-Kermit 9.0.300. New features since 8.0.211 include:", #endif /* OS2 */ " . Open Source Simplified 3-Clause BSD License", " . Full 64-bit memory model on platforms that support it", diff --git a/ckuus3.c b/ckuus3.c index f232159..5887b34 100644 --- a/ckuus3.c +++ b/ckuus3.c @@ -13,7 +13,7 @@ Jeffrey E Altman Secure Endpoints Inc., New York City - Copyright (C) 1985, 2009, + Copyright (C) 1985, 2011, 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. @@ -3389,7 +3389,7 @@ static struct keytab sexpops[] = { /* Built-in operators */ "eval", SX_EVA, 0, /* Assorted commands */ "abs", SX_ABS, SXF_ONE, "truncate",SX_TRU, SXF_ONE|SXF_FLO, - "round", SX_ROU, SXF_ONE|SXF_FLO, + "round", SX_ROU, SXF_ONE|SXF_TWO|SXF_FLO, "ceiling", SX_CEI, SXF_ONE|SXF_FLO, "floor", SX_FLR, SXF_ONE|SXF_FLO, "float", SX_FLO, SXF_ONE|SXF_FLO, @@ -3428,6 +3428,7 @@ static int sexptrunc = 0; /* Flag to force all results to int */ #include /* Floating-point functions */ _PROTOTYP( char * fpformat, (CKFLOAT, int, int) ); +_PROTOTYP( CKFLOAT ckround, (CKFLOAT, int, char *, int) ); extern char math_pi[]; /* Value of Pi */ extern int sexpecho; /* SET SEXPRESSION ECHO value */ @@ -3470,6 +3471,8 @@ sexpdebug(s) char * s; { /* Returns value as string (empty, numeric, or non-numeric) */ +static char sxroundbuf[32]; /* For ROUND result */ + char * dosexp(s) char *s; { /* s = S-Expression */ extern struct mtab *mactab; /* Macro table */ @@ -3562,7 +3565,9 @@ dosexp(s) char *s; { /* s = S-Expression */ } /* Break result up into "words" (an SEXP counts as a word) */ - p[0] = NULL; /* (We don't use element 0) */ + for (i = 0; i < SEXPMAX+1; i++ ) { /* Clear the operands */ + p[i] = NULL; + } if (!*(s+1) || !*(s+2)) { /* No need to call cksplit() */ n = 1; /* if it's one or two chars. */ p[1] = s; /* No need to malloc this either. */ @@ -3605,7 +3610,7 @@ dosexp(s) char *s; { /* s = S-Expression */ debug(F110,sexpdebug("head"),p[1],0); if (n == 1 && p[1]) { - if (*(p[1]) == '\047') { + if (*(p[1]) == '\047') { /* Apostrophe = LISP quote character */ s2 = p[1]; goto xdosexp; } @@ -3817,7 +3822,7 @@ dosexp(s) char *s; { /* s = S-Expression */ } break; case SXF_ONE: - if (n != 2) { + if (n != 2) { printf("?Too %s operands - \"%s\"\n", (n > 2) ? "many" : "few", s); sexprc++; @@ -3836,6 +3841,44 @@ dosexp(s) char *s; { /* s = S-Expression */ } if (kwflags & SXF_FLO) /* Operator requires floating point */ fpflag++; /* Force it */ + + if (x == SX_ROU) { /* ROUND can have 1 or 2 arguments */ + if (n < 2 || n > 3) { + printf("?Too %s operands - \"%s\"\n", + (n > 3) ? "many" : "few", s); + sexprc++; + goto xdosexp; + } + } + if (x == SX_ROU) { + /* But they are not "cumulative" like other SEXP args */ + /* So this case is handled specially */ + char buf1[32], buf2[32]; + float r; + char * s0, * s1; + char * q0, * q1; + + s0 = p[2]; + if (!s0) s0 = ""; + if (!*s0) s0 = "0"; + q0 = dosexp(s0); + ckstrncpy(buf1,q0,32); + q0 = buf1; + + s1 = p[3]; + if (!s1) s1 = ""; + if (!*s1) s1 = "0"; + q1 = dosexp(s1); + if (!q1) q1 = ""; + if (!*q1) q1 = "0"; + ckstrncpy(buf2,q1,32); + q1 = buf2; + + r = ckround(atof(q0),(int)(atof(q1)),sxroundbuf,31); + s2 = sxroundbuf; + sexprc = 0; + goto xdosexp; + } } if (x == SX_SET || x == SX_LET || /* Assignment is special */ x == SX_INC || x == SX_DEC) { @@ -4060,6 +4103,7 @@ dosexp(s) char *s; { /* s = S-Expression */ quote = 0; s2 = p[i+1]; /* Get operand */ if (!s2) s2 = ""; + #ifdef COMMENT if (*s2 == '\047') { /* Is it quoted? */ debug(F110,sexpdebug("'B"),s2,0); @@ -4173,7 +4217,7 @@ dosexp(s) char *s; { /* s = S-Expression */ if ((x == SX_AND && result == 0) || /* Short circuit */ (x == SX_LOR && result != 0)) quit++; - if (!(kwflags & SXF_ONE)) /* Command with single arg */ + if (!(kwflags & SXF_ONE)) /* Command w/single arg */ continue; } if (x == SX_MOD || x == SX_DIV) { @@ -4429,16 +4473,6 @@ dosexp(s) char *s; { /* s = S-Expression */ truncate = 1; break; - case SX_ROU: /* Round */ - if (fpj > 0.0) - fpj += 0.5; - else if (fpj < 0.0) - fpj -= 0.5; - fpresult = fpj; - fpflag = 1; - truncate = 1; - break; - case SX_ABS: /* Absolute value */ result = (j < 0) ? 0 - j : j; #ifdef FNFLOAT diff --git a/ckuus4.c b/ckuus4.c index 3e52fee..946603a 100644 --- a/ckuus4.c +++ b/ckuus4.c @@ -1110,7 +1110,9 @@ struct keytab fnctab[] = { /* Function names */ #else { "permissions",FN_PERM, CM_INV}, /* Permissions of file */ #endif /* CK_PERMS */ +#ifdef SEEK_CUR { "pictureinfo",FN_PICTURE, 0 }, /* Picture orientation/dimensions */ +#endif /* SEEK_CUR */ { "radix", FN_RADIX, 0 }, /* Radix conversion */ #ifndef NORANDOM { "random", FN_RAND, 0}, /* Random number */ @@ -11833,6 +11835,7 @@ fneval(fn,argp,argn,xp) char *fn, *argp[]; int argn; char * xp; { goto fnend; } +#ifdef SEEK_CUR /* \fpicture(): Get dimensions of GIF or JPG image. fdc June 2006 @@ -11967,6 +11970,8 @@ fneval(fn,argp,argn,xp) char *fn, *argp[]; int argn; char * xp; { } goto fnend; } +#endif /* SEEK_CUR */ + if (cx == FN_PID) { int x = -1; if (chknum(bp[0])) { /* Need numeric argument */ diff --git a/ckuus5.c b/ckuus5.c index 744d75e..d542de3 100644 --- a/ckuus5.c +++ b/ckuus5.c @@ -11965,6 +11965,21 @@ shofea() { flag = 1; #endif /* CK_XYZ */ +#ifdef NOFLOAT + printf(" No floating-point arithmetic\n"); + if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; } + flag = 1; + printf(" No S-Expressions (LISP interpreter)\n"); + if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; } + flag = 1; +#else +#ifdef NOSEXP + printf(" No S-Expressions (LISP interpreter)\n"); + if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; } + flag = 1; +#endif /* NOSEXP */ +#endif /* NOFLOAT */ + #ifdef NOTLOG printf(" No transaction log\n"); if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; } diff --git a/makefile b/makefile index 454d3e4..176bc4e 100644 --- a/makefile +++ b/makefile @@ -1,9 +1,8 @@ # makefile / Makefile / ckuker.mak / CKUKER.MAK # -# Tue Jun 21 13:04:45 2011 -BUILDID=20110621 -CKVER= "9.0.299" -TESTID= "Beta.02" +# Thu Jun 30 07:31:33 2011 +BUILDID=20110630 +CKVER= "9.0.300" # # -- Makefile to build C-Kermit for UNIX and UNIX-like platforms -- # @@ -695,8 +694,7 @@ TESTID= "Beta.02" # ? for Solaris 8 on SPARC or Intel, GNU CC, "make solaris8g". # + for Solaris 9 on SPARC (or Intel?), 32-bit, SunPro CC, "make solaris9". # + for Solaris 9 on SPARC (or Intel?), 32-bit, GNU CC, "make solaris9g". -# + for Solaris 9 on SPARC 100% 64-bit, SunPro CC, "make solaris9_64". -# + for Solaris 9 on SPARC (or Intel?), 64-bit, GNU CC, "make solaris9g64". +# ? for Solaris 9 on SPARC (or Intel?), 64-bit, GNU CC, "make solaris9g64". # + for Solaris 10 on SPARC (or Intel?), 32-bit, SunPro CC, "make solaris10". # + for Solaris 10 on SPARC 64-bit, SunPro CC, "make solaris10_64". # + for Solaris 10 on SPARC (or Intel?), 32-bit, GNU CC, "make solaris10g". @@ -3878,15 +3876,6 @@ solaris9g solaris10g solaris11g: -D_FILE_OFFSET_BITS=64 $(KFLAGS)" \ "LIBS= -ltermlib -lsocket -lnsl -lm -lresolv -lpam $(LIBS)" -#Solaris 9, 10, or 11 with Sun CC, 64 bit build. -#DON'T USE THIS ONE ON PC ARCHITECTURE - It compiles and links but won't run. -#OK: 2009/11/16 (but not tested on Solaris 11) -solaris9_64 solaris10_64 solaris11_64: - @echo 'Making C-Kermit $(CKVER) for Solaris 9/10/11 64-bit Sun CC' - $(MAKE) "MAKE=$(MAKE)" solaris9 KTARGET=$${KTARGET:-$(@)} \ - "KFLAGS=-xarch=generic64 -U_FILE_OFFSET_BITS -DNOARROWKEYS" \ - "LNKFLAGS= -xarch=generic64" - #Solaris 9, 10, or 11 with gcc, 64 bit build. #Peeking inside FILE struct not allowed in 64-bit world. #DON'T USE THIS ONE ON PC ARCHITECTURE - It compiles and links but won't run. @@ -6111,6 +6100,8 @@ linux: `if test -n '$$HAVE_OPENPTY'; then echo -lutil; fi` \ `if test -f /usr/lib64/libresolv.a || test -f /usr/lib64/libresolv.so \ || test -f /usr/lib/libresolv.a || test -f /usr/lib/libresolv.so \ + || test -f /usr/lib/i386-linux-gnu/libresolv.a \ + || test -f /usr/lib/i386-linux-gnu/libresolv.so \ || ls /lib/x86_64-linux-gnu/libresolv.* > /dev/null 2> /dev/null; \ then echo -lresolv; fi` \ `if test -f /usr/lib64/libcrypt.a || test -f /usr/lib64/libcrypt.so \ diff --git a/ockermit.ini b/ockermit.ini new file mode 100644 index 0000000..f007561 --- /dev/null +++ b/ockermit.ini @@ -0,0 +1,618 @@ +COMMENT - Standard C-Kermit initialization file +; +; For C-Kermit Version: 8.0 +; +; Filename: +; .kermrc (UNIX, OS-9, Aegis) +; CKERMIT.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga) +; ckermit.ini (Stratus VOS) +; K95.INI (Kermit 95 -- but this big version is not used there) +; K2.INI (Kermit/2 -- but ditto) +; +; Authors: +; Frank da Cruz, Christine M. Gianone, Jeffrey Altman +; Columbia University, New York, NY 10025-7799, USA +; +; This is the standard and recommended C-Kermit 8.0 initialization file. To +; override settings or definitions made in this file, to add new settings or +; definitions, or to make any other desired customizations, create a separate, +; personal customization file called: +; +; .mykermrc (UNIX, OS-9, Aegis, BeBox, Plan 9) +; CKERMOD.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga) +; ckermod.ini (VOS) +; +; You can also define the customization filename in an environment +; variable (logical name in VMS), CKERMOD, which takes precedence over +; the names shown above. +; +; WHAT THIS FILE DOES: +; +; . Defines your default dialing directory name: +; .kdd for UNIX, OS-9 and Aegis; CKERMIT.KDD for other operating systems. +; You can override this with the environment variable K_DIAL_DIRECTORY +; . Defines your default network directory name: +; .knd for UNIX, OS-9 and Aegis; CKERMIT.KND for other operating systems. +; You can override this with the environment variable K_NET_DIRECTORY +; . Defines your default services directory name: +; .ksd for UNIX, OS-9 and Aegis; CKERMIT.KSD for other operating systems. +; You can override this with environment variable K_SERVICE_DIRECTORY. +; . Defines your customization file name (name given above) +; . Performs system-dependent setups for UNIX, VMS, OS/2, etc. +; . Defines VTPRINT macros for use with K95, MS-DOS Kermit, etc. +; . If you have a services directory, all the macros needed to use it are +; defined. If you don't have a services directory, the macros are not +; defined and Kermit starts faster. +; . Executes your personal customization file, if you have one. +; NOTE: Your customization file is NOT executed by Kermit itself; it is +; executed by this file. +; +; In UNIX, with C-Kermit 7.0 and later, you can store this file with a name +; other than .kermrc, and it will not be executed automatically, but, if you +; give this file execute permission, you can execute directly because of the +; "kerbang line" at the top, whenever you want all of the above actions to +; occur. The kerbang line must reflect the actual full path of the Kermit +; 7.0-or-later executable. +; +; C-Kermit 6.0 is documented in the book "Using C-Kermit", 2nd Edition, +; by Frank da Cruz and Christine M. Gianone, 1997, Digital Press / +; Butterworth-Heinemann, ISBN 1-55558-164-1. New features of subsequent +; versions are documented at the Kermit website: +; http://www.columbia.edu/kermit/ +; +; Everything after this point depends on the script programming language. +; The CHECK command terminates this command file immediately if the script +; programming language (IF command) is not configured. +; +set take error on ; This makes CHECK quit if no script language. +check if ; Do we have an IF command? If not, quit now. +set take error off ; Back to normal. + +local _sd _servicedir _xp ; Declare local variables. + +COMMENT - C-Kermit version 6.0 or later required. +; + +asg _xp \v(xprogram) +if not def _xp asg _xp \v(program) +if not equal "\m(_xp)" "C-Kermit" - + stop 1 \v(cmdfile): This initialization file is only for C-Kermit. +echo Executing \v(cmdfile) for \v(system)... +if < \v(version) 60000 - + stop 1 \v(cmdfile): C-Kermit 6.0 or later required. + +forward \v(system) ; First do system-dependent items... + +:unknown ; Should not happen +Stop 1 Error: System type unknown! + +:Aegis ; Apollo Aegis and +:UNIX ; UNIX, all versions +asg _myinit - + \v(home).mykermrc ; Customization filename +if remote forward COMMON ; Skip local-mode items if "-R" +asg _dialdir - + \v(home).kdd ; C-Kermit dialing directory +asg _netdir - + \v(home).knd ; C-Kermit network directory +asg _servicedir - + \v(home).ksd ; C-Kermit services directory +forward COMMON ; End of UNIX section + +:OS9/68K ; OS-9 +asg _myinit - + \v(home).mykermrc ; Customization filename +if remote forward COMMON +asg _dialdir - + \v(home).kdd ; C-Kermit dialing directory +asg _netdir - + \v(home).knd ; C-Kermit network directory +asg _servicedir - + \v(home).ksd ; C-Kermit services directory +else set file display crt +forward COMMON ; End of OS-9 section + +:VMS ; VMS and OpenVMS +forward COMMON + +:OS/2 ; Kermit 95 +:WIN32 +echo This initialization file is not for use with K95. +forward COMMON ; End of OS/2 section + +:AOS/VS ; Data General AOS/VS +set window 1 ; Sliding windows don't work +set file char dg-international ; File character-set +set xfer char latin1 ; Transfer character-set +set file display crt ; File transfer fisplay +def cli push ; Escape to CLI +def reset - ; Macro to reset DG DASHER terminal + run write [!ascii 236 306 301] +forward COMMON ; End of AOS/VS section + +:Amiga ; Commodore Amiga +def cls echo \27[H\27[2J ; CLS command to clear the screen +set file char latin1 ; Use Latin Alphabet 1 for file transfer +set xfer char latin1 ; ... +forward COMMON ; End of Amiga section + +:Atari_ST ; Atari ST +def cls echo \27H\27J ; Clear screen a`la VT52 +set server display on ; Show file xfer display in server mode too +set server timeout 15 ; Nonzero required for ^C interruption! +forward COMMON ; End of Atari ST section + +:Macintosh ; Apple Macintosh +set server display on ; Show file xfer display in server mode too. +forward COMMON + +:Stratus_VOS ; Stratus VOS +asg _myinit \v(home)ckermod.ini +if remote forward COMMON +asg _dialdir \v(home)ckermit.kdd +asg _netdir \v(home)ckermit.knd +asg _servicedir \v(home)ckermit.ksd +forward COMMON ; End of Stratus VOS section + +:COMMON ; For all systems + +; Define macros that are useful when running C-Kermit in remote mode. +; These macros serve no purpose on local-mode-only versions such as +; OS/2, Macintosh, Amiga, and Atari ST Kermit, so we skip defining them +; for those systems. +; +if not = 0 \findex(\v(system),WIN32:OS/2:Macintosh:Amiga:Atari_ST) - + forward files + +; VTPRINT macro. Print a file on your PC's local printer. + +def VTPRINT echo \27[5i, type \%1, echo \27[4i +; or if your printer needs a formfeed to force the page out: +; def VTPRINT def echo \27[5i, type \%1, echo \12\27[4i + +; Macros for host-initiated file transfer using APC: +; NOT NEEDED ANY MORE because of autodownload/autoupload. +; Remove the following FORWARD command to reinstate these definitions: + +:FILES + +; Get customization and directory file names. Environment variables take +; precedence, so you do not have to edit this file to change these filenames. +; +if def \$(CKERMOD) assign _myinit \$(CKERMOD) +if not def _myinit assign _myinit \v(home)CKERMOD.INI + +if remote forward CUSTOM ; Skip all this if -R given on command line + +if def \$(K_NET_DIRECTORY) assign _netdir \$(K_NET_DIRECTORY) +if not def _netdir assign _netdir \v(home)CKERMIT.KND + +if def \$(K_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY) +if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD + +CHECK DIAL ; Is there a DIAL command? +xif fail { ; No. + echo DIAL disabled + forward CUSTOM +} + +CHECK NETWORK +xif success { + xif exist \m(_netdir) { + set net directory \m(_netdir) + echo { Network directory is \m(_netdir) } + } +} + +if eq "\v(name)" "telnet" forward CUSTOM + +xif exist \m(_dialdir) { + set dial directory \m(_dialdir) + echo { Dial directory is \m(_dialdir) } +} + +COMMENT - Services directory + +if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY) +if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD + +; If no services directory is found skip all the big macro definitions and +; go straight to the bottom, where we execute the customization file. + +if not exist \m(_servicedir) forward custom + +echo { Services directory is \m(_servicedir)} + +def MAX_SVCS 200 ; Adjust this if you have more entries +define _sd 0 ; Assume no services directory +open read \m(_servicedir) ; Try to open services directory file +xif success { + declare \&d[\m(MAX_SVCS)] ; It's open, declare directory array + for \%i 1 \m(MAX_SVCS) 1 { ; Read the lines into the array + read \&d[\%i] + if fail break + } + close read + xif > \%i \m(MAX_SVCS) { + echo Too many entries in services directory + echo { Maximum is \m(MAX_SVCS).} + echo { Change definition of MAX_SVCS in \v(cmdfile) to allow more. } + echo { Services directory disabled.} + } else { + asg \&d[0] \feval(\%i - 1) + define _sd 1 + } +} + +xif not \m(_sd) { + def access echo { Services directory not available.} + asg list \m(access) +} else { + def FIND { + set case off + for \%i 1 \&d[0] 1 { + if eq {\%1} {\fsubstr(\&d[\%i],1,\flen(\%1))} break + } + if not > \%i \&d[0] return \&d[\%i] + } + def LIST { + xif > \v(argc) 1 { + do find \%1 + if def \v(return) echo \v(return) + else echo \%1: Not found + } else { + echo \&d[0] items in services directory: + for \%i 1 \&d[0] 1 { echo \fcont(\&d[\%i]) } + } + } + def SPLIT { asg _word1 \%1, asg _word2 \%2 } + def DOACCESS { ; (Used internally by ACCESS macro) + do \%5 \%6 \%7 \%8 \%9 ; Do the connection macro + if fail end 1 + split \%3 ; Get words from \%3 + asg \%3 \m(_word1) + asg \%2 \m(_word2) + do \%3 \%4 {\%1} \%2 ; Login macro, userid, password, prompt + } + def ACCESS { + if not defined \%1 end 1 access what? ; Check service + do find \%1 ; Look it up + if success doaccess {\%2} \v(return) ; OK, try it + else end 1 "\%1" not in services directory ; Not found + if fail end 1 ; DOACCESS failed? + xif eq \v(cmdlevel) 1 { + echo + echo ACCESS: Login succeeded - CONNECTing... + show escape + output \13 + connect /quietly + } + } +} + +:CONNECTION ; Macros for making connections + +COMMENT - SERIAL macro. Arguments: +; \%1 = device name +; \%2 = speed +; +def SERIAL { + if < \v(argc) 3 ; All arguments given? + end 1 Usage: SERIAL device speed ; No. + set line \%1 ; OK, try to SET LINE. + if failure - ; If this failed, + end 1 Can't open device: \%1 ; print message and quit. + set speed \%2 ; Try to set the speed. + if fail end 1 Unsupported speed: \%2 ; Failed. + echo Connection successful. ; Succeeded. +} + +COMMENT - NET macro. Arguments: +; \%1 = network type +; \%2 = host name or address +; +def NET { + if < \v(argc) 3 end 1 Usage: NET network host + set network type \%1 + if fail end 1 unsupported network: \%1 + set login user ; Don't send user ID. + set host \%2 + if fail end 1 Can't reach host: \%2 + echo Connection successful. +} + +COMMENT - CALL macro. Arguments: +; +; \%1 = modem type +; \%2 = device name +; \%3 = speed +; \%4 = phone number +; +def CALL { + if < \v(argc) 5 - ; All arguments present? + end 1 Usage: CALL modem device speed number + xif not equal {\v(modem)} {\%1} { ; Set modem type + set modem \%1 + if fail end 1 unknown modem type: \%1 + } + xif not equal {\v(line)} {\%2} { ; Communication device + set line \%2 + if fail end 1 can't open device: \%2 + } + xif not equal {\v(speed)} {\%3} { ; Communication speed + set speed \%3 + if fail end 1 unsupported speed: \%3 + } + dial \%4 ; Dial the number + if fail end 1 Can't place call: \%4 + end 0 Connection successful. +} + +COMMENT - TCPCALL macro. Arguments: +; +; \%1 = server name:port +; \%2 = modem type +; \%3 = phone number +; +def TCPCALL { + if < \v(argc) 4 - ; All arguments present? + end 1 Usage: TCPCALL server[:port] modem number + set net type tcp/ip ; Which network to use + if fail end 1 unsupported network: tcp/ip + set host \%1 ; Access server and port + if fail end 1 can't access server \%1 + set modem \%2 ; Set modem type + if fail end 1 unknown modem type: \%2 + dial \%3 ; Dial the number + if fail end 1 Can't place call: \%3 + end 0 Connection successful. +} + +COMMENT - SPRINT macro. Arguments: +; \%1 = Service name or address +; +def SPRINT { + if < \v(argc) 2 end 1 Usage: \%0 service + set input timeout proceed + output @D\13 + input 10 TERMINAL= + if fail end 1 No terminal prompt + out D1\13 + inp 10 @ + if fail end 1 No atsign prompt + output c \%1\13 + input 10 CONNECTED + if fail end 1 Can't access \%1 from SprintNet +} + +COMMENT - ULOGIN macro. For logging into systems where user ID is required +; but there is no password. Arguments: +; \%1 = UNIX user ID +; +define ULOGIN { + if < \v(argc) 2 end 1 Usage: \%0 userid + set input timeout proceed ; Handle timeouts ourselves + set case on ; Case is important in UNIX + minput 5 login: Username: {User ID:} {User Name:} + out \%1\13 ; Send username, carriage return + end 0 +} + +COMMENT - VMSLOGIN macro. Arguments: +; \%1 = VMS user ID +; \%2 = Password. If password not supplied, it is prompted for. +; \%3 = System prompt. If omitted a default is supplied. +; +define VMSLOGIN { + if < \v(argc) 2 end 1 Usage: \%0 userid [ password [ prompt ] ] + while not defined \%2 { + askq \%2 { \%1's password: } + } + set parity none ; Set communication parameters + set duplex full + set handshake none + set input timeout proceed ; Handle timeouts ourselves + in 5 Username: ; Is prompt already there? + xif fail { ; No. + for \%i 1 3 1 { ; Try 3 times to get it. + out \13 ; Send carriage return + in 5 Username: ; Look for prompt + if success break ; Success, go log in + } + if > \%i 3 end 1 No Username prompt + } + out \%1\13 ; Send username, carriage return + inp 5 Password: ; Wait 5 sec for this prompt + if fail end 1 No password prompt + pause ; Wait a sec + out \%2\13 ; Send password + xif not emulation { ; No emulator built in? + set input echo off ; Protect terminal from this + minput 10 {\27Z} {\27[c} {\27[0c} ; Get terminal ID query + xif success { ; Got one + output \27[\?1c ; Send VT100 terminal ID + in 2 \27[6n ; Screen dimension query? + if succ out \27[\v(rows);\v(cols)R ; Send dimensions + } + set input echo on ; Echo input again + } + if not def \%3 - ; If we were not given a prompt + asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value + if not def \%3 - ; If we still don't have a prompt + asg \%3 {\13$\32} ; use this one as the default + reinp 0 \%3 ; Did we INPUT the prompt already? + if fail inp 60 \%3 ; No, look now. + if fail end 1 +} + +COMMENT - UNIXLOGIN macro. Arguments: +; \%1 = UNIX user ID +; \%2 = Password. If password not supplied, it is prompted for. +; \%3 = System prompt. If omitted a default is supplied. +; +define UNIXLOGIN { + local \%m \%i + if < \v(argc) 2 - + end 1 Usage: \%0 userid [ password [ prompt ] ] + while not defined \%2 { + askq \%2 { \%1's password: } + } + set input echo on + set parity none ; Set communication parameters. + set duplex full + set handshake none + set input timeout proceed ; Handle timeouts ourselves + set case on ; Case is important in UNIX + def \%m 10 ; Waiting time for INPUT + for \%i 1 5 1 { + minput \%m login: {ssword:} {Password for \%1:} + if success break + output \B\13 + \%m ::= 6-\%1 + } + if > \%i 5 end 1 {No response from host} + xif = \v(minput) 1 { ; Have username prompt + output \%1\13 ; Send username + minput 5 {ssword:} {ssword for \%1:} ; Wait for password prompt + if fail end 1 {No password prompt} + } + pause ; Wait a sec + out \%2\13 ; Send password + if not def \%3 - ; If we were not given a prompt + asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value + if not def \%3 - ; If we still don't have a prompt + asg \%3 {\10$ } ; use this one as the default + reinp 0 \%3 ; Did we INPUT the prompt already? + if fail inp 60 \%3 ; No, look now. + if fail end 1 +} + +COMMENT - VMLINELOGIN macro. Arguments: +; \%1 = User ID +; \%2 = Password +; +define VMLINELOGIN { + if < \v(argc) 2 - + end 1 Usage: \%0 userid [ password ] + while not defined \%2 { + askq \%2 { \%1's password: } + } + set parity mark ; Set communication parameters + set flow none + set handshake xon + set duplex half + set input timeout quit ; Don't bother with IF FAILURE + input 10 BREAK KEY ; Look for BREAK KEY prompt + pause 1 ; Wait a second + output \B ; Send BREAK + input 10 .\17, output logon \%1\13 ; Now log in + input 10 .\17, output \%2\13 ; Send password + input 10 .\17, output \13 ; Send carriage return + input 10 .\17, output \13 ; Send another one + end 0 +} + +COMMENT - VMFULLOGIN macro. Arguments: +; \%1 = User ID +; \%2 = Password +; +define VMFULLOGIN { + if < \v(argc) 2 - + end 1 Usage: \%0 userid [ password ] + while not defined \%2 { + askq \%2 { \%1's password: } + } + set input timeout quit ; Quit if INPUT fails + set parity even ; Set communication parameters + set duplex full + set handshake none + set flow xon/xoff + out \13 ; Send carriage return + inp 5 TERMINAL TYPE: ; Get terminal-type prompt + out vt-100\13 ; Just send "vt-100" + inp 20 RUNNING ; Get RUNNING message + pau 1 ; Wait one second + out \%1\9\%2\13 ; Send user ID, tab, password + out \13\13 ; Two more carriage returns + end 0 +} + +COMMENT - CISLOGIN macro. Arguments: +; \%1 = CompuServe User ID +; \%2 = Password +; \%3 = Prompt +; +define CISLOGIN { + if < \v(argc) 2 - + end 1 Usage: \%0 userid [ password [ prompt ] ] + while not defined \%2 { + askq \%2 { \%1's password: } + } + set terminal bytesize 7 ; No 8-bit characters + set input timeout quit ; Skip the IF FAILURE's + output \13 ; Send initial carriage return + input 5 Host Name: ; Look for Host Name prompt + output cis\13 ; Send "cis" and carriage return + input 5 User ID: ; Look for User ID prompt + output \%1\13 ; Send ID and carriage return + input Password: ; Look for Password prompt + output \%2\13 ; Send password and CR + if not def \%3 asg \%3 \v(prompt) + if not def \%3 asg \%3 {CompuServe Information Service} + input 30 \%3 + end 0 +} + +COMMENT - DOWLOGIN macro. Arguments: +; \%1 = Dow Jones Password +; +define DOWLOGIN { + while not defined \%1 { ; Get password + askq \%1 { Dow Jones password: } + } + set input timeout proceed + input 20 SERVICE PLEASE\?\?\?\? ; Look for Dow prompt + if fail end 1 No service prompt + out djnr\13 ; Select DJNR + input 10 @@@@@@@@ ; Get password prompt + if fail end 1 No password prompt + pause 1 ; Wait a second, then... + output \%1\13 ; send password and CR + input 30 ENTER QUERY ; Get DJNR query prompt + if fail end 1 No main query prompt + pause 1 +} + +COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet. +; +def djnrsprint sprint dow, if success dowlogin + +COMMENT - NOLOGIN macro. Does nothing. Use when login not required. +; +def nologin comment + +:CUSTOM ; Customization file + +; In VMS and OpenVMS, allow for system-wide site customizations + +xif equal "\v(system)" "VMS" { + xif exist CKERMIT_INI:CKERMIT.SYS { + echo Executing CKERMIT_INI:CKERMIT.SYS + take CKERMIT_INI:CKERMIT.SYS + } +} + +; Execute user's personal customization file + +xif exist \m(_myinit) { ; If it exists, + echo Executing \m(_myinit)... ; print message, + take \m(_myinit) ; and TAKE the file. +} + +; Finish up with traditional greeting. + +if < \v(ntime) 43200 echo Good Morning! + else if < \v(ntime) 61200 echo Good Afternoon! + else echo Good Evening. + +End ; of C-Kermit 8.0 initialization file. diff --git a/ockermod.ini b/ockermod.ini new file mode 100644 index 0000000..5848c3f --- /dev/null +++ b/ockermod.ini @@ -0,0 +1,144 @@ +; File CKERMOD.INI, Sample C-Kermit 7.0 customization file. +; +; This file, which is ONLY A SAMPLE, should be called: +; +; .mykermrc (UNIX, OS-9, Aegis, BeBox, Plan 9) +; CKERMOD.INI (VMS, OpenVMS, AOS/VS, OS/2, Amiga, Atari ST) +; ckermod.ini (Stratus VOS) +; +; This file is executed automatically by the standard C-Kermit initialization +; file, CKERMIT.INI (or .kermrc). This file is not executed by C-Kermit itself +; unless the initialization file is not found. +; +; MODify this file to suit your needs and preferences, and install it in your +; home directory. Or replace it entirely with a new file. +; +; The design of this sample customization file lets you fill in a section for +; each different operating system where you run C-Kermit. +; +; In UNIX, if you give this file execute permission and make sure the top +; line indicates the full path of the C-Kermit 7.0-or-later executable, you +; can execute this file directly, as if it was a shell script, except it is +; interpreted by Kermit rather than the shell. This lets you have as many +; different startup files as you like, each suited to a particular purpose. +; +; Authors: Christine Gianone, Frank da Cruz, Jeffrey Altman, +; The Kermit Project, Columbia University. +; Creation: 23 November 1992 for C-Kermit 5A(188). +; Modified: 30 June 1993 for edit 189. +; 04 October 1994 for edit 190. +; 17 April 1995 for edit 191. +; 6 September 1996 for version 6.0, edit 192. +; 1 January 2000 for version 7.0, edit 196. +; 14 October 2001 for version 8.0, edit 200. + +ECHO +ECHO Executing SAMPLE C-Kermit customization file \v(cmdfile) for \v(system)... +ECHO { Please edit this file to reflect your needs and preferences.} +ECHO +; +; ... and then remove the ECHO commands above. + +COMMENT - Settings that apply to all the systems I use: +; +set delay 1 ; I escape back quickly +set dial display on ; I like to watch C-Kermit dial + +; Dialing locale and method +; +; SET DIAL COUNTRY-CODE 1 ; Uncomment and replace with yours +; SET DIAL AREA-CODE 000 ; Uncomment and replace with yours +; SET DIAL LD-PREFIX 1 ; Uncomment and replace with yours +; SET DIAL INTL-PREFIX 011 ; Uncomment and replace with yours +; SET DIAL METHOD TONE ; Uncomment and replace with PULSE if necessary +; SET DIAL DIRECTORY ... ... ; List dialing directory files here + +if < \v(version) 600192 - + stop 1 \v(cmdfile): C-Kermit 6.0.192 or later required. + +set take error on ; Make errors fatal temporarily +check if ; Do we have an IF command? +set take error off ; Yes we do, back to normal + +; The ON_EXIT macro is executed automatically when C-Kermit exits. +; Define as desired. +; +define ON_EXIT echo Returning you to \v(system) now. + +; System-independent quick dialing macro. Depends on having the +; macros MYMODEM, MYPORT, and (optionally) MYSPEED defined in the +; system-dependent sections below. +; +define MYDIAL { + if not defined MYMODEM end 1 {\%0: Modem type not defined.} + set modem type \m(MYMODEM) + if fail end 1 {\%0: \m(MYMODEM): Unsupported modem type.} + if not defined MYPORT end 1 {\%0: Communication port not defined.} + set port \m(MYPORT) + if fail end 1 {\%0: SET PORT \m(MYPORT) failed.} + if defined MYFLOW set flow \m(MYFLOW) + if fail end 1 {\%0: SET FLOW \m(MYFLOW) failed.} + if defined MYSPEED set speed \m(MYSPEED) + if fail end 1 {\%0: SET SPEED \m(MYSPEED) failed.} + dial \%1\%2\%3\%4\%5\%6\%7\%8\%9 + end \v(status) +} + +forward \v(system) ; Go execute system-dependent commands + +:UNIX ; UNIX, all versions... +define MYPORT /dev/cua ; My dialing environment +define MYMODEM usr ; Replace these by what you actually have +define MYSPEED 57600 +; +; If you want all your downloads to go to the same directory, no matter +; what your current directory is, uncomment and edit the following command: +; +; set file download-directory ~/download ; Download directory for UNIX + +; Put other UNIX-specific commands here... +end ; End of UNIX section + +:VMS ; VMS and OpenVMS +define MYPORT TXA0: ; My dialing environment +define MYMODEM usr ; Replace these by what you actually have +define MYSPEED 57600 +; set file download-directory [\$(USER).DOWNLOAD] ; Download directory for VMS +; Put other VMS-specific commands here... +end ; End of VMS section + +:WIN32 ; Windows and OS/2 customizations... +:OS/2 +define MYPORT COM1 ; My dialing environment +define MYMODEM usr ; Replace these by what you actually have +define MYSPEED 57600 +set command byte 8 ; Use 8 bits between Kermit and console +set xfer char latin1 ; Use Latin-1 for text file transfer +set term char latin1 ; And use Latin-1 during CONNECT mode +; set file download-directory C:\DOWNLOADS +end + +:OS9/68K ; OS-9/68000 +define MYPORT /t3 ; My dialing environment +define MYMODEM usr ; Replace these by what you actually have +define MYSPEED 9600 +; set file download-directory ~/downloads +end ; End of OS-9 section + +:AOS/VS ; Data General AOS/VS +define MYPORT @con3 ; My dialing environment +define MYMODEM usr ; Replace these by what you actually have +define MYSPEED 9600 +; set file download-directory \v(home)DOWNLOADS +end + +; And so on, you get the idea... +; Fill in the sections that apply to you. + +:Stratus_VOS ; Stratus VOS +:Amiga ; Commodore Amiga +:Atari_ST ; Atari ST +:Macintosh ; Apple Macintosh +:unknown ; Others + +; (End of CKERMOD.INI)