1: /* restotext.c
   2:  *
   3:  * Copyright (c) 1984, 1985 Xerox Corp.
   4:  *
   5:  * Module: restotext
   6:  * Owner: knox
   7:  * stdout: text description
   8:  * args:
   9:  *   name         (name of the input res file)
  10:  *
  11:  * Description:
  12:  *    This program reads an RES file and writes out a line-by-line
  13:  *    text description of the file.  The name of the RES file is the
  14:  *    the first argument of the command line.  A text description
  15:  *    of the image is written to the standard output.  The commands
  16:  *    in the RES file are translated, but the RES file is not executed.
  17:  *
  18:  *    The image raster will be read from the file "name.res",
  19:  *    where name is read from the command line.  The ".res"
  20:  *    extension will not be added if it is already present in the
  21:  *    name.
  22:  */
  23: 
  24: #ifndef  MC500
  25: #define strrchr(x,y) rindex(x,y)
  26: #endif
  27: 
  28: #include <stdio.h>
  29: 
  30: FILE *fpin;
  31: extern int verbose;
  32: 
  33: main(argc, argv)
  34:   int argc;
  35:   char **argv;
  36:   {
  37:   int n;
  38:   char *filename;
  39:   n = 1;
  40:   verbose = 0;
  41:   if (argc > 1)
  42:     {
  43:     if (strcmp(argv[1], "-v") == 0) verbose = 1;
  44:     if (strcmp(argv[1], "-V") == 0) verbose = 1;
  45:     }
  46:   if (verbose) n++;
  47:   if ((argc-1) < n) { printf("restotext: No RES file name!\n"); exit(2); }
  48:   filename = (char *) malloc(strlen(argv[n])+1+strlen(".res"));
  49:   strcpy(filename, argv[n]);
  50:   if (strcmp(".res", strrchr(filename, '.')) != 0) strcat(filename, ".res");
  51:   fpin = fopen(filename, "r");
  52:   if (fpin == NULL) { fprintf("restotext: Could not open %s!\n", filename); exit(2); }
  53:   free(filename);
  54:   parse(fpin);
  55:   }
  56: 
  57: 
  58: /* Change Log
  59:  *
  60:  * K. Knox,   28-Mar-85 15:04:13, Created first version.
  61:  *
  62:  *
  63:  *
  64:  */

Defined functions

main defined in line 33; never used

Defined macros

strrchr defined in line 25; used 1 times
  • in line 50
Last modified: 1986-01-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 862
Valid CSS Valid XHTML 1.0 Strict