Annotation of coherent/b/kernel/tools/ftmkdev.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * File:       ftmkdev.c
        !             3:  *
        !             4:  * Purpose:    create nodes for floppy tape
        !             5:  *
        !             6:  * $Log:       ftmkdev.c,v $
        !             7:  * Revision 1.1  93/06/14  13:29:32  bin
        !             8:  * Initial revision
        !             9:  * 
        !            10:  */
        !            11: /*
        !            12:  * ----------------------------------------------------------------------
        !            13:  * Includes.
        !            14:  */
        !            15: #include <sys/xlft.h>
        !            16: 
        !            17: /*
        !            18:  * ----------------------------------------------------------------------
        !            19:  * Definitions.
        !            20:  *     Constants.
        !            21:  *     Macros with argument lists.
        !            22:  *     Typedefs.
        !            23:  *     Enums.
        !            24:  */
        !            25: #define LO_MN          0x40            /* low minor number to generate  */
        !            26: #define NUM_DEVS       64              /* number of devices to generate */
        !            27: 
        !            28: #define DNAME_LEN      20
        !            29: 
        !            30: /*
        !            31:  * ----------------------------------------------------------------------
        !            32:  * Functions.
        !            33:  *     Import Functions.
        !            34:  *     Export Functions.
        !            35:  *     Local Functions.
        !            36:  */
        !            37: static void genName();
        !            38: 
        !            39: /*
        !            40:  * ----------------------------------------------------------------------
        !            41:  * Global Data.
        !            42:  *     Import Variables.
        !            43:  *     Export Variables.
        !            44:  *     Local Variables.
        !            45:  */
        !            46: 
        !            47: /*
        !            48:  * ----------------------------------------------------------------------
        !            49:  * Code.
        !            50:  */
        !            51: 
        !            52: main(argc, argv)
        !            53: int argc;
        !            54: char * argv[];
        !            55: {
        !            56:        int     m;      /* minor number */
        !            57:        char    dname[DNAME_LEN];
        !            58: 
        !            59:        printf("/bin/mkdir /dev/ft\n");
        !            60:        printf("/bin/chmog 777 sys sys /dev/ft\n");
        !            61: 
        !            62:        for (m = LO_MN; m < LO_MN + NUM_DEVS; m++) {
        !            63: 
        !            64:                /* Generate device name. */
        !            65:                genName(m, dname);
        !            66: 
        !            67:                printf("/etc/mknod -f /dev/ft/%s c 4 %d\n", dname, m);
        !            68:        }
        !            69:        printf("/bin/chmog 666 sys sys /dev/ft/*\n");
        !            70: }
        !            71: 
        !            72: static void
        !            73: genName(m, str)
        !            74: int m;
        !            75: char * str;
        !            76: {
        !            77:        int     unit, format, control, noRewind, retension;
        !            78: 
        !            79:        unit = m & M_UNT;
        !            80:        format = m & M_FMT;
        !            81:        control = m & M_CTL;
        !            82:        noRewind = m & M_REW;
        !            83:        retension = m & M_RET;
        !            84: 
        !            85:        sprintf(str, "f%dq%d0%s%s%s",
        !            86:          unit,
        !            87:          (format) ? 8 : 4,
        !            88:          (control) ? "c" : "",
        !            89:          (noRewind) ? "n" : "",
        !            90:          (retension) ? "r" : "");
        !            91: }

unix.superglobalmegacorp.com

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