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

Defined functions

putonq defined in line 35; never used
sameaddr defined in line 107; never used
tkoffq defined in line 71; never used

Defined variables

SccsId defined in line 12; never used
Last modified: 1985-06-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2013
Valid CSS Valid XHTML 1.0 Strict