home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / mail / smail / src / rcs / map.c,v < prev    next >
Text File  |  1993-12-21  |  3KB  |  127 lines

  1. head    1.2;
  2. access;
  3. symbols
  4.     C_1:1.2;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.2
  10. date    93.09.18.16.47.47;    author Aussem;    state Exp;
  11. branches;
  12. next    1.1;
  13.  
  14. 1.1
  15. date    93.09.08.16.27.13;    author Aussem;    state Exp;
  16. branches;
  17. next    ;
  18.  
  19.  
  20. desc
  21. @map an UUCP address
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @insert GNU license text in the header
  28. @
  29. text
  30. @/*
  31.  *  map.c
  32.  *
  33.  *  Routines to map an address
  34.  *
  35.  * This program is free software; you can redistribute it and/or
  36.  * modify it under the terms of the GNU General Public License as
  37.  * published by the Free Software Foundation; either version 2 of
  38.  * the License, or (at your option) any later version.
  39.  *
  40.  * This program is distributed in the hope that it will be useful,
  41.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  42.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  43.  * General Public License for more details.
  44.  *
  45.  * You should have received a copy of the GNU General Public License
  46.  * along with this program; if not, write to the Free Software
  47.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  48.  *
  49.  * $Log: map.c,v $
  50.  * Revision 1.1  1993/09/08  16:27:13  Aussem
  51.  * Initial revision
  52.  *
  53.  *
  54.  */
  55.  
  56. static char     *rcsid="$Id: map.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $";
  57.  
  58. # include    <stdio.h>
  59. # include    <sys/types.h>
  60. # include    "defs.h"
  61.  
  62. extern int queuecost;
  63.  
  64. /*
  65. **
  66. **  map(): map addresses into <host, user, form, cost> sets.
  67. **
  68. **  Calls resolve() for each address of argv.  The result is hostv and
  69. **  userv arrays (pointing into buffers userz and hostz), and formv array.
  70. **
  71. */
  72.  
  73. map(argc, argv, hostv, userv, formv, costv)
  74. int argc;                /* address count         */
  75. char **argv;                /* address vector         */
  76. char *hostv[];                /* remote host vector         */
  77. char *userv[];                /* user name vector         */
  78. enum eform formv[];            /* address format vector     */
  79. int costv[];                /* cost vector             */
  80. {
  81.     int i, cost;
  82.     enum eform resolve();
  83.     char *c;
  84.     static char userbuf[BIGBUF], *userz;
  85.     static char hostbuf[BIGBUF], *hostz;
  86.  
  87.     userz = userbuf;
  88.     hostz = hostbuf;
  89.  
  90.     for( i=0; i<argc; i++ ) {
  91. #ifdef DEFQUEUE
  92.         cost = queuecost+1;        /* default is queueing */
  93. #else
  94.         cost = queuecost-1;        /* default is no queueing */
  95. #endif
  96.         userv[i] = userz;        /* put results here */
  97.         hostv[i] = hostz;
  98.         if ( **argv == '(' ) {        /* strip () */
  99.             ++*argv;
  100.             c = index( *argv, ')' );
  101.             if (c)
  102.                 *c = '\0';
  103.         }
  104.                         /* here it comes! */
  105.         formv[i] = resolve(*argv++, hostz, userz, &cost);
  106.         costv[i] = cost;
  107.         userz += strlen( userz ) + 1;    /* skip past \0 */
  108.         hostz += strlen( hostz ) + 1;
  109.     }
  110. }
  111. @
  112.  
  113.  
  114. 1.1
  115. log
  116. @Initial revision
  117. @
  118. text
  119. @d6 4
  120. a9 1
  121.  * $Log$
  122. d11 14
  123. d27 1
  124. a27 1
  125. static char     *rcsid="$Id$";
  126. @
  127.