Compare commits
2 Commits
37aab9b79b
...
6672ecac58
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6672ecac58 | ||
|
|
c8b5621df1 |
12
src/msh.c
12
src/msh.c
@@ -457,12 +457,24 @@ int main(int argc, char** argv) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// oldline is only valid while reading
|
||||||
|
if (oldline != NULL) {
|
||||||
|
free(oldline);
|
||||||
|
oldline = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
putc('\n', stdout);
|
putc('\n', stdout);
|
||||||
|
|
||||||
tcsetattr(fileno(stdin), 0, &orig_term);
|
tcsetattr(fileno(stdin), 0, &orig_term);
|
||||||
|
|
||||||
line[linelen] = 0;
|
line[linelen] = 0;
|
||||||
|
|
||||||
|
if (linelen == 0) {
|
||||||
|
free(line);
|
||||||
|
line = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(historyfile, "%s\n", line);
|
fprintf(historyfile, "%s\n", line);
|
||||||
fflush(historyfile);
|
fflush(historyfile);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user