File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -594,6 +594,7 @@ int SortStricmp(const void *p1, const void *p2);
594
594
595
595
size_t COM_strclr (char * s );
596
596
char * COM_StripQuotes (char * s );
597
+ char * COM_Trim (char * s );
597
598
598
599
// buffer safe operations
599
600
size_t Q_strlcpy (char * dst , const char * src , size_t size );
Original file line number Diff line number Diff line change @@ -658,12 +658,12 @@ static void Cmd_If_f(void)
658
658
if (matched ) {
659
659
// execute branch 1
660
660
if (i > j ) {
661
- Cbuf_InsertText (cmd_current , Cmd_RawArgsFrom (j ));
661
+ Cbuf_InsertText (cmd_current , COM_StripQuotes ( COM_Trim ( Cmd_RawArgsFrom (j )) ));
662
662
}
663
663
} else {
664
664
// execute branch 2
665
665
if (++ i < Cmd_Argc ()) {
666
- Cbuf_InsertText (cmd_current , Cmd_RawArgsFrom (i ));
666
+ Cbuf_InsertText (cmd_current , COM_StripQuotes ( Cmd_RawArgsFrom (i ) ));
667
667
}
668
668
}
669
669
}
Original file line number Diff line number Diff line change @@ -348,6 +348,21 @@ char *COM_StripQuotes(char *s)
348
348
return s ;
349
349
}
350
350
351
+ char * COM_Trim (char * s )
352
+ {
353
+ size_t len ;
354
+
355
+ while (* s && * s <= ' ' )
356
+ s ++ ;
357
+
358
+ len = strlen (s );
359
+ while (len > 0 && s [len - 1 ] <= ' ' )
360
+ len -- ;
361
+
362
+ s [len ] = 0 ;
363
+ return s ;
364
+ }
365
+
351
366
/*
352
367
============
353
368
va
You can’t perform that action at this time.
0 commit comments