From a1f8c58cf24f59eb8b9b779e4c895a6cf854e762 Mon Sep 17 00:00:00 2001 From: spaetz Date: Tue, 20 May 2008 12:52:49 +0000 Subject: [PATCH] make everyone happy. accept config file with -c or by just appending to the cmd line git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1071 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/navit/navit/main.c b/navit/navit/main.c index 1a6b265..e7223ea 100644 --- a/navit/navit/main.c +++ b/navit/navit/main.c @@ -46,7 +46,6 @@ static gchar *get_home_directory(void) if (homedir) return homedir; homedir = getenv("HOME"); - } if (!homedir) { g_warning("Could not find home directory. Using current directory as home directory."); @@ -109,7 +108,7 @@ main_remove_navit(struct navit *nav) void print_usage(void) { - printf(_("navit usage:\nnavit [options]\n\t-c : use as config file\n\t-d : set the debug output level to . (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n")); + printf(_("navit usage:\nnavit [options] [configfile]\n\t-c : use as config file\n\t-d : set the debug output level to . (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n")); } int main(int argc, char **argv) @@ -202,16 +201,16 @@ int main(int argc, char **argv) print_usage(); exit(0); break; - case ' v': - printf(" %s %s\n", "navit", "0.0.4+svn"); + case 'v': + printf("%s %s\n", "navit", "0.0.4+svn"); exit(0); break; case 'c': - printf("c onfig file n is set to `%s'\n", optarg); + printf("config file n is set to `%s'\n", optarg); config_file = optarg; break; case 'd': - printf("T ODO Verbose option is set to `%s'\n", optarg); + printf("TODO Verbose option is set to `%s'\n", optarg); break; case ':': fprintf(stderr, "navit: Error - Option `%c' needs a value\n", optopt); @@ -226,9 +225,8 @@ int main(int argc, char **argv) } } if (optind < argc) { - // there are still unknown non config options left on the command line. - print_usage(); - exit(1); + // use 1sr cmd line option left for the config file + config_file = argv[optind]; } if (! config_file) { -- 2.7.4