DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T r

⟦4a2f6c1a0⟧ TextFile

    Length: 3046 (0xbe6)
    Types: TextFile
    Names: »remail.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦4fd8323b9⟧ »EurOpenD3/mail/elm2.3.tar.Z« 
        └─⟦698c4f91f⟧ 
            └─⟦this⟧ »src/remail.c« 

TextFile


static char rcsid[] = "@(#)$Id: remail.c,v 4.1 90/04/28 22:43:50 syd Exp $";

/*******************************************************************************
 *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
 *
 * 			Copyright (c) 1986, 1987 Dave Taylor
 * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
 *******************************************************************************
 * Bug reports, patches, comments, suggestions should be sent to:
 *
 *	Syd Weinstein, Elm Coordinator
 *	elm@DSI.COM			dsinc!elm
 *
 *******************************************************************************
 * $Log:	remail.c,v $
 * Revision 4.1  90/04/28  22:43:50  syd
 * checkin of Elm 2.3 as of Release PL0
 * 
 *
 ******************************************************************************/

/** For those cases when you want to have a message continue along
    to another person in such a way as they end up receiving it with
    the return address the person YOU received the mail from (does
    this comment make any sense yet??)...

**/

#include "headers.h"
#include <errno.h>

extern int errno;

char *error_name(), *error_description();

int
remail()
{
	/** remail a message... returns TRUE if new foot needed ... **/
	
	FILE *mailfd;
	char entered[VERY_LONG_STRING], expanded[VERY_LONG_STRING];
	char *filename, buffer[VERY_LONG_STRING], ch;
	extern char *tempnam();

	entered[0] = '\0';

	get_to(entered, expanded);
	if (strlen(entered) == 0)
	  return(0);

	display_to(expanded);

	if((filename=tempnam(temp_dir, "snd.")) == NULL) {
	  dprint(1, (debugfile, "couldn't make temp file nam! (remail)\n"));
	  sprintf(buffer, "Sorry - couldn't make file temp file name.");
	  set_error(buffer);
	  return(1);
	}

	if ((mailfd = fopen(filename, "w")) == NULL) {
	  dprint(1, (debugfile, "couldn't open temp file %s! (remail)\n", 
		  filename));
	  dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
		  error_description(errno)));
	  sprintf(buffer, "Sorry - couldn't open file %s for writing (%s).",
		  error_name(errno));
	  set_error(buffer);
	  return(1);
	}

	/** now let's copy the message into the newly opened
	    buffer... **/

	chown (filename, userid, groupid);

	copy_message("", mailfd, FALSE, TRUE, FALSE, TRUE);  

	fclose(mailfd);

	/** Got the messsage, now let's ensure the person really wants to 
	    remail it... **/

	ClearLine(LINES-1);
	ClearLine(LINES);
	PutLine1(LINES-1,0,
	    "Are you sure you want to remail this message (y/n)? y%c",
	    BACKSPACE);
	fflush(stdin);
	fflush(stdout);
	ch = ReadCh();
	if (tolower(ch) == 'n') { /* another day, another No... */
	  Write_to_screen("No.", 0);
	  set_error("Bounce of message cancelled.");
	  (void) unlink(filename);
	  return(1);
	}
	Write_to_screen("Yes.", 0);

	sprintf(buffer,"( (%s %s ; %s %s) & ) < %s", 
	      mailer, strip_parens(strip_commas(expanded)), 
	      remove_cmd, filename, filename);

	PutLine0(LINES,0,"Resending mail...");
	system_call(buffer, SH, FALSE, FALSE);
	set_error("Mail resent.");

	return(1);
}