t2p.c

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