Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
ae09a5a6
...
ae09a5a6b1893087a8b2fa6285f4439dcb484bb0
authored
2002-11-13 13:35:55 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use sieve_compile_error() to report parse errors.
1 parent
91aa105c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
22 deletions
libsieve/require.c
libsieve/sieve.l
libsieve/util.c
libsieve/require.c
View file @
ae09a5a
...
...
@@ -34,8 +34,8 @@ sieve_require (list_t slist)
status
=
iterator_create
(
&
itr
,
slist
);
if
(
status
)
{
sieve_
error
(
"%s:%d: cannot create iterator: %s"
,
sieve_filename
,
sieve_line_num
,
sieve_
compile_error
(
sieve_filename
,
sieve_line_num
,
"cannot create iterator: %s"
,
mu_errstring
(
status
));
return
;
}
...
...
@@ -51,8 +51,9 @@ sieve_require (list_t slist)
reg
=
sieve_action_lookup
(
s
);
if
(
!
reg
)
{
sieve_error
(
"%s:%d: source for the required action %s is not available"
,
sieve_filename
,
sieve_line_num
,
s
);
sieve_compile_error
(
sieve_filename
,
sieve_line_num
,
"source for the required action %s is not available"
,
s
);
break
;
}
reg
->
required
=
1
;
...
...
libsieve/sieve.l
View file @
ae09a5a
...
...
@@ -117,7 +117,7 @@ lex_set_buffer (FILE *fp)
if (!buf)
{
sieve_
error (
"not enough memory");
sieve_
compile_error (sieve_filename, sieve_line_num,
"not enough memory");
abort ();
}
...
...
@@ -218,8 +218,8 @@ push_source (const char *name)
if (stat (name, &st))
{
sieve_
error ("can't stat `%s': %s", name, strerror (errno));
yyerror ("can't include file"
);
sieve_
compile_error (sieve_filename, sieve_line_num,
"can't stat `%s': %s", name, strerror (errno)
);
return 1;
}
...
...
@@ -232,10 +232,12 @@ push_source (const char *name)
{
yyerror ("recursive inclusion");
if (ctx->prev)
sieve_error ("%s:%d: `%s' already included here",
ctx->prev->filename, ctx->prev->line, name);
sieve_compile_error (ctx->prev->filename, ctx->prev->line,
"`%s' already included here",
name);
else
sieve_error ("`%s' already included at top level",
sieve_compile_error (sieve_filename, sieve_line_num,
"`%s' already included at top level",
name);
return 1;
}
...
...
@@ -243,8 +245,8 @@ push_source (const char *name)
fp = fopen (name, "r");
if (!fp)
{
sieve_
error ("can't open `%s': %s", name, strerror (errno));
yyerror ("can't include file"
);
sieve_
compile_error (sieve_filename, sieve_line_num,
"can't open `%s': %s", name, strerror (errno)
);
return 1;
}
...
...
@@ -470,7 +472,8 @@ multiline_begin ()
status = list_create (&string_list);
if (status)
{
sieve_error ("list_create: %s", mu_errstring (status));
sieve_compile_error (sieve_filename, sieve_line_num,
"list_create: %s", mu_errstring (status));
exit (1);
}
}
...
...
libsieve/util.c
View file @
ae09a5a
...
...
@@ -144,20 +144,31 @@ sieve_value_create (sieve_data_type type, void *data)
break
;
default:
sieve_
error
(
"Invalid data type"
);
sieve_
compile_error
(
sieve_filename
,
sieve_line_num
,
"Invalid data type"
);
abort
();
}
return
val
;
}
void
sieve_
error
(
const
char
*
fmt
,
...)
sieve_
compile_error
(
const
char
*
filename
,
int
linenum
,
const
char
*
fmt
,
...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
sieve_error_count
++
;
sieve_machine
->
error_printer
(
sieve_machine
->
data
,
fmt
,
ap
);
sieve_machine
->
parse_error_printer
(
sieve_machine
->
data
,
filename
,
linenum
,
fmt
,
ap
);
va_end
(
ap
);
}
void
sieve_error
(
sieve_machine_t
*
mach
,
const
char
*
fmt
,
...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
mach
->
error_printer
(
mach
->
data
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -187,6 +198,15 @@ _sieve_default_error_printer (void *unused, const char *fmt, va_list ap)
return
mu_verror
(
fmt
,
ap
);
}
int
_sieve_default_parse_error
(
void
*
unused
,
const
char
*
filename
,
int
lineno
,
const
char
*
fmt
,
va_list
ap
)
{
fprintf
(
stderr
,
"%s:%d: "
,
filename
,
lineno
);
vfprintf
(
stderr
,
fmt
,
ap
);
return
0
;
}
char
*
sieve_type_str
(
sieve_data_type
type
)
{
...
...
@@ -304,10 +324,4 @@ sieve_print_tag_list (list_t list, sieve_printf_t printer, void *data)
list_do
(
list
,
(
list_action_t
*
)
tag_printer
,
&
dbg
);
}
void
sieve_set_debug
(
sieve_machine_t
*
mach
,
sieve_printf_t
debug
,
int
level
)
{
mach
->
debug_printer
=
debug
;
mach
->
debug_level
=
level
;
}
...
...
Please
register
or
sign in
to post a comment