Added support for ignoring '-g' per GNU ls, thanks to David Vrabel
[oweals/busybox.git] / loadfont.c
index 64b72561053f813cfcd4b07ff51616f5dd0c4d12..7eaf40e82715b75621921fbe82b6b5c4055a3e4b 100644 (file)
 #define PSF_SEPARATOR  0xFFFF
 
 static const char loadfont_usage[] = "loadfont\n"
-       "\n" "\tLoad a console font from standard input.\n" "\n";
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "Loads a console font from standard input.\n"
+#endif
+       ;
 
 struct psf_header {
        unsigned char magic1, magic2;   /* Magic number */
@@ -47,14 +50,18 @@ extern int loadfont_main(int argc, char **argv)
 {
        int fd;
 
+       if (argc>=2 && *argv[1]=='-') {
+               usage(loadfont_usage);
+       }
+
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
                fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
-               return 1;
+               return( FALSE);
        }
        loadnewfont(fd);
 
-       return 0;
+       return( TRUE);
 }
 
 static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)