+2008-07-26 Nicolas François <nicolas.francois@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@centraliens.net>
* lib/defines.h: Make sure the booleans are defined before using
#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)
{
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++;
}
++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:
usage ();
}
+ /* local, no need for xgetpwnam */
if (getpwnam(adduser) == NULL) {
fprintf (stderr, _("%s: user `%s' does not exist\n")
Prog, adduser);