[mw-devel] MW3 r1053 - trunk/src

pwb at sucs.org pwb at sucs.org
Thu Aug 7 18:31:31 BST 2008


Author: pwb
Date: 2008-08-07 18:31:30 +0100 (Thu, 07 Aug 2008)
New Revision: 1053

Modified:
   trunk/src/newmain.c
Log:
If .doing message is too long, tell the user by how much. Also use gettext.


Modified: trunk/src/newmain.c
===================================================================
--- trunk/src/newmain.c	2008-08-07 15:44:53 UTC (rev 1052)
+++ trunk/src/newmain.c	2008-08-07 17:31:30 UTC (rev 1053)
@@ -451,10 +451,11 @@
 void c_doing(CommandList *cm, int argc, char **argv, char *args)
 {
 	if (argc > 1) {
-		if (strlen(args) > DOINGSIZE-1) {
+		int overflow = (strlen(args) + 1) - DOINGSIZE;
+		if (overflow > 0) {
 			char status[DOINGSIZE];
 			snprintf(status, DOINGSIZE, "%s", args);
-			printf("Status too long, would have been trunacted to '%s'\n", status);
+			printf(_("Sorry, message is %d character%s too long (would be truncated to: '%s'). Try again.\n"), overflow, overflow > 1 ? "s" : "", status);
 			return;
 		}
 		snprintf(user->doing, DOINGSIZE, "%s", args);





More information about the mw-devel mailing list