Fix argument tokenizer
This commit is contained in:
parent
98e580f29c
commit
8b9a527ace
|
@ -6,7 +6,7 @@ project(microirc LANGUAGES C)
|
|||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Wall -Wextra -Werror -Wformat-overflow=2 -Wformat-security -Winit-self -Wstrict-overflow=2 -Wstringop-overflow=2 -Walloc-zero -Wduplicated-branches -Wduplicated-cond -Wtrampolines -Wfloat-equal -Wshadow -Wunsafe-loop-optimizations -Wparentheses -pedantic -fanalyzer -fstack-check)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-Weverything -pedantic)
|
||||
add_compile_options(-Weverything -Wno-padded -pedantic)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
|
|
|
@ -55,15 +55,16 @@ signed int Tok_mesg(char* str, IRC_Message* out)
|
|||
skip_spaces(&progr);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 15 && *progr; i++) {
|
||||
for (i = 0; i < 15 && *progr;) {
|
||||
if (i == 14 || *progr == ':') {
|
||||
out->args[i++] = (*progr == ':') ? progr + 1 : progr;
|
||||
out->trailing = true;
|
||||
break;
|
||||
} else {
|
||||
if ((out->args[i] = strtok_mr(&progr, " ")) == NULL)
|
||||
if ((out->args[i++] = strtok_mr(&progr, " ")) == NULL)
|
||||
return ERR_UIRC_INVALID_FORMAT;
|
||||
skip_spaces(&progr);
|
||||
}
|
||||
skip_spaces(&progr);
|
||||
}
|
||||
out->args[i] = NULL;
|
||||
return 1;
|
||||
|
|
Reference in New Issue