Author Topic: Kermit 95 / C-Kermit for Windows and OS/2  (Read 14416 times)

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Kermit 95 / C-Kermit for Windows and OS/2
« on: January 31, 2023, 11:42:35 pm »
- Kermit 95. Doesn't work, but it's now open source and modular. It could actually be interesting to (re-)port as it once supported OS/2.

I'm the maintainer of Kermit 95 - now called C-Kermit for Windows (and OS/2 I guess). Pull requests welcome :D

My main focus so far has been getting it working properly on Windows again but I have been careful not to break OS/2 support along the way so no need to re-port it. In fact, github produces OS/2 binaries cross-compiled from Windows with OpenWatcom on mostly every commit! All that's needed to get it back to where it was 20 years ago is some bug fixing (bugs probably caused by switching from some IBM compiler to OpenWatcom). Problem is I know almost nothing about OS/2 development (but I do have boxed copies of OS/2 1.3 through to Warp 4 to test on). And also Kermit 95 didn't support SSH on OS/2 AFAIK - but thats a solvable problem now that its open-source.

As far as SSH goes, libssh supposedly supports OS/2 but not OpenWatcom - possibly because OpenSSL doesn't support OpenWatcom either. So either libssh+openssl need to be ported to OpenWatcom or C-Kermit for OS/2 needs to be ported to GCC. Not sure which is easier (or even possible). If the libssh+openssl situation can be sorted out, the libssh support code in C-Kermit for Windows and OS/2 uses Win32 threading APIs so there will be a little bit of porting work there too but I expect that would be pretty easy.

Screenshot of it running on OS/2 here: https://kermitproject.org/ckwscreenshots/os2.html
« Last Edit: January 31, 2023, 11:50:00 pm by davidrg »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #1 on: February 01, 2023, 01:47:38 am »
Third option, the OpenWatcom build use the GCC compiled libssh.
Need the right compile flags on OW for the calling convention (can't use the OW specific one) and the right declarations in the libssh headers for the calling convention. Forget the specifics but it is possible.

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #2 on: February 01, 2023, 03:08:01 am »
Third option, the OpenWatcom build use the GCC compiled libssh.
Need the right compile flags on OW for the calling convention (can't use the OW specific one) and the right declarations in the libssh headers for the calling convention. Forget the specifics but it is possible.

I hadn't considered that! Don't know why though - seems a reasonable enough thing to do and I'm not statically linking either library. libssh and openssl are just written in C so no particular reason why they have to be built with the same compiler. I'll have to look into that some time!

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #3 on: February 01, 2023, 04:24:40 am »
Hi davidrg, forgot to welcome you to the forum.
This is the latest code https://ftp2.zx.net.nz/pub/CKW/test_builds/ckw10b8-beta4/ckw-b4-src.zip?
Is there a git or such repository?
Anyways downloaded the above source and built ckoker32.exe, which seems to run fine though textmode. Wasn't there a graphical exe too? It's been a long time since I played with kermit.
It compiled fine (lots of warnings) on OS/2 after a minor patch to ckoker.mak,
Code: [Select]
L:\work\ckwin-10.0beta.08-4\kermit\k95>diff -u ckoker.mak.orig ckoker.mak
--- ckoker.mak.orig     2023-01-31 18:55:46.000000000 -0800
+++ ckoker.mak  2023-01-31 18:38:06.000000000 -0800
@@ -686,9 +686,9 @@
 !ifdef PLATFORM
 !if "$(PLATFORM)" == "OS2"
 LIBS = os2386.lib rexx.lib \
-!if "$(CMP)" != "OWCL"
-       bigmath.lib
-!endif
+#!if "$(CMP)" != "OWCL"
+#       bigmath.lib
+#!endif
 # OpenWatcom doesn't have bigmath.lib
 # SRP support: libsrp.lib
 !else if "$(PLATFORM)" == "NT"

I see this,
Code: [Select]
===============================================================================
C-Kermit Build Configuration
===============================================================================
Platform:                 OS2
Build:                    K95
Architecture:             x86
Compiler:                 OpenWatcom WCL386
Compiler Version:         OpenWatcom
Compiler Target Platform: OS/2
Enabled Features:         Network-Connections DECnet
Disabled Features:        Kerberos SRP ZLIB SSL SSH ConPTY TelnetEncryptionOption CryptDLL XYZMODEM SuperLAT NetBIOS Mouse-Wheel
===============================================================================

Couple of observations, kerberos, zlib, crypto10.dll, (from OpenSSL) ) are available as GCC builds.
Quickly looking, it looks like you're using the old 16bit TCPIP stack, it would need updating to the 32 bit stack. Actually you should be targeting OS/2 4.5, basically V4 with all the free updates, especially FP#15 and the latest MPTS packages and whatever the last kernel was released by IBM.
There doesn't seem to be any DLLs associated with openssh. For openssl, probably the easiest would be to create OW friendly import libs and add some directive for the right calling convention.
One project I ended up supporting, the screensaver, links to some GCC compiled DLLs, it uses these flags. I'm far from an OW expert.
Code: [Select]
dllflags = -bd
cflags = $(debugflags) -zq -bm -bt=OS2 -6s -fpi87 -fp6 -sg -otexanr -wx

Perhaps Martin should split this topic off to its own thread as well.

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #4 on: February 01, 2023, 09:07:07 am »
I'm impressed you got it building so quickly! Yes, that's the code for the latest beta. Github repository is here: https://github.com/davidrg/ckwin/.

Kermit 95 only had a GUI version on Windows and it was a fairly late addition at that - looking back through the old changelogs it appears to have first appeared in April 2002 with the final release of Kermit 95 less than a year later in January 2003. There is a graphical connection manager though, the dialer, which was available on OS/2 as well as Windows. That does build with OpenWatcom but I've not attempted to build it for OS/2 yet (The dialer was open-sourced after I was last working on getting the OS/2 code going again).

As far as I can tell the TCP/IP side of C-Kermit for OS/2 lives in a DLL with DLLs originally supplied for IBM TCP/IP 2.0 and 1.2, PC/TCP 1.3 and Novell LAN Workplace 3.0. This appears to be the same arrangement C-Kermit used with the last free release for OS/2, 5A(191) of mid-1995, though of course I don't have licenses for any OS/2 SDKs besides what comes with OpenWatcom which doesn't appear to be enough.

I guess next I need to look for a GCC that can cross-compile for OS/2 from Windows or Linux! And yes, I guess all this Kermit stuff probably belongs in its own thread somewhere.

Ian B Manners

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 472
  • Karma: +10/-0
  • I am the computer, it is me.
    • View Profile
    • ComKal Networks Australia
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #5 on: February 01, 2023, 10:09:57 am »
Hi Dave,

Quote
Perhaps Martin should split this topic off to its own thread as well.

Done :)

