| 55 | static struct passwd *get_unix_pw(void); |
| 56 | |
| 57 | int |
| 58 | main(int argc, char *argv[]) |
| 59 | { |
| 60 | char *dir = NULL; |
| 61 | NHFILE *nhfp; |
| 62 | boolean exact_username; |
| 63 | boolean resuming = FALSE; /* assume new game */ |
| 64 | boolean plsel_once = FALSE; |
| 65 | |
| 66 | early_init(argc, argv); |
| 67 | |
| 68 | #if defined(__APPLE__) |
| 69 | { |
| 70 | /* special hack to change working directory to a resource fork when |
| 71 | running from finder --sam */ |
| 72 | #define MAC_PATH_VALUE ".app/Contents/MacOS/" |
| 73 | char mac_cwd[1024], *mac_exe = argv[0], *mac_tmp; |
| 74 | int arg0_len = strlen(mac_exe), mac_tmp_len, mac_lhs_len = 0; |
| 75 | getcwd(mac_cwd, 1024); |
| 76 | if (mac_exe[0] == '/' && !strcmp(mac_cwd, "/")) { |
| 77 | if ((mac_exe = strrchr(mac_exe, '/'))) |
| 78 | mac_exe++; |
| 79 | else |
| 80 | mac_exe = argv[0]; |
| 81 | mac_tmp_len = (strlen(mac_exe) * 2) + strlen(MAC_PATH_VALUE); |
| 82 | if (mac_tmp_len <= arg0_len) { |
| 83 | mac_tmp = malloc(mac_tmp_len + 1); |
| 84 | sprintf(mac_tmp, "%s%s%s", mac_exe, MAC_PATH_VALUE, mac_exe); |
| 85 | if (!strcmp(argv[0] + (arg0_len - mac_tmp_len), mac_tmp)) { |
| 86 | mac_lhs_len = |
| 87 | (arg0_len - mac_tmp_len) + strlen(mac_exe) + 5; |
| 88 | if (mac_lhs_len > mac_tmp_len - 1) |
| 89 | mac_tmp = realloc(mac_tmp, mac_lhs_len); |
| 90 | strncpy(mac_tmp, argv[0], mac_lhs_len); |
| 91 | mac_tmp[mac_lhs_len] = '\0'; |
| 92 | chdir(mac_tmp); |
| 93 | } |
| 94 | free(mac_tmp); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | #endif |
| 99 | |
| 100 | gh.hname = argv[0]; |
| 101 | svh.hackpid = getpid(); |
| 102 | (void) umask(0777 & ~FCMASK); |
| 103 | |
| 104 | choose_windows(DEFAULT_WINDOW_SYS); |
| 105 | |
| 106 | #ifdef SND_LIB_INTEGRATED |
| 107 | /* One of the soundlib interfaces was integrated on build. |
| 108 | * We can leave a hint here for activate_chosen_soundlib later. |
| 109 | * assign_soundlib() just sets an indicator, it doesn't initialize |
| 110 | * any soundlib, and the indicator could be overturned before |
| 111 | * activate_chosen_soundlib() gets called. Qt will place its own |
| 112 | * hint if qt_init_nhwindow() is invoked. |
| 113 | */ |
| 114 | #if defined(SND_LIB_MACSOUND) |
nothing calls this directly
no test coverage detected