aboutsummaryrefslogtreecommitdiff
path: root/console-tools/loadacm.c
diff options
context:
space:
mode:
Diffstat (limited to 'console-tools/loadacm.c')
-rw-r--r--console-tools/loadacm.c14
1 files changed, 11 insertions, 3 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)