This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Using helper apps to dossify ported Unix programs
- To: gnu-win32 at cygnus dot com
- Subject: Using helper apps to dossify ported Unix programs
- From: Victor Schneider <vischne at ibm dot net>
- Date: Fri, 24 Oct 1997 15:58:40 GMT
- Cc: lynx-dev at sig dot net
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
"gnu-win32-request@cygnus.com" with one line of text: "help".