Changed nameof to return from: or sender: field if not
authorKurt A. Schoens <kas@ucbvax.Berkeley.EDU>
Tue, 27 Jan 1981 02:28:24 +0000 (18:28 -0800)
committerKurt A. Schoens <kas@ucbvax.Berkeley.EDU>
Tue, 27 Jan 1981 02:28:24 +0000 (18:28 -0800)
replying; other stuff if appropriate

SCCS-vsn: usr.bin/mail/aux.c 1.5

usr/src/usr.bin/mail/aux.c

index 6e55b2c..d81ab36 100644 (file)
@@ -11,7 +11,7 @@
  * Auxiliary functions.
  */
 
  * Auxiliary functions.
  */
 
-static char *SccsId = "@(#)aux.c       1.4 %G%";
+static char *SccsId = "@(#)aux.c       1.5 %G%";
 
 /*
  * Return a pointer to a dynamic copy of the argument.
 
 /*
  * Return a pointer to a dynamic copy of the argument.
@@ -508,10 +508,12 @@ blankline(linebuf)
 
 /*
  * Fetch the sender's name from the passed message.
 
 /*
  * Fetch the sender's name from the passed message.
+ * If fetching this name for replying purposes, do not
+ * return sender:
  */
 
 char *
  */
 
 char *
-nameof(mp)
+nameof(mp, reply)
        register struct message *mp;
 {
        char namebuf[LINESIZE];
        register struct message *mp;
 {
        char namebuf[LINESIZE];
@@ -520,7 +522,11 @@ nameof(mp)
        register FILE *ibuf;
        int first = 1;
 
        register FILE *ibuf;
        int first = 1;
 
-       if ((cp = hfield("reply-to", mp)) != NOSTR) {
+       if ((cp = hfield("from", mp)) != NOSTR) {
+               strcpy(namebuf, cp);
+               return(savestr(namebuf));
+       }
+       if (!reply && (cp = hfield("sender", mp)) != NOSTR) {
                strcpy(namebuf, cp);
                return(savestr(namebuf));
        }
                strcpy(namebuf, cp);
                return(savestr(namebuf));
        }