/[zanavi_public1]/navit/navit/start_real.c
ZANavi

Diff of /navit/navit/start_real.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2 Revision 27
54char **main_argv; 54char **main_argv;
55 55
56static void 56static void
57print_usage(void) 57print_usage(void)
58{ 58{
59 printf(_("navit usage:\nnavit [options] [configfile]\n\t-c <file>: use <file> as config file\n\t-d <n>: set the debug output level to <n>. (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n")); 59 printf("navit usage:\nnavit [options] [configfile]\n\t-c <file>: use <file> as config file\n\t-d <n>: set the debug output level to <n>. (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n");
60} 60}
61 61
62 62
63#ifndef USE_PLUGINS 63#ifndef USE_PLUGINS
64extern void builtin_init(void); 64extern void builtin_init(void);
144 // use 1st cmd line option that is left for the config file 144 // use 1st cmd line option that is left for the config file
145 if (optind < argc) config_file = argv[optind]; 145 if (optind < argc) config_file = argv[optind];
146 } 146 }
147 147
148 // if config file is explicitely given only look for it, otherwise try std paths 148 // if config file is explicitely given only look for it, otherwise try std paths
149 if (config_file)
150 {
149 if (config_file) list = g_list_append(list,g_strdup(config_file)); 151 list = g_list_append(list,g_strdup(config_file));
152 }
150 else { 153 else
154 {
155
151 list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_USER_DATADIR"), "/navit.xml" , NULL)); 156 list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_USER_DATADIR"), "/navit.xml" , NULL));
152 list = g_list_append(list,g_strdup("navit.xml.local"));
153 list = g_list_append(list,g_strdup("navit.xml")); 157 list = g_list_append(list,g_strdup("navit.xml"));
158
154#ifdef HAVE_API_ANDROID 159#ifdef HAVE_API_ANDROID
155 // new preferred location (the new one should have priority over the legacy!) 160 // **disabled** // new preferred location (the new one should have priority over the legacy!)
156 list = g_list_append(list,g_strdup("/sdcard/zanavi/navit.xml")); 161 // **disabled** // list = g_list_append(list,g_strdup("/sdcard/zanavi/navit.xml"));
157#endif 162#endif
158 list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml.local" , NULL)); 163
159 list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL)); 164 list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL));
165
160#ifndef _WIN32 166#ifndef _WIN32
161 list = g_list_append(list,g_strdup("/etc/navit/navit.xml")); 167 list = g_list_append(list,g_strdup("/etc/navit/navit.xml"));
162#endif 168#endif
169
163 } 170 }
164 li = list; 171 li = list;
165 for (;;) { 172 for (;;)
173 {
166 if (li == NULL) { 174 if (li == NULL)
175 {
167 // We have not found an existing config file from all possibilities 176 // We have not found an existing config file from all possibilities
168 dbg(0,_("No config file navit.xml, navit.xml.local found\n")); 177 dbg(0,"No config file navit.xml, navit.xml.local found\n");
169 return 1; 178 return 1;
170 } 179 }
171 // Try the next config file possibility from the list 180 // Try the next config file possibility from the list
172 config_file = li->data; 181 config_file = li->data;
173 if (file_exists(config_file)) 182 if (file_exists(config_file))
177 else 186 else
178 g_free(config_file); 187 g_free(config_file);
179 li = g_list_next(li); 188 li = g_list_next(li);
180 } 189 }
181 190
182 if (!config_load(config_file, &error)) { 191 if (!config_load(config_file, &error))
183 dbg(0, _("Error parsing '%s': %s\n"), config_file, error ? error->message : ""); 192 {
184 } else {
185 dbg(0, _("Using '%s'\n"), config_file);
186 } 193 }
194
187 while (li) { 195 while (li)
196 {
188 g_free(li->data); 197 g_free(li->data);
189 li = g_list_next(li); 198 li = g_list_next(li);
190 } 199 }
191 g_list_free(list); 200 g_list_free(list);
192 if (! config_get_attr(config, attr_navit, &navit, NULL) && !config_empty_ok) { 201 if (! config_get_attr(config, attr_navit, &navit, NULL) && !config_empty_ok) {
193 dbg(0, _("No instance has been created, exiting\n")); 202 dbg(0, "No instance has been created, exiting\n");
194 exit(1); 203 exit(1);
195 } 204 }
196 event_main_loop_run(); 205 event_main_loop_run();
197 206
198 dbg(0,"1 after main loop ##########################"); 207 dbg(0,"1 after main loop ##########################");

Legend:
Removed from v.2  
changed lines
  Added in v.27

   
Visit the ZANavi Wiki