aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-07-14 01:51:25 +0000
committerMatt Kraai <kraai@debian.org>2000-07-14 01:51:25 +0000
commitd537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch)
tree62127f20fc07758e445d8c4e186306cbe83d77b1 /console-tools
parent4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff)
downloadbusybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz
busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.bz2
busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip
Use errorMsg rather than fprintf.
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/deallocvt.c8
-rw-r--r--console-tools/dumpkmap.c4
-rw-r--r--console-tools/loadacm.c18
-rw-r--r--console-tools/loadfont.c18
-rw-r--r--console-tools/loadkmap.c10
5 files changed, 27 insertions, 31 deletions
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 53d4d9a7c..906f3a9fa 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[])
39 for (i = 1; i < argc; i++) { 39 for (i = 1; i < argc; i++) {
40 num = atoi(argv[i]); 40 num = atoi(argv[i]);
41 if (num == 0) 41 if (num == 0)
42 fprintf(stderr, "%s: 0: illegal VT number\n", applet_name); 42 errorMsg("0: illegal VT number\n");
43 else if (num == 1) 43 else if (num == 1)
44 fprintf(stderr, "%s: VT 1 cannot be deallocated\n", 44 errorMsg("VT 1 cannot be deallocated\n");
45 applet_name);
46 else if (ioctl(fd, VT_DISALLOCATE, num)) { 45 else if (ioctl(fd, VT_DISALLOCATE, num)) {
47 perror("VT_DISALLOCATE"); 46 perror("VT_DISALLOCATE");
48 fprintf(stderr, "%s: could not deallocate console %d\n", 47 errorMsg("could not deallocate console %d\n", num);
49 applet_name, num);
50 exit( FALSE); 48 exit( FALSE);
51 } 49 }
52 } 50 }
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index a497a07d1..f18050529 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv)
58 58
59 fd = open("/dev/tty0", O_RDWR); 59 fd = open("/dev/tty0", O_RDWR);
60 if (fd < 0) { 60 if (fd < 0) {
61 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 61 errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
62 return 1; 62 return 1;
63 } 63 }
64 64
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv)
86 ke.kb_table = i; 86 ke.kb_table = i;
87 if (ioctl(fd, KDGKBENT, &ke) < 0) { 87 if (ioctl(fd, KDGKBENT, &ke) < 0) {
88 88
89 fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); 89 errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
90 } 90 }
91 else { 91 else {
92 write(1,&ke.kb_value,2); 92 write(1,&ke.kb_value,2);
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c
index a64c691d2..9eebf3bb5 100644
--- a/console-tools/loadacm.c
+++ b/console-tools/loadacm.c
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv)
46 46
47 fd = open("/dev/tty", O_RDWR); 47 fd = open("/dev/tty", O_RDWR);
48 if (fd < 0) { 48 if (fd < 0) {
49 fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); 49 errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
50 return( FALSE); 50 return( FALSE);
51 } 51 }
52 52
53 if (screen_map_load(fd, stdin)) { 53 if (screen_map_load(fd, stdin)) {
54 fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); 54 errorMsg("Error loading acm: %s\n", strerror(errno));
55 return( FALSE); 55 return( FALSE);
56 } 56 }
57 57
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp)
79 if (parse_failed) { 79 if (parse_failed) {
80 if (-1 == fseek(fp, 0, SEEK_SET)) { 80 if (-1 == fseek(fp, 0, SEEK_SET)) {
81 if (errno == ESPIPE) 81 if (errno == ESPIPE)
82 fprintf(stderr, 82 errorMsg("16bit screen-map MUST be a regular file.\n"),
83 "16bit screen-map MUST be a regular file.\n"),
84 exit(1); 83 exit(1);
85 else 84 else
86 perror("fseek failed reading binary 16bit screen-map"), 85 perror("fseek failed reading binary 16bit screen-map"),
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp)
91 perror("Cannot read [new] map from file"), exit(1); 90 perror("Cannot read [new] map from file"), exit(1);
92#if 0 91#if 0
93 else 92 else
94 fprintf(stderr, "Input screen-map is binary.\n"); 93 errorMsg("Input screen-map is binary.\n");
95#endif 94#endif
96 } 95 }
97 96
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp)
108 /* rewind... */ 107 /* rewind... */
109 if (-1 == fseek(fp, 0, SEEK_SET)) { 108 if (-1 == fseek(fp, 0, SEEK_SET)) {
110 if (errno == ESPIPE) 109 if (errno == ESPIPE)
111 fprintf(stderr, 110 errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
112 "Assuming 8bit screen-map - MUST be a regular file.\n"),
113 exit(1); 111 exit(1);
114 else 112 else
115 perror("fseek failed assuming 8bit screen-map"), exit(1); 113 perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp)
122 if (-1 == fseek(fp, 0, SEEK_SET)) { 120 if (-1 == fseek(fp, 0, SEEK_SET)) {
123 if (errno == ESPIPE) 121 if (errno == ESPIPE)
124 /* should not - it succedeed above */ 122 /* should not - it succedeed above */
125 fprintf(stderr, "fseek() returned ESPIPE !\n"), 123 errorMsg("fseek() returned ESPIPE !\n"),
126 exit(1); 124 exit(1);
127 else 125 else
128 perror("fseek for binary 8bit screen-map"), exit(1); 126 perror("fseek for binary 8bit screen-map"), exit(1);
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp)
132 perror("Cannot read [old] map from file"), exit(1); 130 perror("Cannot read [old] map from file"), exit(1);
133#if 0 131#if 0
134 else 132 else
135 fprintf(stderr, "Input screen-map is binary.\n"); 133 errorMsg("Input screen-map is binary.\n");
136#endif 134#endif
137 } 135 }
138 136
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp)
141 else 139 else
142 return 0; 140 return 0;
143 } 141 }
144 fprintf(stderr, "Error parsing symbolic map\n"); 142 errorMsg("Error parsing symbolic map\n");
145 return(1); 143 return(1);
146} 144}
147 145
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 7eaf40e82..b3f9f4f11 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv)
56 56
57 fd = open("/dev/tty0", O_RDWR); 57 fd = open("/dev/tty0", O_RDWR);
58 if (fd < 0) { 58 if (fd < 0) {
59 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 59 errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
60 return( FALSE); 60 return( FALSE);
61 } 61 }
62 loadnewfont(fd); 62 loadnewfont(fd);
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
72 memset(buf, 0, sizeof(buf)); 72 memset(buf, 0, sizeof(buf));
73 73
74 if (unit < 1 || unit > 32) { 74 if (unit < 1 || unit > 32) {
75 fprintf(stderr, "Bad character size %d\n", unit); 75 errorMsg("Bad character size %d\n", unit);
76 exit(1); 76 exit(1);
77 } 77 }
78 78
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
112 up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); 112 up = (struct unipair *) malloc(maxct * sizeof(struct unipair));
113 113
114 if (!up) { 114 if (!up) {
115 fprintf(stderr, "Out of memory?\n"); 115 errorMsg("Out of memory?\n");
116 exit(1); 116 exit(1);
117 } 117 }
118 for (glyph = 0; glyph < fontsize; glyph++) { 118 for (glyph = 0; glyph < fontsize; glyph++) {
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
137 if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { 137 if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
138#ifdef ENOIOCTLCMD 138#ifdef ENOIOCTLCMD
139 if (errno == ENOIOCTLCMD) { 139 if (errno == ENOIOCTLCMD) {
140 fprintf(stderr, "It seems this kernel is older than 1.1.92\n"); 140 errorMsg("It seems this kernel is older than 1.1.92\n");
141 fprintf(stderr, "No Unicode mapping table loaded.\n"); 141 errorMsg("No Unicode mapping table loaded.\n");
142 } else 142 } else
143#endif 143#endif
144 perror("PIO_UNIMAPCLR"); 144 perror("PIO_UNIMAPCLR");
@@ -198,13 +198,13 @@ static void loadnewfont(int fd)
198 goto no_psf; 198 goto no_psf;
199 199
200 if (psfhdr.mode > PSF_MAXMODE) { 200 if (psfhdr.mode > PSF_MAXMODE) {
201 fprintf(stderr, "Unsupported psf file mode\n"); 201 errorMsg("Unsupported psf file mode\n");
202 exit(1); 202 exit(1);
203 } 203 }
204 fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); 204 fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
205#if !defined( PIO_FONTX ) || defined( __sparc__ ) 205#if !defined( PIO_FONTX ) || defined( __sparc__ )
206 if (fontsize != 256) { 206 if (fontsize != 256) {
207 fprintf(stderr, "Only fontsize 256 supported\n"); 207 errorMsg("Only fontsize 256 supported\n");
208 exit(1); 208 exit(1);
209 } 209 }
210#endif 210#endif
@@ -214,7 +214,7 @@ static void loadnewfont(int fd)
214 214
215 head = head0 + fontsize * unit; 215 head = head0 + fontsize * unit;
216 if (head > inputlth || (!hastable && head != inputlth)) { 216 if (head > inputlth || (!hastable && head != inputlth)) {
217 fprintf(stderr, "Input file: bad length\n"); 217 errorMsg("Input file: bad length\n");
218 exit(1); 218 exit(1);
219 } 219 }
220 do_loadfont(fd, inbuf + head0, unit, fontsize); 220 do_loadfont(fd, inbuf + head0, unit, fontsize);
@@ -231,7 +231,7 @@ static void loadnewfont(int fd)
231 } else { 231 } else {
232 /* bare font */ 232 /* bare font */
233 if (inputlth & 0377) { 233 if (inputlth & 0377) {
234 fprintf(stderr, "Bad input file size\n"); 234 errorMsg("Bad input file size\n");
235 exit(1); 235 exit(1);
236 } 236 }
237 offset = 0; 237 offset = 0;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index c2e4c94ed..72247a6e4 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv)
59 59
60 fd = open("/dev/tty0", O_RDWR); 60 fd = open("/dev/tty0", O_RDWR);
61 if (fd < 0) { 61 if (fd < 0) {
62 fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); 62 errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
63 exit(FALSE); 63 exit(FALSE);
64 } 64 }
65 65
66 read(0, buff, 7); 66 read(0, buff, 7);
67 if (0 != strncmp(buff, magic, 7)) { 67 if (0 != strncmp(buff, magic, 7)) {
68 fprintf(stderr, "This is not a valid binary keymap.\n"); 68 errorMsg("This is not a valid binary keymap.\n");
69 exit(FALSE); 69 exit(FALSE);
70 } 70 }
71 71
72 if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { 72 if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
73 fprintf(stderr, "Error reading keymap flags: %s\n", 73 errorMsg("Error reading keymap flags: %s\n",
74 strerror(errno)); 74 strerror(errno));
75 exit(FALSE); 75 exit(FALSE);
76 } 76 }
77 77
78 ibuff = (u_short *) malloc(ibuffsz); 78 ibuff = (u_short *) malloc(ibuffsz);
79 if (!ibuff) { 79 if (!ibuff) {
80 fprintf(stderr, "Out of memory.\n"); 80 errorMsg("Out of memory.\n");
81 exit(FALSE); 81 exit(FALSE);
82 } 82 }
83 83
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv)
87 while (pos < ibuffsz) { 87 while (pos < ibuffsz) {
88 if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) 88 if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos))
89 < 0) { 89 < 0) {
90 fprintf(stderr, "Error reading keymap: %s\n", 90 errorMsg("Error reading keymap: %s\n",
91 strerror(errno)); 91 strerror(errno));
92 exit(FALSE); 92 exit(FALSE);
93 } 93 }