- if (!esc) {
- int c; // getc() returns an int
- //int i;
-
-
- status = 0;
- while (!feof(file) && !status) {
- c = getc(file);
- if (c == '#') {
- // Read rest of line (fast :-)
- fgets(buff, sizeof(buff), file);
- ++lineno;
- continue;
- }
-
- if (c == '\"') {
- int i = -1;
- do {
- c = getc(file);
- if (c != '\r')
- buff[++i] = c;
- } while (c!= '\"' && c!= '\n' && !feof(file) &&
- i!= (LEX_MAX_BUFF-2));
-
- if (i == (LEX_MAX_BUFF-2)) {
- printError("Line too long");
- c = '\"'; // Pretend we got a "
- ++i;
- }
-
- if (c!= '\"') {
- printError("Missing quote");
- if (c == '\n')
- ++lineno;
- }
-
- buff[i] = '\0';
- status = LEX_DATA;
- break;
- }
-
- if (c == ',')
- continue; /* Skip ','s */
-
- if (c > ' ' && !feof(file)) {
- int i = 0;
- do {
- buff[i++] = c;
- c = getc(file);
- } while (c > ' ' && c != ',' && !feof(file) &&
- (i != LEX_MAX_BUFF-1) );
- if (i == LEX_MAX_BUFF-1) {
- printError("Line too long");
- }
- buff[i] = '\0';
- status = LEX_TOKEN;
- }
-
- if (c == '\r' && !feof(file)) {
- // The Windows support has lead to the
- // possibility of "\r\n" at the end of
- // a line. This will stop LyX choking
- // when it expected to find a '\n'
- c = getc(file);
- }