[mw-devel] MW3 r1257 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Sat May 26 00:18:29 BST 2012


Author: welshbyte
Date: 2012-05-26 00:18:29 +0100 (Sat, 26 May 2012)
New Revision: 1257

Modified:
   trunk/src/Makefile
   trunk/src/user.c
Log:
Improve the use of defaults on user creation. Also add a testclean make rule to get rid of the test directory.


Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2012-05-18 11:23:54 UTC (rev 1256)
+++ trunk/src/Makefile	2012-05-25 23:18:29 UTC (rev 1257)
@@ -75,7 +75,7 @@
 	-rm -f *.o *.d mw del_user
 
 ifndef TESTDIR
-test:
+test testclean:
 	make TESTDIR=$(CURDIR)/mwtest $@
 else
 test:
@@ -86,4 +86,6 @@
 	done
 	make libdir="$(TESTDIR)" localstatedir="$(TESTDIR)"
 
+testclean: clean
+	rm -rf "$(TESTDIR)"
 endif

Modified: trunk/src/user.c
===================================================================
--- trunk/src/user.c	2012-05-18 11:23:54 UTC (rev 1256)
+++ trunk/src/user.c	2012-05-25 23:18:29 UTC (rev 1257)
@@ -261,6 +261,10 @@
 		char buff[11];
 		printf(_("What status do you want to be ? [rms] "));
 		get_str(buff,10);
+		if (buff[0] == '\0')
+		{ /* User just hit return so use the defaults */
+			strcpy(buff, "rms");
+		}
 		tmp->status=user_stats(buff,0);
 		show_user_stats(tmp->status,buff,false);
 		printf(_("Status set to [%s]\n"),buff);
@@ -280,8 +284,12 @@
 	char passwd[PASSWDSIZE],passwd2[PASSWDSIZE],salt[3];
 	char c[10];
 	do{
-		printf(_("Did I get your name right %s ? y/n: "),name);
+		printf(_("Did I get your name right %s ? [Y]/n: "),name);
 		get_str(c,9);
+		if (c[0] == '\0')
+		{ /* User just hit return so use the default answer */
+			strcpy(c, "y");
+		}
 	}while (!*c);
 	if(*c=='y' || *c=='Y')
 	{




More information about the mw-devel mailing list