3 # ----------------------------------------------------------------------------
4 # "THE BEER-WARE LICENSE" (Revision 42):
5 # <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
6 # can do whatever you want with this stuff. If we meet some day, and you think
7 # this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
8 # ----------------------------------------------------------------------------
12 # During installation, we suffer badly of we have to run MAKEDEV. MAKEDEV
13 # need sh, ln, chown, mknod, awk, rm, test and probably emacs too when
14 # we come down to it. So instead this script will make a C-procedure which
15 # makes all the B & C nodes of a specified directory.
19 (cd $1; ls -li ) | sed 's/,//' | awk '
21 while (getline < "/etc/passwd") {
25 while (getline < "/etc/group") {
30 printf(" * This file is generated from the contents of /dev\n");
32 printf("#define CHK(foo) {i = foo;}\n");
33 printf("#include <unistd.h>\n");
34 printf("#include <sys/types.h>\n");
35 printf("#include <sys/stat.h>\n");
36 printf("int makedevs()\n{\n\tint i=0;\n");
39 printf ("/* %s */\n",$0)
42 if (substr($2,1,1) == "b") {
44 } else if (substr($2,1,1) == "c") {
46 } else if (substr($2,1,1) == "d") {
48 } else if (substr($2,1,1) == "-") {
54 if (substr($2,2,1) == "r") m += 400;
55 if (substr($2,3,1) == "w") m += 200;
56 if (substr($2,4,1) == "x") m += 100;
57 if (substr($2,5,1) == "r") m += 40;
58 if (substr($2,6,1) == "w") m += 20;
59 if (substr($2,7,1) == "x") m += 10;
60 if (substr($2,8,1) == "r") m += 4;
61 if (substr($2,9,1) == "w") m += 2;
62 if (substr($2,10,1) == "x") m += 1;
65 printf ("\tCHK(link(\"%s\",\"%s\"));\n", \
68 printf ("\tCHK(mknod(\"%s\",%s,makedev(%d,%d)));\n", \
70 printf ("\tCHK(chmod(\"%s\",0%d));\n", \
72 printf ("\tCHK(chown(\"%s\",%d,%d));\n", \
78 printf("\treturn i;\n}\n");