Fixes for external protocols part 2

This commit is contained in:
Andrew Pamment 2016-12-10 18:51:23 +10:00
parent d386f58b08
commit 001e61af74

13
files.c
View File

@ -378,7 +378,18 @@ int do_download(struct user_record *user, char *file) {
download_command[bpos] = '\0'; download_command[bpos] = '\0';
} }
} }
argc = 1;
last_char_space = 0;
for (i=0;i<strlen(download_command);i++) {
if (download_command[i] == ' ') {
if (!last_char_space) {
argc++;
last_char_space = 1;
}
} else {
last_char_space = 0;
}
}
bpos = 1; bpos = 1;
arguments = (char **)malloc(sizeof(char *) * (argc + 1)); arguments = (char **)malloc(sizeof(char *) * (argc + 1));
len = strlen(download_command); len = strlen(download_command);