[Pkg-shadow-commits] r2212 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sat Jul 26 16:24:32 UTC 2008
Author: nekral-guest
Date: 2008-07-26 16:24:27 +0000 (Sat, 26 Jul 2008)
New Revision: 2212
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/groupmems.c
Log:
* src/groupmems.c: Really use booleans.
* src/groupmems.c: Change isroot() to a macro that returns a
boolean.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-07-26 16:13:29 UTC (rev 2211)
+++ upstream/trunk/ChangeLog 2008-07-26 16:24:27 UTC (rev 2212)
@@ -1,5 +1,11 @@
2008-07-26 Nicolas François <nicolas.francois at centraliens.net>
+ * src/groupmems.c: Really use booleans.
+ * src/groupmems.c: Change isroot() to a macro that returns a
+ boolean.
+
+2008-07-26 Nicolas François <nicolas.francois at centraliens.net>
+
* lib/defines.h: Make sure the booleans are defined before using
them.
Modified: upstream/trunk/src/groupmems.c
===================================================================
--- upstream/trunk/src/groupmems.c 2008-07-26 16:13:29 UTC (rev 2211)
+++ upstream/trunk/src/groupmems.c 2008-07-26 16:24:27 UTC (rev 2212)
@@ -57,24 +57,18 @@
#define EXIT_INVALID_USER 8 /* specified user does not exist */
#define EXIT_INVALID_GROUP 9 /* specified group does not exist */
-#define TRUE 1
-#define FALSE 0
-
/*
* Global variables
*/
static char *adduser = NULL;
static char *deluser = NULL;
static char *thisgroup = NULL;
-static int purge = FALSE;
-static int list = FALSE;
+static bool purge = false;
+static bool list = false;
static int exclusive = 0;
static char *Prog;
-static int isroot (void)
-{
- return getuid ()? FALSE : TRUE;
-}
+#define isroot () (getuid () == 0)
static int isgroup (void)
{
@@ -117,12 +111,12 @@
static void rmfromgroup (char *user, char **members)
{
int i;
- int found = FALSE;
+ bool found = false;
i = 0;
while (!found && NULL != members[i]) {
if (0 == strcmp (user, members[i])) {
- found = TRUE;
+ found = true;
} else {
i++;
}
@@ -212,14 +206,14 @@
++exclusive;
break;
case 'p':
- purge = TRUE;
+ purge = true;
++exclusive;
break;
case 'g':
thisgroup = strdup (optarg);
break;
case 'l':
- list = TRUE;
+ list = true;
++exclusive;
break;
default:
@@ -231,6 +225,7 @@
usage ();
}
+ /* local, no need for xgetpwnam */
if (getpwnam(adduser) == NULL) {
fprintf (stderr, _("%s: user `%s' does not exist\n")
Prog, adduser);
More information about the Pkg-shadow-commits
mailing list