Lines Matching refs:fp
106 rewind(state.collect.fp);
108 savedeadletter(state.collect.fp);
116 rewind(state.collect.fp);
117 savedeadletter(state.collect.fp);
147 exwrite(char* name, FILE* fp, int f)
163 if (filecopy(NiL, fp, name, of, NiL, (off_t)0, &lc, &cc, 0)) {
173 * Edit the message on state.collect.fp.
180 FILE* fp;
183 if (fp = run_editor(state.collect.fp, (off_t)-1, hp, c, 0)) {
184 fseek(fp, (off_t)0, SEEK_END);
185 fileclose(state.collect.fp);
186 state.collect.fp = fp;
198 pipemessage(FILE* fp, char* cmd)
210 if (run_command(state.var.shell, 0, fileno(fp), fileno(nf), "-c", cmd, NiL) < 0) {
223 state.collect.fp = nf;
224 fileclose(fp);
253 interpolate(char* ms, FILE* fp, int f, int followup)
288 if (copy(mp, fp, ignore, prefix, flags) < 0) {
314 part(FILE* fp, char* name, char* type, int code)
321 fprintf(fp, "\n--%s\n", state.part.out.boundary);
324 fprintf(fp, "Content-Type: %s", type);
326 fprintf(fp, "; charset=us-ascii");
328 fprintf(fp, "; name=\"%s\"", name);
329 fprintf(fp, "\nContent-Transfer-Encoding: %s\n", (code & CODE_64) ? "base64" : (code & CODE_QP) ? "quoted-printable" : "7bit");
331 fprintf(fp, "Content-Disposition: attachment; filename=\"%s\"\n", name);
332 fprintf(fp, "\n");
356 FILE* fp;
361 state.collect.fp = 0;
387 if (!(state.collect.fp = fileopen(state.tmp.mail, "Ew+")))
391 pp.fp = stdin;
392 if ((flags & INTERPOLATE) && interpolate("", state.collect.fp, 'm', 1) < 0)
395 rewind(state.collect.fp);
417 headset(&pp, NiL, pp.fp, hp, NiL, g|GDISPLAY);
444 c = readline(pp.fp, pp.buf, sizeof(pp.buf));
461 if (putline(state.collect.fp, pp.buf) < 0)
500 if (state.var.signature && (fp = fileopen(state.var.signature, "EXr"))) {
501 filecopy(state.var.signature, fp, state.var.signature, state.collect.fp, stdout, (off_t)0, NiL, NiL, 0);
502 fileclose(fp);
527 * to state.collect.fp.
535 if (!(fp = fileopen(s, "ERr")))
539 t = mimetype(state.part.mime, fp, s, &state.openstat);
546 while ((lc = getc(fp)) != EOF) {
552 part(state.collect.fp, s, t, code);
554 rewind(fp);
556 fileclose(fp);
584 if (!(fp = pipeopen(struse(state.path.temp), "r")))
588 else if (!(fp = iscmd(s) ? pipeopen(s + 1, "r") : fileopen(s, "ERr")))
593 while (readline(fp, pp.buf, LINESIZE) >= 0) {
595 if ((n = putline(state.collect.fp, pp.buf)) < 0) {
596 fileclose(fp);
601 fileclose(fp);
603 fprintf(state.collect.fp, "--%s--\n\n", state.part.out.boundary);
613 rewind(state.collect.fp);
626 if (interpolate(pp.buf + 2, state.collect.fp, c, 0) < 0)
643 putline(state.collect.fp, s);
653 rewind(state.collect.fp);
654 fp = stdout;
660 while ((c = getc(state.collect.fp)) != EOF)
662 if (!(fp = pipeopen(state.var.pager, "Jw")))
663 fp = stdout;
666 rewind(state.collect.fp);
668 fprintf(fp, "-------\nMessage contains:\n");
669 headout(fp, hp, GEDIT|GNL);
670 filecopy(NiL, state.collect.fp, NiL, fp, NiL, (off_t)0, NiL, NiL, 0);
672 fileclose(fp);
703 rewind(state.collect.fp);
704 exwrite(s, state.collect.fp, 1);
722 rewind(state.collect.fp);
723 pipemessage(state.collect.fp, &pp.buf[2]);
731 if (putline(state.collect.fp, &pp.buf[1]) < 0)
745 if (state.collect.fp) {
746 fileclose(state.collect.fp);
747 state.collect.fp = 0;
750 if (state.collect.fp) {
751 rewind(state.collect.fp);
756 if (fp = fileopen(state.tmp.edit, "EMw+")) {
757 fprintf(fp, "This is a multipart message in MIME format.\n");
759 while (s = fgets(state.path.path, sizeof(state.path.path), state.collect.fp)) {
762 putc('\n', fp);
775 part(fp, NiL, NiL, 0);
777 fputs(s, fp);
779 fprintf(fp, "\n--%s--\n\n", state.part.out.boundary);
780 fileclose(state.collect.fp);
782 state.collect.fp = fp;
783 rewind(state.collect.fp);
799 return state.collect.fp;
803 * Save fp in ${DEAD}.
806 savedeadletter(FILE* fp)
811 if (filesize(fp) && (s = deadletter()) && (dp = fileopen(s, "Ma"))) {
812 filecopy(NiL, fp, s, dp, NiL, (off_t)0, NiL, NiL, 0);
814 rewind(fp);