2 ** mhstore.c -- store the contents of MIME messages
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
11 #include <h/signals.h>
17 #include <h/mhparse.h>
20 static struct swit switches[] = {
25 #define FILESW 2 /* interface from show */
30 { "type content", 0 },
42 extern char *tmp; /* directory to place temp files */
47 extern char *parts[NPARTS + 1];
48 extern char *types[NTYPES + 1];
53 #define quitser pipeser
56 CT parse_mime(char *);
61 void set_endian(void);
62 void flush_errors(void);
65 void free_content(CT);
66 extern CT *cts; /* The list of top-level contents to display */
67 void freects_done(int) NORETURN;
72 static void pipeser(int);
77 ** Cache of current directory. This must be
78 ** set before these routines are called.
83 ** The directory in which to store the contents.
88 ** Type for a compare function for qsort. This keeps
89 ** the compiler happy.
91 typedef int (*qsort_comp) (const void *, const void *);
97 int make_intermediates(char *);
98 void flush_errors(void);
101 int show_content_aux(CT, int, char *, char *);
106 static void store_single_message(CT);
107 static int store_switch(CT);
108 static int store_generic(CT);
109 static int store_application(CT);
110 static int store_multi(CT);
111 static int store_partial(CT);
112 static int store_external(CT);
113 static int ct_compar(CT *, CT *);
114 static int store_content(CT, CT);
115 static int output_content_file(CT, int);
116 static int output_content_folder(char *, char *);
117 static int parse_format_string(CT, char *, char *, int, char *);
118 static void get_storeproc(CT);
119 static int copy_some_headers(FILE *, CT);
120 static void store_all_messages(CT *);
124 main(int argc, char **argv)
127 char *cp, *file = NULL, *folder = NULL;
128 char *maildir, buf[100], **argp;
130 struct msgs_array msgs = { 0, 0, NULL };
131 struct msgs *mp = NULL;
138 setlocale(LC_ALL, "");
140 invo_name = mhbasename(argv[0]);
142 /* read user profile/context */
145 arguments = getarguments(invo_name, argc, argv, 1);
151 while ((cp = *argp++)) {
153 switch (smatch(++cp, switches)) {
155 ambigsw(cp, switches);
158 adios(NULL, "-%s unknown", cp);
161 snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
162 print_help(buf, switches, 1);
165 print_version(invo_name);
176 if (!(cp = *argp++) || *cp == '-')
177 adios(NULL, "missing argument to %s",
180 adios(NULL, "too many parts (starting with %s), %d max", cp, NPARTS);
185 if (!(cp = *argp++) || *cp == '-')
186 adios(NULL, "missing argument to %s",
189 adios(NULL, "too many types (starting with %s), %d max", cp, NTYPES);
194 if (!(cp = *argp++) || (*cp == '-' && cp[1]))
195 adios(NULL, "missing argument to %s",
197 file = *cp == '-' ? cp : getcpy(expanddir(cp));
205 if (*cp == '+' || *cp == '@') {
207 adios(NULL, "only one folder at a time!");
209 folder = getcpy(expandfol(cp));
211 app_msgarg(&msgs, cp);
214 /* null terminate the list of acceptable parts/types */
221 ** Check if we've specified an additional profile
223 if ((cp = getenv("MHSTORE"))) {
224 if ((fp = fopen(cp, "r"))) {
225 readconfig((struct node **) 0, fp, cp, 0);
228 admonish("", "unable to read $MHSTORE profile (%s)",
234 ** Read the standard profile setup
236 if ((fp = fopen(cp = etcpath("mhn.defaults"), "r"))) {
237 readconfig((struct node **) 0, fp, cp, 0);
242 ** Cache the current directory before we do any chdirs()'s.
247 ** Check for storage directory. If specified,
248 ** then store temporary files there. Else we
249 ** store them in standard nmh directory.
251 if ((cp = context_find(nmhstorage)) && *cp)
252 tmp = concat(cp, "/", invo_name, NULL);
254 tmp = getcpy(toabsdir(invo_name));
256 if (file && msgs.size)
257 adios(NULL, "cannot specify msg and file at same time!");
260 ** check if message is coming from file
263 if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts))))
264 adios(NULL, "out of memory");
267 if ((ct = parse_mime(file)))
271 ** message(s) are coming from a folder
274 app_msgarg(&msgs, seq_cur);
276 folder = getcurfol();
277 maildir = toabsdir(folder);
279 if (chdir(maildir) == NOTOK)
280 adios(maildir, "unable to change directory to");
282 /* read folder and create message structure */
283 if (!(mp = folder_read(folder)))
284 adios(NULL, "unable to read folder %s", folder);
286 /* check for empty folder */
288 adios(NULL, "no messages in %s", folder);
290 /* parse all the message ranges/sequences and set SELECTED */
291 for (msgnum = 0; msgnum < msgs.size; msgnum++)
292 if (!m_convert(mp, msgs.msgs[msgnum]))
294 seq_setprev(mp); /* set the previous-sequence */
296 if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
298 adios(NULL, "out of memory");
301 for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
302 if (is_selected(mp, msgnum)) {
305 msgnam = m_name(msgnum);
306 if ((ct = parse_mime(msgnam)))
316 SIGNAL(SIGQUIT, quitser);
317 SIGNAL(SIGPIPE, pipeser);
320 ** Get the associated umask for the relevant contents.
322 for (ctp = cts; *ctp; ctp++) {
326 if (type_ok(ct, 1) && !ct->c_umask) {
327 if (stat(ct->c_file, &st) != NOTOK)
328 ct->c_umask = ~(st.st_mode & 0777);
330 ct->c_umask = ~m_gmprot();
335 ** Store the message content
337 store_all_messages(cts);
339 /* Now free all the structures for the content */
340 for (ctp = cts; *ctp; ctp++)
346 /* If reading from a folder, do some updating */
348 context_replace(curfolder, folder); /* update current folder */
349 seq_setcur(mp, mp->hghsel); /* update current message */
350 seq_save(mp); /* synchronize sequences */
351 context_save(); /* save the context file */
365 fprintf(stderr, "\n");
375 ** Main entry point to store content from a collection of messages.
378 store_all_messages(CT *cts)
384 ** Check for the directory in which to
385 ** store any contents.
389 if ((cp = context_find(nmhstorage)) && *cp)
394 for (ctp = cts; *ctp; ctp++) {
396 store_single_message(ct);
404 ** Entry point to store the content
405 ** in a (single) message
409 store_single_message(CT ct)
411 if (type_ok(ct, 1)) {
418 if (ct->c_ceclosefnx)
419 (*ct->c_ceclosefnx) (ct);
425 ** Switching routine to store different content types
431 switch (ct->c_type) {
433 return store_multi(ct);
437 switch (ct->c_subtype) {
438 case MESSAGE_PARTIAL:
439 return store_partial(ct);
442 case MESSAGE_EXTERNAL:
443 return store_external(ct);
447 return store_generic(ct);
453 return store_application(ct);
460 return store_generic(ct);
464 adios(NULL, "unknown content type %d", ct->c_type);
468 return OK; /* NOT REACHED */
473 ** Generic routine to store a MIME content.
474 ** (audio, video, image, text, message/rfc922)
481 ** Check if the content specifies a filename.
482 ** Don't bother with this for type "message"
483 ** (only "message/rfc822" will use store_generic).
485 if (autosw && ct->c_type != CT_MESSAGE)
488 return store_content(ct, NULL);
493 ** Store content of type "application"
497 store_application(CT ct)
500 CI ci = &ct->c_ctinfo;
502 /* Check if the content specifies a filename */
507 ** If storeproc is not defined, and the content is type
508 ** "application/octet-stream", we also check for various
509 ** attribute/value pairs which specify if this a tar file.
511 if (!ct->c_storeproc && ct->c_subtype == APPLICATION_OCTETS) {
512 int tarP = 0, zP = 0, gzP = 0;
514 for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
515 /* check for "type=tar" attribute */
516 if (!mh_strcasecmp(*ap, "type")) {
517 if (mh_strcasecmp(*ep, "tar"))
524 /* check for "conversions=compress" attribute */
525 if ((!mh_strcasecmp(*ap, "conversions") ||
526 !mh_strcasecmp(*ap, "x-conversions"))
527 && (!mh_strcasecmp(*ep, "compress") ||
528 !mh_strcasecmp(*ep, "x-compress"))) {
532 /* check for "conversions=gzip" attribute */
533 if ((!mh_strcasecmp(*ap, "conversions") ||
534 !mh_strcasecmp(*ap, "x-conversions"))
535 && (!mh_strcasecmp(*ep, "gzip") ||
536 !mh_strcasecmp(*ep, "x-gzip"))) {
543 ct->c_showproc = getcpy(zP ? "%euncompress | tar tvf -" : (gzP ? "%egzip -dc | tar tvf -" : "%etar tvf -"));
544 if (!ct->c_storeproc) {
546 ct->c_storeproc = getcpy(zP ? "| uncompress | tar xvpf -" : (gzP ? "| gzip -dc | tar xvpf -" : "| tar xvpf -"));
549 ct->c_storeproc= getcpy(zP ? "%m%P.tar.Z" : (gzP ? "%m%P.tar.gz" : "%m%P.tar"));
555 return store_content(ct, NULL);
560 ** Store the content of a multipart message
567 struct multipart *m = (struct multipart *) ct->c_ctparams;
571 for (part = m->mp_parts; part; part = part->mp_next) {
572 CT p = part->mp_part;
574 if (part_ok(p, 1) && type_ok(p, 1)) {
575 result = store_switch(p);
576 if (result == OK && ct->c_subtype == MULTI_ALTERNATE)
586 ** Reassemble and store the contents of a collection
587 ** of messages of type "message/partial".
596 struct partial *pm, *qm;
598 qm = (struct partial *) ct->c_ctparams;
603 for (ctp = cts; *ctp; ctp++) {
605 if (p->c_type == CT_MESSAGE && p->c_subtype == ct->c_subtype) {
606 pm = (struct partial *) p->c_ctparams;
607 if (!pm->pm_stored &&
608 strcmp(qm->pm_partid, pm->pm_partid)
610 pm->pm_marked = pm->pm_partno;
621 advise(NULL, "missing (at least) last part of multipart message");
625 if ((base = (CT *) calloc((size_t) (i + 1), sizeof(*base))) == NULL)
626 adios(NULL, "out of memory");
629 for (ctp = cts; *ctp; ctp++) {
631 if (p->c_type == CT_MESSAGE && p->c_subtype == ct->c_subtype) {
632 pm = (struct partial *) p->c_ctparams;
640 qsort((char *) base, i, sizeof(*base), (qsort_comp) ct_compar);
643 for (ctq = base; *ctq; ctq++) {
645 pm = (struct partial *) p->c_ctparams;
646 if (pm->pm_marked != cur) {
647 if (pm->pm_marked == cur - 1) {
648 admonish(NULL, "duplicate part %d of %d part multipart message", pm->pm_marked, hi);
653 advise (NULL, "missing %spart %d of %d part multipart message", cur != hi ? "(at least) " : "", cur, hi);
664 ** Now cycle through the sorted list of messages of type
665 ** "message/partial" and save/append them to a file.
670 if (store_content(ct, NULL) == NOTOK) {
676 for (; *ctq; ctq++) {
678 if (store_content(p, ct) == NOTOK)
688 ** Store content from a message of type "message/external".
692 store_external(CT ct)
695 struct exbody *e = (struct exbody *) ct->c_ctparams;
696 CT p = e->eb_content;
702 ** Check if the parameters for the external body
703 ** specified a filename.
708 if ((cp = e->eb_name) && *cp != '/' && *cp != '.' &&
709 *cp != '|' && *cp != '!' && !strchr(cp, '%')) {
710 if (!ct->c_storeproc)
711 ct->c_storeproc = getcpy(cp);
713 p->c_storeproc = getcpy(cp);
718 ** Since we will let the Content structure for the
719 ** external body substitute for the current content,
720 ** we temporarily change its partno (number inside
721 ** multipart), so everything looks right.
723 p->c_partno = ct->c_partno;
725 /* we probably need to check if content is really there */
726 result = store_switch(p);
734 ** Compare the numbering from two different
735 ** message/partials (needed for sorting).
739 ct_compar(CT *a, CT *b)
741 struct partial *am = (struct partial *) ((*a)->c_ctparams);
742 struct partial *bm = (struct partial *) ((*b)->c_ctparams);
744 return (am->pm_marked - bm->pm_marked);
749 ** Store contents of a message or message part to
750 ** a folder, a file, the standard output, or pass
751 ** the contents to a command.
753 ** If the current content to be saved is a followup part
754 ** to a collection of messages of type "message/partial",
755 ** then field "p" is a pointer to the Content structure
756 ** to the first message/partial in the group.
760 store_content(CT ct, CT p)
762 int appending = 0, msgnum = 0;
763 int is_partial = 0, first_partial = 0;
764 int last_partial = 0;
765 char *cp, buffer[BUFSIZ];
768 ** Do special processing for messages of
769 ** type "message/partial".
771 ** We first check if this content is of type
772 ** "message/partial". If it is, then we need to check
773 ** whether it is the first and/or last in the group.
775 ** Then if "p" is a valid pointer, it points to the Content
776 ** structure of the first partial in the group. So we copy
777 ** the file name and/or folder name from that message. In
778 ** this case, we also note that we will be appending.
780 if (ct->c_type == CT_MESSAGE && ct->c_subtype == MESSAGE_PARTIAL) {
781 struct partial *pm = (struct partial *) ct->c_ctparams;
783 /* Yep, it's a message/partial */
786 /* But is it the first and/or last in the collection? */
787 if (pm->pm_partno == 1)
789 if (pm->pm_maxno && pm->pm_partno == pm->pm_maxno)
793 ** If "p" is a valid pointer, then it points to the
794 ** Content structure for the first message in the group.
795 ** So we just copy the filename or foldername information
796 ** from the previous iteration of this function.
800 ct->c_storage = getcpy(p->c_storage);
802 /* record the folder name */
804 ct->c_folder = getcpy(p->c_folder);
811 ** Get storage formatting string.
813 ** 1) If we have storeproc defined, then use that
814 ** 2) Else check for a mhstore-store-<type>/<subtype> entry
815 ** 3) Else check for a mhstore-store-<type> entry
816 ** 4) Else if content is "message", use "+" (current folder)
817 ** 5) Else use string "%m%P.%s".
819 if ((cp = ct->c_storeproc) == NULL || *cp == '\0') {
820 CI ci = &ct->c_ctinfo;
822 snprintf(buffer, sizeof(buffer), "%s-store-%s/%s",
823 invo_name, ci->ci_type, ci->ci_subtype);
824 if ((cp = context_find(buffer)) == NULL || *cp == '\0') {
825 snprintf(buffer, sizeof(buffer), "%s-store-%s",
826 invo_name, ci->ci_type);
827 if ((cp = context_find(buffer)) == NULL ||
829 cp = ct->c_type == CT_MESSAGE ?
836 ** Check the beginning of storage formatting string
837 ** to see if we are saving content to a folder.
839 if (*cp == '+' || *cp == '@') {
840 char *tmpfilenam, *folder;
842 /* Store content in temporary file for now */
843 tmpfilenam = m_mktemp(invo_name, NULL, NULL);
844 ct->c_storage = getcpy(tmpfilenam);
846 /* Get the folder name */
848 folder = getcpy(expandfol(cp));
850 folder = getcurfol();
852 /* Check if folder exists */
853 create_folder(toabsdir(folder), 0, exit);
855 /* Record the folder name */
856 ct->c_folder = getcpy(folder);
865 ** Parse and expand the storage formatting string
866 ** in `cp' into `buffer'.
868 parse_format_string(ct, cp, buffer, sizeof(buffer), dir);
871 ** If formatting begins with '|' or '!', then pass
872 ** content to standard input of a command and return.
874 if (buffer[0] == '|' || buffer[0] == '!')
875 return show_content_aux(ct, 0, buffer + 1, dir);
877 /* record the filename */
878 ct->c_storage = getcpy(buffer);
881 /* flush the output stream */
884 /* Now save or append the content to a file */
885 if (output_content_file(ct, appending) == NOTOK)
889 ** If necessary, link the file into a folder and remove
890 ** the temporary file. If this message is a partial,
891 ** then only do this if it is the last one in the group.
893 if (ct->c_folder && (!is_partial || last_partial)) {
894 msgnum = output_content_folder(ct->c_folder, ct->c_storage);
895 unlink(ct->c_storage);
901 ** Now print out the name/number of the message
902 ** that we are storing.
906 fprintf(stderr, "reassembling partials ");
908 fprintf(stderr, "%s", ct->c_file);
910 fprintf(stderr, "%s,", ct->c_file);
912 fprintf(stderr, "storing message %s", ct->c_file);
914 fprintf(stderr, " part %s", ct->c_partno);
918 ** Unless we are in the "middle" of group of message/partials,
919 ** we now print the name of the file, folder, and/or message
920 ** to which we are storing the content.
922 if (!is_partial || last_partial) {
924 fprintf(stderr, " to folder %s as message %d\n",
925 ct->c_folder, msgnum);
926 } else if (strcmp(ct->c_storage, "-")==0) {
927 fprintf(stderr, " to stdout\n");
931 cwdlen = strlen(cwd);
932 fprintf(stderr, " as file %s\n",
933 strncmp(ct->c_storage, cwd,
935 ct->c_storage[cwdlen] != '/' ?
937 ct->c_storage + cwdlen + 1);
946 ** Output content to a file
950 output_content_file(CT ct, int appending)
953 char *file, buffer[BUFSIZ];
958 ** If the pathname is absolute, make sure
959 ** all the relevant directories exist.
961 if (strchr(ct->c_storage, '/') && make_intermediates(ct->c_storage)
965 if (ct->c_encoding != CE_7BIT) {
968 if (!ct->c_ceopenfnx) {
969 advise(NULL, "don't know how to decode part %s of message %s", ct->c_partno, ct->c_file);
973 file = appending || strcmp(ct->c_storage, "-")==0 ?
974 NULL : ct->c_storage;
975 if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
977 if (strcmp(file, ct->c_storage)==0) {
978 (*ct->c_ceclosefnx) (ct);
983 ** Send to standard output
985 if (strcmp(ct->c_storage, "-")==0) {
988 if ((gd = dup(fileno(stdout))) == NOTOK) {
989 advise("stdout", "unable to dup");
991 (*ct->c_ceclosefnx) (ct);
994 if ((fp = fdopen(gd, appending ? "a" : "w")) == NULL) {
995 advise("stdout", "unable to fdopen (%d, \"%s\") from", gd, appending ? "a" : "w");
1003 if ((fp = fopen(ct->c_storage, appending ? "a" : "w"))
1005 advise(ct->c_storage, "unable to fopen for %s",
1007 "appending" : "writing");
1013 ** Filter the header fields of the initial enclosing
1014 ** message/partial into the file.
1016 if (ct->c_type == CT_MESSAGE && ct->c_subtype == MESSAGE_PARTIAL) {
1017 struct partial *pm = (struct partial *) ct->c_ctparams;
1019 if (pm->pm_partno == 1)
1020 copy_some_headers(fp, ct);
1024 switch (cc = read(fd, buffer, sizeof(buffer))) {
1026 advise(file, "error reading content from");
1033 fwrite(buffer, sizeof(*buffer), cc, fp);
1039 (*ct->c_ceclosefnx) (ct);
1041 if (cc != NOTOK && fflush(fp))
1042 advise(ct->c_storage, "error writing to");
1046 return (cc != NOTOK ? OK : NOTOK);
1049 if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
1050 advise(ct->c_file, "unable to open for reading");
1056 fseek(ct->c_fp, pos, SEEK_SET);
1058 if (strcmp(ct->c_storage, "-")==0) {
1061 if ((gd = dup(fileno(stdout))) == NOTOK) {
1062 advise("stdout", "unable to dup");
1065 if ((fp = fdopen(gd, appending ? "a" : "w")) == NULL) {
1066 advise("stdout", "unable to fdopen (%d, \"%s\") from",
1067 gd, appending ? "a" : "w");
1072 if ((fp = fopen(ct->c_storage, appending ? "a" : "w"))
1074 advise(ct->c_storage, "unable to fopen for %s",
1075 appending ? "appending" : "writing");
1081 ** Copy a few of the header fields of the initial
1082 ** enclosing message/partial into the file.
1085 if (ct->c_type == CT_MESSAGE && ct->c_subtype == MESSAGE_PARTIAL) {
1086 struct partial *pm = (struct partial *) ct->c_ctparams;
1088 if (pm->pm_partno == 1) {
1089 copy_some_headers(fp, ct);
1094 while (fgets(buffer, sizeof(buffer) - 1, ct->c_fp)) {
1095 if ((pos += strlen(buffer)) > last) {
1098 diff = strlen(buffer) - (pos - last);
1100 buffer[diff] = '\0';
1103 ** If this is the first content of a group of
1104 ** message/partial contents, then we only copy a few
1105 ** of the header fields of the enclosed message.
1108 switch (buffer[0]) {
1111 if (filterstate < 0)
1120 if (!uprf(buffer, XXX_FIELD_PRF) && !uprf(buffer, VRSN_FIELD) && !uprf(buffer, "Subject:") && !uprf(buffer, "Message-ID:")) {
1135 advise(ct->c_storage, "error writing to");
1145 ** Add a file to a folder.
1147 ** Return the new message number of the file
1148 ** when added to the folder. Return -1, if
1149 ** there is an error.
1153 output_content_folder(char *folder, char *filename)
1158 /* Read the folder. */
1159 if ((mp = folder_read(folder))) {
1160 /* Link file into folder */
1161 msgnum = folder_addmsg(&mp, filename, 0, 0, 0, 0, NULL);
1163 advise(NULL, "unable to read folder %s", folder);
1167 /* free folder structure */
1171 ** Return msgnum. We are relying on the fact that
1172 ** msgnum will be -1, if folder_addmsg() had an error.
1179 ** Parse and expand the storage formatting string
1180 ** pointed to by "cp" into "buffer".
1184 parse_format_string(CT ct, char *cp, char *buffer, int buflen, char *dir)
1188 CI ci = &ct->c_ctinfo;
1191 ** If storage string is "-", just copy it, and
1192 ** return (send content to standard output).
1194 if (cp[0] == '-' && cp[1] == '\0') {
1195 strncpy(buffer, cp, buflen);
1203 ** If formatting string is a pathname that doesn't
1204 ** begin with '/', then preface the path with the
1205 ** appropriate directory.
1207 if (*cp != '/' && *cp != '|' && *cp != '!') {
1208 snprintf(bp, buflen, "%s/", dir[1] ? dir : "");
1216 /* We are processing a storage escape */
1221 ** Insert parameters from Content-Type.
1222 ** This is only valid for '|' commands.
1224 if (buffer[0] != '|' && buffer[0] != '!') {
1233 for (ap=ci->ci_attrs, ep=ci->ci_values;
1235 snprintf(bp, buflen,
1247 /* insert message number */
1248 snprintf(bp, buflen, "%s",
1249 mhbasename(ct->c_file));
1253 /* insert part number with leading dot */
1255 snprintf(bp, buflen, ".%s",
1260 /* insert part number withouth leading dot */
1262 strncpy(bp, ct->c_partno, buflen);
1266 /* insert content type */
1267 strncpy(bp, ci->ci_type, buflen);
1271 /* insert content subtype */
1272 strncpy(bp, ci->ci_subtype, buflen);
1276 /* insert the character % */
1286 /* Advance bp and decrement buflen */
1304 ** Check if the content specifies a filename
1305 ** in its MIME parameters.
1309 get_storeproc(CT ct)
1311 char **ap, **ep, *cp;
1312 CI ci = &ct->c_ctinfo;
1315 ** If the storeproc has already been defined,
1316 ** we just return (for instance, if this content
1317 ** is part of a "message/external".
1319 if (ct->c_storeproc)
1323 ** Check the attribute/value pairs, for the attribute "name".
1324 ** If found, do a few sanity checks and copy the value into
1327 for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
1328 if (!mh_strcasecmp(*ap, "name") && *(cp = *ep) != '/' &&
1329 *cp != '.' && *cp != '|' && *cp != '!' &&
1331 ct->c_storeproc = getcpy(cp);
1339 ** Copy some of the header fields of the initial message/partial
1340 ** message into the header of the reassembled message.
1344 copy_some_headers(FILE *out, CT ct)
1348 hp = ct->c_first_hf; /* start at first header field */
1352 ** A few of the header fields of the enclosing
1353 ** messages are not copied.
1355 if (!uprf(hp->name, XXX_FIELD_PRF) &&
1356 mh_strcasecmp(hp->name, VRSN_FIELD) &&
1357 mh_strcasecmp(hp->name, "Subject") &&
1358 mh_strcasecmp(hp->name, "Message-ID"))
1359 fprintf(out, "%s:%s", hp->name, hp->value);
1360 hp = hp->next; /* next header field */