MacOSX/Qt system tweaks

These changes clean up build warnings and allow the resulting "NetHack"
Application icons to be dragged around freely in the Finder, as is expected
for Mac apps.
This commit is contained in:
warwick
2002-01-24 05:49:04 +00:00
parent 3c240e9b4a
commit 654a297052
4 changed files with 17 additions and 8 deletions
+5 -1
View File
@@ -198,7 +198,11 @@
* otherwise it will be the current directory. * otherwise it will be the current directory.
*/ */
# ifndef HACKDIR # ifndef HACKDIR
# define HACKDIR "/usr/games/lib/nethackdir" /* nethack directory */ # ifdef __APPLE__
# define HACKDIR "nethackdir" /* nethack directory */
# else
# define HACKDIR "/usr/games/lib/nethackdir"
# endif
# endif # endif
/* /*
+1 -1
View File
@@ -452,7 +452,7 @@ setrandom()
#ifdef RANDOM /* srandom() from sys/share/random.c */ #ifdef RANDOM /* srandom() from sys/share/random.c */
srandom((unsigned int) time((time_t *)0)); srandom((unsigned int) time((time_t *)0));
#else #else
# if defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */ # if defined(__APPLE__) || defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */
# ifdef BSD # ifdef BSD
# if defined(SUNOS4) # if defined(SUNOS4)
(void) (void)
+6 -5
View File
@@ -60,7 +60,7 @@ char *argv[];
running from finder --sam */ running from finder --sam */
#define MAC_PATH_VALUE ".app/Contents/MacOS/" #define MAC_PATH_VALUE ".app/Contents/MacOS/"
char mac_cwd[1024], *mac_exe = argv[0], *mac_tmp; char mac_cwd[1024], *mac_exe = argv[0], *mac_tmp;
int arg0_len = strlen(mac_exe), mac_tmp_len; int arg0_len = strlen(mac_exe), mac_tmp_len, mac_lhs_len=0;
getcwd(mac_cwd, 1024); getcwd(mac_cwd, 1024);
if(mac_exe[0] == '/' && !strcmp(mac_cwd, "/")) { if(mac_exe[0] == '/' && !strcmp(mac_cwd, "/")) {
if((mac_exe = strrchr(mac_exe, '/'))) if((mac_exe = strrchr(mac_exe, '/')))
@@ -72,10 +72,11 @@ char *argv[];
mac_tmp = malloc(mac_tmp_len + 1); mac_tmp = malloc(mac_tmp_len + 1);
sprintf(mac_tmp, "%s%s%s", mac_exe, MAC_PATH_VALUE, mac_exe); sprintf(mac_tmp, "%s%s%s", mac_exe, MAC_PATH_VALUE, mac_exe);
if(!strcmp(argv[0] + (arg0_len - mac_tmp_len), mac_tmp)) { if(!strcmp(argv[0] + (arg0_len - mac_tmp_len), mac_tmp)) {
if(arg0_len - mac_tmp_len > mac_tmp_len - 1) mac_lhs_len = (arg0_len - mac_tmp_len) + strlen(mac_exe) + 5;
mac_tmp = realloc(mac_tmp, arg0_len - mac_tmp_len); if(mac_lhs_len > mac_tmp_len - 1)
strncpy(mac_tmp, argv[0], arg0_len - mac_tmp_len); mac_tmp = realloc(mac_tmp, mac_lhs_len);
mac_tmp[arg0_len - mac_tmp_len] = '\0'; strncpy(mac_tmp, argv[0], mac_lhs_len);
mac_tmp[mac_lhs_len] = '\0';
chdir(mac_tmp); chdir(mac_tmp);
} }
free(mac_tmp); free(mac_tmp);
+5 -1
View File
@@ -99,7 +99,11 @@ extern "C" {
#include "qt_xpms.h" #include "qt_xpms.h"
#include <dirent.h> #include <dirent.h>
#include <malloc.h> #ifdef Q_WS_MACX
# include <sys/malloc.h>
#else
# include <malloc.h>
#endif
#ifdef _WS_X11_ #ifdef _WS_X11_
// For userid control // For userid control