* src/chgpasswd.c: Use a bool when possible instead of int

integers.
	* src/chgpasswd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/chgpasswd.c: Avoid implicit conversion of integers to
	booleans.
This commit is contained in:
nekral-guest
2008-06-09 20:56:03 +00:00
parent 0452fa2458
commit 45544f42b9
2 changed files with 24 additions and 15 deletions

View File

@@ -1,3 +1,12 @@
2008-06-09 Nicolas François <nicolas.francois@centraliens.net>
* src/chgpasswd.c: Use a bool when possible instead of int
integers.
* src/chgpasswd.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().
* src/chgpasswd.c: Avoid implicit conversion of integers to
booleans.
2008-06-09 Nicolas François <nicolas.francois@centraliens.net> 2008-06-09 Nicolas François <nicolas.francois@centraliens.net>
* src/groupdel.c: Use a bool when possible instead of int * src/groupdel.c: Use a bool when possible instead of int

View File

@@ -53,16 +53,16 @@
* Global variables * Global variables
*/ */
static char *Prog; static char *Prog;
static int cflg = 0; static bool cflg = false;
static int eflg = 0; static bool eflg = false;
static int md5flg = 0; static bool md5flg = false;
static int sflg = 0; static bool sflg = false;
static const char *crypt_method = NULL; static const char *crypt_method = NULL;
static long sha_rounds = 5000; static long sha_rounds = 5000;
#ifdef SHADOWGRP #ifdef SHADOWGRP
static int is_shadow_grp; static bool is_shadow_grp;
#endif #endif
#ifdef USE_PAM #ifdef USE_PAM
@@ -133,22 +133,22 @@ static void process_flags (int argc, char **argv)
long_options, &option_index)) != -1) { long_options, &option_index)) != -1) {
switch (c) { switch (c) {
case 'c': case 'c':
cflg = 1; cflg = true;
crypt_method = optarg; crypt_method = optarg;
break; break;
case 'e': case 'e':
eflg = 1; eflg = true;
break; break;
case 'h': case 'h':
usage (); usage ();
break; break;
case 'm': case 'm':
md5flg = 1; md5flg = true;
break; break;
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
case 's': case 's':
sflg = 1; sflg = true;
if (!getlong(optarg, &sha_rounds)) { if (getlong(optarg, &sha_rounds) != 0) {
fprintf (stderr, fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"), _("%s: invalid numeric argument '%s'\n"),
Prog, optarg); Prog, optarg);
@@ -337,9 +337,9 @@ int main (int argc, char **argv)
Prog = Basename (argv[0]); Prog = Basename (argv[0]);
setlocale (LC_ALL, ""); (void) setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); (void) textdomain (PACKAGE);
process_flags(argc, argv); process_flags(argc, argv);
@@ -456,7 +456,7 @@ int main (int argc, char **argv)
ok = gr_update (&newgr); ok = gr_update (&newgr);
} }
if (!ok) { if (0 == ok) {
fprintf (stderr, fprintf (stderr,
_ _
("%s: line %d: cannot update group entry\n"), ("%s: line %d: cannot update group entry\n"),
@@ -473,7 +473,7 @@ int main (int argc, char **argv)
* changes to be written out all at once, and then unlocked * changes to be written out all at once, and then unlocked
* afterwards. * afterwards.
*/ */
if (errors) { if (0 != errors) {
fprintf (stderr, fprintf (stderr,
_("%s: error detected, changes ignored\n"), Prog); _("%s: error detected, changes ignored\n"), Prog);
#ifdef SHADOWGRP #ifdef SHADOWGRP