| * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com> |
| * Make ranges of device files quickly. |
| * known bugs: can't deal with alpha ranges |
| int makedevs_main(int argc, char **argv) |
| const char *basedev = argv[1]; |
| const char *type = argv[2]; |
| int major = atoi(argv[3]); |
| int Sminor = atoi(argv[4]); |
| int sbase = argc == 8 ? 1 : 0; |
| if (argc < 7 || *argv[1]=='-') |
| dev = (major << 8) | Sminor; |
| strcpy(devname, basedev); |
| if (mknod(devname, mode, dev)) |
| printf("Failed to create: %s\n", devname); |
| And this is what this program replaces. The shell is too slow! |
| local basedev=$1; local S=$2; local E=$3 |
| local major=$4; local Sminor=$5; local type=$6 |
| if [ ! "$sbase" = "" ]; then |
| mknod "$basedev" $type $major $Sminor |
| Sminor=`expr $Sminor + 1` |
| mknod "$basedev$S" $type $major $Sminor |
| Sminor=`expr $Sminor + 1` |