X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Futilities%2Finclude.c;h=473f67513072485ce153c753f80134fcfa13fed3;hb=fa1e2f50efc0b7b8a9436b40568eadf03feae9dc;hp=bcee162c6a04f56e44a01164d0c7af87662cba62;hpb=e195fccfab97205acb29f90fd1168488d49f1573;p=pspp diff --git a/src/language/utilities/include.c b/src/language/utilities/include.c index bcee162c6a..473f675130 100644 --- a/src/language/utilities/include.c +++ b/src/language/utilities/include.c @@ -23,7 +23,6 @@ #include #include "data/dataset.h" -#include "data/file-name.h" #include "data/session.h" #include "language/command.h" #include "language/lexer/include-path.h" @@ -59,14 +58,13 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) if (lex_match_id (lexer, "FILE")) lex_match (lexer, T_EQUALS); - /* File name can be identifier or string. */ - if (lex_token (lexer) != T_ID && !lex_is_string (lexer)) - { - lex_error (lexer, _("expecting file name")); - return CMD_FAILURE; - } + if (!lex_force_string_or_id (lexer)) + return CMD_FAILURE; relative_name = utf8_to_filename (lex_tokcstr (lexer)); + if (NULL == relative_name) + return CMD_FAILURE; + filename = include_path_search (relative_name); free (relative_name); @@ -94,6 +92,7 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) free (encoding); encoding = xstrdup (lex_tokcstr (lexer)); + lex_get (lexer); } else if (variant == INSERT && lex_match_id (lexer, "SYNTAX")) { @@ -106,8 +105,8 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) syntax_mode = LEX_SYNTAX_AUTO; else { - lex_error (lexer, _("expecting %s, %s, or %s after %s"), - "BATCH", "INTERACTIVE", "AUTO", "SYNTAX"); + lex_error_expecting (lexer, "BATCH", "INTERACTIVE", "AUTO", + NULL_SENTINEL); goto exit; } } @@ -124,8 +123,7 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) } else { - lex_error (lexer, _("expecting %s or %s after %s"), - "YES", "NO", "CD"); + lex_error_expecting (lexer, "YES", "NO", NULL_SENTINEL); goto exit; } } @@ -142,8 +140,7 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant) } else { - lex_error (lexer, _("expecting %s or %s after %s"), - "CONTINUE", "STOP", "ERROR"); + lex_error_expecting (lexer, "CONTINUE", "STOP", NULL_SENTINEL); goto exit; } }