Output errors when setting the locale

This commit is contained in:
Pierre Pronchery 2013-03-09 23:19:23 +01:00
parent 986e92d2ea
commit 30387f6d13

View File

@ -25,7 +25,6 @@
#include "../config.h" #include "../config.h"
#define _(string) gettext(string) #define _(string) gettext(string)
/* constants */ /* constants */
#ifndef PREFIX #ifndef PREFIX
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
@ -38,6 +37,22 @@
#endif #endif
/* private */
/* prototypes */
static int _error(char const * message, int ret);
static int _usage(void);
/* functions */
/* error */
static int _error(char const * message, int ret)
{
fputs("browser: ", stderr);
perror(message);
return ret;
}
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
@ -50,6 +65,8 @@ static int _usage(void)
} }
/* public */
/* functions */
/* main */ /* main */
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
@ -58,7 +75,8 @@ int main(int argc, char * argv[])
int view = -1; int view = -1;
Browser * browser; Browser * browser;
setlocale(LC_ALL, ""); if(setlocale(LC_ALL, "") == NULL)
_error("setlocale", 1);
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
gtk_init(&argc, &argv); gtk_init(&argc, &argv);