Skip to content

Commit 75c2182

Browse files
committed
remove DELIMITER and try both cases
1 parent 85e5faf commit 75c2182

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

cmatrix.c

+9-11
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;
@@ -121,7 +115,6 @@ void finish(void) {
121115
exit(0);
122116
}
123117

124-
125118
/* What we do when we're all set to exit */
126119
void c_die(char *msg, ...) {
127120

@@ -901,9 +894,12 @@ if (console) {
901894
if(msg[i] == '\n')
902895
multiline++;
903896

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

908904
int x_offset = -1 * multiline/2;
909905
int msg_x = LINES/2 + x_offset;
@@ -931,7 +927,9 @@ if (console) {
931927
for (i = 0; i < strlen(line)+4; i++)
932928
addch(' ');
933929

934-
line = strtok(NULL, DELIMITER);
930+
line = strtok(NULL, "\r\n");
931+
if (line == NULL)
932+
line = strtok(NULL, "\n");
935933
x_offset++;
936934
}
937935
}

0 commit comments

Comments
 (0)