X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmain.c;h=fb886abd8647d58a302f35381ab05b293f6b86c1;hb=HEAD;hp=ffe94c735481598cc44e477d01a82c685fa3831a;hpb=7ed8e1d6f794a98c3eb6447dd8e205899fcb1435;p=hvgrip.git diff --git a/src/main.c b/src/main.c index ffe94c7..fb886ab 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,6 +148,9 @@ void Debug(char *fmt,...) int Cmain(int argc, char* argv[]) { + poptContext context; + int status; + /* Unbuffer stdout */ setvbuf(stdout, 0, _IONBF, 0); @@ -153,9 +159,19 @@ int Cmain(int argc, char* argv[]) bindtextdomain(GETTEXT_PACKAGE,GNOMELOCALEDIR); textdomain(GETTEXT_PACKAGE); - gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv, - GNOME_PARAM_POPT_TABLE,options, - GNOME_PROGRAM_STANDARD_PROPERTIES,NULL); + 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)); + + /* Print a short usage message. */ + poptPrintUsage(context, stderr, 0); + + exit(1); + } bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF8"); setenv("CHARSET","UTF-8",1);