home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #5 / AmigaPlus_Extra-CD_5-97.iso / online-tools / mail / pgp_mip / pgpsendmail / source / expandalias.c < prev    next >
C/C++ Source or Header  |  1993-10-12  |  3KB  |  95 lines

  1. /*
  2.  *     $Filename: expandalias $
  3.  *     $Revision: 1.4 $
  4.  *     $Date: 1993/10/06 12:19:18 $
  5.  *
  6.  *     Just a small set of subroutines to control the alias-expand-
  7.  *     routines.
  8.  *
  9.  *     © Copyright 1993 Peter Simons, Germany
  10.  *       All Rights Reserved
  11.  *
  12.  *     $Id: expandalias.c,v 1.4 1993/10/06 12:19:18 simons Exp simons $
  13.  *
  14.  * ------------------------------ log history ----------------------------
  15.  * $Log: expandalias.c,v $
  16.  * Revision 1.4  1993/10/06  12:19:18  simons
  17.  * Changed format of RCS-Header.
  18.  *
  19.  * Revision 1.3  1993/09/02  03:57:45  simons
  20.  * The alias-handling isn't included here directly, but linked with the
  21.  * uucp.lib.
  22.  *
  23.  * Revision 1.2  1993/08/28  18:41:27  simons
  24.  * Renamed ExtractAliases() to ExpandAliases() and modified the routines
  25.  * in minor ways.
  26.  *
  27.  * Revision 1.1  1993/08/28  18:25:35  simons
  28.  * Initial revision
  29.  */
  30.  
  31.  
  32. /**************************************************************************
  33.  *                                                                        *
  34.  * Sektion: Macros, Definitions, Includes, Structures                     *
  35.  *                                                                        *
  36.  **************************************************************************/
  37.  
  38. /************************************* Includes ***********/
  39. #include <stdlib.h>
  40.  
  41. /************************************* Defines ************/
  42. #define MAX_RECEIPIENTS 256     /* max. number of receipients */
  43.  
  44. /************************************* Prototypes *********/
  45. void LoadAliases(void);
  46. int UserAliasList(char const * , int (* )(char const * , long , int ), long , int );
  47. void callBack(char *, long, int);
  48. char **ExtractAliases(char **);
  49.  
  50. /************************************* global Variables ***/
  51.         static char **new_receipients;
  52.         static const char __RCSId[] = "$Id: expandalias.c,v 1.4 1993/10/06 12:19:18 simons Exp simons $";
  53.  
  54.  
  55. /**************************************************************************
  56.  *                                                                        *
  57.  * Sektion: Unterprogramme                                                *
  58.  *                                                                        *
  59.  **************************************************************************/
  60.  
  61. char **ExpandAliases(char *receipients[])
  62. {
  63.         char **new_receipients2;
  64.  
  65.         if (*receipients == NULL)
  66.                 return NULL;
  67.  
  68.         if ((new_receipients = malloc(sizeof(char *[MAX_RECEIPIENTS]))) == NULL)
  69.                 return NULL;
  70.  
  71.         new_receipients2 = new_receipients;
  72.         LoadAliases();
  73.         while (*receipients != NULL) {
  74.                 UserAliasList(*receipients, (int (*)(char *, long, int)) callBack, 0L, 1);
  75.                 receipients++;
  76.         }
  77.         *new_receipients = NULL;
  78.         return new_receipients2;
  79. }
  80.  
  81. void callBack(char *name, long dummy, int show)
  82. {
  83.         switch(name[0]) {
  84.         case '|': case '>': case '<':
  85.                 break;
  86.         case '\\':
  87.                 ++name;
  88.         default:
  89.                 *new_receipients = name;
  90.                 new_receipients++;
  91.                 break;
  92.         }
  93. }
  94.  
  95.