Subject: Using helper apps to dossify ported Unix programs
From: [email-masked] (Victor Schneider)

24 Oct 1997 09:30:30 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]
Cc: [email-masked]

One logical thing to do with Unix programs like lynx.exe is to forget about all
the DOSPATH macro code in its source distribution, and compile it as a pure
Unix program working under W95/WNT.  The way to do this is to edit the lynx.cfg
file so that all the file viewers are called using a dossifying launch program
that converts '/' to '\\' on the command line.

Such a program is attached to this letter.  You can observe that this is one of
the few times that it makes much sense to use `WinMain', since the lpCmdLine
parameter allows you to handle variable-length command lines, and the launcher
itself is only about 12KB of executable when compiled from __CYGWIN32__.

Unfortunately, the launcher crashes the cygwin32 dll when used.

One alternative is to keep Cygwin lynx.exe, and compile the launcher under the
Borland compiler.  What you do is delete the c++ winmain from the c++ module
that the latest Borland builder foists on you, and replace it with the code
below.  That way, the executable is only about 107KB.  However, it _doesn't_
crash the b18 cygwin stack when called from cygwin lynx.exe.

Here is the launch program:

#include <windows.h>

#ifdef __CYGWIN32__
#undef  WINAPI
#define WINAPI	STDCALL
#endif

int
WINAPI WinMain (HINSTANCE hInst, HINSTANCE hprev,
			LPSTR lpCmd, int nCmd)
{
  char *last_slash;
  for ( ; ; )
   if ((last_slash = strstr(lpCmd, "/")) != (char *)NULL)
      last_slash[0] = '\\';
   else break;
  /* CreateProcess is more modern to use, but what a nuisance. */
  return WinExec(lpCmd, nCmd);
}

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".