X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Finclude.c;h=52d0e09c91dec5b559e8c86104917f08cad2b5dd;hb=52c400a0ac67e4a43c5cae5a0d40e1452326240c;hp=8e69dab50c6260f63795d569c910ab48cd743c47;hpb=c3ac5a8af9c449072c7e872ca70a78c1755ae309;p=pspp
diff --git a/src/language/utilities/include.c b/src/language/utilities/include.c
index 8e69dab50c..52d0e09c91 100644
--- a/src/language/utilities/include.c
+++ b/src/language/utilities/include.c
@@ -15,15 +15,20 @@
along with this program. If not, see . */
#include
+
#include
+#include
#include
+#include
+#include
+
+#include
#include
-#include
-#include
-#include
#include
+#include
+#include
+#include
#include
-#include
#include "dirname.h"
#include "xalloc.h"
@@ -86,8 +91,8 @@ cmd_insert (struct lexer *lexer, struct dataset *ds UNUSED)
syntax_mode = GETL_BATCH;
else
{
- lex_error(lexer,
- _("Expecting BATCH or INTERACTIVE after SYNTAX."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "BATCH", "INTERACTIVE", "SYNTAX");
return CMD_FAILURE;
}
}
@@ -104,7 +109,8 @@ cmd_insert (struct lexer *lexer, struct dataset *ds UNUSED)
}
else
{
- lex_error (lexer, _("Expecting YES or NO after CD."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "YES", "NO", "CD");
return CMD_FAILURE;
}
}
@@ -121,7 +127,8 @@ cmd_insert (struct lexer *lexer, struct dataset *ds UNUSED)
}
else
{
- lex_error (lexer, _("Expecting CONTINUE or STOP after ERROR."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "CONTINUE", "STOP", "ERROR");
return CMD_FAILURE;
}
}
@@ -171,7 +178,7 @@ parse_insert (struct lexer *lexer, char **filename)
lex_match (lexer, '=');
/* File name can be identifier or string. */
- if (lex_token (lexer) != T_ID && lex_token (lexer) != T_STRING)
+ if (lex_token (lexer) != T_ID && !lex_is_string (lexer))
{
lex_error (lexer, _("expecting file name"));
return CMD_FAILURE;
@@ -191,6 +198,13 @@ parse_insert (struct lexer *lexer, char **filename)
}
*filename = relative_filename;
+ if (*filename == NULL)
+ {
+ msg (SE, _("Unable to open `%s': %s."),
+ relative_filename, strerror (errno));
+ free (relative_filename);
+ return CMD_FAILURE;
+ }
return CMD_SUCCESS;
}