Annotation of 42BSD/usr.lib/libU77/ttynam_.c, revision 1.1.1.1

1.1       root        1: /*
                      2: char id_ttynam[] = "@(#)ttynam_.c      1.1";
                      3:  *
                      4:  * Return name of tty port associated with lunit
                      5:  *
                      6:  * calling sequence:
                      7:  *     character*19 string, ttynam
                      8:  *     string = ttynam (lunit)
                      9:  * where:
                     10:  *     the character string will be filled with the name of
                     11:  *     the port, preceded with '/dev/', and blank padded.
                     12:  *     (19 is the max length ever required)
                     13:  */
                     14: 
                     15: #include "../libI77/fiodefs.h"
                     16: 
                     17: extern unit units[];
                     18: 
                     19: ttynam_(name, strlen, lu)
                     20: char *name; long strlen; long *lu;
                     21: {
                     22:        char *t = NULL, *ttyname();
                     23: 
                     24:        if (0 <= *lu && *lu < MXUNIT && units[*lu].ufd)
                     25:                t = ttyname(fileno(units[*lu].ufd));
                     26:        if (t == NULL)
                     27:                t = "";
                     28:        b_char(t, name, strlen);
                     29: }

unix.superglobalmegacorp.com

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