summaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-19 03:59:10 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-19 03:59:10 +0000
commit3fe7f9f20b6562e667ff3c9388a6ce00bd1ba19f (patch)
tree98c78a2d9487f52752ed3057d9dd233be6f65161 /console-tools
parenta3e57ca7008cbaf612675b9de3dd18109f8150de (diff)
downloadbusybox-w32-3fe7f9f20b6562e667ff3c9388a6ce00bd1ba19f.tar.gz
busybox-w32-3fe7f9f20b6562e667ff3c9388a6ce00bd1ba19f.tar.bz2
busybox-w32-3fe7f9f20b6562e667ff3c9388a6ce00bd1ba19f.zip
More minor updates to docs (and making apps behave as the docs
suggest they should) -Erik
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/loadacm.c14
-rw-r--r--console-tools/loadfont.c4
-rw-r--r--console-tools/loadkmap.c23
3 files changed, 25 insertions, 16 deletions
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 @@
7 * Peter Novodvorsky <petya@logic.ru> 7 * Peter Novodvorsky <petya@logic.ru>
8 */ 8 */
9 9
10#include "internal.h"
10#include <stdio.h> 11#include <stdio.h>
11#include <stdlib.h> 12#include <stdlib.h>
12#include <memory.h> 13#include <memory.h>
@@ -21,6 +22,9 @@
21#include <sys/ioctl.h> 22#include <sys/ioctl.h>
22#include <sys/kd.h> 23#include <sys/kd.h>
23 24
25static const char loadacm_usage[] = "loadacm\n\n"
26 "Loads an acm from standard input.\n";
27
24typedef unsigned short unicode; 28typedef unsigned short unicode;
25 29
26static long int ctoi(unsigned char *s, int *is_unicode); 30static long int ctoi(unsigned char *s, int *is_unicode);
@@ -33,20 +37,24 @@ int loadacm_main(int argc, char **argv)
33{ 37{
34 int fd; 38 int fd;
35 39
40 if (argc>=2 && *argv[1]=='-') {
41 usage(loadacm_usage);
42 }
43
36 fd = open("/dev/tty", O_RDWR); 44 fd = open("/dev/tty", O_RDWR);
37 if (fd < 0) { 45 if (fd < 0) {
38 fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); 46 fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno));
39 return 1; 47 return( FALSE);
40 } 48 }
41 49
42 if (screen_map_load(fd, stdin)) { 50 if (screen_map_load(fd, stdin)) {
43 fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); 51 fprintf(stderr, "Error loading acm: %s\n", strerror(errno));
44 return 1; 52 return( FALSE);
45 } 53 }
46 54
47 write(fd, "\033(K", 3); 55 write(fd, "\033(K", 3);
48 56
49 return 0; 57 return( TRUE);
50} 58}
51 59
52int screen_map_load(int fd, FILE * fp) 60int 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)
54 fd = open("/dev/tty0", O_RDWR); 54 fd = open("/dev/tty0", O_RDWR);
55 if (fd < 0) { 55 if (fd < 0) {
56 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 56 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
57 return 1; 57 return( FALSE);
58 } 58 }
59 loadnewfont(fd); 59 loadnewfont(fd);
60 60
61 return 0; 61 return( TRUE);
62} 62}
63 63
64static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) 64static 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 @@
29#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30 30
31 31
32static const char loadkmap_usage[] = "loadkmap\n" 32static const char loadkmap_usage[] = "loadkmap\n\n"
33 "\n" 33 "Loads a binary keyboard translation table from standard input.\n";
34
35 "\tLoad a binary keyboard translation table from standard input.\n"
36 "\n";
37 34
38 35
39int loadkmap_main(int argc, char **argv) 36int loadkmap_main(int argc, char **argv)
@@ -43,28 +40,32 @@ int loadkmap_main(int argc, char **argv)
43 int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short); 40 int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short);
44 char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap", buff[7]; 41 char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap", buff[7];
45 42
43 if (argc>=2 && *argv[1]=='-') {
44 usage(loadkmap_usage);
45 }
46
46 fd = open("/dev/tty0", O_RDWR); 47 fd = open("/dev/tty0", O_RDWR);
47 if (fd < 0) { 48 if (fd < 0) {
48 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 49 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
49 return 1; 50 exit(FALSE);
50 } 51 }
51 52
52 read(0, buff, 7); 53 read(0, buff, 7);
53 if (0 != strncmp(buff, magic, 7)) { 54 if (0 != strncmp(buff, magic, 7)) {
54 fprintf(stderr, "This is not a valid binary keymap.\n"); 55 fprintf(stderr, "This is not a valid binary keymap.\n");
55 return 1; 56 exit(FALSE);
56 } 57 }
57 58
58 if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { 59 if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
59 fprintf(stderr, "Error reading keymap flags: %s\n", 60 fprintf(stderr, "Error reading keymap flags: %s\n",
60 strerror(errno)); 61 strerror(errno));
61 return 1; 62 exit(FALSE);
62 } 63 }
63 64
64 ibuff = (u_short *) malloc(ibuffsz); 65 ibuff = (u_short *) malloc(ibuffsz);
65 if (!ibuff) { 66 if (!ibuff) {
66 fprintf(stderr, "Out of memory.\n"); 67 fprintf(stderr, "Out of memory.\n");
67 return 1; 68 exit(FALSE);
68 } 69 }
69 70
70 for (i = 0; i < MAX_NR_KEYMAPS; i++) { 71 for (i = 0; i < MAX_NR_KEYMAPS; i++) {
@@ -75,7 +76,7 @@ int loadkmap_main(int argc, char **argv)
75 < 0) { 76 < 0) {
76 fprintf(stderr, "Error reading keymap: %s\n", 77 fprintf(stderr, "Error reading keymap: %s\n",
77 strerror(errno)); 78 strerror(errno));
78 return 1; 79 exit(FALSE);
79 } 80 }
80 pos += readsz; 81 pos += readsz;
81 } 82 }
@@ -90,5 +91,5 @@ int loadkmap_main(int argc, char **argv)
90 /* Don't bother to close files. Exit does that 91 /* Don't bother to close files. Exit does that
91 * automagically, so we can save a few bytes */ 92 * automagically, so we can save a few bytes */
92 /* close(fd); */ 93 /* close(fd); */
93 return 0; 94 exit(TRUE);
94} 95}