diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h index b4199a3236..4070b0385d 100644 --- a/lib/isc/include/isc/lex.h +++ b/lib/isc/include/isc/lex.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: lex.h,v 1.19 2000/06/22 21:57:39 tale Exp $ */ +/* $Id: lex.h,v 1.20 2000/07/10 05:11:18 marka Exp $ */ #ifndef ISC_LEX_H #define ISC_LEX_H 1 @@ -342,6 +342,20 @@ isc_lex_getsourceline(isc_lex_t *lex); * Current line number or 0 if no current source. */ +isc_boolean_t +isc_lex_isfile(isc_lex_t *lex); +/* + * Return whether the current input source is a file. + * + * Requires: + * 'lex' is a valid lexer. + * + * Returns: + * ISC_TRUE if the current input is a file, + * ISC_FALSE otherwise. + */ + + ISC_LANG_ENDDECLS #endif /* ISC_LEX_H */ diff --git a/lib/isc/lex.c b/lib/isc/lex.c index 80395fa56f..5a838a9a77 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: lex.c,v 1.31 2000/06/23 22:32:10 brister Exp $ */ +/* $Id: lex.c,v 1.32 2000/07/10 05:11:17 marka Exp $ */ #include @@ -718,3 +718,17 @@ isc_lex_getsourceline(isc_lex_t *lex) { return (source->line); } + +isc_boolean_t +isc_lex_isfile(isc_lex_t *lex) { + inputsource *source; + + REQUIRE(VALID_LEX(lex)); + + source = HEAD(lex->sources); + + if (source == NULL) + return (ISC_FALSE); + + return (source->is_file); +}