C-KERMIT 5A UPDATE NOTES FOR OS/2 January 1992 The following are notes from Kai Uwe Rommel at the Technical University of Munich, Germany, describing the work he did to adapt C-Kermit 5A to OS/2. The program compiles to about 305K, runs in a window, does not support TCP/IP or other networking, does not use the Presentation Manager, but has also been tested under OS/2 2.0. Note: all differences described below have been applied to the ckc*.* and cku*.* files already. Notes to the C-Kermit 5A(176) OS/2 diffs/files of 12/30/91 ---------------------------------------------------------- Files: ckoker.mak Makefile for OS/2, Microsoft C 6.00 (5.1 not supported) ckoker.def Linker definition file for kermit ckwart.def Linker definition file for wart The linker definition files are required to specify some executable attributes, such as the screen interface used, the ability to deal with long filenames of HPFS etc. and a comment. ckotio.c Terminal I/O for OS/2 serial ports/modems ckocon.c OS/2 connect command, alarm() and opendir() and friends ckodir.h Declarations for opendir() and struct direct ckufio.dif diffs to ckufio.c for OS/2 ckoker.dif diffs to all other modules Notes to ckufio.c/ckufio.dif: I have compiled the modified ckufio.c under HP-UX, to verify that it still works with Unix and have tested the file name matching, which is the part, where I did changes that could affect Unix too. It works. The following changes were made: - The ckzsys string was moved to the top of the file together with ckuver.h to make it more prominent. - All occurences of '/' or / in strings were replaced by the macros DIRSEP and ISDIRSEP(c) with the appropriate code changes for strings. These two macros are defined at the very top. I have not changed code in non-Unix #ifdef branches (e.g. aegis). - Included a few #ifdef OS2 statements at the top to include a few extra headers or to #define some symbols. - Added the DELCMD, DIRCMD etc. definitions for OS/2. - Added code for OS/2 binary file access (O_BINARY and similar stuff). - The chdir() return code in case of success is 0 only, say the Unix manuals I have access to as well as the OS/2 manuals. - Check if getenv("HOME") is not NULL (for OS/2). - getcwd is an exception where OS/2 is not BSD-compatible but follows System V. - Own zxcmd() and zclosf() for OS/2. - No shxpand() under OS/2. - Different znewn() for OS/2. - rename() used under OS/2 instead of link(), unlink(). - A few changes to zfcdat() and zstime(), zfcdat must not be static because it is prototyped differently, and MS C complains about this. - Slightly different zprint for OS/2. - Many changes to the traverse(),fgen() functions, #ifdef'ed OS2, but Unix code changed too, to make #ifdef sections smaller. Works with Unix still, of course, because functionality didn't change, only a few statements have been expressed differently. OS/2 cannot stat() directory names with trailing / (except root itself). - Different zsyscmd() and zshcmd() for OS/2. - Added zchdisk() to change disk drive. Notes to ckoker.dif: - Various #ifdef OS2's in ckcdeb.h. - OS/2 uses ckuxla.h of Unix version in ckxla.h. - Re-ordered a few ck* headers in ckucmd.c. - Corrected dial method in ckudia.c (should not be hardcoded to tone or pulse but rather just use the default method which can be changed with the modem init string, if a modem's default not suitable or cannot be set via dip switch or non-volatile RAM). - Various deletes of obsolete OS2 #ifdefs in ckudia.c. - If a dial timeout occurs, a CR should be sent to abort a possible still waiting modem (depending on the busy tone used here in Germany, my modem does not always fail with "BUSY" but simply waits for a much longer period, longer than timeout). - Deleted obsolete OS2 #ifdef in ckuscr.c. - Changed OS/2 help texts in ckuus2.c for SET KEY and SET TERMINAL COLOR. - Changed keymap external declaration in ckuus3.c #ifdef'ed OS2 to be the actual *definition* and deleted the definition from ckuusr.c, where it is never referenced. Deleted the static initialization and added a loop in ckuus5.c to initialize it. Thus keymap could be even made DYNAMIC, although I did not do this yet. - Made code for set key in ckuus3.c independent of keymap size and data type. - Deleted much obsolete OS/2 code from ckuus4.c. - Enhanced the search methods for ckermit.ini in OS/2 version in ckuus5.c. - Changed keymap declaration #ifdef'ed OS2 and added init loop as mentioned above. - Changed shover() a little bit. - Made implementation of show key independent of keymap data type by using int instead of char for the character to read. - Use conincraw() for OS/2 there. The normal OS/2 coninc() ignores all keys above 0xFF to not confuse the command line editor with them. - Deleted some obsolete OS/2 code from ckuus6.c. - Added SET TERMINAL COLOR implementation to ckuus7.c. - Deleted keymap definition and initialization from ckuusr.c as mentioned above. - Deleted some obsolete OS/2 code from ckuusr.c - Two little changes to ckuusy.c (no job suspending available for OS/2). - Added OS/2 herald to ckuver.h. That's all! /* Kai Uwe Rommel, Munich ----- rommel@informatik.tu-muenchen.de */ ------------------------------ January 2, 1992: The file ckoker.dif contains the following patches: - correction of bug in ckuus3.c with >= vs. > KEYMAP. - solution to various problems with filename matching in ckufio.c for OS/2 and drive selectors C: etc. - dodebug's parameter n must be long instead of int because pointers are sometimes passed for it and ANSI C says, that int's are not necessarily big enough to hold a pointer's representation for some machines (such as MS C large model under OS/2 1.x). All (int) casts for pointer arguments passed to parameter n of dodebug() were replaced by (long) casts. dodebug() itself has been changed a bit. The %d's in printf formats have to be %ld's now. - the days variable in zstime must be long for machines with 16 bit int's because otherwise overflow will occur. - some more obsolete OS/2 declarations etc. in general files have been deleted and replaced by prototypes in ckcdeb.h. - the keymap declaration and initialization has been generalized with #define KEYMAP / typedef KEY in ckuusr.h. I have raised the warning level I use with Microsoft C from -W1 (default) to -W2. This produced a lot more warnings. The following changes were made to eliminate them and make the code more portable (all of these warnings were portability warnings): - wherever a larger int value is passed for a parameter to a function call where a smaller one is declared in the prototype, a cast has been added (long passed to int or int passed to char parameter). - missing prototypes were added, in order to have prototypes for *all* function calls, even for those through pointers. The _PROTOTYP() macro has always been used, of course. ------------------------------ January 6, 1992: New versions of - ckocon.c - ckotio.c Diffs - ckoker.dif (see below) Changes made (ckoker.dif): - The SET KEY command is now implemented (with macros). Things left over to do are \K-verbs and replaying of the macros in the other non-OS/2 connect procedures. Where the character is sent to the line, macrotab[char] should be checked and if not NULL, the whole string where it points to should be sent. Probably the whole mapping/shifting/ charset-translation/sending stuff should be moved into a subfunction and then be called for each character of the macro instead of only for the single character. - I have now created an extra macrotab table (see diffs) because of the otherwise required pointer arithmetic which should be avoided for OS/2 (and MAC) in this case. The tables (keymap and macrotab) are now always malloc'ed and the actual macro strings too. The malloc result is checked so macro definitions are simply ignored if the process runs out of data space. - Related to the SET KEY statement are some (commented) changes for OS/2 in the xesc() routine in ckucmd.c to allow backslash sequences larger than 8 bits for OS/2's SET KEY for the scan codes up to 767. - The \K-verbs have not been implemented yet. I don't think it is so important to have it immediately. How to do it? One way would be to save special codes into keymap or macrotab which would save space but requires more code change and requires the portable C-Kermit routines to know about all possible \K-verbs. The other way would be simply saving the \Kxxxx text as a macro and let all the connect commands detect and handle them. This would allow arbitrary verbs for whatever terminal emulation the connect command on a specific machine implements. This wastes a little bit of memory but since it is optional to assign macros, it wouldn't hurt. As a compromise, we could create a global verb table with a list of most common verbs and what sequence they send (for the common VT-100 keys, for example) so the connect commands could lookup that table and take the action found there, if any, or handle the verb themselves, if nothing was found in the table. - I have deleted some special OS/2 handshaking code left over from the 5A PM version from Chris Armstrong, because that code didn't work anyway and caused problems to an external V42/V42.bis modem. Hardware handshaking is not modified by C-Kermit under OS/2 anymore but can be set before entering C-Kermit with the MODE command. - I have removed all the OS2 ifdef's from the file name expansion code in ckufio.c and started over again. I had problems with OS/2's stat() failing on trailing directory separators and created much ifdefs to avoid them. I have now wrapped stat() into os2stat() where I strip them from a local copy and the file name expansion code is now much nicer (less OS2 ifdef's). - To allow double \\ as path name separators, I had to fix a bug in ckucmd.c where the double ones (escape charaters) are removed. Otherwise later the appended * for expansion was placed behind the 0 terminator of the shortened string. - OS/2 knows a line speed of 7200. Added it to the table. - In ckuusr.c, there is a problem in the implementation of the TYPE and CAT commands. See comment there. I have not fixed it. ------------------------------