]> andersk Git - moira.git/commitdiff
Deal with user status properly instead of just printing "active" or "inactive"
authormar <mar>
Sat, 30 Jul 1988 17:29:12 +0000 (17:29 +0000)
committermar <mar>
Sat, 30 Jul 1988 17:29:12 +0000 (17:29 +0000)
clients/moira/user.c

index e19faea2bbc405792051c6d7db924ce0007a9366..0e812c7e42d093063b87e1a660b78b99f4641cd3 100644 (file)
 #define BY_NAME  2
 #define CLASS 3
 
+/*     Function Name: UserState
+ *     Description: Convert a numeric state into a descriptive string.
+ *     Arguments: state value
+ *     Returns: pointer to statically allocated string.
+ */
+
+static char *states[] = { "Not registered",
+                         "Active",
+                         "Half registered",
+                         "Marked for deletion",
+                         "Not registerable" };
+
+static char *UserState(state)
+int state;
+{
+    if (state < 0 || state > 4)
+       return("Unknown");
+    return(states[state]);
+}
+
+
 /*     Function Name: PrintUserName
  *     Description: Print name of a user.
  *     Arguments: info - the information about a user.
@@ -71,7 +92,7 @@ char ** info;
            info[U_UID], info[U_SHELL], info[U_CLASS]);
     Put_message(buf);
     sprintf(buf, "Account is: %-10s Encrypted MIT ID number: %s",
-           atoi(info[U_STATE]) ? "active" : "inactive", info[U_MITID]);
+           UserState(atoi(info[U_STATE])), info[U_MITID]);
     Put_message(buf);
     sprintf(buf, MOD_FORMAT, info[U_MODBY], info[U_MODTIME],info[U_MODWITH]);
     Put_message(buf);
This page took 0.056917 seconds and 5 git commands to generate.