|
|
|
@@ -195,6 +195,8 @@ char* read_line() { |
|
|
|
size_t lenmax = 100, len = lenmax; |
|
|
|
int c; |
|
|
|
|
|
|
|
int nesting = 0; |
|
|
|
|
|
|
|
if(line == NULL) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
@@ -215,8 +217,14 @@ char* read_line() { |
|
|
|
linep = linen; |
|
|
|
} |
|
|
|
|
|
|
|
if((*line++ = (char)c) == '\n') |
|
|
|
break; |
|
|
|
*line++; |
|
|
|
if((*line = (char)c) == '(') |
|
|
|
++nesting; |
|
|
|
else if((*line = (char)c) == ')') |
|
|
|
--nesting; |
|
|
|
else if((*line = (char)c) == '\n') |
|
|
|
if (nesting == 0) |
|
|
|
break; |
|
|
|
} |
|
|
|
(*line)--; // we dont want the \n actually |
|
|
|
*line = '\0'; |
|
|
|
|