From 3fe7f9f20b6562e667ff3c9388a6ce00bd1ba19f Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Wed, 19 Apr 2000 03:59:10 +0000 Subject: [PATCH] More minor updates to docs (and making apps behave as the docs suggest they should) -Erik --- Makefile | 2 +- console-tools/loadacm.c | 14 +++++++++++--- console-tools/loadfont.c | 4 ++-- console-tools/loadkmap.c | 23 ++++++++++++----------- docs/busybox.pod | 30 ++++++++++++++++++++++++++---- loadacm.c | 14 +++++++++++--- loadfont.c | 4 ++-- loadkmap.c | 23 ++++++++++++----------- 8 files changed, 77 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 6a4b41b01..90a1a21fd 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ export VERSION # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. # eg: `make DODEBUG=true tests' -DODEBUG = true +DODEBUG = false # If you want a static binary, turn this on. DOSTATIC = false diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 66f79092c..8f6923478 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c @@ -7,6 +7,7 @@ * Peter Novodvorsky */ +#include "internal.h" #include #include #include @@ -21,6 +22,9 @@ #include #include +static const char loadacm_usage[] = "loadacm\n\n" + "Loads an acm from standard input.\n"; + typedef unsigned short unicode; static long int ctoi(unsigned char *s, int *is_unicode); @@ -33,20 +37,24 @@ int loadacm_main(int argc, char **argv) { int fd; + if (argc>=2 && *argv[1]=='-') { + usage(loadacm_usage); + } + fd = open("/dev/tty", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); - return 1; + return( FALSE); } if (screen_map_load(fd, stdin)) { fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); - return 1; + return( FALSE); } write(fd, "\033(K", 3); - return 0; + return( TRUE); } int screen_map_load(int fd, FILE * fp) diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 0f6afecd4..5e1f04d76 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -54,11 +54,11 @@ extern int loadfont_main(int argc, char **argv) fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + return( FALSE); } loadnewfont(fd); - return 0; + return( TRUE); } static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index fe533d522..75e52e148 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c @@ -29,11 +29,8 @@ #include -static const char loadkmap_usage[] = "loadkmap\n" - "\n" - - "\tLoad a binary keyboard translation table from standard input.\n" - "\n"; +static const char loadkmap_usage[] = "loadkmap\n\n" + "Loads a binary keyboard translation table from standard input.\n"; int loadkmap_main(int argc, char **argv) @@ -43,28 +40,32 @@ int loadkmap_main(int argc, char **argv) int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short); char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap", buff[7]; + if (argc>=2 && *argv[1]=='-') { + usage(loadkmap_usage); + } + fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + exit(FALSE); } read(0, buff, 7); if (0 != strncmp(buff, magic, 7)) { fprintf(stderr, "This is not a valid binary keymap.\n"); - return 1; + exit(FALSE); } if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { fprintf(stderr, "Error reading keymap flags: %s\n", strerror(errno)); - return 1; + exit(FALSE); } ibuff = (u_short *) malloc(ibuffsz); if (!ibuff) { fprintf(stderr, "Out of memory.\n"); - return 1; + exit(FALSE); } for (i = 0; i < MAX_NR_KEYMAPS; i++) { @@ -75,7 +76,7 @@ int loadkmap_main(int argc, char **argv) < 0) { fprintf(stderr, "Error reading keymap: %s\n", strerror(errno)); - return 1; + exit(FALSE); } pos += readsz; } @@ -90,5 +91,5 @@ int loadkmap_main(int argc, char **argv) /* Don't bother to close files. Exit does that * automagically, so we can save a few bytes */ /* close(fd); */ - return 0; + exit(TRUE); } diff --git a/docs/busybox.pod b/docs/busybox.pod index a946e2857..0a61839e4 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod @@ -807,7 +807,13 @@ Example: =item loadacm -FIXME -- this command does not yet have proper documentation +Usage: loadacm + +Loads an acm from standard input. + +Example: + + $ loadacm < /etc/i18n/acmname ------------------------------- @@ -817,12 +823,21 @@ Usage: loadfont Loads a console font from standard input. +Example: + + $ loadfont < /etc/i18n/fontname ------------------------------- =item loadkmap -FIXME -- this command does not yet have proper documentation +Usage: loadkmap + +Loads a binary keyboard translation table from standard input. + +Example: + + $ loadkmap < /etc/i18n/lang-keymap ------------------------------- @@ -1297,7 +1312,14 @@ Usage: sh lash -- the BusyBox LAme SHell (command interpreter) -FIXME -- this command does not yet have proper documentation +This command does not yet have proper documentation. + +Use lash just as you would use any other shell. It properly handles pipes, +redirects, job control, can be used as the shell for scripts (#!/bin/sh), and +has a sufficient set of builtins to do what is needed. It does not (yet) +support Bourne Shell syntax. If you need things like "if-then-else", "while", +and such, use ash or bash. If you just need a very simple and extremely small +shell, this will do the job. ------------------------------- @@ -1781,4 +1803,4 @@ Enrique Zanardi =cut -# $Id: busybox.pod,v 1.16 2000/04/18 00:00:52 erik Exp $ +# $Id: busybox.pod,v 1.17 2000/04/19 03:59:10 erik Exp $ diff --git a/loadacm.c b/loadacm.c index 66f79092c..8f6923478 100644 --- a/loadacm.c +++ b/loadacm.c @@ -7,6 +7,7 @@ * Peter Novodvorsky */ +#include "internal.h" #include #include #include @@ -21,6 +22,9 @@ #include #include +static const char loadacm_usage[] = "loadacm\n\n" + "Loads an acm from standard input.\n"; + typedef unsigned short unicode; static long int ctoi(unsigned char *s, int *is_unicode); @@ -33,20 +37,24 @@ int loadacm_main(int argc, char **argv) { int fd; + if (argc>=2 && *argv[1]=='-') { + usage(loadacm_usage); + } + fd = open("/dev/tty", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); - return 1; + return( FALSE); } if (screen_map_load(fd, stdin)) { fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); - return 1; + return( FALSE); } write(fd, "\033(K", 3); - return 0; + return( TRUE); } int screen_map_load(int fd, FILE * fp) diff --git a/loadfont.c b/loadfont.c index 0f6afecd4..5e1f04d76 100644 --- a/loadfont.c +++ b/loadfont.c @@ -54,11 +54,11 @@ extern int loadfont_main(int argc, char **argv) fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + return( FALSE); } loadnewfont(fd); - return 0; + return( TRUE); } static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) diff --git a/loadkmap.c b/loadkmap.c index fe533d522..75e52e148 100644 --- a/loadkmap.c +++ b/loadkmap.c @@ -29,11 +29,8 @@ #include -static const char loadkmap_usage[] = "loadkmap\n" - "\n" - - "\tLoad a binary keyboard translation table from standard input.\n" - "\n"; +static const char loadkmap_usage[] = "loadkmap\n\n" + "Loads a binary keyboard translation table from standard input.\n"; int loadkmap_main(int argc, char **argv) @@ -43,28 +40,32 @@ int loadkmap_main(int argc, char **argv) int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short); char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap", buff[7]; + if (argc>=2 && *argv[1]=='-') { + usage(loadkmap_usage); + } + fd = open("/dev/tty0", O_RDWR); if (fd < 0) { fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + exit(FALSE); } read(0, buff, 7); if (0 != strncmp(buff, magic, 7)) { fprintf(stderr, "This is not a valid binary keymap.\n"); - return 1; + exit(FALSE); } if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { fprintf(stderr, "Error reading keymap flags: %s\n", strerror(errno)); - return 1; + exit(FALSE); } ibuff = (u_short *) malloc(ibuffsz); if (!ibuff) { fprintf(stderr, "Out of memory.\n"); - return 1; + exit(FALSE); } for (i = 0; i < MAX_NR_KEYMAPS; i++) { @@ -75,7 +76,7 @@ int loadkmap_main(int argc, char **argv) < 0) { fprintf(stderr, "Error reading keymap: %s\n", strerror(errno)); - return 1; + exit(FALSE); } pos += readsz; } @@ -90,5 +91,5 @@ int loadkmap_main(int argc, char **argv) /* Don't bother to close files. Exit does that * automagically, so we can save a few bytes */ /* close(fd); */ - return 0; + exit(TRUE); } -- 2.25.1