Attempt to fix niggling quote bug

This commit is contained in:
Andrew Pamment 2017-09-12 11:17:34 +10:00
parent a259082692
commit d18accdbcb

View File

@ -951,6 +951,7 @@ int main(int argc, char **argv)
unwrapped_quote_len = strlen(unwrapped_quote); unwrapped_quote_len = strlen(unwrapped_quote);
} }
fgets(buffer, 80, fptr); fgets(buffer, 80, fptr);
} }
fclose(fptr); fclose(fptr);
@ -964,6 +965,7 @@ int main(int argc, char **argv)
continue; continue;
} }
} }
if (i < unwrapped_quote_len - 1) { if (i < unwrapped_quote_len - 1) {
if (unwrapped_quote[i+1] == ' ' || unwrapped_quote[i+1] == '\r') { if (unwrapped_quote[i+1] == ' ' || unwrapped_quote[i+1] == '\r') {
continue; continue;
@ -991,7 +993,7 @@ int main(int argc, char **argv)
if (unwrapped_quote[i] == '\r' || unwrapped_quote[i] == ' ' || i - last_space > 71) { if (unwrapped_quote[i] == '\r' || unwrapped_quote[i] == ' ' || i - last_space > 71) {
quote_lines[quote_line_count] = (char *)malloc(i - start_line + 6); quote_lines[quote_line_count] = (char *)malloc(i - start_line + 6);
memset(buffer, 0, 256); memset(buffer, 0, 256);
strncpy(buffer, &unwrapped_quote[start_line], 74); strncpy(buffer, &unwrapped_quote[start_line], (i - last_space > 71 ? 74 : 73));
sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer); sprintf(quote_lines[quote_line_count], " %c> %s", msgto[0], buffer);
j = 0; j = 0;
start_line = i+1; start_line = i+1;