Skip to content

Commit

Permalink
implement h,?,run-with-no-arguments help; remove old h
Browse files Browse the repository at this point in the history
svn:revision:55754
svn:branch:trunk
svn:account:carlmoore
  • Loading branch information
carlmoore committed Jun 13, 2013
1 parent 85f9bfa commit 80fc6d7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/fb/fbcmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,8 @@ pars_Argv(int argc, char **argv)
{
int c;

while ((c = bu_getopt(argc, argv, "hF:s:S:w:W:n:N:")) != -1) {
while ((c = bu_getopt(argc, argv, "F:s:S:w:W:n:N:h?")) != -1) {
switch (c) {
case 'h' :
scr_width = scr_height = 1024;
break;
case 'F':
framebuffer = bu_optarg;
break;
Expand All @@ -612,7 +609,7 @@ pars_Argv(int argc, char **argv)
case 'N':
scr_height = atoi(bu_optarg);
break;
case '?' :
default :
return 0;
}
}
Expand All @@ -625,7 +622,7 @@ pars_Argv(int argc, char **argv)
static void
usage()
{
(void) fprintf(stderr, "Usage: fbcmap [-h] [-F framebuffer]\n");
(void) fprintf(stderr, "Usage: fbcmap [-F framebuffer]\n");
(void) fprintf(stderr, " [-{sS} squarescrsize] [-{wW} scr_width] [-{nN} scr_height]\n");
(void) fprintf(stderr, " [map_number]\n");
(void) fprintf(stderr,
Expand All @@ -646,9 +643,9 @@ usage()
(void) fprintf(stderr, "Color map #10, solid black.\n");
(void) fprintf(stderr, "Color map #11, solid white.\n");
(void) fprintf(stderr, "Color map #12, 18%% neutral grey.\n");
bu_exit(1, NULL);
}


int
main(int argc, char **argv)
{
Expand All @@ -658,10 +655,10 @@ main(int argc, char **argv)
ColorMap *cp = &cmap;
FBIO *fbp;

if (! pars_Argv(argc, argv)) {
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
usage();
if (! pars_Argv(argc, argv))
usage();
return 1;
}

if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == NULL)
return 1;
Expand Down

0 comments on commit 80fc6d7

Please sign in to comment.