Welcome to the forums David.
I used Kermit quite a lot back in my DEC days back in the 80's and 90's. Certainly owe it a lot for making my life easy back then.
Cheers
Ian B Manners

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #6 on: February 01, 2023, 10:05:37 pm »
Hi David,
There isn't really a GCC cross-compiler, at least that runs on NT, it is possible to use the RSX library to run the EMX GCC 2.8.1 on Win9x but it probably wouldn't be worthwhile as it'll have the same problems.
Briefly tried compiling the dialer, my nmake wasn't happy with the makeflle and for some reason nmake32 is broken here.
There is a copy of the toolkit (sdk) here, https://github.com/bitwiseworks/os2tk45, I'd assume the headers and libs would work for cross-compiling with OW, they work fine natively. It supports both the old and new TCPIP stack.
Stack updates are described here, http://web.archive.org/web/20060926010237/http://www.warpupdates.mynetcologne.de/english/net_mpts.html, the site has lots of other info on updating, many links are broken but it gives file names to Google and IBM still has most of its updates on one of its ftp sites.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #7 on: February 01, 2023, 10:08:02 pm »
Here's what I compiled if anyone is interested. Lightly tested and I just copied the exe's, ini's and such from the build.

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #8 on: February 02, 2023, 02:05:53 am »
Hi David,
There isn't really a GCC cross-compiler, at least that runs on NT, it is possible to use the RSX library to run the EMX GCC 2.8.1 on Win9x but it probably wouldn't be worthwhile as it'll have the same problems.
Briefly tried compiling the dialer, my nmake wasn't happy with the makeflle and for some reason nmake32 is broken here.
There is a copy of the toolkit (sdk) here, https://github.com/bitwiseworks/os2tk45, I'd assume the headers and libs would work for cross-compiling with OW, they work fine natively. It supports both the old and new TCPIP stack.
Stack updates are described here, http://web.archive.org/web/20060926010237/http://www.warpupdates.mynetcologne.de/english/net_mpts.html, the site has lots of other info on updating, many links are broken but it gives file names to Google and IBM still has most of its updates on one of its ftp sites.

If I get time tonight I might have a look at the dialer and see if I can get it building - it already builds with OpenWatcom 1.9 for all x86 Windows newer than NT 3.10, and it previously built for OS/2 with the IBM compiler, so I can't imagine there is too much standing in the way of OpenWatcom+OS/2.

This ticket is currently tracking the state of the C-Kermit for OS/2 (Kermit/2): https://github.com/davidrg/ckwin/issues/8 - I think this pretty much covers all the regressions from the final commercial release of Kermit 95 (v2.1.2) for OS/2 that I've noticed so far in my fairly limited testing. As far as I can tell (I'll have to dig out my K95 CD sometime to check) the OS/2 version didn't have OpenSSL (#156) or SSH (#157) support back then - probably due to compiler issues. Kerberos I'm just ignoring for now - most likely C-Kermit itself (on all platforms) needs to gain Heimdal Kerberos support but I doubt there is enough demand for Kerberos-secured telnet, ftp and http at this point to make the work worthwhile.

