continue;
}
char* tmp = str;
- str = sn_strcat(tmp, line);
+ str = sn_strcat3(tmp, line, "\n");
free(tmp);
if(br == 0) {
sn_eval(sn, str, strlen(str));
}
if(cbuf[0] != '\r' && cbuf[0] != '\n') {
char* tmp = str;
- str = sn_strcat(tmp, cbuf);
+ str = sn_strcat3(tmp, cbuf, "\n");
free(tmp);
}
#endif
return str;
}
+char* sn_strcat3(const char* str1, const char* str2, const char* str3) {
+ char* tmp = sn_strcat(str1, str2);
+ char* r = sn_strcat(tmp, str3);
+ free(tmp);
+ return r;
+}
+
char* sn_strdup(const char* str1) {
char* str = malloc(strlen(str1) + 1);
memcpy(str, str1, strlen(str1));
#include <stdio.h>
char* sn_strcat(const char* str1, const char* str2);
+char* sn_strcat3(const char* str1, const char* str2, const char* str3);
char* sn_strdup(const char* str1);
void sn_print_to(FILE* f, struct sn_generic* gen);
void sn_print_generic(struct sn_generic* gen);