tumble.c

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