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$ */
/* 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 program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,12 +37,23 @@
#endif
/* phone */
/* 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("phone: ", stderr);
perror(message);
return ret;
}
/* usage */
static int _usage(void)
{
@ -65,7 +76,8 @@ int main(int argc, char * argv[])
int retry = -1;
char * p;
setlocale(LC_ALL, "");
if(setlocale(LC_ALL, "") == NULL)
_error("setlocale", 1);
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
gtk_init(&argc, &argv);