mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-26 17:20:12 +01:00
4a5e57816c
Signed-off-by: Janos SUTO <sj@acts.hu>
37 lines
850 B
C
37 lines
850 B
C
/*
|
|
* common.c
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <locale.h>
|
|
#include <stdbool.h>
|
|
#include <assert.h>
|
|
#include "../src/piler.h"
|
|
|
|
|
|
int setup_and_parse_message(struct session_data *sdata, struct parser_state *state, struct data *data, char *filename, struct config *cfg){
|
|
struct stat st;
|
|
|
|
if(stat(filename, &st) != 0){
|
|
fprintf(stderr, "%s is not found, skipping\n", filename);
|
|
return 1;
|
|
}
|
|
|
|
init_session_data(sdata, cfg);
|
|
|
|
sdata->delivered = 0;
|
|
sdata->tot_len = st.st_size;
|
|
|
|
snprintf(sdata->ttmpfile, SMALLBUFSIZE-1, "%s", filename);
|
|
snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", filename);
|
|
snprintf(sdata->tmpframe, SMALLBUFSIZE-1, "%s.m", filename);
|
|
|
|
*state = parse_message(sdata, 1, data, cfg);
|
|
post_parse(sdata, state, cfg);
|
|
|
|
return 0;
|
|
}
|