Using KEDIT with Linux and other UNIX systems

This page describes how to run KEDIT for Windows 1.6 under the Linux variant of UNIX.

The basic vehicle is a windows emulater called Wine. KEDIT is likely to run on any UNIX variant that supports Wine.

Refer to Mansfield's site for support and licensing information.

If you are a current KEDIT user on UNIX, please report the version of the operating system and Wine, as well as experiences you think will benefit other users.

If you are an XEDIT user looking for a workstation alternative, I hope this information will be useful.

Introduction

Died-in-the-wool CMS users who are forced to use alien systems soon come to rely on KEDIT because of its command compatibility with XEDIT and the fact that users can move their XEDIT macros back and forth with no change, as long as a few rules are observed on CMS to cope with limitations in KEXX.

On Microsoft systems, running KEDIT obviously poses no difficulty as the product is built for Windows.

The situation on Linux and similar systems, e.g., FreeBSD, is however not entirely hopeless as current Wine (ultimo 2011) supports enough of the Windowns API to make KEDIT run, albeit with minor occasional annoyances. As an example, I can edit a program, run make from KEDIT, analyse the listing for error messages and position the edit window at the failing source line.

What works everywhere

  1. The installer. That is, there is no need to copy from an existing Windows installation (though that works too).

  2. The editor panel; that is, navigating, entering text, and so on. Though, depending on the window manager, you may have to disable some shortcuts to get a particular keystroke combination passed to KEDIT.

  3. KEXX.

  4. DOS[QUIET|WAIT] does "work" in the sense of issuing the commands in Wine's emulated DOS box, but this is likely not the behaviour wanted by a UNIX user. See more below.

Caveat emptor!

It would appear that Wine defines works along the lines that the program does not fail and produces desired results. If you start KEDIT in a console window, you will see messages detailing unimplemented features. No doubt these messages are intended to motivate the developers to fix their implementation.

It is probably advisable to restrict KEDIT use to a single session if you see messages to the effect that file locking is failing.

The help system

On early Wine with Fedora 13, any reference to the help system (command or menu) crashed the editor somewhere deep in an emulated library. Later versions note the fact that they do not handle the function.

On Ubuntu 11.04 and later, Help works to the extent of opening the reference manual, but it does not navigate to the requested topic. One may hope that this gets fixed in a later Wine release.

Annoyances

Tested UNIX versions

I tried to enter this information into the Wine database, but the version of Wine shipped with Fedora was deemed too old by the Wine people, so they did not wish the information in their database.

Please report your experience to jphartmann@gmail.com

Tested versions
UNIX Type Release Wine release Remarks
Linux Fedora 13 1.3.21 Help system not usable.
Linux Ubuntu 11.04 Help goes to front of manual, ignoring any subject specified.

Integrating with UNIX

Invoking KEDIT

KEDIT is invoked through the wine command, for example:

   wine ~/kedit95/keditw32.exe

This assumes that KEDIT is installed (copied more likely) to the kedit95 directory in your home directory.

As Wine uses the Windows file name notation you will need to map forward slashes to backslashes. This is an example shell script (call it x):

#!/bin/bash
fn=$(echo $*|tr '/' '\\')
wine ~/kedit95/keditw32.exe $fn

Issuing UNIX commands from KEDIT

The KEDIT DOS commands work by launching KedwDosA.exe under the covers.

The good news is that KEDIT (or Wine) issues kedwdosa.exe (in lowercase) and if you supply a shell script in the path, it will be invoked with the parameter list specified on the KEDIT command prefixed a word to distinguish the three command variations.

The bad news is that the Wine implementaton of the underlying interface is woefully inadequate. It would appear that the command is forked off, but not by the system() function as one might expect; the return code is always zero and the UNIX command usually completes much later than the XEDIT command, at least on a multiprocessor system.

This can be overcome by programming, but at the expense of the KEDIT process polling for an indication the the command has finished.

Sample KEDIT macro to issue UNIX command

There are may ways to skin a cat in this game; the following is just a sample.

Use the macro UNIXWAIT instead of issuing DOSWAIT. I tried to link DOSWAIT.KEX to UNIXWAIT.KEX, but it looks like the symbolic link is not understood by Wine.

UNIXWAIT.KEX

The UNIXWAIT macro is used instead of DOSWAIT to issue a command. The command can include shell features, such as redirection and pipelines. The macro is synchronous and the return code from the macro is the return code from the UNIX command or the negative if there is any trouble with the DOSQUIET command.

This sample requires write acces to the present working directory; if you change the position of the temporary file ($$XEDITDosRC$$), be sure to change kedwdos.exe too.

/* Issue UNIX command via dosquiet and poll for return code          */
/*                                John Hartmann 30 Aug 2011 13:11:32 */
Signal on novalue
 
/*********************************************************************/
/* Wine does not know how to harvest the exit status from a command, */
/* so it would appear that the morons (a technical term) just fork() */
/* it without waiting.                                               */
/*                                                                   */
/* Either  KEDIT  does  not  know how to access the return code, but */
/* more likely it is always 0; certanly that is what exitcode.1 is.  */
/*                                                                   */
/* DOSQUIET  invokes kedwdosa.exe, which resolved to KedwDosA.exe on */
/* windows.   On  linux  this  would get the command executed in the */
/* limited dos box, which is presumably not our desire.              */
/*                                                                   */
/* So  we  add  a  lowercase  shell script to intercept the command. */
/* This script creates the return code file, which we can sample the */
/* existence of here (but we must remove it here to ensure no race). */
/* Thus,  the  file  name  must be "known", as we don't want to send */
/* more data through the dos command.                                */
/*                                                                   */
/* The  command is run in a subprocess of the one that invoked XEDIT */
/* initially.   Unless  the  command  redirects  the standard output */
/* files,  their output appears at the controlling terminal, if any. */
/* (Interspersed with messages from Wine.)                           */
/*********************************************************************/
 
rcfn = '$$XEDITDosRC$$'
'nomsg erase' rcfn
'command dosquiet' arg(1)
If rc\=0
   Then exit -rc
 
/* We  should  dearly not poll here, but there seems to be no way to */
/* wait in KEDIT.                                                    */
 
do until lines(rcfn)>0
end
 
rv = linein(rcfn)
call lineout rcfn                     /* Close it so we can erase    */
'erase' rcfn
exit rv
   

kedtwdosa.exe

This is the executable shell script that replaces the interface module. As case differs, this script will coreside in a standard installation of KEDIT.

#!/bin/bash
 
# Ensure that the language is not UTF-8 as gcc tries to use UTF-8 and
# KEDIT does not understand that.  So force code page 819.
export LANG=C
 
# Drop first parameter, which is to control how the command terminates
shift
 
# Eval allows redirect & stuff; otherwise they would be passed as args
# to the command.
eval $*
r=$?
echo -n $r > '$$XEDITDosRC$$'
exit $r
    

2012-02-01, John P. Hartmann.