Annotation of researchv10no/netfs/libnetb/callsource.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * figure out who called us
                      3:  * research version:
                      4:  * network services have a known environment
                      5:  * either
                      6:  *     CSOURCE="source=callingmachine ..."     (new service manager)
                      7:  * or
                      8:  *     CSOURCE="callingmachine"        (old manager, and some imitations)
                      9:  * or
                     10:  *     DKSOURCE="callingmachine.userid"        (very old manager)
                     11:  *
                     12:  * it may be pointless to support them all in one place
                     13:  */
                     14: 
                     15: extern char *getenv();
                     16: extern char *strchr(), *strrchr();
                     17: 
                     18: #define        NULL    0
                     19: 
                     20: char *
                     21: _rfcallsource()
                     22: {
                     23:        char *v;
                     24:        register char *p;
                     25: 
                     26:        if ((v = getenv("CSOURCE")) != NULL) {
                     27:                if (strncmp("source=", v, 7) == 0) {    /* new style */
                     28:                        v += 7;
                     29:                        if ((p = strchr(v, ' ')) != NULL)
                     30:                                *p = 0;
                     31:                        return (v);
                     32:                }
                     33:                /* old style */
                     34:                if ((p = strrchr(v, '!')) != NULL)
                     35:                        *p = 0;
                     36:                return (v);
                     37:        }
                     38:        if ((v = getenv("DKSOURCE")) != NULL) {         /* even older style */
                     39:                if ((p = strchr(v, '.')) != NULL)
                     40:                        *p = 0;
                     41:                return (v);
                     42:        }
                     43:        /* give up */
                     44:        return (0);
                     45: }

unix.superglobalmegacorp.com

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