+Thu Jun 21 17:10:08 CEST 2001 Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+ * Fixed the silc_parse_command_line to remove extra spaces
+ from the start and end of the arguments. Affected file is
+ lib/silcutil/silcutil.c.
+
Tue Jun 19 22:10:36 EEST 2001 Pekka Riikonen <priikone@poseidon.pspt.fi>
* Fixed a possible crash in silc_packet_send_prepare. It now
o LEAVE does not work correctly, it doesn't leave the channel for real!
- o The input line parser in client (librarys) doesn't like extra spaces
- at the end of line (like after commands).
-
o /KICK does not remove the client from Irssi's NAMES list.
o Giving KILL command crashes the client.
int i, len = 0;
int argc = 0;
const char *cp = buffer;
+ char *tmp;
*parsed = silc_calloc(1, sizeof(**parsed));
*parsed_lens = silc_calloc(1, sizeof(**parsed_lens));
/* Get the command first */
len = strcspn(cp, " ");
- (*parsed)[0] = silc_to_upper((char *)cp);
+ tmp = silc_to_upper((char *)cp);
+ (*parsed)[0] = silc_calloc(len + 1, sizeof(char));
+ memcpy((*parsed)[0], tmp, len);
+ silc_free(tmp);
(*parsed_lens)[0] = len;
- cp += len + 1;
+ cp += len;
+ while (*cp == ' ')
+ cp++;
argc++;
/* Parse arguments */
len = strcspn(cp, " ");
else
len = strlen(cp);
+ while (len && cp[len - 1] == ' ')
+ len--;
+ if (!len)
+ break;
*parsed = silc_realloc(*parsed, sizeof(**parsed) * (argc + 1));
*parsed_lens = silc_realloc(*parsed_lens,
if (strlen(cp) == 0)
break;
else
- cp++;
+ while (*cp == ' ')
+ cp++;
}
}