4 static void *file_parse __P((char **));
5 static void file_destroy __P((void *));
6 static int file_send __P((void *, ipmon_msg_t *));
7 static void file_print __P((void *));
8 static int file_match __P((void *, void *));
9 static void *file_dup __P((void *));
11 typedef struct file_opts_s {
18 ipmon_saver_t filesaver = {
35 ctx = calloc(1, sizeof(*ctx));
39 if (strings[0] != NULL && strings[0][0] != '\0') {
41 if (!strncmp(strings[0], "raw://", 6)) {
43 ctx->path = strdup(strings[0] + 6);
44 ctx->fp = fopen(ctx->path, "ab");
45 } else if (!strncmp(strings[0], "file://", 7)) {
46 ctx->path = strdup(strings[0] + 7);
47 ctx->fp = fopen(ctx->path, "a");
62 file_match(ctx1, ctx2)
65 file_opts_t *f1 = ctx1, *f2 = ctx2;
67 if (f1->raw != f2->raw)
69 if (strcmp(f1->path, f2->path))
90 file_opts_t *file = ctx;
96 printf("%s", file->path);
104 file_opts_t *file = ctx;
110 if (file->path != NULL)
121 file_opts_t *file = ctx;
124 fwrite(msg->imm_data, msg->imm_dsize, 1, file->fp);
126 fprintf(file->fp, "%s", msg->imm_msg);