- debug_printf ("retrieving message from stdin\n");
- if ((fd = copy_message (fileno (stdin), tmpfil, 1)) == -1)
- adios (NULL, "unable to create temporary file");
- }
-
- if (debug)
- debug_printf ("temporary file=\"%s\"\n", tmpfil);
-
- /* Delete the temp file now or a copy of every single message passed through
- slocal will be left in the /tmp directory until deleted manually! This
- unlink() used to be under an 'else' of the 'if (debug)' above, but since
- some people like to always run slocal with -debug and log the results,
- the /tmp directory would get choked over time. Of course, now that we
- always delete the temp file, the "temporary file=" message above is
- somewhat pointless -- someone watching debug output wouldn't have a
- chance to 'tail -f' or 'ln' the temp file before it's unlinked. The best
- thing would be to delay this unlink() until later if debug == 1, but I'll
- leave that for someone who cares about the temp-file-accessing
- functionality (they'll have to watch out for cases where we adios()). */
- unlink (tmpfil);
-
- if (!(fp = fdopen (fd, "r+")))
- adios (NULL, "unable to access temporary file");
-
- /*
- * If no sender given, extract it
- * from envelope information. */
- if (sender == NULL)
- get_sender (envelope, &sender);
-
- if (mbox == NULL) {
- snprintf (mailbox, sizeof(mailbox), "%s/%s",
- mmdfldir[0] ? mmdfldir : pw->pw_dir,
- mmdflfil[0] ? mmdflfil : pw->pw_name);
- mbox = mailbox;
- }
- if (home == NULL)
- home = pw->pw_dir;
-
- if (debug) {
- debug_printf ("addr=\"%s\"\n", trim(addr));
- debug_printf ("user=\"%s\"\n", trim(user));
- debug_printf ("info=\"%s\"\n", trim(info));
- debug_printf ("sender=\"%s\"\n", trim(sender));
- debug_printf ("envelope=\"%s\"\n", envelope ? trim(envelope) : "");
- debug_printf ("mbox=\"%s\"\n", trim(mbox));
- debug_printf ("home=\"%s\"\n", trim(home));
- debug_printf ("ddate=\"%s\"\n", trim(ddate));
- debug_printf ("now=%02d:%02d\n\n", now->tw_hour, now->tw_min);
- }
-
- /* deliver the message */
- status = localmail (fd, mdlvr);
-
- done (status != -1 ? RCV_MOK : RCV_MBX);
- return 1;
+ debug_printf("temporary file=\"%s\"\n", tmpfil);
+
+ /*
+ ** Delete the temp file now or a copy of every single message
+ ** passed through slocal will be left in the /tmp directory until
+ ** deleted manually! This unlink() used to be under an 'else'
+ ** of the 'if (debug)' above, but since some people like to
+ ** always run slocal with -debug and log the results, the /tmp
+ ** directory would get choked over time. Of course, now that
+ ** we always delete the temp file, the "temporary file=" message
+ ** above is somewhat pointless -- someone watching debug output
+ ** wouldn't have a chance to 'tail -f' or 'ln' the temp file
+ ** before it's unlinked. The best thing would be to delay this
+ ** unlink() until later if debug == 1, but I'll leave that for
+ ** someone who cares about the temp-file-accessing functionality
+ ** (they'll have to watch out for cases where we adios()).
+ */
+ unlink(tmpfil);
+
+ if (!(fp = fdopen(fd, "r+")))
+ adios(NULL, "unable to access temporary file");
+
+ /*
+ ** If no sender given, extract it
+ ** from envelope information.
+ */
+ if (sender == NULL)
+ get_sender(envelope, &sender);
+
+ if (mbox == NULL) {
+ snprintf(mailbox, sizeof(mailbox), "%s/%s",
+ mmdfldir[0] ? mmdfldir : pw->pw_dir,
+ mmdflfil[0] ? mmdflfil : pw->pw_name);
+ mbox = mailbox;
+ }
+ if (home == NULL)
+ home = pw->pw_dir;
+
+ if (debug) {
+ debug_printf("addr=\"%s\"\n", trim(addr));
+ debug_printf("user=\"%s\"\n", trim(user));
+ debug_printf("info=\"%s\"\n", trim(info));
+ debug_printf("sender=\"%s\"\n", trim(sender));
+ debug_printf("envelope=\"%s\"\n",
+ envelope ? trim(envelope) : "");
+ debug_printf("mbox=\"%s\"\n", trim(mbox));
+ debug_printf("home=\"%s\"\n", trim(home));
+ debug_printf("ddate=\"%s\"\n", trim(ddate));
+ debug_printf("now=%02d:%02d\n\n", now->tw_hour, now->tw_min);
+ }
+
+ /* deliver the message */
+ status = localmail(fd, mdlvr);
+
+ done(status != -1 ? RCV_MOK : RCV_MBX);
+ return 1;