Fix:graphics_cocoa:Better main argument handling
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 25 Aug 2011 18:56:19 +0000 (18:56 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 25 Aug 2011 18:56:19 +0000 (18:56 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4712 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/config_.h
navit/navit/debug.c
navit/navit/graphics/cocoa/graphics_cocoa.m
navit/navit/start_real.c

index d49e17d..fe379cc 100644 (file)
@@ -1,6 +1,8 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+extern int main_argc;
+extern char **main_argv;
 extern struct config *config;
 extern int config_empty_ok;
 /* prototypes */
index 2f87f3d..0a2502d 100644 (file)
@@ -88,7 +88,11 @@ debug_init(const char *program_name)
        gdb_program=g_strdup(program_name);
        signal(SIGSEGV, sigsegv);
        debug_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
+       debug_fp = stdout;
+#else
        debug_fp = stderr;
+#endif
 }
 
 
index 95256de..bd5d29d 100644 (file)
@@ -1,4 +1,5 @@
 #include "config.h"
+#include "config_.h"
 #include "debug.h"
 #include "plugin.h"
 #include "point.h"
@@ -615,15 +616,8 @@ event_cocoa_main_loop_run(void)
 #endif
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 #if USE_UIKIT
-#if 1
-       int argc=2;
-       char *argv[]={"Debug/navit.app/navit","-RegisterForSystemEvents",NULL};
-#else
-       int argc=1;
-       char *argv[]={"navit",NULL};
-#endif
        dbg(0,"calling main\n");
-       int retval = UIApplicationMain(argc, argv, nil, @"NavitAppDelegate");
+       int retval = UIApplicationMain(main_argc, main_argv, nil, @"NavitAppDelegate");
        dbg(0,"retval=%d\n",retval);
 #else
        NavitAppDelegate * delegate = [[NavitAppDelegate alloc] init];
index e27041a..baefbc4 100644 (file)
@@ -110,6 +110,9 @@ int main_real(int argc, char **argv)
 #ifdef HAVE_GETOPT_H
        opterr=0;  //don't bomb out on errors.
 #endif /* _MSC_VER */
+       /* ingore iphone command line argument */
+       if (argc == 2 && !strcmp(argv[1],"-RegisterForSystemEvents"))
+               argc=1;
        if (argc > 1) {
                /* DEVELOPPERS : don't forget to update the manpage if you modify theses options */
                while((opt = getopt(argc, argv, ":hvc:d:e:s:")) != -1) {