diff --git a/.DS_Store b/.DS_Store index 4845a554..574bedb8 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Grafx2.xcodeproj/project.pbxproj b/Grafx2.xcodeproj/project.pbxproj index 698f9175..a3bf47ff 100644 --- a/Grafx2.xcodeproj/project.pbxproj +++ b/Grafx2.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ F5AD4B1F0EA8CCF0009CCAC4 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AD4B1E0EA8CCF0009CCAC4 /* version.c */; }; F5AE6F990EDA119D000CE0EF /* GrafX2_Classic.gif in Copy fonts */ = {isa = PBXBuildFile; fileRef = F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */; }; F5AE83FD0ECF8FD300200704 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */; }; + F5AED03E0F1989E00090A93F /* mountlist.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AED03C0F1989E00090A93F /* mountlist.c */; }; F5AFA00D0EFAC7D300663B43 /* brush.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0070EFAC7D300663B43 /* brush.c */; }; F5AFA00E0EFAC7D300663B43 /* pxsimple.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0080EFAC7D300663B43 /* pxsimple.c */; }; F5AFA00F0EFAC7D300663B43 /* pxtall.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AFA0090EFAC7D300663B43 /* pxtall.c */; }; @@ -128,6 +129,7 @@ F5AD4B1E0EA8CCF0009CCAC4 /* version.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = ""; }; F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = GrafX2_Classic.gif; path = fonts/GrafX2_Classic.gif; sourceTree = ""; }; F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; + F5AED03C0F1989E00090A93F /* mountlist.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mountlist.c; sourceTree = ""; }; F5AFA0070EFAC7D300663B43 /* brush.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = brush.c; sourceTree = ""; }; F5AFA0080EFAC7D300663B43 /* pxsimple.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxsimple.c; sourceTree = ""; }; F5AFA0090EFAC7D300663B43 /* pxtall.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pxtall.c; sourceTree = ""; }; @@ -225,6 +227,7 @@ 29B97314FDCFA39411CA2CEA /* Grafx2 */ = { isa = PBXGroup; children = ( + F5AED03C0F1989E00090A93F /* mountlist.c */, F5AFA0070EFAC7D300663B43 /* brush.c */, F5AFA0080EFAC7D300663B43 /* pxsimple.c */, F5AFA0090EFAC7D300663B43 /* pxtall.c */, @@ -396,6 +399,7 @@ F5AFA0100EFAC7D300663B43 /* pxwide.c in Sources */, F5AFA0110EFAC7D300663B43 /* setup.c in Sources */, F5AFA0120EFAC7D300663B43 /* windows.c in Sources */, + F5AED03E0F1989E00090A93F /* mountlist.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -428,6 +432,10 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + __macosx__, + __linux__, + ); INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ( @@ -463,6 +471,10 @@ FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Versions/A/Frameworks\""; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; + GCC_PREPROCESSOR_DEFINITIONS = ( + __macosx__, + __linux__, + ); INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ( diff --git a/Grafx2.xcodeproj/xx.pbxuser b/Grafx2.xcodeproj/xx.pbxuser index 06c23b53..f196dc9b 100644 --- a/Grafx2.xcodeproj/xx.pbxuser +++ b/Grafx2.xcodeproj/xx.pbxuser @@ -77,7 +77,7 @@ 43, 20, 79, - 110, + 587, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, @@ -165,8 +165,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 251761415; - PBXWorkspaceStateSaveDate = 251761415; + PBXPerProjectTemplateStateSaveDate = 253331600; + PBXWorkspaceStateSaveDate = 253331600; }; sourceControlManager = F5B19B690EA4BD79003F4BA4 /* Source Control */; userBuildSettings = { @@ -184,6 +184,14 @@ sepNavWindowFrame = "{{15, 76}, {906, 665}}"; }; }; + F5AED03C0F1989E00090A93F /* mountlist.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {867, 17252}}"; + sepNavSelRange = "{4702, 50}"; + sepNavVisRect = "{{0, 2973}, {867, 536}}"; + sepNavWindowFrame = "{{15, 76}, {906, 665}}"; + }; + }; F5B138930EB71977000B83CC /* texte.c */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {932, 8455}}"; diff --git a/Grafx2.xcodeproj/xx.perspective b/Grafx2.xcodeproj/xx.perspective index 5506b2d9..f4261103 100644 --- a/Grafx2.xcodeproj/xx.perspective +++ b/Grafx2.xcodeproj/xx.perspective @@ -3,7 +3,7 @@ ActivePerspectiveName - Project + Build AllowedModules @@ -188,9 +188,9 @@ PerspectiveWidths - 953 - 953 - 953 + 1469 + 1469 + 1469 Perspectives @@ -264,12 +264,12 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 9 + 1 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {305, 387}} + {{0, 0}, {305, 402}} PBXTopSmartGroupGIDs @@ -279,14 +279,12 @@ GeometryConfiguration Frame - {{0, 0}, {322, 405}} + {{0, 0}, {322, 420}} GroupTreeTableConfiguration MainColumn 305 - RubberWindowFrame - 14 169 992 446 0 0 1024 746 Module PBXSmartGroupTreeModule @@ -323,9 +321,7 @@ GeometryConfiguration Frame - {{0, 0}, {665, 0}} - RubberWindowFrame - 14 169 992 446 0 0 1024 746 + {{0, 0}, {1142, 0}} Module PBXNavigatorGroup @@ -334,12 +330,10 @@ Proportion - 400pt + 415pt Tabs - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -350,9 +344,7 @@ GeometryConfiguration Frame - {{10, 27}, {665, 373}} - RubberWindowFrame - 14 169 992 446 0 0 1024 746 + {{10, 27}, {1142, 388}} Module XCDetailModule @@ -393,7 +385,7 @@ Proportion - 665pt + 1142pt Name @@ -411,11 +403,11 @@ TableOfContents - F5ADFF250F0180EF0008467A + F5AED0690F1999120090A93F 1CA23ED40692098700951B8B - F5ADFF260F0180EF0008467A + F5AED06A0F1999120090A93F F5A33EBD0EC89C3000F8052D - F5ADFF270F0180EF0008467A + F5AED06B0F1999120090A93F 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -463,7 +455,7 @@ PBXSmartGroupTreeModuleColumnWidthsKey - 123 + 252 PBXSmartGroupTreeModuleColumnsKey_v4 @@ -481,7 +473,7 @@ PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {0, 0}} + {{0, 0}, {252, 402}} PBXTopSmartGroupGIDs @@ -491,17 +483,19 @@ GeometryConfiguration Frame - {{0, 0}, {140, 554}} + {{0, 0}, {269, 420}} GroupTreeTableConfiguration MainColumn - 123 + 252 + RubberWindowFrame + -288 -7 1469 461 0 0 1024 746 Module PBXSmartGroupTreeModule Proportion - 140pt + 269pt Dock @@ -512,7 +506,7 @@ PBXProjectModuleGUID F5A33EC20EC89C3000F8052D PBXProjectModuleLabel - asm pthread_mutex_lock 0x90001a38 + PBXSplitModuleInNavigatorKey Split0 @@ -520,7 +514,7 @@ PBXProjectModuleGUID F5A33EC30EC89C3000F8052D PBXProjectModuleLabel - asm pthread_mutex_lock 0x90001a38 + SplitCount 1 @@ -533,7 +527,9 @@ GeometryConfiguration Frame - {{0, 0}, {808, 0}} + {{0, 0}, {1195, 0}} + RubberWindowFrame + -288 -7 1469 461 0 0 1024 746 Module PBXNavigatorGroup @@ -542,10 +538,12 @@ Proportion - 0pt + 415pt Tabs + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -560,7 +558,9 @@ GeometryConfiguration Frame - {{10, 27}, {0, -27}} + {{10, 27}, {1195, 388}} + RubberWindowFrame + -288 -7 1469 461 0 0 1024 746 Module PBXBuildResultsModule @@ -622,7 +622,7 @@ Proportion - 0pt + 1195pt Name @@ -640,14 +640,14 @@ TableOfContents - F5ADFF280F0180EF0008467A + F5AED06C0F1999130090A93F 1CA23EE50692099D00951B8B - F5ADFF290F0180EF0008467A + F5AED06D0F1999130090A93F F5A33EC20EC89C3000F8052D - F5ADFF2A0F0180EF0008467A + F5AED06E0F1999130090A93F XCMainBuildResultsModuleGUID 1CA23EE80692099D00951B8B - F5ADFF2B0F0180EF0008467A + F5AED06F0F1999130090A93F ToolbarConfiguration xcode.toolbar.config.buildAndRun @@ -691,12 +691,12 @@ GeometryConfiguration Frame - {{0, 0}, {977, 174}} + {{0, 0}, {1323, 0}} Module PBXDebugCLIModule Proportion - 174pt + 0pt ContentConfiguration @@ -715,8 +715,8 @@ yes sizes - {{0, 0}, {474, 215}} - {{474, 0}, {503, 215}} + {{0, 0}, {641, 197}} + {{641, 0}, {682, 197}} VerticalSplitView @@ -731,8 +731,8 @@ yes sizes - {{0, 0}, {977, 215}} - {{0, 215}, {977, 228}} + {{0, 0}, {1323, 197}} + {{0, 197}, {1323, 211}} @@ -754,12 +754,12 @@ DebugSTDIOWindowFrame {{200, 200}, {500, 300}} Frame - {{0, 179}, {977, 443}} + {{0, 5}, {1323, 408}} Module PBXDebugSessionModule Proportion - 443pt + 408pt Name @@ -778,15 +778,15 @@ TableOfContents - F5A33EF20EC89FAD00F8052D + F5AED0700F1999130090A93F 1CCC7628064C1048000F2A68 1CCC7629064C1048000F2A68 - F5A33EF30EC89FAD00F8052D - F5A33EF40EC89FAD00F8052D - F5A33EF50EC89FAD00F8052D - F5A33EF60EC89FAD00F8052D - F5A33EE10EC89F6100F8052D - F5A33EF70EC89FAD00F8052D + F5AED0710F1999130090A93F + F5AED0720F1999130090A93F + F5AED0730F1999130090A93F + F5AED0740F1999130090A93F + F5AED0410F1989EC0090A93F + F5AED0750F1999130090A93F ToolbarConfiguration xcode.toolbar.config.debug @@ -795,7 +795,7 @@ PerspectivesBarVisible PinnedNavigatorIdentifier - F5AE852A0ECFA27900200704 + F5AED0670F1998B10090A93F ShelfIsVisible SourceDescription @@ -818,10 +818,11 @@ 5 WindowOrderList + F5AED0750F1999130090A93F /Users/xx/Grafx2/Grafx2.xcodeproj WindowString - 14 169 992 446 0 0 1024 746 + -288 -7 1469 461 0 0 1024 746 WindowTools diff --git a/init.c b/init.c index 573b8747..92871de4 100644 --- a/init.c +++ b/init.c @@ -131,7 +131,7 @@ void Rechercher_drives(void) TypeLecteur=LECTEUR_NETWORK; break; } - NomLecteur[0]='A'+IndiceBit; + NomLecteur[0]='A'+IndiceBit; Ajouter_lecteur(NomLecteur[0], TypeLecteur,NomLecteur); IndiceLecteur++; } @@ -161,14 +161,16 @@ void Rechercher_drives(void) while(Liste_points_montage != NULL) { - if(Liste_points_montage -> me_dummy == 0 && !strcmp(Liste_points_montage->me_mountdir,"/") && !strcmp(Liste_points_montage->me_mountdir,"/home")) + if(Liste_points_montage->me_dummy == 0 && strcmp(Liste_points_montage->me_mountdir,"/") && strcmp(Liste_points_montage->me_mountdir,"/home")) { Ajouter_lecteur(lettre++, Liste_points_montage->me_remote==1?LECTEUR_NETWORK:LECTEUR_HDD, Liste_points_montage->me_mountdir); } next = Liste_points_montage -> me_next; +#ifndef __macosx__ free(Liste_points_montage -> me_type); +#endif free(Liste_points_montage); Liste_points_montage = next; } diff --git a/mountlist.c b/mountlist.c index 7dabb4ea..df3a34c0 100644 --- a/mountlist.c +++ b/mountlist.c @@ -19,7 +19,11 @@ #if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__)) // We don't use autoconf and all that in grafx2, so let's do the config here ... +#ifdef __macosx__ // MacOS X is POSIX compliant +#define MOUNTED_GETMNTINFO +#else #define MOUNTED_GETMNTENT1 +#endif // --- END GRAFX2 CUSTOM CONFIG --- #include "mountlist.h" @@ -151,6 +155,26 @@ #undef closedir #ifndef ME_DUMMY +#ifdef __macosx__ +# define ME_DUMMY(Fs_name, Fs_type) \ + (strcmp (Fs_type, "autofs") == 0 \ + || strcmp (Fs_type, "none") == 0 \ + || strcmp (Fs_type, "proc") == 0 \ + || strcmp (Fs_type, "subfs") == 0 \ + || strcmp (Fs_type, "sysfs") == 0 \ + || strcmp (Fs_type, "usbfs") == 0 \ + || strcmp (Fs_type, "devpts") == 0 \ + || strcmp (Fs_type, "tmpfs") == 0 \ + /* for NetBSD 3.0 */ \ + || strcmp (Fs_type, "kernfs") == 0 \ + /* for Irix 6.5 */ \ + || strcmp (Fs_type, "ignore") == 0 \ + /* for MacOSX */ \ + || strcmp (Fs_type, "devfs") == 0 \ + || strcmp (Fs_type, "fdesc") == 0 \ + || strcmp (Fs_type, "nfs") == 0 \ + || strcmp (Fs_type, "volfs") == 0) +#else # define ME_DUMMY(Fs_name, Fs_type) \ (strcmp (Fs_type, "autofs") == 0 \ || strcmp (Fs_type, "none") == 0 \ @@ -165,6 +189,7 @@ /* for Irix 6.5 */ \ || strcmp (Fs_type, "ignore") == 0) #endif +#endif // ME_DUMMY #ifndef ME_REMOTE /* A file system is `remote' if its Fs_name contains a `:' @@ -177,7 +202,7 @@ || strcmp (Fs_type, "cifs") == 0))) #endif -#if MOUNTED_GETMNTINFO +#ifdef MOUNTED_GETMNTINFO # if ! HAVE_STRUCT_STATFS_F_FSTYPENAME static char * @@ -413,7 +438,35 @@ read_file_system_list (bool need_fs_type) } #endif /* MOUNTED_GETMNTENT1. */ -#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ + +#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ +#ifdef __macosx__ + { + struct statfs *fsp; + int entries; + int i; + + entries = getmntinfo (&fsp, MNT_NOWAIT); + if (entries < 0) + return NULL; + for (i = 0; i < entries; i++) + { + me = malloc (sizeof *me); + me->me_devname = strdup (fsp->f_mntfromname); + me->me_mountdir = strdup (fsp->f_mntonname); + me->me_type = fsp->f_fstypename; + me->me_type_malloced = 0; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); + me->me_remote = ME_REMOTE (me->me_devname, me->me_type); + me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ + + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; + fsp++; + } + } +#else { struct statfs *fsp; int entries; @@ -423,24 +476,26 @@ read_file_system_list (bool need_fs_type) return NULL; for (; entries-- > 0; fsp++) { - char *fs_type = fsp_to_string (fsp); + char *fs_type = fsp_to_string (fsp); - me = xmalloc (sizeof *me); - me->me_devname = xstrdup (fsp->f_mntfromname); - me->me_mountdir = xstrdup (fsp->f_mntonname); - me->me_type = fs_type; - me->me_type_malloced = 0; - me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); - me->me_remote = ME_REMOTE (me->me_devname, me->me_type); - me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (fsp->f_mntfromname); + me->me_mountdir = xstrdup (fsp->f_mntonname); + me->me_type = fs_type; + me->me_type_malloced = 0; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); + me->me_remote = ME_REMOTE (me->me_devname, me->me_type); + me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ - /* Add to the linked list. */ - *mtail = me; - mtail = &me->me_next; + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; } } +#endif #endif /* MOUNTED_GETMNTINFO */ + #ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */ { struct statvfs *fsp; @@ -456,6 +511,7 @@ read_file_system_list (bool need_fs_type) me->me_mountdir = xstrdup (fsp->f_mntonname); me->me_type = xstrdup (fsp->f_fstypename); me->me_type_malloced = 1; + prtinf("device: %s\n", me->me_devname); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_dev = (dev_t) -1; /* Magic; means not known yet. */