Annotation of researchv10dc/dist/man/v4/man2/dup.2, revision 1.1.1.1

1.1       root        1: .th DUP II 8/5/73
                      2: .sh NAME
                      3: dup \*- duplicate an open file descriptor
                      4: .sh SYNOPSIS
                      5: (dup = 41.; not in assembler)
                      6: .br
                      7: (file descriptor in r0)
                      8: .br
                      9: .ft B
                     10: sys dup
                     11: .s3
                     12: dup(fildes)
                     13: .br
                     14: int fildes;
                     15: .ft R
                     16: .sh DESCRIPTION
                     17: Given
                     18: a file descriptor returned from
                     19: an
                     20: .it open,
                     21: .it pipe,
                     22: or
                     23: .it creat
                     24: call,
                     25: .it dup
                     26: will allocate another file descriptor
                     27: synonymous
                     28: with
                     29: the original.
                     30: The new file descriptor is returned in r0.
                     31: .s3
                     32: .it Dup
                     33: is used more to reassign the value
                     34: of file descriptors
                     35: than to genuinely
                     36: duplicate a file descriptor.
                     37: Since the algorithm to allocate
                     38: file descriptors
                     39: returns the
                     40: lowest available
                     41: value between 0 and 9,
                     42: combinations of
                     43: .it dup
                     44: and
                     45: .it close
                     46: can be
                     47: used to
                     48: manipulate file descriptors
                     49: in a general way.
                     50: This is handy for
                     51: manipulating standard input and/or
                     52: standard output.
                     53: .sh "SEE ALSO"
                     54: creat(II), open(II), close(II), pipe(II)
                     55: .sh DIAGNOSTICS
                     56: The
                     57: error bit (c-bit)
                     58: is set if:
                     59: the given file descriptor is invalid;
                     60: there are already 10 open files.
                     61: From C, a \*-1 returned value indicates an error.

unix.superglobalmegacorp.com

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