+ unlink(f->name);
+ free(f);
+end:
+ //FIXME: what to do with exit code when pipe failed?
+ destroy_email(em);
+}
+
+static void
+do_pipe(char* program, struct list* hash)
+{
+ struct email em = prepare_email(hash);
+ struct procstat* f;
+ int res = 0;
+ char* buf;
+ off_t pos;
+
+ f = pipe_to(program, &em);
+ if (!f) {
+ res++;
+ goto end;
+ }
+ pos = lseek(f->fd, 0, SEEK_END);
+ lseek(f->fd, 0, SEEK_SET);
+ buf = xmalloc(pos);
+
+ read(f->fd, buf, pos);
+ //set_last_pipe_var(buf);
+ free(buf);
+