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.
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]);
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,
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;
Prompt_input("First Name: ", first, BUFSIZ);
Prompt_input("Last Name: ", last, BUFSIZ);
+ FixCase(first);
+ FixCase(last);
args[0] = first;
args[1] = last;