Article View: news.software.readers
Article #38458Win32/95/NT patch for slrn/misc.c
From: vischne
Date: Wed, 04 Feb 1998 00:00
Date: Wed, 04 Feb 1998 00:00
119 lines
3474 bytes
3474 bytes
The following changes to slrn_mail_file allows the Windows version of
sendmail.exe to send mail from slrn.exe:
============================================================================
int slrn_mail_file (char *file, int edit, unsigned int editline,
char *to, char *subject) /*{{{*/
{
char buf [256 + 2 * SLRN_MAX_PATH_LEN];
#if defined(__os2__) || defined(__NT__) || defined(_WIN32)
char outfile [SLRN_MAX_PATH_LEN];
#endif
if (edit && (Slrn_Batch == 0))
{
if (slrn_edit_file (Slrn_Editor_Mail, file, editline) < 0) return -1;
while (1)
{
char rsp;
rsp = slrn_get_response ("yYnNeE", "Mail the message? \001Yes, \001No, \001Edit");
rsp |= 0x20;
if (rsp == 'n') return -1;
if (rsp == 'y') break;
if (slrn_edit_file (Slrn_Editor_Mail, file, 1) < 0) return -1;
}
}
slrn_message_now ("Sending ...");
if (-1 == slrn_save_file_to_mail_file (file, Slrn_Save_Replies_File, NULL))
return -1;
slrn_chmap_fix_file (file);
#ifdef VMS
sprintf(buf, "%s\"%s\"", MAIL_PROTOCOL, to);
vms_send_mail( buf, subject, file );
#else
(void) to; (void) subject;
/* What I need to do is to open the file and feed it line by line to the
* sendmail program. This way I can strip out blank headers.
*/
if (Slrn_Use_Mime)
{
FILE *fp, *pp;
int header = 1;
char line[1024];
fp = fopen (file, "r");
if (fp == NULL) return (-1);
slrn_mime_scan_file (fp);
# if defined(__os2__) || defined(__NT__) || defined(_WIN32)
pp = slrn_open_tmpfile (outfile, "w");
# else
pp = slrn_popen (Slrn_SendMail_Command, "w");
# endif
if (pp == NULL)
{
slrn_fclose (fp);
return (-1);
}
while (fgets (line, sizeof(line), fp) != NULL)
{
unsigned int len = strlen (line);
if (len == 0) continue;
len--;
if (line [len] == '\n') line [len] = 0;
if (header)
{
if (line[0] == 0)
{
header = 0;
slrn_mime_add_headers (pp);
fp = slrn_mime_encode (fp);
}
slrn_mime_header_encode (line, sizeof(line));
}
fputs (line, pp);
putc('\n', pp);
}
slrn_fclose (fp);
#if defined(__os2__) || defined(__NT__) || defined(_WIN32)
slrn_fclose (pp);
#ifdef _WIN32
sprintf (buf, "%s -F %s -t %s", Slrn_SendMail_Command, outfile, to);
#else
sprintf (buf, "%s %s", Slrn_SendMail_Command, outfile);
#endif
slrn_posix_system (buf, 0);
#else
slrn_pclose (pp);
#endif
}
else
{
#if defined(__os2__) || defined(__NT__)
sprintf (buf, "%s %s", Slrn_SendMail_Command, file);
#elif defined(_WIN32)
sprintf (buf, "%s -F %s -t %s", Slrn_SendMail_Command, outfile, to);
#else
sprintf (buf, "%s < %s", Slrn_SendMail_Command, file);
#endif
slrn_posix_system (buf, 0);
}
#endif /* NOT VMS */
slrn_message ("Sending...done");
return 0;
}
Technical Details
Message-ID:
<34d89716.0@news3.ibm.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <34d89716.0@news3.ibm.net> Subject: Win32/95/NT patch for slrn/misc.c Date: Wed, 04 Feb 1998 00:00:00 +0000 From: vischne@ibm.net-nospam Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 322026461 Organization: The Light Newsgroups: news.software.readers