sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 3c5f2b240750b3226c8dee75c1b20785f9bb2f16
parent 1fbe4e95eded282e20a18a773c792f2f91e6660b
Author: David Galos <galosd83@students.rowan.edu>
Date:   Wed Jul  3 11:48:06 -0400

Simplyfing mknod. Good eye, Truls Becken.

Diffstat:
mknod.c | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mknod.c b/mknod.c @@ -17,12 +17,8 @@ int main(int argc, char **argv) { mode_t type, mode = 0644; - mode_t types['u'+1]; dev_t dev; - types['u'] = types['c'] = S_IFCHR; - types['b'] = S_IFBLK; - ARGBEGIN { case 'm': mode = estrtol(EARGF(usage()), 8); @@ -36,7 +32,7 @@ main(int argc, char **argv) if(strlen(argv[1]) != 1 || !strchr("ucb", argv[1][0])) eprintf("mknod: '%s': invalid type\n", argv[1]); - type = types[(unsigned)argv[1][0]]; + type = (argv[1][0] == 'b') ? S_IFBLK : S_IFCHR; dev = makedev(estrtol(argv[2], 0), estrtol(argv[3], 0));