os/2 fixes :)

SVN revision: 3852
This commit is contained in:
Carsten Haitzler 2000-11-11 00:18:58 +00:00
parent 11e7b0369a
commit 63c17d1769
6 changed files with 57 additions and 1 deletions

View File

@ -14,3 +14,4 @@ Martin Grimm <grimm.martin@gmx.de>
Matt McClanahan <cardinal@dodds.net>
Steve Langasek <vorlon@dodds.net>
Christophe Tronche <ch.tronche@computer.org>
Nathan Ingersoll <ningerso@d.umn.edu>

View File

@ -51,7 +51,11 @@ exists(char *file)
static int
can_read(char *file)
{
#ifndef __EMX__
if (!(permissions(file) & (S_IRUSR | S_IRGRP | S_IROTH)))
#else
if (!(permissions(file)))
#endif
return 0;
return (1 + access(file, R_OK));
}
@ -59,7 +63,11 @@ can_read(char *file)
static int
can_write(char *file)
{
#ifndef __EMX__
if (!(permissions(file) & (S_IWUSR | S_IWGRP | S_IWOTH)))
#else
if (!(permissions(file)))
#endif
return 0;
return (1 + access(file, W_OK));
}
@ -79,7 +87,14 @@ load (ImlibImage *im, ImlibProgressFunction progress,
if (!im->file)
return 0;
strcpy(file, im->file);
#ifdef __EMX__
if ( (isalpha((int)file[0])) && (file[1]==':') &&
((file[2]=='\\') || (file[2]=='/')))
ptr = strchr(file, ':');
if (ptr) ptr=strrchr(++ptr, ':');
#else
ptr = strrchr(file, ':');
#endif
if (ptr)
{
*ptr = 0;
@ -245,7 +260,14 @@ save (ImlibImage *im, ImlibProgressFunction progress,
if (!im->file)
return 0;
strcpy(file, im->file);
#ifdef __EMX__
if ( (isalpha((int)file[0])) && (file[1]==':') &&
((file[2]=='\\') || (file[2]=='/')))
cp = strchr(file, ':');
if (cp) cp=strrchr(++cp, ':');
#else
cp = strrchr(file, ':');
#endif
if (cp)
{
*cp = 0;

View File

@ -32,4 +32,12 @@ if ((y + h) > ((yy) + (hh))) {h = (hh) - (y - yy);}
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#ifdef __EMX__
extern char *__XOS2RedirRoot(const char *);
#endif
#ifdef __EMX__
extern char *__XOS2RedirRoot(const char *);
#endif
#endif

View File

@ -171,7 +171,11 @@ char **__imlib_ListFilters(int *num_ret)
}
/* same for system loader path */
sprintf(s, SYS_LOADERS_PATH "/filter");
#ifndef __EMX__
l = __imlib_FileDir(s, &num);
#else
l = __imlib_FileDir(__XOS2RedirRoot(s), &num);
#endif
if (num > 0)
{
*num_ret += num;
@ -179,7 +183,11 @@ char **__imlib_ListFilters(int *num_ret)
for (i = 0; i < num; i++)
{
sprintf(s, SYS_LOADERS_PATH "/filter/%s", l[i]);
#ifndef __EMX__
list[pi + i] = strdup(s);
#else
list[pi + i] = strdup(__XOS2RedirRoot(s));
#endif
}
__imlib_FileFreeDirList(l, num);
}

View File

@ -24,10 +24,19 @@ __imlib_FileRealFile(const char *file)
newfile = strdup(file);
if (!newfile) return NULL;
#ifndef __EMX__
colon = strrchr(file, ':');
if (!colon) return newfile;
*colon = 0;
return newfile;
#else
colon = strrchr(file, ':');
/* if colon is chars 0, 1, or 2 it might be a drive letter for os/2 */
if ((colon - file) < 3) return newfile;
if (!colon) return newfile;
*colon = 0;
return newfile;
#endif
}
char *

View File

@ -651,7 +651,11 @@ __imlib_ListLoaders(int *num_ret)
}
/* same for system loader path */
sprintf(s, SYS_LOADERS_PATH "/image");
#ifndef __EMX__
l = __imlib_FileDir(s, &num);
#else
l = __imlib_FileDir(__XOS2RedirRoot(s), &num);
#endif
if (num > 0)
{
*num_ret += num;
@ -660,7 +664,11 @@ __imlib_ListLoaders(int *num_ret)
for (i = 0; i < num; i++)
{
sprintf(s, SYS_LOADERS_PATH "/image/%s", l[i]);
list[pi + i] = strdup(s);
#ifndef __EMX__
list[pi + i] = strdup(s);
#else
list[pi + i] = strdup(__XOS2RedirRoot(s));
#endif
}
__imlib_FileFreeDirList(l, num);
}