diff options
Diffstat (limited to 'imageto/main.c')
-rw-r--r-- | imageto/main.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/imageto/main.c b/imageto/main.c index 07d9b37..f1228d3 100644 --- a/imageto/main.c +++ b/imageto/main.c @@ -81,12 +81,12 @@ static void set_pbm_input_format (void); 1) (normal) analyze the image and write out the ``true'' characters, 2) (-strips) takes a constant number of scanlines as each character, 3) (-epsf) write out the image as an Encapsulated PostScript file. - + The output name is, correspondingly, constructed differently: 1) if `output_name' was supplied, and has a suffix, that's it. 2) if `output_name' was supplied, but has no suffix, append `.eps' if we're doing EPSF, else append `<suffix>.<dpi>gf', where - <suffix> is + <suffix> is a) `sp', if we are doing strips; b) the design size, if not. 3) if `output_name' was not supplied, use the basename of the input @@ -102,11 +102,11 @@ main (int argc, string argv[]) input_name = read_command_line (argc, argv); writing_gf = !output_epsf; - - set_input_format (input_name); + + set_input_format (input_name); /* If the input format is PBM, then they must also tell us the dpi. */ - if (image_open_input_file == pbm_open_input_file + if (image_open_input_file == pbm_open_input_file && image_header.hres == 0) { fprintf (stderr, "If you use PBM format, you must supply the dpi.\n"); @@ -116,7 +116,7 @@ main (int argc, string argv[]) /* Open the main input file. */ (*image_open_input_file) (extend_filename (input_name, input_extension)); - + /* We need the horizontal resolution before we can make the GF name, so, at least for IMG input, have to read the header. */ (*image_get_header) (); @@ -179,7 +179,7 @@ main (int argc, string argv[]) } (*image_close_input_file) (); - + return 0; } @@ -193,12 +193,12 @@ print_scanline (one_byte line[], unsigned width) if (trace_scanlines) { printf ("%7d:", scanline_count++); - + /* If the line is entirely white, don't print anything. */ if (memchr (line, BLACK, width)) { unsigned c; - + for (c = 0; c < width; c++) { /* Compress eight consecutive spaces to a tab, if we're at the beginning of a tab mark. This handles the usual @@ -289,21 +289,21 @@ read_command_line (int argc, string argv[]) while (true) { g = getopt_long_only (argc, argv, "", long_options, &option_index); - + if (g == EOF) break; if (g == '?') exit (1); /* Unknown option. */ - + assert (g == 0); /* We have no short option names. */ - + if (ARGUMENT_IS ("baselines")) baseline_list = scan_unsigned_list (optarg); - + else if (ARGUMENT_IS ("designsize")) design_size = atof (optarg); - + else if (ARGUMENT_IS ("dpi")) { image_header.hres = (two_bytes) atou (optarg); @@ -346,13 +346,13 @@ read_command_line (int argc, string argv[]) else if (ARGUMENT_IS ("range")) GET_RANGE (optarg, starting_char, ending_char); - + else if (ARGUMENT_IS ("version")) printf ("%s.\n", version_string); /* Else it was a flag; getopt has already done the assignment. */ } - + if (do_strips && output_epsf) FATAL ("imageto: Sorry, -strips and -epsf are mutually exclusive"); @@ -367,7 +367,7 @@ static void set_input_format (string filename) { string input_extension; - + /* If it's already set, just return. */ if (image_open_input_file != NULL) return; @@ -380,7 +380,7 @@ set_input_format (string filename) else if (STREQ (input_extension, "pbm")) set_pbm_input_format (); - + else /* Can't guess it; quit. */ { fprintf (stderr, "You must supply an input format.\n"); |