j = 1;
for (int i = 0; outp[i]; i++) {
j++;
- if (outp[i] == '\n' && outp[i+1] == '\n') i+=3;
- nl = (char *) realloc(nl, j);
- if (!nl) memfail();
- next[0] = outp[i+1];
- strncat(nl, next, 2);
+ if (outp[i] == '\n' && outp[i+1] == '\n') {
+ i++;
+ } else {
+ nl = (char *) realloc(nl, j);
+ if (!nl) memfail();
+ next[0] = outp[i];
+ strncat(nl, next, 2);
+ }
}
free(outp);
return nl;