delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/30/07:18:46

From: vischne AT ibm DOT net-nospam
Subject: Non-crashing launcher app for cygwin
30 Oct 1997 07:18:46 -0800 :
Message-ID: <199710301442.OAA173572.cygnus.gnu-win32@out2.ibm.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Here is a non-crashing version of the dos-path launcher app for use
with ported Unix applications that call external viewers:

===================================================================
#include <windows.h>

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

char *my_strstr(char *, char *);

int
WINAPI WinMain (HINSTANCE hInst, HINSTANCE hprev,
			LPSTR lpCmd, int nCmd)
{
  char *last_slash = lpCmd;
  for(;;)
   if ((last_slash = my_strstr(last_slash, "/")) != (char *)NULL)
    last_slash[0] = '\\';
   else break;
  return WinExec(lpCmd, nCmd);
}

char *my_strstr(char *object, char *subject)
{
/* Done in an attempt to free the application from cygwin.dll: */
  if ((object == (char *)NULL) || (subject == (char *)NULL))
   return (char *)NULL;
  while (*subject != *object)
   if (*object == '\0')
    return (char *)NULL;
   else object++;
  return (char *)object;
}


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019