X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=config.c;h=5ad8de624ea420f2b0d67060c0d3ad7f2d5ec035;hb=496ea4aee6c10fb6fa4d799df0df7ae34b4deb0b;hp=00cd0236bd22a3be2e6ce6c85f761e9e7746cbc4;hpb=528b4479a96491431b243bf02da43c792962fb27;p=debian%2Felilo diff --git a/config.c b/config.c index 00cd023..5ad8de6 100644 --- a/config.c +++ b/config.c @@ -255,7 +255,16 @@ next(VOID) back = 0; return ch; } - return getc(); +/* + * config files served from pxe/tftpboot windows servers can contain + * extraneous '\r' characters, often the first char in the file, and + * we need to simply skip over those and continue on + */ + ch = getc(); + if(ch == '\r') + ch = getc(); + + return ch; } /* @@ -310,13 +319,13 @@ get_token_core(CHAR16 *str, UINTN maxlen, BOOLEAN rhs) CHAR16 *here; for (;;) { - while ((ch = next()), ch == ' ' || ch == '\t' || ch == '\n') if (ch == '\n') line_num++; + while ((ch = next()), ch == ' ' || ch == '\t' || ch == '\n') if (ch == '\n' ) line_num++; if (ch == CHAR_EOF) return TOK_EOF; + /* skip comment line */ if (ch != '#') break; - /* skip comment line */ while ((ch = next()), ch != '\n') if (ch == CHAR_EOF) return TOK_EOF; line_num++; } @@ -762,7 +771,10 @@ config_parse(VOID) if (tok == TOK_EOF) break; - if (tok == TOK_ERR) return -1; + if (tok == TOK_ERR) { + Print(L"Bad Token from elilo config file, parser read: %s\n elilo exiting\n", str); + return -1; + } if ( (p = find_option(current_options, str)) == NULL) { config_error(L"Unkown option %s", str);