Annotation of researchv10no/libc/gen/getshput.c, revision 1.1.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       <shares.h>
                     19: 
                     20: 
                     21: unsigned long
                     22: getshput(lp, func)
                     23:        struct lnode *  lp;
                     24:        unsigned long   (*func)();
                     25: {
                     26:        unsigned long   ri;
                     27:        struct lnode    p;
                     28: 
                     29:        (void)getshares(&p, lp->l_uid, 1);
                     30: 
                     31:        if ( (ri = (*func)(lp, &p)) != 0 )
                     32:                if ( putshares(&p, ri) <= 0 )
                     33:                        return 0;
                     34: 
                     35:        return ri;
                     36: }

unix.superglobalmegacorp.com

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