Annotation of researchv10no/cmd/mk/export.proto/libc/dup2.c, revision 1.1.1.1

1.1       root        1: #ifdef SYSV
                      2: /*
                      3:        dup2(a, b)
                      4: 
                      5:        dup a as value b
                      6: */
                      7: 
                      8: dup2(a, b)
                      9: {
                     10:        int poot[256];          /* greater than NFILES i hope! */
                     11:        register i, ret;
                     12: 
                     13:        close(b);
                     14:        for(i = 0; (poot[i] = dup(a)) >= 0; i++)
                     15:                if(poot[i] == b) break;
                     16:        ret = i;
                     17:        while(--i >= 0)
                     18:                close(poot[i]);         /* don't need 'em anymore */
                     19:        return(poot[ret]);
                     20: }
                     21: #endif

unix.superglobalmegacorp.com

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