From 354d596db3e7bbc13ca1dad46a174b54d753d32f Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 22 Apr 2010 11:48:08 +0000 Subject: [PATCH] Added a usage screen to the run utility --- po/fr.po | 6 +++++- src/run.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/po/fr.po b/po/fr.po index 5337472..c3514fa 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Panel 0.0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-22 13:41+0200\n" +"POT-Creation-Date: 2010-04-22 13:47+0200\n" "PO-Revision-Date: 2010-04-22 12:45+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: French\n" @@ -70,3 +70,7 @@ msgstr "Erreur" #: ../src/run.c:318 msgid "Child exited with error code 127" msgstr "La commande a retourné un code d'erreur 127" + +#: ../src/run.c:392 +msgid "Usage: run\n" +msgstr "Usage: run\n" diff --git a/src/run.c b/src/run.c index 709c259..1f260f5 100644 --- a/src/run.c +++ b/src/run.c @@ -386,15 +386,32 @@ static void _on_run_terminal_toggle(GtkWidget * widget, gpointer data) } +/* usage */ +static int _usage(void) +{ + fputs(_("Usage: run\n"), stderr); + return 1; +} + + /* main */ int main(int argc, char * argv[]) { + int o; Run * run; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); gtk_init(&argc, &argv); + while((o = getopt(argc, argv, "")) != -1) + switch(o) + { + default: + return _usage(); + } + if(optind != argc) + return _usage(); if((run = _run_new()) == NULL) return _run_error(error_get(), 2); gtk_main();