Skip to content

Commit 08c9138

Browse files
committed
remove DELIMITER and try both cases
1 parent 85e5faf commit 08c9138

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

cmatrix.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ int *updates = NULL; /* What does this do again? */
8787
volatile sig_atomic_t signal_status = 0; /* Indicates a caught signal */
8888
#endif
8989

90-
#ifdef _WIN32
91-
char *DELIMITER = "\r\n";
92-
#else
93-
char *DELIMITER = "\n";
94-
#endif
95-
9690
int va_system(char *str, ...) {
9791

9892
va_list ap;
@@ -901,9 +895,12 @@ if (console) {
901895
if(msg[i] == '\n')
902896
multiline++;
903897

904-
char *line = strtok(msg, DELIMITER);
905-
if (line == NULL)
906-
line = msg;
898+
char *line = strtok(msg, "\r\n");
899+
if (line == NULL) {
900+
line = strtok(msg, "\n");
901+
if (line == NULL)
902+
line = msg;
903+
}
907904

908905
int x_offset = -1 * multiline/2;
909906
int msg_x = LINES/2 + x_offset;
@@ -931,7 +928,9 @@ if (console) {
931928
for (i = 0; i < strlen(line)+4; i++)
932929
addch(' ');
933930

934-
line = strtok(NULL, DELIMITER);
931+
line = strtok(NULL, "\r\n");
932+
if (line == NULL)
933+
line = strtok(NULL, "\n");
935934
x_offset++;
936935
}
937936
}

0 commit comments

Comments
 (0)