-MEFIN: /* Now we're done typing the message. Before returning, append any
- * attachments the user has selected
- */
- if (strlen(boundary)==0) goto SKIPAT;
- fp = fopen(filename, "a");
- while (AttachList != NULL) {
- sprintf(buf, "uuencode %s <%s",
- AttachList->filename, AttachList->filename);
- atpipe = popen(buf, "r");
- if (atpipe != NULL) {
- fprintf(fp,"--%s\n", boundary);
- fprintf(fp,"Content-type: application/octet-stream;\n");
- fprintf(fp,"%cname=%c%s%c\n",
- 9, 34, AttachList->filename, 34);
- fprintf(fp,"Content-Transfer-Encoding: x-uudecode\n");
- fprintf(fp,"Content-Disposition: attachment;\n");
- fprintf(fp,"%cfilename=%c%s%c\n\n",
- 9, 34, AttachList->filename, 34);
- while (fgets(buf, 256, atpipe)!=NULL) {
- buf[strlen(buf)-1]=0;
- fprintf(fp, "%s\n", buf);
- }
- pclose(atpipe);
- }
- else {
- printf("*** Cannot open %s: %s\n",
- AttachList->filename, strerror(errno));
- }
- Aptr = AttachList->next;
- free(AttachList);
- AttachList = Aptr;
- }
- fprintf(fp, "--%s--\n", boundary); /* end of attachments */
- fclose(fp);
-
-SKIPAT: return(0);