Annotation of coherent/b/STREAMS/conf_79/mkdev.c, revision 1.1

1.1     ! root        1: #define        _DDI_DKI        1
        !             2: #define        _SYSV4          1
        !             3: 
        !             4: /*
        !             5:  * This program performs some simple processing on a device master-file,
        !             6:  * mdevice (4) as specified in the "System File and Devices Reference
        !             7:  * Manual" for Unix System V, Release 4.
        !             8:  *
        !             9:  * The first part of the program inhales the 'mdevice' file. Other processing
        !            10:  * is dependent on the internal details of the character-device interface
        !            11:  * used by Coherent - our aim is to supply details for a mapping layer that
        !            12:  * converts the Coherent device system calling format.
        !            13:  */
        !            14: /*
        !            15:  *-IMPORTS:
        !            16:  *     <sys/compat.h>
        !            17:  *             CONST
        !            18:  *             PROTO
        !            19:  *             ARGS ()
        !            20:  *             LOCAL
        !            21:  *     <stdlib.h>
        !            22:  *             EXIT_SUCCESS
        !            23:  *             EXIT_FAILURE
        !            24:  *             NULL
        !            25:  *             free ()
        !            26:  *             malloc ()
        !            27:  *     <unistd.h>
        !            28:  *             STDERR_FILENO
        !            29:  *     "mdev.h"
        !            30:  *             read_mdev_file ()
        !            31:  *     "sdev.h"
        !            32:  *             read_sdev_file ()
        !            33:  *     "symbol.h"
        !            34:  *             symbol_init ()
        !            35:  *     "assign.h"
        !            36:  *              assign_imajors ()
        !            37:  *     "mkconf.c"
        !            38:  *             write_conf_c ()
        !            39:  */
        !            40: 
        !            41: #include <sys/compat.h>
        !            42: #include <stdlib.h>
        !            43: #include <unistd.h>
        !            44: 
        !            45: #include "mdev.h"
        !            46: #include "sdev.h"
        !            47: #include "mtune.h"
        !            48: #include "stune.h"
        !            49: #include "symbol.h"
        !            50: #include "assign.h"
        !            51: #include "mkconf.h"
        !            52: 
        !            53: /*
        !            54:  * Some ancient systems do not define EXIT_SUCCESS or EXIT_FAILURE.
        !            55:  */
        !            56: 
        !            57: #ifndef EXIT_SUCCESS
        !            58: #define EXIT_SUCCESS   0
        !            59: #define        EXIT_FAILURE    1
        !            60: #endif
        !            61: 
        !            62: 
        !            63: #ifdef USE_PROTO
        !            64: void usage (void)
        !            65: #else
        !            66: void
        !            67: usage ()
        !            68: #endif
        !            69: {
        !            70:        static char     usage_msg [] = {
        !            71:                "Usage:\t-d\tGenerate device configuration tables and makefiles\n"
        !            72:                "\t-t\tGenerate tunable parameter tables\n"
        !            73:        };
        !            74: 
        !            75:        write (STDERR_FILENO, usage_msg, sizeof (usage_msg) - 1);
        !            76: }
        !            77: 
        !            78: 
        !            79: #ifdef USE_PROTO
        !            80: int main (int argc, char * argv [])
        !            81: #else
        !            82: int
        !            83: main (argc, argv)
        !            84: int            argc;
        !            85: char         * argv [];
        !            86: #endif
        !            87: {
        !            88:        extinfo_t     * extinfop;
        !            89:        int             do_devices = 0;
        !            90:        int             do_tune = 0;
        !            91:        int             i;
        !            92: 
        !            93:        symbol_init ();
        !            94: 
        !            95:        for (i = 1 ; i < argc ; i ++) {
        !            96:                int             switches;
        !            97:                int             j;
        !            98: 
        !            99:                if (argv [i][0] != '-') {
        !           100:                        usage ();
        !           101:                        return EXIT_FAILURE;
        !           102:                }
        !           103: 
        !           104:                switches = strlen (argv [i]);
        !           105: 
        !           106:                for (j = 1 ; j < switches ; j ++) {
        !           107: 
        !           108:                        switch (argv [i][j]) {
        !           109: 
        !           110:                        case 'd':
        !           111:                                do_devices ++;
        !           112:                                break;
        !           113: 
        !           114:                        case 't':
        !           115:                                do_tune ++;
        !           116:                                break;
        !           117: 
        !           118:                        default:
        !           119:                                usage ();
        !           120:                                return EXIT_FAILURE;
        !           121:                        }
        !           122:                }
        !           123:        }
        !           124: 
        !           125:        if (! do_devices && ! do_tune) {
        !           126:                usage ();
        !           127:                return EXIT_FAILURE;
        !           128:        }
        !           129: 
        !           130:        if (do_devices) {
        !           131:                read_mdev_file ("mdevice");
        !           132:                read_sdev_file ("sdevice");
        !           133: 
        !           134:                if ((extinfop = assign_imajors ()) != NULL) {
        !           135: 
        !           136:                        write_conf_c ("conf.c", extinfop);
        !           137:                        free (extinfop);
        !           138:                }
        !           139: 
        !           140:                write_link ("drvbld.mak", "template.mak");
        !           141:        }
        !           142: 
        !           143:        if (do_tune) {
        !           144:                read_mtune_file ("mtune");
        !           145:                read_stune_file ("stune");
        !           146:                write_conf_h ("conf.h");
        !           147:        }
        !           148: 
        !           149:        return EXIT_SUCCESS;
        !           150: }

unix.superglobalmegacorp.com

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