public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Using helper apps to dossify ported Unix programs
@ 1997-10-24  9:00 Victor Schneider
  0 siblings, 0 replies; only message in thread
From: Victor Schneider @ 1997-10-24  9:00 UTC (permalink / raw)
  To: gnu-win32; +Cc: lynx-dev

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".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-10-24  9:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-24  9:00 Using helper apps to dossify ported Unix programs Victor Schneider

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).