X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Finclude.c;h=2f1fdeb2c1781c2c66fbc6254f5b8faf4471668a;hb=fe3a0a8896cc9f099196f0d0228bb0cfa688c34a;hp=3e9a5b7bfc7230d28e1997d452012bfd3473d19d;hpb=3816248a008a4af75aac6319d0c9929cb7ff679e;p=pspp-builds.git diff --git a/src/language/utilities/include.c b/src/language/utilities/include.c index 3e9a5b7b..2f1fdeb2 100644 --- a/src/language/utilities/include.c +++ b/src/language/utilities/include.c @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,9 +22,12 @@ #include #include #include -#include +#include +#include #include #include +#include + #include "gettext.h" #define _(msgid) gettext (msgid) @@ -33,6 +35,10 @@ int cmd_include (struct lexer *lexer, struct dataset *ds UNUSED) { + struct source_stream *ss; + char *found_fn; + char *target_fn; + /* Skip optional FILE=. */ if (lex_match_id (lexer, "FILE")) lex_match (lexer, '='); @@ -43,7 +49,20 @@ cmd_include (struct lexer *lexer, struct dataset *ds UNUSED) lex_error (lexer, _("expecting file name")); return CMD_CASCADING_FAILURE; } - getl_include_syntax_file (ds_cstr (lex_tokstr (lexer))); + + target_fn = ds_cstr (lex_tokstr (lexer)); + + ss = lex_get_source_stream (lexer); + found_fn = fn_search_path (target_fn, getl_include_path ( ss )); + + if (found_fn != NULL) + { + getl_include_source (ss, create_syntax_file_source (found_fn)); + free (found_fn); + } + else + msg (SE, _("Can't find `%s' in include file search path."), + target_fn); lex_get (lexer); return lex_end_of_command (lexer);