mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
added a debug option to the parse_line function
This commit is contained in:
parent
eb44c74036
commit
97ca851780
@ -64,6 +64,7 @@ struct _parse_rule config_parse_rules[] =
|
|||||||
{ "clamd_addr", "string", (void*) string_parser, offsetof(struct __config, clamd_addr), "", MAXVAL-1},
|
{ "clamd_addr", "string", (void*) string_parser, offsetof(struct __config, clamd_addr), "", MAXVAL-1},
|
||||||
{ "clamd_port", "integer", (void*) int_parser, offsetof(struct __config, clamd_port), "0", sizeof(int)},
|
{ "clamd_port", "integer", (void*) int_parser, offsetof(struct __config, clamd_port), "0", sizeof(int)},
|
||||||
{ "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1},
|
{ "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1},
|
||||||
|
{ "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)},
|
||||||
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
|
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
|
||||||
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
|
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
|
||||||
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
|
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
|
||||||
|
@ -63,6 +63,8 @@ struct __config {
|
|||||||
int memcached_to_db_interval;
|
int memcached_to_db_interval;
|
||||||
|
|
||||||
int archive_emails_not_having_message_id;
|
int archive_emails_not_having_message_id;
|
||||||
|
|
||||||
|
int debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,6 +142,8 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
|||||||
char *p, *q, puf[SMALLBUFSIZE];
|
char *p, *q, puf[SMALLBUFSIZE];
|
||||||
int x, n, len, b64_len, boundary_line=0;
|
int x, n, len, b64_len, boundary_line=0;
|
||||||
|
|
||||||
|
if(cfg->debug == 1) printf("line: %s", buf);
|
||||||
|
|
||||||
state->line_num++;
|
state->line_num++;
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
|
|||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
|
|
||||||
all: parser view
|
all: parser debug
|
||||||
|
|
||||||
parser: parser.c ../src/libpiler.a
|
parser: parser.c ../src/libpiler.a
|
||||||
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $^ -lpiler $(LIBS) $(LIBDIR)
|
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $^ -lpiler $(LIBS) $(LIBDIR)
|
||||||
|
|
||||||
view: view.c ../src/libpiler.a
|
debug: debug.c ../src/libpiler.a
|
||||||
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $^ -lpiler $(LIBS) $(LIBDIR)
|
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $^ -lpiler $(LIBS) $(LIBDIR)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@ -38,7 +38,7 @@ test:
|
|||||||
./parser
|
./parser
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f parser view
|
rm -f parser debug
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
|
@ -42,6 +42,8 @@ int main(int argc, char **argv){
|
|||||||
snprintf(sdata.filename, SMALLBUFSIZE-1, "%s", argv[1]);
|
snprintf(sdata.filename, SMALLBUFSIZE-1, "%s", argv[1]);
|
||||||
snprintf(sdata.tmpframe, SMALLBUFSIZE-1, "%s.m", argv[1]);
|
snprintf(sdata.tmpframe, SMALLBUFSIZE-1, "%s.m", argv[1]);
|
||||||
|
|
||||||
|
cfg.debug = 1;
|
||||||
|
|
||||||
state = parse_message(&sdata, 0, &cfg);
|
state = parse_message(&sdata, 0, &cfg);
|
||||||
post_parse(&sdata, &state, &cfg);
|
post_parse(&sdata, &state, &cfg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user