Annotation of 40BSD/cmd/delivermail/addr.c, revision 1.1.1.1

1.1       root        1: # include "dlvrmail.h"
                      2: 
                      3: static char SccsId[] = "@(#)addr.c     1.3     8/2/80";
                      4: 
                      5: /*
                      6: **  PUTONQ -- put an address node on the end of a queue
                      7: **
                      8: **     Parameters:
                      9: **             a -- the address to put on the queue.
                     10: **             q -- the queue to put it on.
                     11: **
                     12: **     Returns:
                     13: **             none
                     14: **
                     15: **     Side Effects:
                     16: **             none
                     17: **
                     18: **     Called By:
                     19: **             alias
                     20: **             recipient
                     21: */
                     22: 
                     23: putonq(a, q)
                     24:        register addrq *a;
                     25:        register addrq *q;
                     26: {
                     27:        if (q->q_prev == NULL)
                     28:        {
                     29:                q->q_prev = q->q_next = a;
                     30:                a->q_prev = NULL;
                     31:        }
                     32:        else
                     33:        {
                     34:                a->q_prev = q->q_prev;
                     35:                q->q_prev->q_next = a;
                     36:                q->q_prev = a;
                     37:        }
                     38:        a->q_next = NULL;
                     39: }
                     40: /*
                     41: **  TKOFFQ -- remove address node from queue
                     42: **
                     43: **     Takes a node off of a queue, from anyplace in the queue.
                     44: **
                     45: **     Parameters:
                     46: **             a -- the node to remove.
                     47: **             q -- the queue to remove it from.
                     48: **
                     49: **     Returns:
                     50: **             none
                     51: **
                     52: **     Side Effects:
                     53: **             none
                     54: **
                     55: **     Called By:
                     56: **             alias
                     57: */
                     58: 
                     59: tkoffq(a, q)
                     60:        register addrq *a;
                     61:        register addrq *q;
                     62: {
                     63:        if (a->q_prev != NULL)
                     64:                a->q_prev->q_next = a->q_next;
                     65:        else
                     66:                q->q_next = a->q_next;
                     67:        if (a->q_next != NULL)
                     68:                a->q_next->q_prev = a->q_prev;
                     69:        else
                     70:                q->q_prev = a->q_prev;
                     71: }
                     72: /*
                     73: **  SAMEADDR -- Determine if tow addresses are the same
                     74: **
                     75: **     This is not just a straight comparison -- if the mailer doesn't
                     76: **     care about the host we just ignore it, etc.
                     77: **
                     78: **     Parameters:
                     79: **             a, b -- pointers to the internal forms to compare.
                     80: **             wildflg -- if TRUE, 'a' may have no user specified,
                     81: **                     in which case it is to match anything.
                     82: **
                     83: **     Returns:
                     84: **             TRUE -- they represent the same mailbox.
                     85: **             FALSE -- they don't.
                     86: **
                     87: **     Side Effects:
                     88: **             none.
                     89: **
                     90: **     Called By:
                     91: **             recipient
                     92: **             alias
                     93: */
                     94: 
                     95: bool
                     96: sameaddr(a, b, wildflg)
                     97:        register addrq *a;
                     98:        register addrq *b;
                     99:        bool wildflg;
                    100: {
                    101:        /* if they don't have the same mailer, forget it */
                    102:        if (a->q_mailer != b->q_mailer)
                    103:                return (FALSE);
                    104: 
                    105:        /* if the user isn't the same, we can drop out */
                    106:        if ((!wildflg || a->q_user[0] != '\0') && strcmp(a->q_user, b->q_user) != 0)
                    107:                return (FALSE);
                    108: 
                    109:        /* if the mailer ignores hosts, we have succeeded! */
                    110:        if (flagset(M_NOHOST, a->q_mailer->m_flags))
                    111:                return (TRUE);
                    112: 
                    113:        /* otherwise compare hosts (but be careful for NULL ptrs) */
                    114:        if (a->q_host == NULL || b->q_host == NULL)
                    115:                return (FALSE);
                    116:        if (strcmp(a->q_host, b->q_host) != 0)
                    117:                return (FALSE);
                    118: 
                    119:        return (TRUE);
                    120: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.