3 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
6 readline(FILE* stream, char **buf, size_t *n)
14 *buf = calloc(512, sizeof(char));
21 for (i=0; (ch = fgetc(stream)) != EOF; i++)
24 *buf = xbt_realloc(*buf, *n += 512);
29 if(cr && (*buf)[i] != '\n')
31 /* old Mac os uses CR */
35 /* move to the previous pos (pos of the CR) */
36 fsetpos(stream, &pos);
38 /* process as linux now */
46 /* Windows uses CRLF */
63 /* register the CR position for mac */
64 fgetpos(stream, &pos);
70 *buf = xbt_realloc(*buf, *n += 1);
72 /* Mac os file ended with a blank line */
73 if(ch == EOF && (*buf)[i - 1] == '\r')