Added some pathes for AROS operating system. We need someone to test it out now :)

Also, there is a realpath implementation there wich may be useful for BeOS too


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@421 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-12-27 11:43:03 +00:00
parent 4c48c74a96
commit e2fe9dcd79
9 changed files with 116 additions and 7 deletions

View File

@ -62,6 +62,19 @@ else
NOTTF = 1
else
#AROS specific
ifeq ($(PLATFORM),AROS)
DELCOMMAND = rm -rf
MKDIR = mkdir -p
RMDIR = rmdir
CP = cp
BIN = grafx2
CFGBIN = gfxcfg
COPT = -Wall _c _g `i386-linux-aros-sdl-config --cflags` $(TTFCOPT)
LOPT = -lSDL_image `i386-linux-aros-sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT)
CC = i386-linux-aros-gcc
OBJDIR = obj/aros
#BeOS specific
ifeq ($(PLATFORM),BeOS)
DELCOMMAND = rm -rf

View File

@ -23,7 +23,7 @@ $(OBJDIR)/loadsave.o: loadsave.c const.h struct.h global.h loadsave.h graph.h \
divers.h pages.h op_c.h boutons.h erreurs.h io.h sdlscreen.h windows.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h loadsave.h graph.h divers.h \
init.h boutons.h moteur.h pages.h files.h sdlscreen.h erreurs.h \
readini.h saveini.h io.h texte.h setup.h windows.h brush.h
readini.h saveini.h io.h texte.h setup.h windows.h brush.h realpath.h
$(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h loadsave.h graph.h divers.h \
special.h boutons.h operatio.h shade.h erreurs.h sdlscreen.h windows.h brush.h
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h graph.h
@ -43,6 +43,7 @@ $(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h loadsave.h sdlscreen.h \
$(OBJDIR)/readini.o: readini.c const.h global.h struct.h loadsave.h graph.h divers.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h loadsave.h graph.h \
divers.h erreurs.h sdlscreen.h readline.h windows.h
$(OBJDIR)/realpath.o: realpath.c
$(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h loadsave.h readini.h io.h \
erreurs.h graph.h divers.h
$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h loadsave.h sdlscreen.h \

1
aide.c
View File

@ -417,6 +417,7 @@ void Bouton_Stats(void)
}
#else
// Free disk space is only for shows. Other platforms can display 0.
Taille=0;
#endif
if(Taille > (100ULL*1024*1024*1024))

View File

@ -29,7 +29,7 @@
#include <sys/stat.h>
#include <unistd.h>
#if defined(__amigaos4__)
#if defined(__amigaos4__) || defined(__AROS__)
#include <proto/dos.h>
#include <dirent.h>
#define isHidden(Enreg) (0)

4
init.c
View File

@ -69,7 +69,7 @@ void Ajouter_lecteur(char Lettre, byte Type, char *Chemin)
// Rechercher la liste et le type des lecteurs de la machine
void Rechercher_drives(void)
{
#if defined(__amigaos4__)
#if defined(__amigaos4__) || defined(__AROS__)
// No icons by default.
// It's possible to add some here.
@ -124,7 +124,7 @@ void Rechercher_drives(void)
#if defined(__BEOS__) || defined(__HAIKU__)
char * Home = getenv("$HOME");
#else
char * Home = getenv("HOME");
char * Home = getenv("HOME");
#endif
Ajouter_lecteur('/', LECTEUR_HDD, "/");
Ajouter_lecteur('~', LECTEUR_HDD, Home ? Home : "");

2
main.c
View File

@ -58,6 +58,8 @@
#elif defined(__macosx__)
#import <corefoundation/corefoundation.h>
#import <sys/param.h>
#elif defined(__AROS__) || defined(__BEOS__)
#include "realpath.h"
#endif
byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran

86
realpath.c Normal file
View File

@ -0,0 +1,86 @@
/* Found in:
http://amiga.sourceforge.net/amigadevhelp/FUNCTIONS/GeekGadgets/realpath/ex02_realpath.c
*/
#include <limits.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
static char *sep(char *path)
{
char *tmp, c;
tmp = strrchr(path, '/');
if(tmp) {
c = tmp[1];
tmp[1] = 0;
if (chdir(path)) {
return NULL;
}
tmp[1] = c;
return tmp + 1;
}
return path;
}
char *realpath(const char *_path, char *resolved_path)
{
int fd = open(".", O_RDONLY), l;
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
char tmp2[PATH_MAX];
if (fd < 0) {
return NULL;
}
strncpy(path, _path, PATH_MAX);
if (chdir(path)) {
if (errno == ENOTDIR) {
l = readlink(path, lnk, PATH_MAX);
if (!(tmp = sep(path))) {
resolved_path = NULL;
goto abort;
}
if (l < 0) {
if (errno != EINVAL) {
resolved_path = NULL;
goto abort;
}
} else {
lnk[l] = 0;
if (!(tmp = sep(lnk))) {
resolved_path = NULL;
goto abort;
}
}
} else {
resolved_path = NULL;
goto abort;
}
}
if(resolved_path==NULL) // if we called realpath with null as a 2nd arg
resolved_path = (char*) malloc( PATH_MAX );
if (!getcwd(resolved_path, PATH_MAX)) {
resolved_path = NULL;
goto abort;
}
if(strcmp(resolved_path, "/") && *tmp) {
strcat(resolved_path, "/");
}
strcat(resolved_path, tmp);
abort:
fchdir(fd);
close(fd);
return resolved_path;
}

6
realpath.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _REALPATH_H
#define _REALPATH_H
char *realpath(const char *_path, char *resolved_path);
#endif

View File

@ -49,7 +49,7 @@ int Create_ConfigDirectory(char * Config_Dir)
#endif
}
#if defined(__macosx__) || defined(__amigaos4__)
#if defined(__macosx__) || defined(__amigaos4__) || defined(__AROS__)
#define ARG_UNUSED __attribute__((unused))
#else
#define ARG_UNUSED
@ -70,7 +70,7 @@ void Set_Program_Directory(ARG_UNUSED const char * argv0,char * Program_Dir)
strcat(Program_Dir ,"/");
// AmigaOS4: hard-coded volume name.
#elif defined(__amigaos4__)
#elif defined(__amigaos4__) || defined(__AROS__)
strcpy(Program_Dir,"PROGDIR:");
// Others: The part of argv[0] before the executable name.
@ -113,7 +113,7 @@ void Set_Config_Directory(const char * Program_Dir, char * Config_Dir)
strcpy(Config_Dir,Program_Dir);
strcat(Config_Dir,"Contents/Resources/");
// AmigaOS4
#elif defined(__amigaos4__)
#elif defined(__amigaos4__) || defined(__AROS__)
strcpy(Config_Dir,"PROGDIR:");
#else
char FileName[TAILLE_CHEMIN_FICHIER];