ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rcollate.c
(Generate patch)

Comparing ray/src/util/rcollate.c (file contents):
Revision 2.12 by greg, Fri May 30 18:10:20 2014 UTC vs.
Revision 2.35 by greg, Sat Dec 28 18:05:14 2019 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   */
7  
8   #include <stdlib.h>
9 #include <string.h>
9   #include <ctype.h>
10   #include "platform.h"
11   #include "rtio.h"
12   #include "resolu.h"
13 < #ifdef _WIN32
14 < #undef ftello
15 < #define ftello  ftell
16 < #undef ssize_t
17 < #define ssize_t size_t
13 > #if defined(_WIN32) || defined(_WIN64)
14 >  #undef ftello
15 >  #define       ftello  ftell
16 >  #undef ssize_t
17 >  #define ssize_t       size_t
18   #else
19 < #include <sys/mman.h>
19 >  #include <sys/mman.h>
20   #endif
21  
22 < #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
24 < #undef getc
25 < #undef putc
26 < #define getc    getc_unlocked
27 < #define putc    putc_unlocked
28 < #endif
22 > #define MAXLEVELS       16      /* max RxC.. block pairs */
23  
24   typedef struct {
25 +        void    *mapped;        /* memory-mapped pointer */
26          void    *base;          /* pointer to base memory */
27          size_t  len;            /* allocated memory length */
33        int     mapped;         /* memory-mapped file? */
28   } MEMLOAD;              /* file loaded/mapped into memory */
29  
30   typedef struct {
31          int     nw_rec;         /* number of words per record */
32 <        int     nrecs;          /* number of records we found */
32 >        long    nrecs;          /* number of records we found */
33          char    *rec[1];        /* record array (extends struct) */
34   } RECINDEX;
35  
# Line 49 | Line 43 | free_load(MEMLOAD *mp)
43                  return;
44   #ifdef MAP_FILE
45          if (mp->mapped)
46 <                munmap(mp->base, mp->len);
46 >                munmap(mp->mapped, mp->len);
47          else
48   #endif
49                  free(mp->base);
50 +        mp->mapped = NULL;
51          mp->base = NULL;
52          mp->len = 0;
53   }
54  
60 /* load a file into memory */
61 static int
62 load_file(MEMLOAD *mp, FILE *fp)
63 {
64        int     fd;
65        off_t   skip, flen;
66
67        if (mp == NULL)
68                return(-1);
69        mp->base = NULL;
70        mp->len = 0;
71        mp->mapped = 0;
72        if (fp == NULL)
73                return(-1);
74        fd = fileno(fp);
75        skip = ftello(fp);
76        flen = lseek(fd, 0, SEEK_END);
77        if (flen <= skip)
78                return((int)(flen - skip));
79        mp->len = (size_t)(flen - skip);
80 #ifdef MAP_FILE
81        if (mp->len > 1L<<20) {         /* map file if > 1 MByte */
82                mp->base = mmap(NULL, mp->len, PROT_READ, MAP_PRIVATE, fd, skip);
83                if (mp->base != MAP_FAILED) {
84                        mp->mapped = 1;
85                        return(1);      /* mmap() success */
86                }
87                mp->base = NULL;        /* fall back to reading it in... */
88        }
89 #endif
90        if (lseek(fd, skip, SEEK_SET) != skip ||
91                        (mp->base = malloc(mp->len)) == NULL) {
92                mp->len = 0;
93                return(-1);
94        }
95        if (read(fd, (char *)mp->base, mp->len) != mp->len) {
96                free_load(mp);
97                return(-1);
98        }
99        return(1);
100 }
101
55   /* load memory from an input stream, starting from current position */
56   static int
57   load_stream(MEMLOAD *mp, FILE *fp)
# Line 109 | Line 62 | load_stream(MEMLOAD *mp, FILE *fp)
62  
63          if (mp == NULL)
64                  return(-1);
65 +        mp->mapped = NULL;
66          mp->base = NULL;
67          mp->len = 0;
114        mp->mapped = 0;
68          if (fp == NULL)
69                  return(-1);
70          while ((nr = fread(buf, 1, sizeof(buf), fp)) > 0) {
71                  if (!alloced)
72 <                        mp->base = malloc(nr);
72 >                        mp->base = malloc(alloced = nr);
73                  else if (mp->len+nr > alloced)
74                          mp->base = realloc(mp->base,
75                                  alloced = alloced*(2+(nr==sizeof(buf)))/2+nr);
# Line 134 | Line 87 | load_stream(MEMLOAD *mp, FILE *fp)
87          return(mp->len > 0);
88   }
89  
90 + /* load a file into memory */
91 + static int
92 + load_file(MEMLOAD *mp, FILE *fp)
93 + {
94 +        int     fd;
95 +        off_t   skip, flen, fpos;
96 +
97 + #if defined(_WIN32) || defined(_WIN64)
98 +                                /* too difficult to fix this */
99 +        return load_stream(mp, fp);
100 + #endif
101 +        if (mp == NULL)
102 +                return(-1);
103 +        mp->mapped = NULL;
104 +        mp->base = NULL;
105 +        mp->len = 0;
106 +        if (fp == NULL)
107 +                return(-1);
108 +        fd = fileno(fp);
109 +        skip = ftello(fp);
110 +        flen = lseek(fd, 0, SEEK_END);
111 +        if (flen <= skip)
112 +                return((int)(flen - skip));
113 +        mp->len = (size_t)(flen - skip);
114 + #ifdef MAP_FILE
115 +        if (mp->len > 1L<<20) {         /* map file if > 1 MByte */
116 +                mp->mapped = mmap(NULL, flen, PROT_READ, MAP_PRIVATE, fd, 0);
117 +                if (mp->mapped != MAP_FAILED) {
118 +                        mp->base = (char *)mp->mapped + skip;
119 +                        return(1);      /* mmap() success */
120 +                }
121 +                mp->mapped = NULL;      /* else fall back to reading it in... */
122 +        }
123 + #endif
124 +        if (lseek(fd, skip, SEEK_SET) != skip ||
125 +                        (mp->base = malloc(mp->len)) == NULL) {
126 +                mp->len = 0;
127 +                return(-1);
128 +        }
129 +        fpos = skip;
130 +        while (fpos < flen) {           /* read() fails if n > 2 GBytes */
131 +                ssize_t nread = read(fd, (char *)mp->base+(fpos-skip),
132 +                                (flen-fpos < 1L<<24) ? flen-fpos : 1L<<24);
133 +                if (nread <= 0) {
134 +                        free_load(mp);
135 +                        return(-1);
136 +                }
137 +                fpos += nread;
138 +        }
139 +        return(1);
140 + }
141 +
142   /* free a record index */
143   #define free_records(rp)        free(rp)
144  
# Line 141 | Line 146 | load_stream(MEMLOAD *mp, FILE *fp)
146   static RECINDEX *
147   index_records(const MEMLOAD *mp, int nw_rec)
148   {
149 +        int             nall = 0;
150          RECINDEX        *rp;
151          char            *cp, *mend;
152          int             n;
# Line 149 | Line 155 | index_records(const MEMLOAD *mp, int nw_rec)
155                  return(NULL);
156          if (nw_rec <= 0)
157                  return(NULL);
158 <        rp = (RECINDEX *)malloc(sizeof(RECINDEX) + mp->len/(2*nw_rec)*sizeof(char *));
158 >        nall = 1000;
159 >        rp = (RECINDEX *)malloc(sizeof(RECINDEX) + nall*sizeof(char *));
160          if (rp == NULL)
161                  return(NULL);
162          rp->nw_rec = nw_rec;
# Line 161 | Line 168 | index_records(const MEMLOAD *mp, int nw_rec)
168                          ++cp;
169                  if (cp >= mend)
170                          break;
171 +                if (rp->nrecs >= nall) {
172 +                        nall += nall>>1;        /* get more record space */
173 +                        rp = (RECINDEX *)realloc(rp,
174 +                                        sizeof(RECINDEX) + nall*sizeof(char *));
175 +                        if (rp == NULL)
176 +                                return(NULL);
177 +                }
178                  rp->rec[rp->nrecs++] = cp;      /* point to first non-white */
179                  n = rp->nw_rec;
180                  while (++cp < mend)             /* find end of record */
# Line 204 | Line 218 | count_columns(const RECINDEX *rp)
218  
219   /* copy nth record from index to stdout */
220   static int
221 < print_record(const RECINDEX *rp, int n)
221 > print_record(const RECINDEX *rp, long n)
222   {
223          int     words2go = rp->nw_rec;
224          char    *scp;
# Line 237 | Line 251 | output_stream(FILE *fp)
251  
252          if (fp == NULL)
253                  return(0);
254 <        fflush(stdout);                 /* assumes nothing in input buffer */
255 <        while ((n = read(fileno(fp), buf, sizeof(buf))) > 0)
254 >        fflush(stdout);
255 >        while ((n = fread(buf, 1, sizeof(buf), fp)) > 0)
256                  if (write(fileno(stdout), buf, n) != n)
257                          return(0);
258 <        return(n >= 0);
258 >        return(!ferror(fp));
259   }
260  
261   /* get next word from stream, leaving stream on EOL or start of next word */
# Line 274 | Line 288 | int            ni_columns = 0;                 /* number of input columns */
288   int             ni_rows = 0;                    /* number of input rows */
289   int             no_columns = 0;                 /* number of output columns */
290   int             no_rows = 0;                    /* number of output rows */
291 + int             transpose = 0;                  /* transpose rows & cols? */
292 + int             i_header = 1;                   /* input header? */
293 + int             o_header = 1;                   /* output header? */
294 + int             outArray[MAXLEVELS][2];         /* output block nesting */
295 + int             outLevels = 0;                  /* number of blocking levels */
296  
297 + /* parse RxCx... string */
298 + static int
299 + get_array(const char *spec, int blklvl[][2], int nlvls)
300 + {
301 +        int     n;
302 +
303 +        if (nlvls <= 0) {
304 +                fputs("Too many block levels!\n", stderr);
305 +                exit(1);
306 +        }
307 +        if (sscanf(spec, "%dx%d", &blklvl[0][0], &blklvl[0][1]) != 2) {
308 +                fputs("Bad block specification!\n", stderr);
309 +                exit(1);
310 +        }
311 +        while (isdigit(*spec))
312 +                spec++;
313 +        spec++;         /* 'x' */
314 +        while (isdigit(*spec))
315 +                spec++;
316 +        if ((*spec != 'x') & (*spec != 'X')) {
317 +                if (*spec) {
318 +                        fputs("Blocks must be separated by 'x' or 'X'\n", stderr);
319 +                        exit(1);
320 +                }
321 +                return(1);
322 +        }
323 +        spec++;
324 +        n = get_array(spec, blklvl+1, nlvls-1);
325 +        if (!n)
326 +                return(0);
327 +        blklvl[0][0] *= blklvl[1][0];
328 +        blklvl[0][1] *= blklvl[1][1];
329 +        return(n+1);
330 + }
331 +
332   /* check settings and assign defaults */
333   static int
334   check_sizes()
# Line 288 | Line 342 | check_sizes()
342                          comp_size = sizeof(double);
343                  else if (!strcmp(fmtid, "byte"))
344                          comp_size = 1;
345 <                else {
345 >                else if (strcmp(fmtid, "ascii")) {
346                          fprintf(stderr, "Unsupported format: %s\n", fmtid);
347                          return(0);
348                  }
349          }
350 +        if (transpose && (no_rows <= 0) & (no_columns <= 0)) {
351 +                if (ni_rows > 0) no_columns = ni_rows;
352 +                if (ni_columns > 0) no_rows = ni_columns;
353 +        } else if ((no_rows <= 0) & (no_columns > 0) &&
354 +                        !((ni_rows*ni_columns) % no_columns))
355 +                no_rows = ni_rows*ni_columns/no_columns;
356          if (n_comp <= 0)
357                  n_comp = 3;
358          return(1);
359   }
360  
361 < /* output transposed ASCII or binary data from memory */
361 > /* call to compute block input position */
362 > static long
363 > get_block_pos(int r, int c, int blklvl[][2], int nlvls)
364 > {
365 >        long    n = 0;
366 >
367 >        while (nlvls > 1) {
368 >                int     sr = r/blklvl[1][0];
369 >                int     sc = c/blklvl[1][1];
370 >                r -= sr*blklvl[1][0];
371 >                c -= sc*blklvl[1][1];
372 >                n += sr*blklvl[1][0]*blklvl[0][1] + sc*blklvl[1][0]*blklvl[1][1];
373 >                blklvl++;
374 >                nlvls--;
375 >        }
376 >        n += r*blklvl[0][1] + c;
377 >        return(n);
378 > }
379 >
380 > /* return input offset based on array ordering and transpose option */
381 > static long
382 > get_input_pos(int r, int c)
383 > {
384 >        long    n;
385 >
386 >        if (outLevels > 1) {            /* block reordering */
387 >                n = get_block_pos(r, c, outArray, outLevels);
388 >                if (transpose) {
389 >                        r = n/ni_rows;
390 >                        c = n - r*ni_rows;
391 >                        n = (long)c*ni_columns + r;
392 >                }
393 >        } else if (transpose)           /* transpose only */
394 >                n = (long)c*ni_columns + r;
395 >        else                            /* XXX should never happen! */
396 >                n = (long)r*no_columns + c;
397 >        return(n);
398 > }
399 >
400 > /* output reordered ASCII or binary data from memory */
401   static int
402 < do_transpose(const MEMLOAD *mp)
402 > do_reorder(const MEMLOAD *mp)
403   {
404          static const char       tabEOL[2] = {'\t','\n'};
405          RECINDEX                *rp = NULL;
# Line 321 | Line 420 | do_transpose(const MEMLOAD *mp)
420          } else if ((ni_rows > 0) & (ni_columns > 0)) {
421                  nrecords = ni_rows*ni_columns;
422                  if (nrecords > mp->len/(n_comp*comp_size)) {
423 <                        fprintf(stderr,
424 <                            "Input too small for specified size and type\n");
423 >                        fputs("Input too small for specified size and type\n",
424 >                                        stderr);
425                          return(0);
426                  }
427          } else
# Line 334 | Line 433 | do_transpose(const MEMLOAD *mp)
433                  ni_columns = nrecords/ni_rows;
434          if (nrecords != ni_rows*ni_columns)
435                  goto badspec;
436 <        if (no_columns <= 0)
437 <                no_columns = ni_rows;
438 <        if (no_rows <= 0)
439 <                no_rows = ni_columns;
440 <        if ((no_rows != ni_columns) | (no_columns != ni_rows))
441 <                goto badspec;
442 <                                                /* transpose records */
436 >        if (transpose) {
437 >                if (no_columns <= 0)
438 >                        no_columns = ni_rows;
439 >                if (no_rows <= 0)
440 >                        no_rows = ni_columns;
441 >                if (outLevels <= 1 &&
442 >                                (no_rows != ni_columns) | (no_columns != ni_rows))
443 >                        goto badspec;
444 >        } else {
445 >                if (no_columns <= 0)
446 >                        no_columns = ni_columns;
447 >                if (no_rows <= 0)
448 >                        no_rows = ni_rows;
449 >        }
450 >        if (ni_rows*ni_columns != no_rows*no_columns) {
451 >                fputs("Number of input and output records do not match\n",
452 >                                stderr);
453 >                return(0);
454 >        }
455 >                                                /* reorder records */
456          for (i = 0; i < no_rows; i++) {
457 <            for (j = 0; j < no_columns; j++)
457 >            for (j = 0; j < no_columns; j++) {
458 >                long    n = get_input_pos(i, j);
459 >                if (n >= nrecords) {
460 >                        fputs("Index past end-of-file\n", stderr);
461 >                        return(0);
462 >                }
463                  if (rp != NULL) {               /* ASCII output */
464 <                        print_record(rp, j*ni_columns + i);
464 >                        print_record(rp, n);
465                          putc(tabEOL[j >= no_columns-1], stdout);
466                  } else {                        /* binary output */
467 <                        fwrite((char *)mp->base +
468 <                                        (n_comp*comp_size)*(j*ni_columns + i),
352 <                                        n_comp*comp_size, 1, stdout);
467 >                        putbinary((char *)mp->base + (n_comp*comp_size)*n,
468 >                                        comp_size, n_comp, stdout);
469                  }
470 +            }
471              if (ferror(stdout)) {
472                  fprintf(stderr, "Error writing to stdout\n");
473                  return(0);
# Line 360 | Line 477 | do_transpose(const MEMLOAD *mp)
477                  free_records(rp);
478          return(1);
479   badspec:
480 <        fprintf(stderr, "Bad transpose specification -- check dimension(s)\n");
480 >        fprintf(stderr, "Bad dimension(s)\n");
481          return(0);
482   }
483  
# Line 372 | Line 489 | do_resize(FILE *fp)
489          int     columns2go = no_columns;
490          char    word[256];
491                                                  /* sanity checks */
492 <        if (comp_size)
493 <                return(output_stream(fp));      /* binary data -- just copy */
492 >        if (comp_size || (no_columns == ni_columns) & (no_rows == ni_rows))
493 >                return(output_stream(fp));      /* no-op -- just copy */
494          if (no_columns <= 0) {
495                  fprintf(stderr, "Missing -oc specification\n");
496                  return(0);
# Line 426 | Line 543 | done:
543   static int
544   headline(char *s, void *p)
545   {
546 <        static char     fmt[32];
546 >        static char     fmt[MAXFMTLEN];
547          int             n;
548  
549          if (formatval(fmt, s)) {
# Line 460 | Line 577 | headline(char *s, void *p)
577          if (!strncmp(s, "NCOMP=", 6)) {
578                  n = atoi(s+6);
579                  if ((n_comp > 0) & (n != n_comp)) {
580 <                        fputs("Incorrect number of components", stderr);
580 >                        fputs("Incorrect number of components\n", stderr);
581                          return(-1);
582                  }
583                  n_comp = n;
584                  return(0);
585          }
586 <        fputs(s, stdout);                       /* copy header info. */
586 >        if (o_header)
587 >                fputs(s, stdout);               /* copy header info. */
588          return(0);
589   }
590  
# Line 474 | Line 592 | headline(char *s, void *p)
592   int
593   main(int argc, char *argv[])
594   {
595 <        int     i_header = 1;                   /* input header? */
478 <        int     o_header = 1;                   /* output header? */
479 <        int     transpose = 0;                  /* transpose rows & cols? */
480 <        int     i;
595 >        int     a;
596  
597 <        for (i = 1; i < argc && argv[i][0] == '-'; i++)
598 <                switch (argv[i][1]) {
597 >        for (a = 1; a < argc && argv[a][0] == '-'; a++)
598 >                switch (argv[a][1]) {
599                  case 'i':                       /* input */
600 <                        if (argv[i][2] == 'c')  /* columns */
601 <                                ni_columns = atoi(argv[++i]);
602 <                        else if (argv[i][2] == 'r')
603 <                                ni_rows = atoi(argv[++i]);
600 >                        if (argv[a][2] == 'c')  /* columns */
601 >                                ni_columns = atoi(argv[++a]);
602 >                        else if (argv[a][2] == 'r')
603 >                                ni_rows = atoi(argv[++a]);
604                          else
605                                  goto userr;
606                          break;
607                  case 'o':                       /* output */
608 <                        if (argv[i][2] == 'c')  /* columns */
609 <                                no_columns = atoi(argv[++i]);
610 <                        else if (argv[i][2] == 'r')
611 <                                no_rows = atoi(argv[++i]);
612 <                        else
608 >                        if (argv[a][2] == 'c')  /* columns */
609 >                                no_columns = atoi(argv[++a]);
610 >                        else if (argv[a][2] == 'r')
611 >                                no_rows = atoi(argv[++a]);
612 >                        else if (argv[a][2] ||
613 >                          !(outLevels=get_array(argv[++a], outArray, MAXLEVELS)))
614                                  goto userr;
615                          break;
616                  case 'h':                       /* turn off header */
617 <                        switch (argv[i][2]) {
617 >                        switch (argv[a][2]) {
618                          case 'i':
619                                  i_header = 0;
620                                  break;
# Line 516 | Line 632 | main(int argc, char *argv[])
632                          transpose = !transpose;
633                          break;
634                  case 'f':                       /* format */
635 <                        switch (argv[i][2]) {
635 >                        switch (argv[a][2]) {
636                          case 'a':               /* ASCII */
637                          case 'A':
638                                  fmtid = "ascii";
# Line 540 | Line 656 | main(int argc, char *argv[])
656                          default:
657                                  goto userr;
658                          }
659 <                        if (argv[i][3]) {
660 <                                if (!isdigit(argv[i][3]))
659 >                        if (argv[a][3]) {
660 >                                if (!isdigit(argv[a][3]))
661                                          goto userr;
662 <                                n_comp = atoi(argv[i]+3);
663 <                        }
662 >                                n_comp = atoi(argv[a]+3);
663 >                        } else
664 >                                n_comp = 1;
665                          break;
666                  case 'w':                       /* warnings on/off */
667                          warnings = !warnings;
# Line 552 | Line 669 | main(int argc, char *argv[])
669                  default:
670                          goto userr;
671                  }
672 <        if (i < argc-1)                         /* arg count OK? */
672 >        if (a < argc-1)                         /* arg count OK? */
673                  goto userr;
674 +        if (outLevels) {                        /* should check consistency? */
675 +                no_rows = outArray[0][0];
676 +                no_columns = outArray[0][1];
677 +        }
678                                                  /* open input file? */
679 <        if (i == argc-1 && freopen(argv[i], "r", stdin) == NULL) {
680 <                fprintf(stderr, "%s: cannot open for reading\n", argv[i]);
679 >        if (a == argc-1 && freopen(argv[a], "r", stdin) == NULL) {
680 >                fprintf(stderr, "%s: cannot open for reading\n", argv[a]);
681                  return(1);
682          }
683          if (comp_size) {
# Line 564 | Line 685 | main(int argc, char *argv[])
685                  SET_FILE_BINARY(stdout);
686          }
687                                                  /* check for no-op */
688 <        if (!transpose & (i_header == o_header) && (comp_size ||
689 <                        (no_columns == ni_columns) & (no_rows == ni_rows))) {
688 >        if (!transpose & (outLevels <= 1) & (i_header == o_header) &&
689 >                        (no_columns == ni_columns) & (no_rows == ni_rows)) {
690                  if (warnings)
691                          fprintf(stderr, "%s: no-op -- copying input verbatim\n",
692                                  argv[0]);
# Line 574 | Line 695 | main(int argc, char *argv[])
695                  return(0);
696          }
697          if (i_header) {                         /* read header */
698 <                if (getheader(stdin, &headline, NULL) < 0)
698 >                if (getheader(stdin, headline, NULL) < 0)
699                          return(1);
700                  if (!check_sizes())
701                          return(1);
# Line 584 | Line 705 | main(int argc, char *argv[])
705                  }
706          } else if (!check_sizes())
707                  return(1);
708 <        if (o_header) {                         /* write header */
709 <                printargs(argc, argv, stdout);
710 <                if (transpose && (no_rows <= 0) & (no_columns <= 0)) {
711 <                        if (ni_rows > 0) no_columns = ni_rows;
591 <                        if (ni_columns > 0) no_rows = ni_columns;
592 <                }
708 >        if (o_header) {                         /* write/add to header */
709 >                if (!i_header)
710 >                        newheader("RADIANCE", stdout);
711 >                printargs(a, argv, stdout);
712                  if (no_rows > 0)
713                          printf("NROWS=%d\n", no_rows);
714                  if (no_columns > 0)
# Line 598 | Line 717 | main(int argc, char *argv[])
717                  fputformat(fmtid, stdout);
718                  fputc('\n', stdout);            /* finish new header */
719          }
720 <        if (transpose) {                        /* transposing rows & columns? */
721 <                MEMLOAD myMem;                  /* need to load into memory */
722 <                if (i == argc-1) {
720 >        if (transpose | (outLevels > 1)) {      /* moving stuff around? */
721 >                MEMLOAD myMem;                  /* need to map into memory */
722 >                if (a == argc-1) {
723                          if (load_file(&myMem, stdin) <= 0) {
724                                  fprintf(stderr, "%s: error loading file into memory\n",
725 <                                                argv[i]);
725 >                                                argv[a]);
726                                  return(1);
727                          }
728                  } else if (load_stream(&myMem, stdin) <= 0) {
# Line 611 | Line 730 | main(int argc, char *argv[])
730                                                  argv[0]);
731                          return(1);
732                  }
733 <                if (!do_transpose(&myMem))
733 >                if (!do_reorder(&myMem))
734                          return(1);
735 <                /* free_load(&myMem); */
736 <        } else if (!do_resize(stdin))           /* just reshaping input */
735 >                /* free_load(&myMem);   about to exit, so don't bother */
736 >        } else if (!do_resize(stdin))           /* reshaping input */
737                  return(1);
738          return(0);
739   userr:
740          fprintf(stderr,
741 < "Usage: %s [-h[io]][-w][-f[afdb][N]][-t][-ic in_col][-ir in_row][-oc out_col][-or out_row] [input.dat]\n",
741 > "Usage: %s [-h[io]][-w][-f[afdb][N]][-t][-ic in_col][-ir in_row][-oc out_col][-or out_row][-o RxC[xR1xC1..]] [input.dat]\n",
742                          argv[0]);
743          return(1);
744   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines