Update internal.h to conditionally include asm/string.h
[oweals/busybox.git] / fbset.c
diff --git a/fbset.c b/fbset.c
index a75e431db011b15e8292bfc7ec3c96020603fa46..0a84dce236b42e0b51d30181b24798c4e47b9e33 100644 (file)
--- a/fbset.c
+++ b/fbset.c
@@ -62,7 +62,7 @@
 #define CMD_ALL         11
 #define CMD_INFO        12
 
-#ifdef BB_FBSET_FANCY
+#ifdef BB_FEATURE_FBSET_FANCY
 #define CMD_XRES       13
 #define CMD_YRES       14
 #define CMD_VXRES      15
@@ -104,10 +104,10 @@ struct cmdoptions_t {
        "-hsync", 1, CMD_HSYNC}, {
        "-vsync", 1, CMD_VSYNC}, {
        "-laced", 1, CMD_LACED}, {
-       "-double", 1, CMD_DOUBLE},
-#ifdef BB_FBSET_FANCY
-       {
-       "--help", 0, CMD_HELP}, {
+       "-double", 1, CMD_DOUBLE}, {
+       "-help", 0, CMD_HELP}, {
+#ifdef BB_FEATURE_FBSET_FANCY
+       "-help", 0, CMD_HELP}, {
        "-all", 0, CMD_ALL}, {
        "-xres", 1, CMD_XRES}, {
        "-yres", 1, CMD_YRES}, {
@@ -115,7 +115,7 @@ struct cmdoptions_t {
        "-vyres", 1, CMD_VYRES}, {
        "-depth", 1, CMD_DEPTH}, {
        "-match", 0, CMD_MATCH}, {
-       "--geometry", 5, CMD_GEOMETRY}, {
+       "-geometry", 5, CMD_GEOMETRY}, {
        "-pixclock", 1, CMD_PIXCLOCK}, {
        "-left", 1, CMD_LEFT}, {
        "-right", 1, CMD_RIGHT}, {
@@ -123,16 +123,15 @@ struct cmdoptions_t {
        "-lower", 1, CMD_LOWER}, {
        "-hslen", 1, CMD_HSLEN}, {
        "-vslen", 1, CMD_VSLEN}, {
-       "--timings", 7, CMD_TIMING}, {
+       "-timings", 7, CMD_TIMING}, {
        "-csync", 1, CMD_CSYNC}, {
        "-gsync", 1, CMD_GSYNC}, {
        "-extsync", 1, CMD_EXTSYNC}, {
        "-bcast", 1, CMD_BCAST}, {
        "-rgba", 1, CMD_RGBA}, {
        "-step", 1, CMD_STEP}, {
-       "-move", 1, CMD_MOVE},
+       "-move", 1, CMD_MOVE}, {
 #endif
-       {
        0, 0, 0}
 };
 
@@ -164,8 +163,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
                }
        }
 #else
-       fprintf(stderr,
-                       "W: mode reading was disabled on this copy of fbset; ignoring request\n");
+       errorMsg( "mode reading not compiled in\n");
 #endif
        return 0;
 }
@@ -199,7 +197,7 @@ static void showmode(struct fb_var_screeninfo *v)
                                         v->vsync_len);
        }
        printf("\nmode \"%ux%u-%u\"\n", v->xres, v->yres, (int) (vrate + 0.5));
-#ifdef BB_FBSET_FANCY
+#ifdef BB_FEATURE_FBSET_FANCY
        printf("\t# D: %.3f MHz, H: %.3f kHz, V: %.3f Hz\n", drate / 1e6,
                   hrate / 1e3, vrate);
 #endif
@@ -218,21 +216,26 @@ static void showmode(struct fb_var_screeninfo *v)
        printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
                   v->red.offset, v->green.length, v->green.offset, v->blue.length,
                   v->blue.offset, v->transp.length, v->transp.offset);
-       printf("endmode\n");
+       printf("endmode\n\n");
 }
 
 static void fbset_usage(void)
 {
+#ifndef BB_FEATURE_TRIVIAL_HELP
        int i;
+#endif
 
 #ifndef STANDALONE
        fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
                        BB_VER, BB_BT);
 #endif
        fprintf(stderr, "Usage: fbset [options] [mode]\n");
-       fprintf(stderr, "\tThe following options are recognized:\n");
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       fprintf(stderr, "\nShows and modifies frame buffer device settings\n\n");
+       fprintf(stderr, "The following options are recognized:\n");
        for (i = 0; g_cmdoptions[i].name; i++)
-               fprintf(stderr, "\t\t%s\n", g_cmdoptions[i].name);
+               fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
+#endif
        exit(-1);
 }
 
@@ -283,7 +286,7 @@ extern int fbset_main(int argc, char **argv)
                                        varset.hsync_len = strtoul(argv[6], 0, 0);
                                        varset.vsync_len = strtoul(argv[7], 0, 0);
                                        break;
-#ifdef BB_FBSET_FANCY
+#ifdef BB_FEATURE_FBSET_FANCY
                                case CMD_XRES:
                                        varset.xres = strtoul(argv[1], 0, 0);
                                        break;
@@ -323,7 +326,8 @@ extern int fbset_main(int argc, char **argv)
                if (ioctl(fh, FBIOPUT_VSCREENINFO, &var))
                        PERROR("fbset(ioctl)");
        showmode(&var);
-       close(fh);
+       /* Don't close the file, as exiting will take care of that */
+       /* close(fh); */
 
        return (TRUE);
 }