Annotation of researchv9/libc/gen/getshput.c, revision 1.1

1.1     ! root        1: /*LINTLIBRARY*/
        !             2: 
        !             3: /*
        !             4: **     Reads, modifies, and writes the record in the ``shares'' file
        !             5: **     whose uid matches "lp->l_uid".
        !             6: **
        !             7: **     The function indicated by the "func" argument is called with the address
        !             8: **     of the original structure, and the address of the structure to be updated.
        !             9: **
        !            10: **     Returns value returned by passed function for success and 0 for error
        !            11: **     But note, that if the function returns 0 itself, then the ``shares'' file
        !            12: **     will not be updated.
        !            13: **
        !            14: **     Otherwise, the value returned by the function is used to update the
        !            15: **     ``extime'' field in the shares record.
        !            16: */ 
        !            17: 
        !            18: #include       <sys/types.h>
        !            19: #include       <sys/lnode.h>
        !            20: #include       <shares.h>
        !            21: 
        !            22: 
        !            23: unsigned long
        !            24: getshput(lp, func)
        !            25:        struct lnode *  lp;
        !            26:        unsigned long   (*func)();
        !            27: {
        !            28:        unsigned long   ri;
        !            29:        struct lnode    p;
        !            30: 
        !            31:        (void)getshares(&p, lp->l_uid, 1);
        !            32: 
        !            33:        if ( (ri = (*func)(lp, &p)) != 0 )
        !            34:                if ( putshares(&p, ri) <= 0 )
        !            35:                        return 0;
        !            36: 
        !            37:        return ri;
        !            38: }

unix.superglobalmegacorp.com

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