Ok, this is a pretty major update to sh.c. I renamed all the variables and
[oweals/busybox.git] / loadacm.c
index 826c2a33fc714bc8d878059fadf4b8036264f785..52702bf6d98c0852bac39d27cd2a8376644adb62 100644 (file)
--- a/loadacm.c
+++ b/loadacm.c
@@ -39,18 +39,16 @@ int loadacm_main(int argc, char **argv)
 
        fd = open("/dev/tty", O_RDWR);
        if (fd < 0) {
-               errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
-               return( FALSE);
+               perror_msg_and_die("Error opening /dev/tty1");
        }
 
        if (screen_map_load(fd, stdin)) {
-               errorMsg("Error loading acm: %s\n", strerror(errno));
-               return( FALSE);
+               perror_msg_and_die("Error loading acm");
        }
 
        write(fd, "\033(K", 3);
 
-       return( TRUE);
+       return EXIT_SUCCESS;
 }
 
 int screen_map_load(int fd, FILE * fp)
@@ -72,7 +70,7 @@ int screen_map_load(int fd, FILE * fp)
                if (parse_failed) {
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
-                                       errorMsg("16bit screen-map MUST be a regular file.\n"),
+                                       error_msg("16bit screen-map MUST be a regular file.\n"),
                                                exit(1);
                                else
                                        perror("fseek failed reading binary 16bit screen-map"),
@@ -83,7 +81,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [new] map from file"), exit(1);
 #if 0
                        else
-                               errorMsg("Input screen-map is binary.\n");
+                               error_msg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -100,7 +98,7 @@ int screen_map_load(int fd, FILE * fp)
        /* rewind... */
        if (-1 == fseek(fp, 0, SEEK_SET)) {
                if (errno == ESPIPE)
-                       errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
+                       error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"),
                                exit(1);
                else
                        perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -113,7 +111,7 @@ int screen_map_load(int fd, FILE * fp)
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
                                        /* should not - it succedeed above */
-                                       errorMsg("fseek() returned ESPIPE !\n"),
+                                       error_msg("fseek() returned ESPIPE !\n"),
                                                exit(1);
                                else
                                        perror("fseek for binary 8bit screen-map"), exit(1);
@@ -123,7 +121,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [old] map from file"), exit(1);
 #if 0
                        else
-                               errorMsg("Input screen-map is binary.\n");
+                               error_msg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp)
                else
                        return 0;
        }
-       errorMsg("Error parsing symbolic map\n");
+       error_msg("Error parsing symbolic map\n");
        return(1);
 }
 
@@ -330,10 +328,7 @@ void saveoldmap(int fd, char *omfil)
        }
 #endif
 
-       if ((fp = fopen(omfil, "w")) == NULL) {
-               perror(omfil);
-               exit(1);
-       }
+       fp = xfopen(omfil, "w");
 #ifdef GIO_UNISCRNMAP
        if (is_old_map) {
 #endif