Annotation of researchv10no/libc/gen/nametty.c, revision 1.1

1.1     ! root        1: #include <sys/types.h>
        !             2: #include <sys/stat.h>
        !             3: /*
        !             4:  * give a name to a tty
        !             5:  * name must be an extant file
        !             6:  */
        !             7: 
        !             8: #define        MSFS    3       /* mounted stream filesystem */
        !             9: 
        !            10: nametty(fd, name)
        !            11: int fd;
        !            12: char *name;
        !            13: {
        !            14:        struct stat st;
        !            15: 
        !            16:        if (fmount(MSFS, fd, name, 0) < 0)
        !            17:                return (0);
        !            18:        /*
        !            19:         * make fake pipe mode match mounted fd;
        !            20:         * silly annoyance
        !            21:         */
        !            22:        if (fstat(fd, &st) >= 0)
        !            23:                chmod(name, st.st_mode & 0777);
        !            24:        return (1);
        !            25: }

unix.superglobalmegacorp.com

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