lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV Using helper apps to dossify ported Unix programs


From: Victor Schneider
Subject: LYNX-DEV Using helper apps to dossify ported Unix programs
Date: Fri, 24 Oct 1997 15:58:40 GMT

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);
}

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]