tumble.c

changeset 134
313aba417199
parent 133
76c197fe2eeb
child 139
ec2a06d8a2a6
     1.1 --- a/tumble.c	Fri Mar 14 08:57:40 2003 +0000
     1.2 +++ b/tumble.c	Sun Mar 16 13:58:26 2003 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4   * tumble: build a PDF file from image files
     1.5   *
     1.6   * Main program
     1.7 - * $Id: tumble.c,v 1.35 2003/03/14 00:57:40 eric Exp $
     1.8 + * $Id: tumble.c,v 1.36 2003/03/16 05:58:26 eric Exp $
     1.9   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.10   *
    1.11   * This program is free software; you can redistribute it and/or modify
    1.12 @@ -80,11 +80,11 @@
    1.13    fprintf (stderr, "http://tumble.brouhaha.com/\n");
    1.14    fprintf (stderr, "\n");
    1.15    fprintf (stderr, "usage:\n");
    1.16 -  fprintf (stderr, "    %s [options] -s spec\n", progname);
    1.17 +  fprintf (stderr, "    %s [options] -c <control.tum>\n", progname);
    1.18    fprintf (stderr, "    %s [options] <input.tif>... -o <output.pdf>\n", progname);
    1.19    fprintf (stderr, "options:\n");
    1.20 -  fprintf (stderr, "    -v   verbose\n");
    1.21 -  fprintf (stderr, "    -b fmt  create bookmarks\n");
    1.22 +  fprintf (stderr, "    -v        verbose\n");
    1.23 +  fprintf (stderr, "    -b <fmt>  create bookmarks\n");
    1.24    fprintf (stderr, "bookmark format:\n");
    1.25    fprintf (stderr, "    %%F  file name (sans suffix)\n");
    1.26    fprintf (stderr, "    %%p  page number\n");
    1.27 @@ -635,18 +635,18 @@
    1.28  }
    1.29  
    1.30  
    1.31 -void main_spec (char *spec_fn)
    1.32 +void main_control (char *control_fn)
    1.33  {
    1.34 -  if (! parse_spec_file (spec_fn))
    1.35 -    fatal (2, "error parsing spec file\n");
    1.36 -  if (! process_specs ())
    1.37 -    fatal (3, "error processing spec file\n");
    1.38 +  if (! parse_control_file (control_fn))
    1.39 +    fatal (2, "error parsing control file\n");
    1.40 +  if (! process_controls ())
    1.41 +    fatal (3, "error processing control file\n");
    1.42  }
    1.43  
    1.44  
    1.45  int main (int argc, char *argv[])
    1.46  {
    1.47 -  char *spec_fn = NULL;
    1.48 +  char *control_fn = NULL;
    1.49    char *out_fn = NULL;
    1.50    char *bookmark_fmt = NULL;
    1.51    int inf_count = 0;
    1.52 @@ -673,13 +673,13 @@
    1.53  	      else
    1.54  		fatal (1, "missing filename after \"-o\" option\n");
    1.55  	    }
    1.56 -	  else if (strcmp (argv [1], "-s") == 0)
    1.57 +	  else if (strcmp (argv [1], "-c") == 0)
    1.58  	    {
    1.59  	      if (argc)
    1.60  		{
    1.61  		  argc--;
    1.62  		  argv++;
    1.63 -		  spec_fn = argv [1];
    1.64 +		  control_fn = argv [1];
    1.65  		}
    1.66  	      else
    1.67  		fatal (1, "missing filename after \"-s\" option\n");
    1.68 @@ -705,17 +705,17 @@
    1.69        argv++;
    1.70      }
    1.71  
    1.72 -  if (! ((! out_fn) ^ (! spec_fn)))
    1.73 -    fatal (1, "either a spec file or an output file (but not both) must be specified\n");
    1.74 +  if (! ((! out_fn) ^ (! control_fn)))
    1.75 +    fatal (1, "either a control file or an output file (but not both) must be specified\n");
    1.76  
    1.77    if (out_fn && ! inf_count)
    1.78      fatal (1, "no input files specified\n");
    1.79  
    1.80 -  if (spec_fn && inf_count)
    1.81 -    fatal (1, "if spec file is provided, input files can't be specified as arguments\n");
    1.82 +  if (control_fn && inf_count)
    1.83 +    fatal (1, "if control file is provided, input files can't be specified as arguments\n");
    1.84  
    1.85 -  if (spec_fn)
    1.86 -    main_spec (spec_fn);
    1.87 +  if (control_fn)
    1.88 +    main_control (control_fn);
    1.89    else
    1.90      main_args (out_fn, inf_count, in_fn, bookmark_fmt);
    1.91