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

Comparing ray/src/px/pcompos.c (file contents):
Revision 1.9 by greg, Fri May 31 10:21:31 1991 UTC vs.
Revision 2.9 by greg, Mon Aug 10 11:23:13 1992 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14  
15   #include  "color.h"
16  
17 + #include  "resolu.h"
18  
19 < #define  MAXFILE        32
19 > #define  MAXFILE        64
20  
21                                          /* output picture size */
22   int  xsiz = 0;
# Line 69 | Line 70 | main(argc, argv)
70   int  argc;
71   char  *argv[];
72   {
72        double  atof();
73          int  ncolumns = 0;
74          int  autolabel = 0;
75          int  curcol = 0, curx = 0, cury = 0;
# Line 119 | Line 119 | dofiles:
119          for (nfile = 0; an < argc; nfile++) {
120                  if (nfile >= MAXFILE)
121                          goto toomany;
122 <                if (autolabel)
123 <                        thislabel = argv[an];
124 <                else
125 <                        thislabel = NULL;
122 >                thislabel = NULL;
123                  input[nfile].hasmin = input[nfile].hasmax = 0;
124                  while (an < argc && (argv[an][0] == '-' || argv[an][0] == '+'))
125                          switch (argv[an][1]) {
# Line 146 | Line 143 | dofiles:
143                          case 'l':
144                                  if (strcmp(argv[an], "-l"))
145                                          goto userr;
146 <                                thislabel = argv[++an];
146 >                                thislabel = argv[an+1];
147 >                                an += 2;
148                                  break;
149                          case '\0':
150                                  if (argv[an][0] == '-')
# Line 158 | Line 156 | dofiles:
156   getfile:
157                  if (argc-an < (ncolumns ? 1 : 3))
158                          goto userr;
159 +                if (autolabel && thislabel == NULL)
160 +                        thislabel = argv[an];
161                  if (!strcmp(argv[an], "-")) {
162                          input[nfile].name = "<stdin>";
163                          input[nfile].fp = stdin;
164                  } else {
165 <                        input[nfile].name = argv[an];
166 <                        if ((input[nfile].fp = argv[an][0] == '!' ?
167 <                                        popen(argv[an]+1, "r") :
168 <                                        fopen(argv[an], "r")) == NULL) {
165 >                        if (argv[an][0] == '!') {
166 >                                input[nfile].name = "<Command>";
167 >                                input[nfile].fp = popen(argv[an]+1, "r");
168 >                        } else {
169 >                                input[nfile].name = argv[an];
170 >                                input[nfile].fp = fopen(argv[an], "r");
171 >                        }
172 >                        if (input[nfile].fp == NULL) {
173                                  perror(argv[an]);
174                                  quit(1);
175                          }
# Line 181 | Line 185 | getfile:
185                  }
186                                                  /* get picture size */
187                  if (fgetresolu(&input[nfile].xres, &input[nfile].yres,
188 <                                input[nfile].fp) != (YMAJOR|YDECR)) {
188 >                                input[nfile].fp) < 0) {
189                          fprintf(stderr, "%s: bad picture size\n",
190                                          input[nfile].name);
191                          quit(1);
# Line 213 | Line 217 | getfile:
217                                  goto toomany;
218                          input[nfile].name = "<Label>";
219                          input[nfile].hasmin = input[nfile].hasmax = 0;
220 +                        input[nfile].xres = input[nfile-1].xres;
221 +                        input[nfile].yres = labelht;
222                          if ((input[nfile].fp = lblopen(thislabel,
223                                          &input[nfile].xres,
224                                          &input[nfile].yres)) == NULL)
# Line 229 | Line 235 | getfile:
235                                          /* add new header info. */
236          printargs(argc, argv, stdout);
237          fputformat(COLRFMT, stdout);
238 <        printf("\n-Y %d +X %d\n", ysiz, xsiz);
238 >        putchar('\n');
239 >        fprtresolu(xsiz, ysiz, stdout);
240  
241          compos();
242          
# Line 332 | Line 339 | int  *xp, *yp;
339          char  com[128];
340          FILE  *fp;
341  
342 <        sprintf(com, "psign -h %d '%.30s' | pfilt -1 -x /2 -y /2",
336 <                        2*labelht, s);
342 >        sprintf(com, "psign -s -.15 -a 2 -x %d -y %d '%.90s'", *xp, *yp, s);
343          if ((fp = popen(com, "r")) == NULL)
344                  return(NULL);
345          if (checkheader(fp, COLRFMT, NULL) < 0)
346                  goto err;
347 <        if (fgetresolu(xp, yp, fp) != (YMAJOR|YDECR))
347 >        if (fgetresolu(xp, yp, fp) < 0)
348                  goto err;
349          return(fp);
350   err:
# Line 350 | Line 356 | err:
356   quit(code)              /* exit gracefully */
357   int  code;
358   {
359 +        int  status;
360 +
361 +        if (code == 0)                  /* reap any children */
362 +                while (wait(&status) != -1)
363 +                        if (code == 0)
364 +                                code = status>>8 & 0xff;
365          exit(code);
366   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines