aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-05-20 19:46:20 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-05-20 19:46:20 +0000
commit48c99630a93560a4c40efdbe955e9a1e395a6162 (patch)
treeb9424125bb1f69713368cfeef5de3cc00a149c98 /src
parentd779018cf7e2ea8846ad9b305511f6b304c1ffc2 (diff)
downloadmailfromd-48c99630a93560a4c40efdbe955e9a1e395a6162.tar.gz
mailfromd-48c99630a93560a4c40efdbe955e9a1e395a6162.tar.bz2
Bugfixes
git-svn-id: file:///svnroot/mailfromd/trunk@1459 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'src')
-rw-r--r--src/lex.l21
-rw-r--r--src/pp.c10
2 files changed, 20 insertions, 11 deletions
diff --git a/src/lex.l b/src/lex.l
index e65f87b1..6c3e47ff 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -107,7 +107,7 @@ get_const(const char *name)
return 0;
}
-size_t input_line;
+static size_t input_line;
static void
advance_line()
@@ -167,15 +167,24 @@ MACRO {LOCUS}|{VMACRO}|__statedir__
<COMMENT>"*"+"/" BEGIN(INITIAL);
/* Configuration directives */
^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n parse_line_cpp(yytext, &locus);
-^[ \t]*#[ \t]*line[ \t].*\n {
+<INITIAL,COMMENT>^[ \t]*#[ \t]*line[ \t].*\n {
struct locus newloc;
memset(&newloc, 0, sizeof newloc);
parse_line(yytext, &newloc);
- if (is_stdin(newloc.file))
- locus.line += newloc.line - input_line;
- else
+
+ if (is_stdin(newloc.file)) {
+ if (newloc.line > input_line)
+ locus.line += newloc.line - input_line;
+ else {
+ size_t diff = input_line - newloc.line;
+ if (diff < locus.line)
+ locus.line -= diff;
+ }
+ input_line = newloc.line;
+ } else {
locus = newloc;
- input_line++;
+ input_line++;
+ }
}
^[ \t]*#[ \t]*pragma[ \t].*/\n parse_pragma(yytext);
^[ \t]*#[ \t]*error[ \t].*\n { parse_error("%s", yytext); advance_line(); }
diff --git a/src/pp.c b/src/pp.c
index d5aec559..38bf5888 100644
--- a/src/pp.c
+++ b/src/pp.c
@@ -401,7 +401,7 @@ pop_source()
}
static int
-try_file(const char *name, int allow_cwd, char **newp)
+try_file(const char *name, int allow_cwd, int err_not_found, char **newp)
{
static char *cwd = ".";
struct file_data fd;
@@ -422,7 +422,7 @@ try_file(const char *name, int allow_cwd, char **newp)
if (!fd.found) {
mu_list_do(std_include_path, find_include_file, &fd);
- if (!fd.found) {
+ if (!fd.found && err_not_found) {
parse_error_locus(&LOCUS,
_("%s: No such file or directory"), name);
*newp = NULL;
@@ -460,7 +460,7 @@ parse_include(const char *text, int once)
} else
allow_cwd = 1;
- if (p[0] != '/' && try_file(p, allow_cwd, &tmp))
+ if (p[0] != '/' && try_file(p, allow_cwd, 1, &tmp))
p = tmp;
}
@@ -511,7 +511,7 @@ parse_require(const char *text)
fname = NULL;
if (p[0] != '/') {
- if (try_file(p, 0, &tmp))
+ if (try_file(p, 0, 1, &tmp))
p = tmp;
else
p = NULL;
@@ -654,7 +654,7 @@ preprocess_input(char *extpp)
return EX_OSFILE;
}
- if (try_file("pp-setup", 1, &setup_file)) {
+ if (try_file("pp-setup", 1, 0, &setup_file)) {
FILE *infile = fopen(setup_file, "r");
if (!infile)
mu_error(_("Cannot open preprocessor setup file `%s': %s"),

Return to:

Send suggestions and report system problems to the System administrator.