botched copyright
[unix-history] / usr / src / usr.bin / mail / names.c
index 9aa1fdc..983a185 100644 (file)
@@ -1,4 +1,12 @@
-#
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)names.c     5.2 (Berkeley) %G%";
+#endif not lint
 
 /*
  * Mail -- a mail program
 
 /*
  * Mail -- a mail program
@@ -8,8 +16,6 @@
 
 #include "rcv.h"
 
 
 #include "rcv.h"
 
-static char *SccsId = "@(#)names.c     2.7 %G%";
-
 /*
  * Allocate a single element of a name list,
  * initialize its name field to the passed
 /*
  * Allocate a single element of a name list,
  * initialize its name field to the passed
@@ -547,7 +553,7 @@ unpack(np)
        register struct name *n;
        char *cp;
        char hbuf[10];
        register struct name *n;
        char *cp;
        char hbuf[10];
-       int t, extra, metoo;
+       int t, extra, metoo, verbose;
 
        n = np;
        if ((t = lengthof(n)) == 0)
 
        n = np;
        if ((t = lengthof(n)) == 0)
@@ -568,6 +574,9 @@ unpack(np)
        metoo = value("metoo") != NOSTR;
        if (metoo)
                extra++;
        metoo = value("metoo") != NOSTR;
        if (metoo)
                extra++;
+       verbose = value("verbose") != NOSTR;
+       if (verbose)
+               extra++;
 #endif SENDMAIL
        if (hflag)
                extra += 2;
 #endif SENDMAIL
        if (hflag)
                extra += 2;
@@ -582,6 +591,8 @@ unpack(np)
        *ap++ = "-i";
        if (metoo)
                *ap++ = "-m";
        *ap++ = "-i";
        if (metoo)
                *ap++ = "-m";
+       if (verbose)
+               *ap++ = "-v";
 #endif SENDMAIL
        if (hflag) {
                *ap++ = "-h";
 #endif SENDMAIL
        if (hflag) {
                *ap++ = "-h";
@@ -768,18 +779,30 @@ count(np)
        return(c);
 }
 
        return(c);
 }
 
+cmpdomain(name, dname)
+       register char *name, *dname;
+{
+       char buf[BUFSIZ];
+
+       strcpy(buf, dname);
+       buf[strlen(name)] = '\0';
+       return(icequal(name, buf));
+}
+
 /*
 /*
- * Delete the given name from a namelist.
+ * Delete the given name from a namelist, using the passed
+ * function to compare the names.
  */
 struct name *
  */
 struct name *
-delname(np, name)
+delname(np, name, cmpfun)
        register struct name *np;
        char name[];
        register struct name *np;
        char name[];
+       int (* cmpfun)();
 {
        register struct name *p;
 
        for (p = np; p != NIL; p = p->n_flink)
 {
        register struct name *p;
 
        for (p = np; p != NIL; p = p->n_flink)
-               if (icequal(p->n_name, name)) {
+               if ((* cmpfun)(p->n_name, name)) {
                        if (p->n_blink == NIL) {
                                if (p->n_flink != NIL)
                                        p->n_flink->n_blink = NIL;
                        if (p->n_blink == NIL) {
                                if (p->n_flink != NIL)
                                        p->n_flink->n_blink = NIL;