Use bb_xopen
authorGlenn L McGrath <bug1@ihug.co.nz>
Sat, 20 Dec 2003 06:00:08 +0000 (06:00 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sat, 20 Dec 2003 06:00:08 +0000 (06:00 -0000)
console-tools/dumpkmap.c
console-tools/loadacm.c
console-tools/loadfont.c
console-tools/openvt.c

index 85926556cd86817e96e35f3208b572a309a87117..19ba77d828359e0129fa63a40102a68ce7dea532 100644 (file)
@@ -51,11 +51,7 @@ int dumpkmap_main(int argc, char **argv)
                bb_show_usage();
        }
 
-       fd = open(CURRENT_VC, O_RDWR);
-       if (fd < 0) {
-               bb_perror_msg("Error opening " CURRENT_VC);
-               return EXIT_FAILURE;
-       }
+       fd=bb_xopen(CURRENT_VC, O_RDWR);
 
        write(1, magic, 7);
 
index 640aa4401713afba24187de03894a04970cb397e..edaf51afb11cb3b9e8ea5e446fe03cabf2b4073d 100644 (file)
@@ -37,10 +37,7 @@ int loadacm_main(int argc, char **argv)
                bb_show_usage();
        }
 
-       fd = open(CURRENT_VC, O_RDWR);
-       if (fd < 0) {
-               bb_perror_msg_and_die("Error opening " CURRENT_VC);
-       }
+       fd = bb_xopen(CURRENT_VC, O_RDWR);
 
        if (screen_map_load(fd, stdin)) {
                bb_perror_msg_and_die("Error loading acm");
index 6108151a63ebb42d87bb0ccda3857a68a7b5ba7e..4580dc4e05a5d86125fd40b762d5470ce47e77ee 100644 (file)
@@ -46,9 +46,7 @@ extern int loadfont_main(int argc, char **argv)
        if (argc != 1)
                bb_show_usage();
 
-       fd = open(CURRENT_VC, O_RDWR);
-       if (fd < 0)
-               bb_perror_msg_and_die("Error opening " CURRENT_VC);
+       fd = bb_xopen(CURRENT_VC, O_RDWR);
        loadnewfont(fd);
 
        return EXIT_SUCCESS;
index 269dfc01a48997c37b8aba2ad3e07ebb74d00ae5..bafd1d0a2669d881f57224553181055a2cab3cbc 100644 (file)
@@ -48,11 +48,8 @@ int openvt_main(int argc, char **argv)
        if (!isdigit(argv[1][0]))
                bb_show_usage();
 
-       vtno = (int) atol(argv[1]);
-
-       /* if (vtno <= 0 || vtno > 63) */
-       if (vtno <= 0 || vtno > 12)
-               bb_error_msg_and_die("Illegal vt number (%d)", vtno);     
+       /* check for Illegal vt number */
+       vtno=bb_xgetlarg(argv[1], 10, 1, 12);
 
        sprintf(vtname, VTNAME, vtno);
 
@@ -73,8 +70,7 @@ int openvt_main(int argc, char **argv)
                close(0);                       /* so that new vt becomes stdin */
 
                /* and grab new one */
-               if ((fd = open(vtname, O_RDWR)) == -1)
-                       bb_perror_msg_and_die("could not open %s", vtname);       
+               fd = bb_xopen(vtname, O_RDWR);
 
                /* Reassign stdout and sterr */
                close(1);