summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorErik Andersen2000-04-15 16:34:54 +0000
committerErik Andersen2000-04-15 16:34:54 +0000
commit5e1189e187f6a7957dadb8eda2c271c4a0777a23 (patch)
tree140cd30d77342c730afbc1df863bec93c63978a8 /miscutils
parent95c1c1e05f290ccbcc2ff863a62bcee5d57bf5c8 (diff)
downloadbusybox-5e1189e187f6a7957dadb8eda2c271c4a0777a23.zip
busybox-5e1189e187f6a7957dadb8eda2c271c4a0777a23.tar.gz
More documentation updates, and minor fixes to make things sync
up with the docs. -Erik
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/makedevs.c19
-rw-r--r--miscutils/mt.c15
2 files changed, 25 insertions, 9 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 5948bac..c8206e0 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -17,10 +17,18 @@
#include <sys/stat.h>
static const char makedevs_usage[] =
- "makedevs 0.01 -- Create an entire range of device files\n\n"
- "\tmakedevs /dev/ttyS c 4 64 0 63 (ttyS0-ttyS63)\n"
-
- "\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n";
+ "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n"
+ "Creates a range of 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\n"
+ "FIRST specifies the number appended to NAME to create the first device.\n"
+ "LAST specifies the number of the last item that should be created.\n"
+ "If 's' is the last argument, the base device is created as well.\n\n"
+ "For example:\n"
+ "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n"
+ "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n";
int makedevs_main(int argc, char **argv)
{
@@ -38,6 +46,9 @@ int makedevs_main(int argc, char **argv)
char devname[255];
char buf[255];
+ if (argc < 7 || *argv[1]=='-')
+ usage(makedevs_usage);
+
switch (type[0]) {
case 'c':
mode = S_IFCHR;
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 9791b64..cf20d17 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -4,7 +4,8 @@
#include <sys/mtio.h>
#include <sys/fcntl.h>
-static const char mt_usage[] = "mt [-f device] opcode value\n";
+static const char mt_usage[] = "mt [-f device] opcode value\n\n"
+ "Control magnetic tape drive operation\n";
struct mt_opcodes {
char *name;
@@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv)
const struct mt_opcodes *code = opcodes;
struct mtop op;
int fd;
+
+ if ((argc != 2 && argc != 3) || **(argv + 1) == '-') {
+ usage(mt_usage);
+ }
if (strcmp(argv[1], "-f") == 0) {
if (argc < 4) {
@@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv)
if (code->name == 0) {
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
- return (FALSE);
+ exit (FALSE);
}
op.mt_op = code->value;
@@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv)
if ((fd = open(file, O_RDONLY, 0)) < 0) {
perror(file);
- return (FALSE);
+ exit (FALSE);
}
if (ioctl(fd, MTIOCTOP, &op) != 0) {
perror(file);
- return (FALSE);
+ exit (FALSE);
}
- return (TRUE);
+ exit (TRUE);
}