t2p.c

changeset 14
4c261fbf8c77
parent 12
c3e2c2344560
child 17
d4699dfddcc0
     1.1 diff -r 3ab5717225d3 -r 4c261fbf8c77 t2p.c
     1.2 --- a/t2p.c	Sun Dec 30 01:54:43 2001 +0000
     1.3 +++ b/t2p.c	Sun Dec 30 04:16:46 2001 +0000
     1.4 @@ -1,7 +1,7 @@
     1.5  /*
     1.6   * tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
     1.7   * Main program
     1.8 - * $Id: t2p.c,v 1.2 2001/12/29 10:59:47 eric Exp $
     1.9 + * $Id: t2p.c,v 1.3 2001/12/29 20:16:46 eric Exp $
    1.10   * Copyright 2001 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -32,6 +32,8 @@
    1.14  #include "tiff2pdf.h"
    1.15  
    1.16  
    1.17 +int line;
    1.18 +
    1.19  FILE *yyin;
    1.20  TIFF *in;
    1.21  panda_pdf *out;
    1.22 @@ -207,9 +209,26 @@
    1.23  }
    1.24  
    1.25  
    1.26 +void input_images (int first, int last)
    1.27 +{
    1.28 +  if (first == last)
    1.29 +    printf ("image %d\n", first);
    1.30 +  else
    1.31 +    printf ("iamges %d..%d\n", first, last);
    1.32 +}
    1.33 +
    1.34 +void output_pages (int first, int last)
    1.35 +{
    1.36 +  if (first == last)
    1.37 +    printf ("page %d\n", first);
    1.38 +  else
    1.39 +    printf ("pages %d..%d\n", first, last);
    1.40 +}
    1.41 +
    1.42 +
    1.43  void yyerror (char *s)
    1.44  {
    1.45 -  fprintf (stderr, "%s\n", s);
    1.46 +  fprintf (stderr, "%d: %s\n", line, s);
    1.47  }
    1.48  
    1.49  
    1.50 @@ -226,18 +245,21 @@
    1.51        goto fail;
    1.52      }
    1.53  
    1.54 -  yyin = fopen (argv [2], "r");
    1.55 +  yyin = fopen (argv [1], "r");
    1.56    if (! yyin)
    1.57      {
    1.58 -      fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
    1.59 +      fprintf (stderr, "can't open spec file '%s'\n", argv [1]);
    1.60        result = 3;
    1.61        goto fail;
    1.62      }
    1.63  
    1.64 +  line = 1;
    1.65 +
    1.66    yyparse ();
    1.67  
    1.68   fail:
    1.69 -  fclose (yyin);
    1.70 +  if (yyin)
    1.71 +    fclose (yyin);
    1.72    close_tiff_input_file ();
    1.73    close_pdf_output_file ();
    1.74    return (result);