📄 post.c
字号:
int len; char *cp; if (!fill_in && (flags & HBCC)) return; if (!nameoutput) { fprintf (out, "%s: ", name); linepos += (nameoutput = strlen (name) + 2); if (fill_in) linepos -= strlen (group); } cp = fill_in ? group : concat (group, ";", NULLCP); len = strlen (cp); if (linepos > nameoutput) if (len + linepos + 2 > outputlinelen) { fprintf (out, ",\n%*s", nameoutput, ""); linepos = nameoutput; } else { fputs (", ", out); linepos += 2; } fputs (cp, out); linepos += len;}/* */static int insert (np)register struct mailname *np;{ register struct mailname *mp; if (np -> m_mbox == NULL) return 0; for (mp = np -> m_type == LOCALHOST ? &localaddrs : np -> m_type == UUCPHOST ? &uuaddrs : &netaddrs; mp -> m_next; mp = mp -> m_next) if (uleq (np -> m_host, mp -> m_next -> m_host) && uleq (np -> m_mbox, mp -> m_next -> m_mbox) && np -> m_bcc == mp -> m_next -> m_bcc) return 0; mp -> m_next = np; recipients++; return 1;}static pl () { register int i; register struct mailname *mp; printf ("-------\n\t-- Addresses --\nlocal:\t"); for (mp = localaddrs.m_next; mp; mp = mp -> m_next) printf ("%s%s%s", mp -> m_mbox, mp -> m_bcc ? "[BCC]" : "", mp -> m_next ? ",\n\t" : ""); printf ("\nnet:\t"); for (mp = netaddrs.m_next; mp; mp = mp -> m_next) printf ("%s%s@%s%s%s", mp -> m_path ? mp -> m_path : "", mp -> m_mbox, mp -> m_host, mp -> m_bcc ? "[BCC]" : "", mp -> m_next ? ",\n\t" : ""); printf ("\nuucp:\t"); for (mp = uuaddrs.m_next; mp; mp = mp -> m_next) printf ("%s!%s%s", mp -> m_host, mp -> m_mbox, mp -> m_bcc ? "[BCC]" : "", mp -> m_next ? ",\n\t" : ""); printf ("\n\t-- Folder Copies --\nfcc:\t"); for (i = 0; i < fccind; i++) printf ("%s%s", fccfold[i], i + 1 < fccind ? ",\n\t" : ""); printf ("\n");}/* */static anno () { register struct mailname *mp; for (mp = localaddrs.m_next; mp; mp = mp -> m_next) if (annoaux (mp) == NOTOK) goto oops; for (mp = netaddrs.m_next; mp; mp = mp -> m_next) if (annoaux (mp) == NOTOK) goto oops; for (mp = uuaddrs.m_next; mp; mp = mp -> m_next) if (annoaux (mp) == NOTOK) break;oops: ; (void) close (pfd); pfd = NOTOK;}static int annoaux (mp)register struct mailname *mp;{ int i; char buffer[BUFSIZ]; (void) sprintf (buffer, "%s\n", adrformat (mp)); i = strlen (buffer); return (write (pfd, buffer, i) == i ? OK : NOTOK);}/* */static insert_fcc (hdr, pp)register struct headers *hdr;register char *pp;{ register char *cp; for (cp = pp; isspace (*cp); cp++) continue; for (pp += strlen (pp) - 1; pp > cp && isspace (*pp); pp--) continue; if (pp >= cp) *++pp = NULL; if (*cp == NULL) return; if (fccind >= FCCS) adios (NULLCP, "too many %ss", hdr -> value); fccfold[fccind++] = getcpy (cp);}/* BCC GENERATION */static make_bcc_file () { int fd, i, child_id; char *vec[6]; register FILE *out; (void) strcpy (bccfil, m_tmpfil ("bccs")); if ((out = fopen (bccfil, "w")) == NULL) adios (bccfil, "unable to create"); (void) chmod (bccfil, 0600); fprintf (out, "Date: %s\n", dtime (&clock)); if (msgid) fprintf (out, "Message-ID: <%d.%ld@%s>\n", getpid (), clock, LocalName ()); fprintf (out, "From: %s\n", signature);#ifdef X400 mtsval = msgxmts; /* If draft file has valid X-Mts, use it */ if (mtsval == NONEMTS) /* else if command line has valid mts */ mtsval = argxmts; /* use it, else use the default. */ if (mtsval == NONEMTS) mtsval = DEFMTS; fprintf (out, "X-Mts: %s\n", mts_vals[mtsval]);#endif X400 if (subject) fprintf (out, "Subject: %s", subject); fprintf (out, "BCC:\n\n------- Blind-Carbon-Copy\n\n"); (void) fflush (out); if (filter == NULL) { if ((fd = open (tmpfil, 0)) == NOTOK) adios (NULLCP, "unable to re-open"); cpydgst (fd, fileno (out), tmpfil, bccfil); (void) close (fd); } else { vec[0] = r1bindex (mhlproc, '/'); for (i = 0; (child_id = fork ()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: adios ("fork", "unable to"); case OK: (void) dup2 (fileno (out), 1); i = 1; vec[i++] = "-forward"; vec[i++] = "-form"; vec[i++] = filter; vec[i++] = tmpfil; vec[i] = NULL; execvp (mhlproc, vec); fprintf (stderr, "unable to exec "); perror (mhlproc); _exit (-1); default: (void) pidXwait (child_id, mhlproc); break; } } (void) fseek (out, 0L, 2); fprintf (out, "\n------- End of Blind-Carbon-Copy\n"); (void) fclose (out);}/* ADDRESS VERIFICATION */static verify_all_addresses (talk)int talk;{#ifndef MHMTS int retval;#endif not MHMTS#ifdef MMDFMTS#ifdef RP_NS int len; struct rp_bufstruct reply;#endif RP_NS#endif MMDFMTS register struct mailname *lp;#ifndef MHMTS sigon ();#endif not MHMTS#ifdef MMDFMTS if (!whomsw || checksw) { if (rp_isbad (retval = mm_init ()) || rp_isbad (retval = mm_sbinit ()) || rp_isbad (retval = mm_winit (NULLCP, submitopts, from))) die (NULLCP, "problem initializing MMDF system [%s]", rp_valstr (retval));#ifdef RP_NS if (rp_isbad (retval = mm_rrply (&reply, &len))) die (NULLCP, "problem with sender address [%s]", rp_valstr (retval));#endif RP_NS }#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) { if (!whomsw ||checksw) if (rp_isbad (retval = x400s_init (clientsw, serversw, 0, 0, snoop)) || rp_isbad (retval = x400s_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval)); } else#endif X400#ifdef SENDMTS if (!whomsw || checksw) if (rp_isbad (retval = sm_init (clientsw, serversw, 0, 0, snoop)) || rp_isbad (retval = sm_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval));#endif SENDMTS if (talk && !whomsw) printf (" -- Address Verification --\n");#ifndef BERK if (talk && localaddrs.m_next) printf (" -- Local Recipients --\n");#endif BERK for (lp = localaddrs.m_next; lp; lp = lp -> m_next) do_an_address (lp, talk, encryptsw);#ifndef BERK if (talk && uuaddrs.m_next) printf (" -- UUCP Recipients --\n");#endif BERK for (lp = uuaddrs.m_next; lp; lp = lp -> m_next) do_an_address (lp, talk, encryptsw);#ifndef BERK if (talk && netaddrs.m_next) printf (" -- Network Recipients --\n");#endif BERK for (lp = netaddrs.m_next; lp; lp = lp -> m_next) do_an_address (lp, talk, encryptsw); chkadr (); if (talk && !whomsw) printf (" -- Address Verification Successful --\n");#ifdef MMDFMTS if (!whomsw || checksw) (void) mm_end (NOTOK);#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) { if (!whomsw || checksw) (void) x400s_end (DONE); } else#endif X400#ifdef SENDMTS if (!whomsw || checksw) (void) sm_end (DONE);#endif SENDMTS (void) fflush (stdout);#ifndef MHMTS sigoff ();#endif not MHMTS}/* */static chkadr () {#define plural(x) (x == 1 ? "" : "s") if (badadr && unkadr) die (NULLCP, "%d address%s unparsable, %d addressee%s undeliverable", badadr, plural (badadr), unkadr, plural (badadr)); if (badadr) die (NULLCP, "%d address%s unparsable", badadr, plural (badadr)); if (unkadr) die (NULLCP, "%d addressee%s undeliverable", unkadr, plural (unkadr));}/* MTS INTERACTION */#ifdef TMAstatic postplain (file, bccque, talk)#else TMAstatic post (file, bccque, talk)#endif TMAregister char *file;int bccque, talk;{ int fd;#ifndef MHMTS int retval;#ifdef MMDFMTS#ifdef RP_NS int len; struct rp_bufstruct reply;#endif RP_NS#endif MMDFMTS#else MHMTS int ud;#endif MHMTS if (verbose) if (msgflags & MINV) printf (" -- Posting for %s %s Recipients --\n", bccque ? "Blind" : "Sighted", mts_vals[mtsval]); else printf (" -- Posting for All %s Recipients --\n",mts_vals[mtsval]); sigon ();#ifdef MMDFMTS if (rp_isbad (retval = mm_init ()) || rp_isbad (retval = mm_sbinit ()) || rp_isbad (retval = mm_winit (NULLCP, submitopts, from))) die (NULLCP, "problem initializing MMDF system [%s]", rp_valstr (retval));#ifdef RP_NS if (rp_isbad (retval = mm_rrply (&reply, &len))) die (NULLCP, "problem with sender address [%s]", rp_valstr (retval));#endif RP_NS#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) { if (rp_isbad (retval = x400s_init (clientsw, serversw, watch, verbose, snoop)) || rp_isbad (retval = x400s_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval)); } else#endif X400#ifdef SENDMTS if (rp_isbad (retval = sm_init (clientsw, serversw, watch, verbose, snoop)) || rp_isbad (retval = sm_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval));#endif SENDMTS#ifndef MHMTS do_addresses (bccque, talk && verbose); if ((fd = open (file, 0)) == NOTOK) die (file, "unable to re-open"); do_text (file, fd);#else MHMTS if ((fd = open (file, 0)) == NULL) adios (file, "unable to re-open");#ifdef MF ud = UucpChan () && uuaddrs.m_next ? make_uucp_file (fd) : NOTOK;#else not MF ud = NOTOK;#endif not MF do_addresses (file, fd, ud, bccque, talk && verbose); if (ud != NOTOK) (void) close (ud);#endif MHMTS (void) close (fd); (void) fflush (stdout);#ifdef MMDFMTS (void) mm_sbend (); (void) mm_end (OK);#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) (void) x400s_end (!(msgflags & MINV) || bccque ? OK : DONE); else#endif X400#ifdef SENDMTS (void) sm_end (!(msgflags & MINV) || bccque ? OK : DONE);#endif SENDMTS sigoff (); if (verbose) if (msgflags & MINV) printf (" -- %s Recipient Copies Posted --\n", bccque ? "Blind" : "Sighted"); else printf (" -- Recipient Copies Posted --\n"); (void) fflush (stdout);}/* */#ifdef TMAstatic postcipher (file, bccque, talk)register char *file;int bccque, talk;{ int fdP, state; char reason[BUFSIZ]; struct mailname *lp; if (verbose) if (msgflags & MINV) printf (" -- Posting for %s Recipients --\n", bccque ? "Blind" : "Sighted"); else printf (" -- Posting for All Recipients --\n"); if ((fdP = open (file, 0)) == NOTOK) adios (file, "unable to re-open"); if (ciphinit (fdP, reason) == NOTOK) adios (NULLCP, "%s", reason); (void) close (fdP); for (state = 0, lp = localaddrs.m_next; lp; lp = lp -> m_next) if (lp -> m_bcc ? bccque : !bccque) {#ifndef BERK if (talk && !state) printf (" -- Local Recipients --\n");#endif BERK do_a_cipher (lp, talk);#ifndef BERK state++;#endif BERK } for (state = 0, lp = uuaddrs.m_next; lp; lp = lp -> m_next) if (lp -> m_bcc ? bccque : !bccque) {#ifndef BERK if (talk && !state) printf (" -- UUCP Recipients --\n");#endif BERK do_a_cipher (lp, talk);#ifndef BERK state++;#endif BERK } for (state = 0, lp = netaddrs.m_next; lp; lp = lp -> m_next) if (lp -> m_bcc ? bccque : !bccque) {#ifndef BERK if (talk && !state) printf (" -- Network Recipients --\n");#endif BERK do_a_cipher (lp, talk);#ifndef BERK state++;#endif BERK } if (ciphdone (reason) == NOTOK) admonish (NULLCP, "%s", reason);#ifdef X400 if (mts_arg == X400MTS) { if (!(msgflags & MINV) || bccque) (void) x400s_end (OK); } else#endif X400#ifdef SENDMTS if (!(msgflags & MINV) || bccque) (void) sm_end (OK);#endif SENDMTS if (verbose) if (msgflags & MINV) printf (" -- %s Recipient Copies Posted --\n", bccque ? "Blind" : "Sighted"); else printf (" -- Recipient Copies Posted --\n"); (void) fflush (stdout);}/* */static do_a_cipher (lp, talk)register struct mailname *lp;int talk;{ int fd, retval; register char *mbox, *host; char addr[BUFSIZ], reason[BUFSIZ];#ifdef MMDFMTS#ifdef RP_NS int len; struct rp_bufstruct reply;#endif RP_NS#endif MMDFMTS sigon ();#ifdef MMDFMTS if (rp_isbad (retval = mm_init ()) || rp_isbad (retval = mm_sbinit ()) || rp_isbad (retval = mm_winit (NULL, submitopts, from))) die (NULLCP, "problem initializing MMDF system [%s]", rp_valstr (retval));#ifdef RP_NS if (rp_isbad (retval = mm_rrply (&reply, &len))) die (NULLCP, "problem with sender address [%s]", rp_valstr (retval));#endif RP_NS#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) { if (rp_isbad (retval = x400s_init (clientsw, serversw, watch, verbose, snoop)) || rp_isbad (retval = x400s_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval)); } else#endif X400#ifdef SENDMTS if (rp_isbad (retval = sm_init (clientsw, serversw, watch, verbose, snoop)) || rp_isbad (retval = sm_winit (smtpmode, from))) die (NULLCP, "problem initializing server; %s", rp_string (retval));#endif SENDMTS do_an_address (lp, talk, 0); switch (lp -> m_type) { case LOCALHOST: mbox = lp -> m_mbox; host = LocalName (); (void) strcpy (addr, mbox); break; case UUCPHOST: #ifdef MMDFMTS mbox = concat (lp -> m_host, "!", lp -> m_mbox, NULLCP); host = UucpChan ();#endif MMDFMTS#ifdef X400 if (mts_arg == X400MTS) { mbox = auxformat (lp, 0); host = NULL; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -