mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Mingw update
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6666 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
984e5973ff
commit
7066b8e47f
24 changed files with 155 additions and 577 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2000-06-11 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/base/preface.h.in: Define MINGW if MINW32.
|
||||
* Headers/gnustep/base/TcpPort.h: Change WIN32 to MINGW since
|
||||
CYGWIN has unix-like services.
|
||||
* Headers/gnustep/base/UdpPort.h: Likewise.
|
||||
* Source/GSTcpPort.m, Source/NSData.m, Source/NSDate.m,
|
||||
Source/NSFileManager.m, Source/NSHost.m, Source/NSLog.m,
|
||||
Source/NSPage.m, Source/NSProcessInfo.m, Source/NSString.m,
|
||||
Source/NSThread.m, Source/NSUser.m, Source/UdpPort.m,
|
||||
Source/UnixFileHandle.m, : Likewise.
|
||||
|
||||
* Source/Makefile.postamble: touch generated h files so they aren'y
|
||||
re-copied every compile.
|
||||
|
||||
* Source/NSBundle.m (_absolutePathOfExecutable:): New method.
|
||||
(mainBundle): Use it.
|
||||
* Source/NSTask.m (launch): Likewise.
|
||||
* Source/find_exec.m: Removed.
|
||||
|
||||
2000-06-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSeq.h: Reverted bogus change.
|
||||
|
|
|
@ -89,6 +89,7 @@ extern NSString* NSLoadedClasses;
|
|||
#ifndef NO_GNUSTEP
|
||||
@interface NSBundle (GNUstep)
|
||||
|
||||
+ (NSString *) _absolutePathOfExecutable: (NSString *)path;
|
||||
+ (NSString*) _gnustep_target_cpu;
|
||||
+ (NSString*) _gnustep_target_dir;
|
||||
+ (NSString*) _gnustep_target_os;
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
#include <base/preface.h>
|
||||
#include <base/Port.h>
|
||||
#include <base/RunLoop.h>
|
||||
#if !defined(__WIN32__) || defined(__CYGWIN__)
|
||||
#ifdef __MINGW__
|
||||
# include <winsock.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif /* !__WIN32__ */
|
||||
#endif
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
/* A concrete implementation of a Port object implemented on top of
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
#include <base/preface.h>
|
||||
#include <base/Port.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW__
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif /* !WIN32 */
|
||||
#endif
|
||||
|
||||
@interface UdpInPort : InPort
|
||||
{
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifndef __MINGW__
|
||||
#define __MINGW__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#include <windows.h>
|
||||
#define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1)
|
||||
|
|
|
@ -335,7 +335,6 @@ NSValue.m \
|
|||
NSZone.m \
|
||||
externs.m \
|
||||
objc-load.m \
|
||||
find_exec.m \
|
||||
NSURL.m \
|
||||
NSURLHandle.m
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#if !defined(__WIN32__) || defined(__CYGWIN__)
|
||||
#ifndef __MINGW__
|
||||
#include <unistd.h> /* for gethostname() */
|
||||
#include <netinet/in.h> /* for inet_ntoa() */
|
||||
#include <fcntl.h>
|
||||
|
@ -63,14 +63,14 @@ extern int errno;
|
|||
#define NBLK_OPT FNDELAY
|
||||
#endif
|
||||
|
||||
#endif /* !__WIN32__ */
|
||||
#endif /* !__MINGW__ */
|
||||
#include <string.h> /* for memset() and strchr() */
|
||||
#if !defined(__WIN32__) || defined(__CYGWIN__)
|
||||
#ifndef __MINGW__
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <errno.h>
|
||||
#endif /* !__WIN32__ */
|
||||
#endif /* !__MINGW__ */
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE -1
|
||||
|
|
|
@ -153,14 +153,17 @@ $(GNUSTEP_OBJ_DIR)/preface${OEXT}: Foundation/preface.h
|
|||
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.h: ../config.status
|
||||
$(MKDIRS) $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-mv Foundation/config.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.h
|
||||
|
||||
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/GSConfig.h: ../config.status
|
||||
$(MKDIRS) $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-mv Foundation/GSConfig.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/GSConfig.h
|
||||
|
||||
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h: mframe/config.status
|
||||
$(MKDIRS) $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-mv mframe/mframe.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
|
||||
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h
|
||||
|
||||
Foundation/o_%_bas.h: Foundation/o_x_bas.h.in
|
||||
sed -e "s/@XX@/$*/g" $< > $@
|
||||
|
|
|
@ -96,9 +96,6 @@ static NSString* library_combo =
|
|||
nil;
|
||||
#endif
|
||||
|
||||
/* Declaration from find_exec.c */
|
||||
extern char *objc_find_executable(const char *name);
|
||||
|
||||
/* This function is provided for objc-load.c, although I'm not sure it
|
||||
really needs it (So far only needed if using GNU dld library) */
|
||||
const char *
|
||||
|
@ -237,7 +234,6 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
{
|
||||
NSMutableString *system;
|
||||
NSString *str;
|
||||
char *output;
|
||||
|
||||
if ((str = [env objectForKey: @"GNUSTEP_TARGET_DIR"]) != nil)
|
||||
gnustep_target_dir = RETAIN(str);
|
||||
|
@ -270,10 +266,9 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
{
|
||||
_executable_path =
|
||||
[[[NSProcessInfo processInfo] arguments] objectAtIndex: 0];
|
||||
output = objc_find_executable([_executable_path cString]);
|
||||
NSAssert(output, NSInternalInconsistencyException);
|
||||
_executable_path = [NSString stringWithCString: output];
|
||||
OBJC_FREE(output);
|
||||
_executable_path =
|
||||
[NSBundle _absolutePathOfExecutable: _executable_path];
|
||||
NSAssert(_executable_path, NSInternalInconsistencyException);
|
||||
}
|
||||
|
||||
RETAIN(_executable_path);
|
||||
|
@ -308,6 +303,53 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (NSString *) _absolutePathOfExecutable: (NSString *)path
|
||||
{
|
||||
NSFileManager *mgr;
|
||||
NSDictionary *env;
|
||||
NSString *pathlist, *prefix;
|
||||
id patharr;
|
||||
|
||||
path = [path stringByStandardizingPath];
|
||||
if ([path isAbsolutePath])
|
||||
return path;
|
||||
|
||||
mgr = [NSFileManager defaultManager];
|
||||
env = [[NSProcessInfo processInfo] environment];
|
||||
pathlist = [env objectForKey:@"PATH"];
|
||||
#if defined(__MINGW__)
|
||||
patharr = [pathlist componentsSeparatedByString:@";"];
|
||||
#else
|
||||
patharr = [pathlist componentsSeparatedByString:@":"];
|
||||
#endif
|
||||
patharr = [patharr objectEnumerator];
|
||||
while ((prefix = [patharr nextObject]))
|
||||
{
|
||||
if ([prefix isEqual:@"."])
|
||||
prefix = [mgr currentDirectoryPath];
|
||||
prefix = [prefix stringByAppendingPathComponent: path];
|
||||
if ([mgr isExecutableFileAtPath: prefix])
|
||||
return [prefix stringByStandardizingPath];
|
||||
#if defined(__WIN32__)
|
||||
/* Also add common executable extensions on windows */
|
||||
if ([path pathExtension] == nil)
|
||||
{
|
||||
NSString *wpath;
|
||||
wpath = [prefix stringByAppendingPathExtension: @"exe"];
|
||||
if ([mgr isExecutableFileAtPath: wpath])
|
||||
return [wpath stringByStandardizingPath];
|
||||
wpath = [prefix stringByAppendingPathExtension: @"com"];
|
||||
if ([mgr isExecutableFileAtPath: wpath])
|
||||
return [wpath stringByStandardizingPath];
|
||||
wpath = [prefix stringByAppendingPathExtension: @"cmd"];
|
||||
if ([mgr isExecutableFileAtPath: wpath])
|
||||
return [wpath stringByStandardizingPath];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSBundle *)mainBundle
|
||||
{
|
||||
[load_lock lock];
|
||||
|
|
|
@ -120,17 +120,17 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len, NSZone* zone)
|
|||
void *tmp = 0;
|
||||
int c;
|
||||
|
||||
#if defined(__MINGW__)
|
||||
return NO;
|
||||
#endif
|
||||
|
||||
if ([path getFileSystemRepresentation: thePath
|
||||
maxLength: sizeof(thePath)-1] == NO)
|
||||
{
|
||||
NSDebugLog(@"Open (%s) attempt failed - bad path", thePath);
|
||||
return NO;
|
||||
}
|
||||
#if defined(__WIN32__)
|
||||
theFile = fopen(thePath, "rb");
|
||||
#else
|
||||
theFile = fopen(thePath, "r");
|
||||
#endif
|
||||
|
||||
if (theFile == NULL) /* We failed to open the file. */
|
||||
{
|
||||
|
@ -541,6 +541,10 @@ failure:
|
|||
FILE *theFile;
|
||||
int c;
|
||||
|
||||
#if defined(__MINGW__)
|
||||
return NO;
|
||||
#endif
|
||||
|
||||
if ([path getFileSystemRepresentation: theRealPath
|
||||
maxLength: sizeof(theRealPath)-1] == NO)
|
||||
{
|
||||
|
@ -568,11 +572,7 @@ failure:
|
|||
else
|
||||
{
|
||||
strcpy(thePath, theRealPath);
|
||||
#if defined(__WIN32__)
|
||||
theFile = fopen(thePath, "wb");
|
||||
#else
|
||||
theFile = fopen(thePath, "w");
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if (useAuxiliaryFile)
|
||||
|
@ -594,11 +594,7 @@ failure:
|
|||
}
|
||||
|
||||
/* Open the file (whether temp or real) for writing. */
|
||||
#if defined(__WIN32__)
|
||||
theFile = fopen(thePath, "wb");
|
||||
#else
|
||||
theFile = fopen(thePath, "w");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (theFile == NULL) /* Something went wrong; we weren't
|
||||
|
|
|
@ -108,7 +108,7 @@ otherTime(NSDate* other)
|
|||
NSTimeInterval
|
||||
GSTimeNow()
|
||||
{
|
||||
#if !defined(__WIN32__)
|
||||
#if !defined(__MINGW__)
|
||||
volatile NSTimeInterval interval;
|
||||
struct timeval tp;
|
||||
|
||||
|
@ -137,7 +137,7 @@ GSTimeNow()
|
|||
t = otherTime(d);
|
||||
RELEASE(d);
|
||||
return t + sys_time.wMilliseconds / 1000.0;
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* __MINGW__ */
|
||||
}
|
||||
|
||||
/* The implementation of NSDate. */
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
#define DIR_enum_state DIR
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
#define WIN32ERR ((DWORD)0xFFFFFFFF)
|
||||
#endif
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
# include <limits.h> /* for PATH_MAX */
|
||||
# include <utime.h>
|
||||
#else
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW__
|
||||
# include <limits.h>
|
||||
# include <sys/utime.h>
|
||||
#else
|
||||
|
@ -206,8 +206,8 @@ static NSFileManager* defaultManager = nil;
|
|||
{
|
||||
const char* cpath = [self fileSystemRepresentationWithPath: path];
|
||||
|
||||
#if defined(__WIN32__)
|
||||
return SetCurrentDirectory(cpath);
|
||||
#if defined(__MINGW__)
|
||||
return SetCurrentDirectory(cpath) == TRUE ? YES : NO;
|
||||
#else
|
||||
return (chdir(cpath) == 0);
|
||||
#endif
|
||||
|
@ -216,7 +216,7 @@ static NSFileManager* defaultManager = nil;
|
|||
- (BOOL) createDirectoryAtPath: (NSString*)path
|
||||
attributes: (NSDictionary*)attributes
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
BOOL ok;
|
||||
|
||||
ok = CreateDirectory([self fileSystemRepresentationWithPath: path], NULL);
|
||||
|
@ -321,14 +321,14 @@ static NSFileManager* defaultManager = nil;
|
|||
while (cur < len);
|
||||
|
||||
return YES;
|
||||
#endif /* WIN32 */
|
||||
#endif /* !MINGW */
|
||||
}
|
||||
|
||||
- (NSString*) currentDirectoryPath
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
if (GetCurrentDirectory(PATH_MAX, path) > PATH_MAX)
|
||||
return nil;
|
||||
#else
|
||||
|
@ -339,7 +339,7 @@ static NSFileManager* defaultManager = nil;
|
|||
if (getwd(path) == NULL)
|
||||
return nil;
|
||||
#endif /* HAVE_GETCWD */
|
||||
#endif /* WIN32 */
|
||||
#endif /* !MINGW */
|
||||
|
||||
return [self stringWithFileSystemRepresentation: path length: strlen(path)];
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ static NSFileManager* defaultManager = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
DWORD res;
|
||||
|
||||
res = GetFileAttributes(cpath);
|
||||
|
@ -743,7 +743,7 @@ static NSFileManager* defaultManager = nil;
|
|||
}
|
||||
|
||||
return YES;
|
||||
#endif /* WIN32 */
|
||||
#endif /* MINGW */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,7 @@ static NSFileManager* defaultManager = nil;
|
|||
return NO;
|
||||
else
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
DWORD res= GetFileAttributes(cpath);
|
||||
|
||||
if (res == WIN32ERR)
|
||||
|
@ -775,7 +775,7 @@ static NSFileManager* defaultManager = nil;
|
|||
return NO;
|
||||
else
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
DWORD res= GetFileAttributes(cpath);
|
||||
|
||||
if (res == WIN32ERR)
|
||||
|
@ -795,7 +795,7 @@ static NSFileManager* defaultManager = nil;
|
|||
return NO;
|
||||
else
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
DWORD res= GetFileAttributes(cpath);
|
||||
int len = strlen(cpath);
|
||||
|
||||
|
@ -839,7 +839,7 @@ static NSFileManager* defaultManager = nil;
|
|||
|
||||
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
long long totalsize, freesize;
|
||||
id values[5];
|
||||
id keys[5] = {
|
||||
|
@ -912,7 +912,7 @@ static NSFileManager* defaultManager = nil;
|
|||
#else
|
||||
return nil;
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
#endif /* MINGW */
|
||||
}
|
||||
|
||||
- (BOOL) changeFileAttributes: (NSDictionary*)attributes atPath: (NSString*)path
|
||||
|
@ -923,7 +923,7 @@ static NSFileManager* defaultManager = nil;
|
|||
NSDate *date;
|
||||
BOOL allOk = YES;
|
||||
|
||||
#ifndef __WIN32__
|
||||
#ifndef __MINGW__
|
||||
num = [attributes objectForKey: NSFileOwnerAccountNumber];
|
||||
if (num)
|
||||
{
|
||||
|
@ -990,7 +990,7 @@ static NSFileManager* defaultManager = nil;
|
|||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* __MINGW__ */
|
||||
|
||||
num = [attributes objectForKey: NSFilePosixPermissions];
|
||||
if (num)
|
||||
|
@ -1123,7 +1123,7 @@ static NSFileManager* defaultManager = nil;
|
|||
const char* lpath = [self fileSystemRepresentationWithPath: path];
|
||||
const char* npath = [self fileSystemRepresentationWithPath: otherPath];
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW__
|
||||
return NO;
|
||||
#else
|
||||
return (symlink(lpath, npath) == 0);
|
||||
|
@ -1146,7 +1146,7 @@ static NSFileManager* defaultManager = nil;
|
|||
|
||||
- (const char*) fileSystemRepresentationWithPath: (NSString*)path
|
||||
{
|
||||
#if 0 && defined(__WIN32__)
|
||||
#if 0 && defined(__MINGW__)
|
||||
unsigned len = [path length];
|
||||
NSMutableData *d = [NSMutableData dataWithLength: len + 5];
|
||||
char *fspath = (char*)[d mutableBytes];
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
#include <netdb.h>
|
||||
/* #include <libc.h>*/
|
||||
|
||||
#if defined(__WIN32__) && !defined(__CYGWIN__)
|
||||
#include <Windows32/Sockets.h>
|
||||
#if defined(__MINGW__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif /* __WIN32__*/
|
||||
#endif /* !__MINGW__*/
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE -1
|
||||
|
|
|
@ -97,7 +97,7 @@ NSLogv (NSString* format, va_list args)
|
|||
if (_NSLog_printf_handler == NULL)
|
||||
_NSLog_printf_handler = *_NSLog_standard_printf_handler;
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
pid = (int)GetCurrentProcessId(),
|
||||
#else
|
||||
pid = (int)getpid();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <base/preface.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <string.h>
|
||||
#ifndef __WIN32__
|
||||
#ifndef __MINGW__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
@ -38,7 +38,7 @@
|
|||
#include <linux/sys.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW__
|
||||
#include <malloc.h>
|
||||
static size_t
|
||||
getpagesize(void)
|
||||
|
|
|
@ -184,7 +184,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
i = 0;
|
||||
while (env[i])
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
char buf[1024];
|
||||
char *cp;
|
||||
DWORD len;
|
||||
|
@ -486,7 +486,7 @@ extern char** _environ;
|
|||
#undef main
|
||||
int main(int argc, char *argv[], char *env[])
|
||||
{
|
||||
#if defined(__WIN32__) && !defined(__CYGWIN__)
|
||||
#if defined(__MINGW__)
|
||||
WSADATA lpWSAData;
|
||||
|
||||
// Initialize Windows Sockets
|
||||
|
@ -495,7 +495,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
printf("Could not startup Windows Sockets\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* __MINGW__ */
|
||||
|
||||
#ifdef __MS_WIN32__
|
||||
_MB_init_runtime();
|
||||
|
@ -566,7 +566,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
{
|
||||
int pid;
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
pid = (int)GetCurrentProcessId();
|
||||
#else
|
||||
pid = (int)getpid();
|
||||
|
|
|
@ -117,7 +117,7 @@ static Class NSString_class; /* For speed */
|
|||
#define GSPLUNI 1
|
||||
#include "propList.h"
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
static unichar pathSepChar = (unichar)'\\';
|
||||
static NSString *pathSepString = @"\\";
|
||||
static NSString *rootPath = @"C:\\";
|
||||
|
@ -138,7 +138,7 @@ pathSeps()
|
|||
{
|
||||
if (myPathSeps == nil)
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
myPathSeps = [NSCharacterSet characterSetWithCharactersInString: @"/\\"];
|
||||
#else
|
||||
myPathSeps = [NSCharacterSet characterSetWithCharactersInString: @"/"];
|
||||
|
@ -2121,7 +2121,7 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (NSString*) stringByResolvingSymlinksInPath
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
return self;
|
||||
#else
|
||||
const int MAX_PATH = 1024;
|
||||
|
@ -2268,7 +2268,7 @@ handle_printf_atsign (FILE *stream,
|
|||
strcpy(new_buf, &new_buf[8]);
|
||||
}
|
||||
return [NSString stringWithCString: new_buf];
|
||||
#endif /* (__WIN32__) */
|
||||
#endif /* (__MINGW__) */
|
||||
}
|
||||
|
||||
- (NSString*) stringByStandardizingPath
|
||||
|
@ -2317,10 +2317,10 @@ handle_printf_atsign (FILE *stream,
|
|||
return s;
|
||||
|
||||
/*
|
||||
* For absolute paths, we must resolve symbolic links or (on win32)
|
||||
* For absolute paths, we must resolve symbolic links or (on MINGW)
|
||||
* remove '/../' sequences and their matching parent directories.
|
||||
*/
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
/* Condense `/../' */
|
||||
r = NSMakeRange(0, [s length]);
|
||||
while ((r = [s rangeOfCharacterFromSet: pathSeps()
|
||||
|
@ -2400,7 +2400,7 @@ handle_printf_atsign (FILE *stream,
|
|||
if ([self length] == 0)
|
||||
return NO;
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
if ([self indexOfString: @":"] != NSNotFound)
|
||||
return YES;
|
||||
#else
|
||||
|
|
|
@ -361,9 +361,6 @@ GSCheckTasks()
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Declaration from find_exec.c */
|
||||
extern char *objc_find_executable(const char *name);
|
||||
|
||||
- (void) launch
|
||||
{
|
||||
NSMutableArray *toClose;
|
||||
|
@ -427,29 +424,21 @@ extern char *objc_find_executable(const char *name);
|
|||
lpath = [base_path stringByAppendingPathComponent: prog];
|
||||
if ([mgr isExecutableFileAtPath: lpath] == NO)
|
||||
{
|
||||
const char *cpath = 0;
|
||||
|
||||
/*
|
||||
* Last resort - if the launch path was simply a program name
|
||||
* get objc_find_executable() to try using the PATH environment
|
||||
* get NSBundle to try using the PATH environment
|
||||
* variable to find the executable.
|
||||
*/
|
||||
if ([base_path isEqualToString: @""] == YES)
|
||||
{
|
||||
|
||||
cpath = objc_find_executable([prog cString]);
|
||||
lpath = [NSBundle _absolutePathOfExecutable: prog];
|
||||
}
|
||||
if (cpath == 0)
|
||||
if (lpath == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"NSTask - launch path (%@) is not valid",
|
||||
format: @"NSTask - launch path (%@) not valid",
|
||||
_launchPath];
|
||||
}
|
||||
else
|
||||
{
|
||||
lpath = [NSString stringWithCString: cpath];
|
||||
OBJC_FREE((void*)cpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +541,7 @@ extern char *objc_find_executable(const char *name);
|
|||
setpgrp(getpid(), getpid());
|
||||
#endif
|
||||
#else
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
pid = (int)GetCurrentProcessId(),
|
||||
#else
|
||||
pid = (int)getpid();
|
||||
|
|
|
@ -254,7 +254,7 @@ gnustep_base_thread_callback()
|
|||
#ifdef HAVE_USLEEP
|
||||
usleep (30*60*1000000);
|
||||
#else
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
Sleep (30*60*1000);
|
||||
#else
|
||||
sleep (30*60);
|
||||
|
@ -269,7 +269,7 @@ gnustep_base_thread_callback()
|
|||
#ifdef HAVE_USLEEP
|
||||
usleep ((int)(delay*1000000));
|
||||
#else
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
Sleep (delay*1000);
|
||||
#else
|
||||
sleep ((int)delay);
|
||||
|
|
|
@ -115,7 +115,7 @@ NSHomeDirectory(void)
|
|||
NSString *
|
||||
NSHomeDirectoryForUser(NSString *login_name)
|
||||
{
|
||||
#if !defined(__WIN32__)
|
||||
#if !defined(__MINGW__)
|
||||
struct passwd *pw;
|
||||
|
||||
[gnustep_global_lock lock];
|
||||
|
@ -140,12 +140,14 @@ NSHomeDirectoryForUser(NSString *login_name)
|
|||
s = [NSString stringWithCString: nb];
|
||||
NSZoneFree(NSDefaultMallocZone(), nb);
|
||||
}
|
||||
else
|
||||
else if (n > 0)
|
||||
{
|
||||
/* null terminate it and return the string */
|
||||
buf[n] = '\0';
|
||||
s = [NSString stringWithCString: buf];
|
||||
}
|
||||
else
|
||||
s = NSOpenStepRootDirectory();
|
||||
[gnustep_global_lock unlock];
|
||||
return s;
|
||||
#endif
|
||||
|
@ -289,7 +291,7 @@ NSOpenStepRootDirectory(void)
|
|||
objectForKey: @"GNUSTEP_ROOT"];
|
||||
|
||||
if (root == nil)
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
root = @"C:\\";
|
||||
#else
|
||||
root = @"/";
|
||||
|
|
|
@ -37,14 +37,14 @@
|
|||
#include <sys/select.h>
|
||||
#endif /* _AIX */
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW__
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#endif /* !__WIN32__ */
|
||||
#endif /* !__MINGW__ */
|
||||
|
||||
/* For IRIX machines, which don't define this */
|
||||
#ifndef IPPORT_USERRESERVED
|
||||
|
@ -262,11 +262,11 @@ static NSMapTable *port_number_2_in_port = NULL;
|
|||
{
|
||||
if (_is_valid)
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
#if defined(__MINGW__)
|
||||
closesocket (_port_socket);
|
||||
#else
|
||||
close (_port_socket);
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* __MINGW__ */
|
||||
[super invalidate];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include <Foundation/NSHost.h>
|
||||
#include <Foundation/NSByteOrder.h>
|
||||
|
||||
#if defined(__WIN32__) && !defined(__CYGWIN__)
|
||||
#include <Windows32/Sockets.h>
|
||||
#if defined(__MINGW__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <signal.h>
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* __MINGW__ */
|
||||
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -1,241 +0,0 @@
|
|||
/*
|
||||
find_exec.c - routine to find the executable path
|
||||
|
||||
From the dld distribution -- copyrighted below.
|
||||
Modified by Adam Fedor - traverse links
|
||||
|
||||
Given a filename, objc_find_executable searches the directories listed in
|
||||
environment variable PATH for a file with that filename.
|
||||
A new copy of the complete path name of that file is returned. This new
|
||||
string may be disposed by free() later on.
|
||||
*/
|
||||
|
||||
/* This file is part of DLD, a dynamic link/unlink editor for C.
|
||||
|
||||
Copyright (C) 1990 by W. Wilson Ho.
|
||||
|
||||
The author can be reached electronically by how@cs.ucdavis.edu or
|
||||
through physical mail at:
|
||||
|
||||
W. Wilson Ho
|
||||
Division of Computer Science
|
||||
University of California at Davis
|
||||
Davis, CA 95616
|
||||
*/
|
||||
|
||||
/* This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 1, or (at your option) any
|
||||
later version.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include <limits.h>
|
||||
#define S_IFLNK 0120000
|
||||
int readlink(char *path, char *buf, int bufsiz) { return (-1); }
|
||||
int lstat(char *path, struct stat *buf) { return (-1); }
|
||||
#define MAXPATHLEN 255
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEFAULT_PATH ".:~/bin::/usr/local/bin:/usr/new:/usr/ucb:/usr/bin:/bin:/usr/hosts"
|
||||
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
#define PATH_SEPARATOR ';'
|
||||
#define PATH_COMPONENT "\\"
|
||||
#else
|
||||
#define PATH_SEPARATOR ':'
|
||||
#define PATH_COMPONENT "/"
|
||||
#endif
|
||||
|
||||
/* ABSOLUTE_FILENAME_P (fname): True if fname is an absolute filename */
|
||||
#if defined(atarist) || defined(__WIN32__) || defined(_WIN32)
|
||||
#define ABSOLUTE_FILENAME_P(fname) ((fname[0] == '/') || \
|
||||
(fname[0] && (fname[1] == ':')))
|
||||
#else
|
||||
#define ABSOLUTE_FILENAME_P(fname) (fname[0] == '/')
|
||||
#endif /* atarist */
|
||||
|
||||
static char *
|
||||
copy_of (s)
|
||||
register char *s;
|
||||
{
|
||||
register char *p = (char *) malloc (strlen(s)+1);
|
||||
|
||||
if (!p) return 0;
|
||||
|
||||
*p = 0;
|
||||
strcpy (p, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
static int
|
||||
find_full_path(char *path)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if ( stat(path, &statbuf) != 0)
|
||||
return -1;
|
||||
|
||||
if ( (lstat(path, &statbuf) == 0)
|
||||
&& (statbuf.st_mode & S_IFLNK) == S_IFLNK) {
|
||||
char link[MAXPATHLEN+1];
|
||||
int cc;
|
||||
cc = readlink(path, link, MAXPATHLEN);
|
||||
if (cc == -1)
|
||||
return -1;
|
||||
link[cc] = '\0';
|
||||
if (ABSOLUTE_FILENAME_P(link)) {
|
||||
strcpy(path, link);
|
||||
} else if (strlen(path)+strlen(link) < MAXPATHLEN) {
|
||||
char *p;
|
||||
p = strrchr(path, '/');
|
||||
if (p)
|
||||
*(p+1) = '\0';
|
||||
strcat(path, link);
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
objc_find_executable (const char *file)
|
||||
{
|
||||
char *search;
|
||||
register char *p;
|
||||
int cwd_in_path = 0;
|
||||
|
||||
if (ABSOLUTE_FILENAME_P(file)) {
|
||||
search = copy_of(file);
|
||||
find_full_path(search);
|
||||
return search;
|
||||
/*
|
||||
return copy_of (file);
|
||||
*/
|
||||
}
|
||||
|
||||
if ((search = (char *) getenv("PATH")) == 0)
|
||||
search = DEFAULT_PATH;
|
||||
|
||||
p = search;
|
||||
|
||||
while (*p) {
|
||||
char name[MAXPATHLEN];
|
||||
register char *next;
|
||||
|
||||
next = name;
|
||||
|
||||
/* copy directory name into [name] */
|
||||
while (*p && *p != PATH_SEPARATOR) *next++ = *p++;
|
||||
*next = 0;
|
||||
if (*p) p++;
|
||||
|
||||
if (name[0] == '.' && name[1] == 0) {
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd (name, MAXPATHLEN);
|
||||
#else
|
||||
getwd (name);
|
||||
#endif
|
||||
cwd_in_path = 1;
|
||||
}
|
||||
|
||||
strcat (name, PATH_COMPONENT);
|
||||
strcat (name, file);
|
||||
|
||||
/*
|
||||
if (access (name, X_OK) == 0)
|
||||
*/
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
|
||||
/* Also add common executable extensions on windows */
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
{
|
||||
int fl = strlen(name);
|
||||
|
||||
strcat (name, ".com");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".exe");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".bat");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".cmd");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
If '.' not in PATH, check this too
|
||||
*/
|
||||
if (!cwd_in_path) {
|
||||
char name[MAXPATHLEN];
|
||||
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd (name, MAXPATHLEN);
|
||||
#else
|
||||
getwd (name);
|
||||
#endif
|
||||
strcat (name, PATH_COMPONENT);
|
||||
strcat (name, file);
|
||||
|
||||
/*
|
||||
if (access (name, X_OK) == 0)
|
||||
*/
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
|
||||
/* Also add common executable extensions on windows */
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
{
|
||||
int fl = strlen(name);
|
||||
|
||||
strcat (name, ".com");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".exe");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".bat");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".cmd");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,241 +0,0 @@
|
|||
/*
|
||||
find_exec.c - routine to find the executable path
|
||||
|
||||
From the dld distribution -- copyrighted below.
|
||||
Modified by Adam Fedor - traverse links
|
||||
|
||||
Given a filename, objc_find_executable searches the directories listed in
|
||||
environment variable PATH for a file with that filename.
|
||||
A new copy of the complete path name of that file is returned. This new
|
||||
string may be disposed by free() later on.
|
||||
*/
|
||||
|
||||
/* This file is part of DLD, a dynamic link/unlink editor for C.
|
||||
|
||||
Copyright (C) 1990 by W. Wilson Ho.
|
||||
|
||||
The author can be reached electronically by how@cs.ucdavis.edu or
|
||||
through physical mail at:
|
||||
|
||||
W. Wilson Ho
|
||||
Division of Computer Science
|
||||
University of California at Davis
|
||||
Davis, CA 95616
|
||||
*/
|
||||
|
||||
/* This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 1, or (at your option) any
|
||||
later version.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include <limits.h>
|
||||
#define S_IFLNK 0120000
|
||||
int readlink(char *path, char *buf, int bufsiz) { return (-1); }
|
||||
int lstat(char *path, struct stat *buf) { return (-1); }
|
||||
#define MAXPATHLEN 255
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEFAULT_PATH ".:~/bin::/usr/local/bin:/usr/new:/usr/ucb:/usr/bin:/bin:/usr/hosts"
|
||||
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
#define PATH_SEPARATOR ';'
|
||||
#define PATH_COMPONENT "\\"
|
||||
#else
|
||||
#define PATH_SEPARATOR ':'
|
||||
#define PATH_COMPONENT "/"
|
||||
#endif
|
||||
|
||||
/* ABSOLUTE_FILENAME_P (fname): True if fname is an absolute filename */
|
||||
#if defined(atarist) || defined(__WIN32__) || defined(_WIN32)
|
||||
#define ABSOLUTE_FILENAME_P(fname) ((fname[0] == '/') || \
|
||||
(fname[0] && (fname[1] == ':')))
|
||||
#else
|
||||
#define ABSOLUTE_FILENAME_P(fname) (fname[0] == '/')
|
||||
#endif /* atarist */
|
||||
|
||||
static char *
|
||||
copy_of (s)
|
||||
register char *s;
|
||||
{
|
||||
register char *p = (char *) malloc (strlen(s)+1);
|
||||
|
||||
if (!p) return 0;
|
||||
|
||||
*p = 0;
|
||||
strcpy (p, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
static int
|
||||
find_full_path(char *path)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if ( stat(path, &statbuf) != 0)
|
||||
return -1;
|
||||
|
||||
if ( (lstat(path, &statbuf) == 0)
|
||||
&& (statbuf.st_mode & S_IFLNK) == S_IFLNK) {
|
||||
char link[MAXPATHLEN+1];
|
||||
int cc;
|
||||
cc = readlink(path, link, MAXPATHLEN);
|
||||
if (cc == -1)
|
||||
return -1;
|
||||
link[cc] = '\0';
|
||||
if (ABSOLUTE_FILENAME_P(link)) {
|
||||
strcpy(path, link);
|
||||
} else if (strlen(path)+strlen(link) < MAXPATHLEN) {
|
||||
char *p;
|
||||
p = strrchr(path, '/');
|
||||
if (p)
|
||||
*(p+1) = '\0';
|
||||
strcat(path, link);
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
objc_find_executable (const char *file)
|
||||
{
|
||||
char *search;
|
||||
register char *p;
|
||||
int cwd_in_path = 0;
|
||||
|
||||
if (ABSOLUTE_FILENAME_P(file)) {
|
||||
search = copy_of(file);
|
||||
find_full_path(search);
|
||||
return search;
|
||||
/*
|
||||
return copy_of (file);
|
||||
*/
|
||||
}
|
||||
|
||||
if ((search = (char *) getenv("PATH")) == 0)
|
||||
search = DEFAULT_PATH;
|
||||
|
||||
p = search;
|
||||
|
||||
while (*p) {
|
||||
char name[MAXPATHLEN];
|
||||
register char *next;
|
||||
|
||||
next = name;
|
||||
|
||||
/* copy directory name into [name] */
|
||||
while (*p && *p != PATH_SEPARATOR) *next++ = *p++;
|
||||
*next = 0;
|
||||
if (*p) p++;
|
||||
|
||||
if (name[0] == '.' && name[1] == 0) {
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd (name, MAXPATHLEN);
|
||||
#else
|
||||
getwd (name);
|
||||
#endif
|
||||
cwd_in_path = 1;
|
||||
}
|
||||
|
||||
strcat (name, PATH_COMPONENT);
|
||||
strcat (name, file);
|
||||
|
||||
/*
|
||||
if (access (name, X_OK) == 0)
|
||||
*/
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
|
||||
/* Also add common executable extensions on windows */
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
{
|
||||
int fl = strlen(name);
|
||||
|
||||
strcat (name, ".com");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".exe");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".bat");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".cmd");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
If '.' not in PATH, check this too
|
||||
*/
|
||||
if (!cwd_in_path) {
|
||||
char name[MAXPATHLEN];
|
||||
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd (name, MAXPATHLEN);
|
||||
#else
|
||||
getwd (name);
|
||||
#endif
|
||||
strcat (name, PATH_COMPONENT);
|
||||
strcat (name, file);
|
||||
|
||||
/*
|
||||
if (access (name, X_OK) == 0)
|
||||
*/
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
|
||||
/* Also add common executable extensions on windows */
|
||||
#if defined(__WIN32__) || defined(_WIN32)
|
||||
{
|
||||
int fl = strlen(name);
|
||||
|
||||
strcat (name, ".com");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".exe");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".bat");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
|
||||
strcat (name, ".cmd");
|
||||
if (find_full_path (name) == 0)
|
||||
return copy_of (name);
|
||||
name[fl] = '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue