]> andersk Git - moira.git/commitdiff
make sure user's real names follow capitalization rules
authormar <mar>
Wed, 2 May 1990 15:47:21 +0000 (15:47 +0000)
committermar <mar>
Wed, 2 May 1990 15:47:21 +0000 (15:47 +0000)
clients/moira/user.c

index 4c8d271bb1a85821ae0298021deebf4ee94b021a..2f7bf985edfcbfd224c272b44a703c0044c6a6f3 100644 (file)
@@ -133,6 +133,29 @@ char ** info;
     return(info);
 }
 
+
+/* Check that the supplied name follows the capitalization rules, and 
+ * offer to correct it if not.
+ */
+
+CorrectCapitalization(name)
+char **name;
+{
+    char temp_buf[BUFSIZ], fixname[BUFSIZ];
+
+    strcpy(fixname, *name);
+    FixCase(fixname);
+    if (strcmp(fixname, *name)) {
+       Put_message("You entered a name which does not follow the capitalization conventions.");
+       sprintf(temp_buf, "Correct it to \"%s\"", fixname);
+       if (YesNoQuestion(temp_buf, 1)) {
+           free(*name);
+           *name = strsave(fixname);
+       }
+    }
+}
+
+
 /*     Function Name: AskUserInfo.
  *     Description: This function askes the user for information about a 
  *                   machine and saves it into a structure.
@@ -148,7 +171,7 @@ AskUserInfo(info, name)
 char ** info;
 Bool name;
 {
-    char temp_buf[BUFSIZ], *newname, *temp_ptr;
+    char temp_buf[BUFSIZ], fixname[BUFSIZ], *newname, *temp_ptr;
 
     if (name) {
        sprintf(temp_buf,"\nChanging Attributes of user %s.\n",info[U_NAME]);
@@ -158,8 +181,11 @@ Bool name;
        char *argv[3];
 
        GetValueFromUser("User's last name", &info[U_LAST]);
+       CorrectCapitalization(&info[U_LAST]);
        GetValueFromUser("User's first name", &info[U_FIRST]);
+       CorrectCapitalization(&info[U_FIRST]);
        GetValueFromUser("User's middle name", &info[U_MIDDLE]);
+       CorrectCapitalization(&info[U_MIDDLE]);
        argv[0] = info[U_FIRST];
        argv[1] = info[U_LAST];
        if (do_mr_query("get_user_by_name", 2, argv,
@@ -183,8 +209,11 @@ Bool name;
     GetValueFromUser("User's shell", &info[U_SHELL]);
     if (name) {
        GetValueFromUser("User's last name", &info[U_LAST]);
+       CorrectCapitalization(&info[U_LAST]);
        GetValueFromUser("User's first name", &info[U_FIRST]);
+       CorrectCapitalization(&info[U_FIRST]);
        GetValueFromUser("User's middle name", &info[U_MIDDLE]);
+       CorrectCapitalization(&info[U_MIDDLE]);
     }
     while (1) {
        int i;
@@ -372,6 +401,8 @@ GetUidNumberFromName()
     
     Prompt_input("First Name: ", first, BUFSIZ);
     Prompt_input("Last  Name: ", last, BUFSIZ);
+    FixCase(first);
+    FixCase(last);
 
     args[0] = first;
     args[1] = last;
This page took 0.177958 seconds and 5 git commands to generate.