Annotation of 43BSDReno/sbin/mknod/mknod.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1989 The Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * This code is derived from software contributed to Berkeley by
        !             6:  * Kevin Fall.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms are permitted
        !             9:  * provided that: (1) source distributions retain this entire copyright
        !            10:  * notice and comment, and (2) distributions including binaries display
        !            11:  * the following acknowledgement:  ``This product includes software
        !            12:  * developed by the University of California, Berkeley and its contributors''
        !            13:  * in the documentation or other materials provided with the distribution
        !            14:  * and in all advertising materials mentioning features or use of this
        !            15:  * software. Neither the name of the University nor the names of its
        !            16:  * contributors may be used to endorse or promote products derived
        !            17:  * from this software without specific prior written permission.
        !            18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            19:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            20:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            21:  */
        !            22: 
        !            23: #ifndef lint
        !            24: char copyright[] =
        !            25: "@(#) Copyright (c) 1989 The Regents of the University of California.\n\
        !            26:  All rights reserved.\n";
        !            27: #endif /* not lint */
        !            28: 
        !            29: #ifndef lint
        !            30: static char sccsid[] = "@(#)mknod.c    4.4 (Berkeley) 6/1/90";
        !            31: #endif /* not lint */
        !            32: 
        !            33: #include <sys/types.h>
        !            34: #include <sys/stat.h>
        !            35: #include <stdio.h>
        !            36: 
        !            37: main(argc, argv)
        !            38:        int argc;
        !            39:        char **argv;
        !            40: {
        !            41:        extern int errno;
        !            42:        u_short mode;
        !            43:        char *strerror();
        !            44: 
        !            45:        if (argc != 5) {
        !            46:                (void)fprintf(stderr,
        !            47:                    "usage: mknod name [b | c] major minor\n");
        !            48:                exit(1);
        !            49:        }
        !            50: 
        !            51:        mode = 0666;
        !            52:        if (argv[2][0] == 'c')
        !            53:                mode |= S_IFCHR;
        !            54:        else if (argv[2][0] == 'b')
        !            55:                mode |= S_IFBLK;
        !            56:        else {
        !            57:                (void)fprintf(stderr,
        !            58:                    "mknod: node must be type 'b' or 'c'.\n");
        !            59:                exit(1);
        !            60:        }
        !            61: 
        !            62:        if (mknod(argv[1], mode, makedev(atoi(argv[3]), atoi(argv[4]))) < 0) {
        !            63:                (void)fprintf(stderr,
        !            64:                    "mknod: %s: %s\n", argv[1], strerror(errno));
        !            65:                exit(1);
        !            66:        }
        !            67:        exit(0);
        !            68: }

unix.superglobalmegacorp.com

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