Add arg err_pos to add_include_stream.  Use error there instead of fprintf.
@@ -1944,12 +1944,12 @@ static void pre_finish (c2m_ctx_t c2m_ctx) {
free (c2m_ctx->pre_ctx);
}
-static void add_include_stream (c2m_ctx_t c2m_ctx, const char *fname) {
+static void add_include_stream (c2m_ctx_t c2m_ctx, const char *fname, pos_t err_pos) {
FILE *f;
assert (fname != NULL);
if ((f = fopen (fname, "r")) == NULL) {
- if (options->message_file != NULL) fprintf (stderr, "error in opening file %s\n", fname);
+ if (options->message_file != NULL) error (c2m_ctx, err_pos, "error in opening file %s", fname);
longjmp (c2m_ctx->env, 1); // ???
}
add_stream (c2m_ctx, f, fname, NULL);
@@ -2790,7 +2790,7 @@ static void process_directive (c2m_ctx_t c2m_ctx) {
error (c2m_ctx, t->pos, "more %d include levels", VARR_LENGTH (stream_t, streams) - 1);
goto ret;
}
- add_include_stream (c2m_ctx, name);
+ add_include_stream (c2m_ctx, name, t->pos);
} else if (strcmp (t->repr, "line") == 0) {
skip_nl (c2m_ctx, NULL, temp_buffer);
unget_next_pptoken (c2m_ctx, new_token (c2m_ctx, t->pos, "", T_EOP, N_IGNORE));