There being no GCC that can cross-compile for OS/2 is a bit of a pain as it makes automated builds from Github that include OpenSSL and SSH for OS/2 impossible. But that's a problem for another day - fixing the remaining build issues and getting an optimised build with TCP/IP and NetBIOS that doesn't crash on startup ought to be dealt with first.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #9 on: February 02, 2023, 04:29:52 am »
Revisiting the dialer and using wmake, the problem is that it thinks I'm on Windows.
Code: [Select]
===============================================================================
C-Kermit Dialer Build Configuration
===============================================================================
Architecture:             x86
Compiler:                 OpenWatcom C/C++ CL clone
Compiler Version:         Visual C++ 7.0 compatible
Compiler Target Platform: Windows
===============================================================================

With a bunch of errors about extensions, from zinc I guess, cpp.obn and such.
I found the PM version of C-Kermit, it is weird and basically draws what looks like a VIO window.
Also there's C-Kermit_5A-191 which looks fairly complete for its time, no ssh of course.
https://hobbes.nmsu.edu/?search=kermit&stype=any&sort=type_name&dir=%2F

Edit: better screen capture
« Last Edit: February 02, 2023, 04:33:36 am by Dave Yeo »

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #10 on: February 02, 2023, 07:03:28 am »
Yeah, Kermit 5A(191) for OS/2 is what both this and the windows version were based on originally. Its the last free version for OS/2 before it was turned into a commercial product and ported to Windows as Kermit 95. So the OS/2 and Windows versions are very closely related - a pretty big chunk of the code that was originally specific to OS/2 is also used on Windows too with #ifdef OS2ONLY or #ifdef NT differentiating between the platforms where there are API differences (#ifdef OS2 means OS/2 or Windows)

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #11 on: February 02, 2023, 11:16:47 am »
Spent a bunch of time tonight getting the Dialer to build for OS/2 with OpenWatcom 1.9 (cross-compiled from Windows). It needed a bunch of makefile changes as the makefile only knew how to build the OS/2 target with the IBM compiler. And of course there were various build errors in the OS/2 bits of the dialer which had never seen the Watcom compiler before. And there are new bat/cmd files for setting an OS/2 build of the dialer going either on windows or OS/2 (the OS/2 hosted .cmd files are at the moment untested though - my NetWare server is currently down making getting stuff on/off OS/2 a bit challenging).

So it now builds fine, warnings aside, but it doesn't run at all. I just get SYS3175 "A program generated an access violation at 00000000". I've spent a few hours looking at it and I've no idea why. I'm not very familiar with OpenWatcoms wpp386 and wlink (for windows I just use its Visual C++-compatible frontend and linker) so it may well be the problem lies there. Or some issue with runtime libraries or the OS/2 version of OpenZinc.

At any rate, the buildable (but not yet runnable) code is on this branch: https://github.com/davidrg/ckwin/tree/dialer-for-os2 (edit: changes are now on the master branch)
« Last Edit: February 03, 2023, 11:49:24 pm by davidrg »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #12 on: February 02, 2023, 11:50:35 pm »
Seems OpenZinc is not simple to install. Directions say to run A:\install.bat but I've downloaded 3 different packages without an install.bat. Might be easier to build it. Might be the problem with the dialler, slightly incompatible build options, though I'd expect a sys2070 in that case

davidrg

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #13 on: February 03, 2023, 04:25:29 am »
I've never attempted to install OpenZinc - for windows at least it was sufficient to just grab the full package (http://openzinc.com/Downloads/OZ1.zip - includes source and binaries for all platforms and compilers) and extract it into a folder named 'zinc' alongside the 'kermit' folder in the source tree (this is how the Kermit 95 2.1.3 build tree was organised), such that you have:

Code: [Select]
\kermit\k95\ckoker.mak
\kermit\dialer\k95dial.mak
\zinc\copymak.bat
\setenv.cmd

For building with OpenWatcom 1.9 for Windows that's all I've had to do. For Visual C++ I had to customise all the makefiles for each version of Visual C++ to link against the multithreaded runtime and rebuild which was annoying but seemingly nothing new - looking at the Zinc code in the Kermit 95 build tree the same was done for the commercial releases.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4984
  • Karma: +110/-1
    • View Profile
Re: Kermit 95 / C-Kermit for Windows and OS/2
« Reply #14 on: February 03, 2023, 04:46:46 am »
Ok, did you recompile Zinc or just use the included libs by using set LIB?
And is DOS required, DOS is broken here as the computer is too new and lacking stuff in the video BIOS. Looks like changing copymak.bat to copymak.cmd should work. Otherwise have to switch to an UEFI install of OS/2 where it has its own video BIOS.