From: Rusty Lynch Date: Fri, 24 Aug 2012 23:42:47 +0000 (-0700) Subject: Enable just passing a url as the last argument without having to use a -u or --url X-Git-Tag: 1.0_branch~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fupstream;p=profile%2Fivi%2Fwebskeleton.git Enable just passing a url as the last argument without having to use a -u or --url --- diff --git a/webskeleton.c b/webskeleton.c index eac0c3b..3c94fd1 100644 --- a/webskeleton.c +++ b/webskeleton.c @@ -202,7 +202,7 @@ static Context *create_context(const char *url, Eina_Bool fullscreen) int main(int argc, char *argv[]) { const char *url = NULL; - int n = 0; + int n = 0, valid_option_count = 0; Eina_Bool fullscreen = EINA_FALSE; if (!ecore_evas_init()) @@ -236,12 +236,18 @@ int main(int argc, char *argv[]) break; case 'h': default: - fprintf(stderr, "Usage: %s [--help] [--fullscreen] [--width=] [--height=] [--url=]\n", argv[0]); + fprintf(stderr, "Usage: %s [--help] [--fullscreen] [--width=] [--height=] [URL]\n", argv[0]); exit(-1); } + valid_option_count++; + } + + if (!url) { + if (valid_option_count < argc - 1) + url = strdup(argv[argc - 1]); + else + url = DEFAULT_URL; } - if (!url) - url = DEFAULT_URL; Context *browser = create_context(url, fullscreen); Ecore_Event_Handler *handle = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, 0);