X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmain.c;h=74ff8f72c1f9232b76165f470e7cd2839fa13725;hb=0038fb69bf115cd2b0d4ff86734fed309ff510bc;hp=ffe94c735481598cc44e477d01a82c685fa3831a;hpb=7ed8e1d6f794a98c3eb6447dd8e205899fcb1435;p=hvgrip.git diff --git a/src/main.c b/src/main.c index ffe94c7..74ff8f7 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,9 @@ */ #include -#include +#include +#include +#include #include #include "grip.h" @@ -114,6 +116,7 @@ struct poptOption options[] = { N_("Run in verbose (debug) mode"), NULL }, + POPT_AUTOHELP { NULL, '\0', @@ -145,19 +148,32 @@ void Debug(char *fmt,...) int Cmain(int argc, char* argv[]) { + poptContext context; + int status; + /* Unbuffer stdout */ setvbuf(stdout, 0, _IONBF, 0); /* setup locale, i18n */ gtk_set_locale(); - bindtextdomain(GETTEXT_PACKAGE,GNOMELOCALEDIR); - textdomain(GETTEXT_PACKAGE); + bindtextdomain(PACKAGE_TARNAME, LOCALEDIR); + textdomain(PACKAGE_TARNAME); + + gtk_init(&argc, &argv); + context = poptGetContext(NULL, argc, (const char **) argv, options, 0); + status = poptGetNextOpt(context); + if (status != -1) { + fprintf(stderr, "Error with option [%s]:\n %s\n", + poptBadOption(context, POPT_BADOPTION_NOALIAS), + poptStrerror(status)); - gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv, - GNOME_PARAM_POPT_TABLE,options, - GNOME_PROGRAM_STANDARD_PROPERTIES,NULL); + /* Print a short usage message. */ + poptPrintUsage(context, stderr, 0); + + exit(1); + } - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF8"); + bind_textdomain_codeset(PACKAGE_TARNAME, "UTF8"); setenv("CHARSET","UTF-8",1); do_debug=verbose;