Re: [gnome-mud] Critical errors on startup, Seg Fault during key depression



On Wed, 2003-12-17 at 22:13, Jens Bech Madsen wrote:
> Definitely. I use lots of single character aliases. If those are
> expanded everywhere they appear in input strings, I will have a very
> hard time.
> 
> I think just expanding the first word makes sense. This is basically
> what all other clients I have tried do.
> 
> Comparing with tintin++, aliases are first word only, if you want
> expansion of a string everywhere, you use a substitution.

The attached patch should only expand the first word with no nested
alias.

Seems ok?


regards
Robin

-- 
Robin Ericsson <lobbin localhost nu>
? .net.c.swp
Index: net.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/net.c,v
retrieving revision 1.65
diff -u -p -u -r1.65 net.c
--- net.c	23 Nov 2003 19:43:51 -0000	1.65
+++ net.c	18 Dec 2003 13:47:28 -0000
@@ -82,10 +82,11 @@ gchar *host = "", *port = "";
 static void check_aliases(GString *string, CONNECTION_DATA *cd, gchar *t, gint level)
 {
 	gchar **a = g_strsplit (t," ", -1), *r;
+	gboolean checked = FALSE;
 
-	if (level > 5)
+	if (level > 0)
 	{
-		g_message("Maximum nested alias reached.");
+		//g_message("Maximum nested alias reached.");
 		append_word_to_command (string, t);
 		return;
 	}
@@ -94,9 +95,18 @@ static void check_aliases(GString *strin
 	{
 		gchar *b = *a++;
 		
-		if ((r = check_alias (cd->profile->alias, b)))
+		if (!checked)
 		{
-			check_aliases(string, cd, r, level+1);
+			if ((r = check_alias (cd->profile->alias, b)))
+			{
+				check_aliases(string, cd, r, level+1);
+			}
+			else
+			{
+				append_word_to_command (string, b);
+			}
+
+			checked = TRUE;
 		}
 		else
 		{


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]