Annotation of researchv10no/cmd/refer/update/look.c, revision 1.1

1.1     ! root        1: # include "stdio.h"
        !             2: # include "assert.h"
        !             3: # define mv(f,g) {close(g); dup(f); close(f);}
        !             4: /* send everything through chkbib & lhunt */
        !             5: char * indexes= "/usr/dict/papers/Ind";
        !             6: lookup (fin, fout)
        !             7:        FILE *fin, *fout;
        !             8: {
        !             9:        struct pipe {int fr, fw;};
        !            10:        struct pipe p1, p2, p3;
        !            11: pipe(&p1); pipe(&p2); pipe(&p3);
        !            12: if (fork()==0)
        !            13:        {
        !            14:        /* chkbib process; read p1.fr, write p2.fw */
        !            15:        close(p1.fw); close(p2.fr); close(p3.fr); close(p3.fw);
        !            16:        mv (p2.fw, 1);
        !            17:        mv (p1.fr, 0);
        !            18:        execl("/usr/lib/refer/mkey", "mkey", "-s", 0);
        !            19:        _assert(0);
        !            20:        }
        !            21: close(p1.fr);
        !            22: if (fork()==0)
        !            23:        {
        !            24:        /* lhunt reads p2, writes p3 */
        !            25:        close(p1.fw); close(p1.fr); close(p2.fw); close(p3.fr);
        !            26:        mv (p3.fw, 1);
        !            27:        mv (p2.fr, 0);
        !            28:        execl("/usr/lib/refer/hunt", "hunt", "-Ty", "-Fn",  /*"-C1",*/
        !            29:                indexes, 0);
        !            30:        _assert(0);
        !            31:        }
        !            32: close(p3.fw);
        !            33: close(p2.fr); close(p2.fw);
        !            34: /* now get some files */
        !            35: close (fin->_file); fin->_file = p1.fw;
        !            36: close(fout->_file); fout->_file=p3.fr;
        !            37: return;
        !            38: }

unix.superglobalmegacorp.com

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