vn diffs to use Reply-to and From headers
Andrew H. Marrinson
andy at icom.UUCP
Sat Sep 6 01:09:03 AEST 1986
Here are the context diffs to vn to make it use the Reply-to, and From
header for responding via the 'm' command. This is useful for those who
have auto-routing software. I also added code to insert a To header in the
message being built.
------------------------ cut here, run through sh -----------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# head.h.diff
# reader.c.diff
# strings.c.diff
# This archive created: Thu Sep 4 20:42:15 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'head.h.diff'" '(504 characters)'
if test -f 'head.h.diff'
then
echo shar: will not over-write existing file "'head.h.diff'"
else
sed 's/^ X//' << \SHAR_EOF > 'head.h.diff'
X*** head.h.old Tue Sep 2 19:53:52 1986
X--- head.h Tue Sep 2 19:52:52 1986
X***************
X*** 12,17
X #define DHDLEN 6
X #define FHEAD "From: "
X #define FHDLEN 6
X #define FTHEAD "Followup-To: "
X #define FTHDLEN 13
X #define THEAD "Subject: "
X
X--- 12,21 -----
X #define DHDLEN 6
X #define FHEAD "From: "
X #define FHDLEN 6
X+ #define RTHEAD "Reply-To: "
X+ #define RTHDLEN 10
X+ #define TOHEAD "To: "
X+ #define TOHDLEN 4
X #define FTHEAD "Followup-To: "
X #define FTHDLEN 13
X #define THEAD "Subject: "
SHAR_EOF
if test 504 -ne "`wc -c < 'head.h.diff'`"
then
echo shar: error transmitting "'head.h.diff'" '(should have been 504 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'reader.c.diff'" '(5305 characters)'
if test -f 'reader.c.diff'
then
echo shar: will not over-write existing file "'reader.c.diff'"
else
sed 's/^ X//' << \SHAR_EOF > 'reader.c.diff'
X*** reader.c.old Tue Sep 2 19:53:54 1986
X--- reader.c Tue Sep 2 20:24:37 1986
X***************
X*** 19,26
X extern char *Hdon_msg;
X extern char *Hdoff_msg;
X
X! extern char *T_head, *FT_head, *N_head, *L_head;
X! extern char *F_head, *P_head, *M_head, *R_head;
X
X static FILE *Fpread;
X static char *Fname;
X
X--- 19,26 -----
X extern char *Hdon_msg;
X extern char *Hdoff_msg;
X
X! extern char *T_head, *FT_head, *N_head, *L_head, *RT_head;
X! extern char *TO_head, *F_head, *P_head, *M_head, *R_head;
X
X static FILE *Fpread;
X static char *Fname;
X***************
X*** 93,100
X double atof();
X char *optr;
X char c, *rf, buf[RECLEN], path[RECLEN], mid[RECLEN], ngrp[RECLEN];
X! char from[RECLEN], title[RECLEN], flto[RECLEN], pstr[24];
X! char dgname[48], getpgch(), *index(), *digest_extract();
X char *tgetstr();
X
X *pages = 0;
X
X--- 93,100 -----
X double atof();
X char *optr;
X char c, *rf, buf[RECLEN], path[RECLEN], mid[RECLEN], ngrp[RECLEN];
X! char from[RECLEN], title[RECLEN], flto[RECLEN], reply[RECLEN];
X! char pstr[24], dgname[48], getpgch(), *index(), *digest_extract();
X char *tgetstr();
X
X *pages = 0;
X***************
X*** 117,123
X return (0);
X }
X
X! hlines = gethead (path, mid, from, title, ngrp, flto, &artlin);
X total = (float) artlin + 1.0;
X if (total < .99)
X total = 1.0;
X
X--- 117,123 -----
X return (0);
X }
X
X! hlines = gethead (path, mid, from, title, ngrp, flto, reply, &artlin);
X total = (float) artlin + 1.0;
X if (total < .99)
X total = 1.0;
X***************
X*** 189,195
X else
X strcpy (pstr,PAGE_NEXT);
X }
X! c = getpgch(pstr,path,mid,from,title,ngrp,flto);
X
X /*
X handle user input:
X
X--- 189,195 -----
X else
X strcpy (pstr,PAGE_NEXT);
X }
X! c = getpgch(pstr,path,mid,from,reply,title,ngrp,flto);
X
X /*
X handle user input:
X***************
X*** 244,251
X posting followups, does not rewind, but leaves file at end of header
X lines. Returns number of header lines.
X */
X! static gethead (path, mid, from, title, ngrp, flto, lin)
X! char *path, *mid, *from, *title, *ngrp, *flto;
X int *lin;
X {
X int count;
X
X--- 244,251 -----
X posting followups, does not rewind, but leaves file at end of header
X lines. Returns number of header lines.
X */
X! static gethead (path, mid, from, title, ngrp, flto, reply, lin)
X! char *path, *mid, *from, *title, *ngrp, *flto, *reply;
X int *lin;
X {
X int count;
X***************
X*** 253,259
X long pos,ftell();
X
X *lin = 0;
X! *path = *mid = *from = *title = *ngrp = *flto = '\0';
X
X /* for conditional is abnormal - expected exit is break */
X for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count)
X
X--- 253,259 -----
X long pos,ftell();
X
X *lin = 0;
X! *path = *mid = *from = *title = *ngrp = *flto = *reply = '\0';
X
X /* for conditional is abnormal - expected exit is break */
X for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count)
X***************
X*** 304,309
X strcpy (flto,buf+FTHDLEN);
X continue;
X }
X if (strncmp(buf,L_head,LHDLEN) == 0)
X {
X buf [strlen(buf)-1] = '\0';
X
X--- 304,315 -----
X strcpy (flto,buf+FTHDLEN);
X continue;
X }
X+ if (strncmp(buf,RT_head,RTHDLEN) == 0)
X+ {
X+ buf [strlen(buf)-1] = '\0';
X+ strcpy (reply,buf+RTHDLEN);
X+ continue;
X+ }
X if (strncmp(buf,L_head,LHDLEN) == 0)
X {
X buf [strlen(buf)-1] = '\0';
X***************
X*** 319,326
X handles "mail", "save" and "followup" internally
X as well as flag resets.
X */
X! static char getpgch(prompt,path,mid,from,title,ngrp,flto)
X! char *prompt, *path, *mid, *from, *title, *ngrp, *flto;
X {
X char c;
X int ic;
X
X--- 325,332 -----
X handles "mail", "save" and "followup" internally
X as well as flag resets.
X */
X! static char getpgch(prompt,path,mid,from,reply,title,ngrp,flto)
X! char *prompt, *path, *mid, *from, *reply, *title, *ngrp, *flto;
X {
X char c;
X int ic;
X***************
X*** 362,368
X help_pg ();
X break;
X case PG_REPLY:
X! mail (path,title,from);
X break;
X case PG_FOLLOW:
X followup (mid,title,ngrp,flto);
X
X--- 368,374 -----
X help_pg ();
X break;
X case PG_REPLY:
X! mail (*reply ? reply : from,title,from);
X break;
X case PG_FOLLOW:
X followup (mid,title,ngrp,flto);
X***************
X*** 418,424
X tmpnam (fn);
X if ((fp = fopen(fn,"w")) == NULL)
X printex ("can't open %s\n",fn);
X! fprintf (fp,"%s%s%s\n\n%s:\n", T_head, FPFIX, t, f);
X edcopy (fp);
X fclose (fp);
X tty_set (SAVEMODE);
X
X--- 424,430 -----
X tmpnam (fn);
X if ((fp = fopen(fn,"w")) == NULL)
X printex ("can't open %s\n",fn);
X! fprintf (fp,"%s%s\n%s%s%s\n\n%s:\n", TO_head, p, T_head, FPFIX, t, f);
X edcopy (fp);
X fclose (fp);
X tty_set (SAVEMODE);
X***************
X*** 432,438
X new = rprompt ("still want to mail it ? ",cmd);
X if (new != NULL && (*new == 'y' || *new == 'Y'))
X {
X! sprintf (cmd,"%s %s <%s", Mailer, p, fn);
X system (cmd);
X printf ("given to mailer\n");
X }
X
X--- 438,446 -----
X new = rprompt ("still want to mail it ? ",cmd);
X if (new != NULL && (*new == 'y' || *new == 'Y'))
X {
X! if ((new = index(p, '(')) != NULL)
X! *new = '\0'; /* a poor way of deleting comments */
X! sprintf (cmd,"%s '%s' <%s", Mailer, p, fn);
X system (cmd);
X printf ("given to mailer\n");
X }
SHAR_EOF
if test 5305 -ne "`wc -c < 'reader.c.diff'`"
then
echo shar: error transmitting "'reader.c.diff'" '(should have been 5305 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'strings.c.diff'" '(469 characters)'
if test -f 'strings.c.diff'
then
echo shar: will not over-write existing file "'strings.c.diff'"
else
sed 's/^ X//' << \SHAR_EOF > 'strings.c.diff'
X*** strings.c.old Tue Sep 2 19:53:54 1986
X--- strings.c Tue Sep 2 19:52:51 1986
X***************
X*** 20,25
X char *D_head = DHEAD;
X char *F_head = FHEAD;
X char *FT_head = FTHEAD;
X char *T_head = THEAD;
X char *L_head = LHEAD;
X char *N_head = NHEAD;
X
X--- 20,27 -----
X char *D_head = DHEAD;
X char *F_head = FHEAD;
X char *FT_head = FTHEAD;
X+ char *RT_head = RTHEAD;
X+ char *TO_head = TOHEAD;
X char *T_head = THEAD;
X char *L_head = LHEAD;
X char *N_head = NHEAD;
SHAR_EOF
if test 469 -ne "`wc -c < 'strings.c.diff'`"
then
echo shar: error transmitting "'strings.c.diff'" '(should have been 469 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
--
andy at icom.UUCP
Or for those of Andrew H. Marrinson
you who wish to ICOM Systems, Inc.
play it the hard Arlington Heights, IL 60005
way: ihnp4!icom!andy
More information about the Comp.sources.unix
mailing list