summaryrefslogtreecommitdiff
path: root/mknod.c
diff options
context:
space:
mode:
authorErik Andersen2000-02-08 19:58:47 +0000
committerErik Andersen2000-02-08 19:58:47 +0000
commite49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch)
treec90bda10731ad9333ce3b404f993354c9fc104b8 /mknod.c
parentc0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff)
downloadbusybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.zip
busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'mknod.c')
-rw-r--r--mknod.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/mknod.c b/mknod.c
index 5822cd3..b11a81f 100644
--- a/mknod.c
+++ b/mknod.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* Mini mknod implementation for busybox
*
@@ -28,22 +29,22 @@
#include <unistd.h>
static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n"
-"Make block or character special files.\n\n"
-"TYPEs include:\n"
-"\tb:\tMake a block (buffered) device.\n"
-"\tc or u:\tMake a character (un-buffered) device.\n"
-"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
+ "Make block or character special files.\n\n"
+ "TYPEs include:\n"
+ "\tb:\tMake a block (buffered) device.\n"
-int
-mknod_main(int argc, char** argv)
+ "\tc or u:\tMake a character (un-buffered) device.\n"
+ "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
+
+int mknod_main(int argc, char **argv)
{
- mode_t mode = 0;
- dev_t dev = 0;
+ mode_t mode = 0;
+ dev_t dev = 0;
- if ( argc != 5 || **(argv+1) == '-' ) {
- usage (mknod_usage);
+ if (argc != 5 || **(argv + 1) == '-') {
+ usage(mknod_usage);
}
- switch(argv[2][0]) {
+ switch (argv[2][0]) {
case 'c':
case 'u':
mode = S_IFCHR;
@@ -55,21 +56,21 @@ mknod_main(int argc, char** argv)
mode = S_IFIFO;
break;
default:
- usage (mknod_usage);
+ usage(mknod_usage);
}
- if ( mode == S_IFCHR || mode == S_IFBLK ) {
+ if (mode == S_IFCHR || mode == S_IFBLK) {
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
- if ( argc != 5 ) {
- usage (mknod_usage);
+ if (argc != 5) {
+ usage(mknod_usage);
}
}
mode |= 0666;
- if ( mknod(argv[1], mode, dev) != 0 ) {
+ if (mknod(argv[1], mode, dev) != 0) {
perror(argv[1]);
- return( FALSE);
+ return (FALSE);
}
- return( TRUE);
+ return (TRUE);
}