Annotation of coherent/a/tmp/smail/map.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char    *sccsid="@(#)map.c      2.5 (smail) 9/15/87";
                      3: #endif
                      4: 
                      5: # include      <stdio.h>
                      6: # include      <sys/types.h>
                      7: # include      "defs.h"
                      8: 
                      9: extern int queuecost;
                     10: 
                     11: /*
                     12: **
                     13: **  map(): map addresses into <host, user, form, cost> sets.
                     14: **
                     15: **  Calls resolve() for each address of argv.  The result is hostv and 
                     16: **  userv arrays (pointing into buffers userz and hostz), and formv array.
                     17: **
                     18: */
                     19: 
                     20: map(argc, argv, hostv, userv, formv, costv)
                     21: int argc;                              /* address count                */
                     22: char **argv;                           /* address vector               */
                     23: char *hostv[];                         /* remote host vector           */
                     24: char *userv[];                         /* user name vector             */
                     25: enum eform formv[];                    /* address format vector        */
                     26: int costv[];                           /* cost vector                  */
                     27: {
                     28:        int i, cost;
                     29:        enum eform resolve();
                     30:        char *c;
                     31:        static char userbuf[BIGBUF], *userz;
                     32:        static char hostbuf[BIGBUF], *hostz;
                     33: 
                     34:        userz = userbuf;
                     35:        hostz = hostbuf;
                     36: 
                     37:        for( i=0; i<argc; i++ ) {
                     38: #ifdef DEFQUEUE
                     39:                cost = queuecost+1;             /* default is queueing */
                     40: #else
                     41:                cost = queuecost-1;             /* default is no queueing */
                     42: #endif
                     43:                userv[i] = userz;               /* put results here */
                     44:                hostv[i] = hostz;
                     45:                if ( **argv == '(' ) {          /* strip () */
                     46:                        ++*argv;
                     47:                        c = index( *argv, ')' );
                     48:                        if (c)
                     49:                                *c = '\0';
                     50:                }
                     51:                                                /* here it comes! */
                     52:                formv[i] = resolve(*argv++, hostz, userz, &cost);
                     53:                costv[i] = cost;
                     54:                userz += strlen( userz ) + 1;   /* skip past \0 */
                     55:                hostz += strlen( hostz ) + 1;
                     56:        }
                     57: }

unix.superglobalmegacorp.com

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