Report errors when setlocale() fails

This commit is contained in:
Pierre Pronchery 2013-03-10 00:42:37 +01:00
parent 87c0565357
commit 7a45550917

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010-2013 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Phone */ /* This file is part of DeforaOS Desktop Phone */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,12 +37,23 @@
#endif #endif
/* phone */
/* private */ /* private */
/* prototypes */ /* prototypes */
static int _error(char const * message, int ret);
static int _usage(void); static int _usage(void);
/* functions */ /* functions */
/* error */
static int _error(char const * message, int ret)
{
fputs("phone: ", stderr);
perror(message);
return ret;
}
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
@ -65,7 +76,8 @@ int main(int argc, char * argv[])
int retry = -1; int retry = -1;
char * p; char * p;
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);