Superfluous trailing space in alias

If you've had any problems with Nexuiz, or would like to report bugs, post here.

Moderators: Nexuiz Moderators, Moderators

Superfluous trailing space in alias

Postby Nil » Mon Jun 04, 2007 7:07 pm

When creating an alias in "static void Cmd_Alias_f (void)" in cmd.c (rev. 7312) a " " gets appended to each "command" argument if there are more than 1. Thus an "alias changename name some name" will result in name = "some name " when executed.
I would think that the condition for appending " " could rather look like this:
Code: Select all
=== cmd.c
==================================================================
--- cmd.c       (revision 4737)
+++ cmd.c       (local)
@@ -466,7 +466,7 @@
        for (i=2 ; i< c ; i++)
        {
                strlcat (cmd, Cmd_Argv(i), sizeof (cmd));
-               if (i != c)
+               if (i + 1 < c)
                        strlcat (cmd, " ", sizeof (cmd));
        }
        strlcat (cmd, "\n", sizeof (cmd));
Nil
Advanced member
 
Posts: 81
Joined: Wed Mar 01, 2006 5:10 pm

Postby divVerent » Mon Jun 04, 2007 9:16 pm

Reported to the engine author, however, as a workaround, alias changename "name \"somename\"" should work fine.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby Nil » Mon Jun 04, 2007 9:24 pm

divVerent wrote:alias changename "name "somename"" should work fine.

Yeah, it does. :) Thanks!
Nil
Advanced member
 
Posts: 81
Joined: Wed Mar 01, 2006 5:10 pm

Postby divVerent » Mon Jun 04, 2007 10:14 pm

Another workaround: append a semicolon:

alias changename "name yournewname;"

contrary to \", this should also work in previous versions.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE


Return to Nexuiz - Support / Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron