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

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.14 by greg, Mon Sep 21 12:07:52 1992 UTC vs.
Revision 2.18 by greg, Tue Nov 10 21:24:34 1992 UTC

# Line 63 | Line 63 | int  ambounce = 0;                     /* ambient bounces */
63   char  *amblist[128];                    /* ambient include/exclude list */
64   int  ambincl = -1;                      /* include == 1, exclude == 0 */
65  
66 + #ifdef MSDOS
67 + int  ralrm = 60;                        /* seconds between reports */
68 + #else
69   int  ralrm = 0;                         /* seconds between reports */
70 + #endif
71  
72   double  pctdone = 0.0;                  /* percentage done */
73  
# Line 145 | Line 149 | openheader()                   /* save standard output to header file
149   }
150  
151  
148 closeheader()                   /* done with header output */
149 {
150        if (hfname == NULL)
151                return;
152        if (fflush(stdout) == EOF || (hfp = fopen(hfname, "r")) == NULL)
153                error(SYSTEM, "error reopening header file");
154 }
155
156
152   dupheader()                     /* repeat header on standard output */
153   {
154          register int  c;
155  
156 <        if (fseek(hfp, 0L, 0) < 0)
156 >        if (hfp == NULL) {
157 >                if ((hfp = fopen(hfname, "r")) == NULL)
158 >                        error(SYSTEM, "error reopening header file");
159 > #ifdef MSDOS
160 >                setmode(fileno(hfp), O_BINARY);
161 > #endif
162 >        } else if (fseek(hfp, 0L, 0) < 0)
163                  error(SYSTEM, "seek error on header file");
164          while ((c = getc(hfp)) != EOF)
165                  putchar(c);
# Line 185 | Line 186 | char  *pout, *zout, *prvr;
186          register char  *cp;
187          RESOLU  rs;
188          double  pa;
188                                        /* finished writing header */
189        closeheader();
189                                          /* check sampling */
190          if (psample < 1)
191                  psample = 1;
# Line 210 | Line 209 | char  *pout, *zout, *prvr;
209                                  error(USER, "unexpected EOF on view input");
210                  prvr = fbuf;                    /* mark for renaming */
211          }
212 <        if (pout != NULL) {
212 >        if (pout != NULL & prvr != NULL) {
213                  sprintf(fbuf, pout, seq);
214 <                if (prvr != NULL && !strcmp(prvr, fbuf)) {      /* rename */
215 <                        fbuf2[0] = '\0';
216 <                        if ((cp = rindex(fbuf, '/')) != NULL)
217 <                                strncpy(fbuf2, fbuf, cp-fbuf+1);
218 <                        strcat(fbuf2, RFTEMPLATE);
214 >                if (!strcmp(prvr, fbuf)) {      /* rename */
215 >                        strcpy(fbuf2, fbuf);
216 >                        for (cp = fbuf2; *cp; cp++)
217 >                                ;
218 >                        while (cp > fbuf2 && !ISDIRSEP(cp[-1]))
219 >                                cp--;
220 >                        strcpy(cp, RFTEMPLATE);
221                          prvr = mktemp(fbuf2);
222                          if (rename(fbuf, prvr) < 0 && errno != ENOENT) {
223                                  sprintf(errmsg,
# Line 237 | Line 238 | char  *pout, *zout, *prvr;
238                                          "cannot open output file \"%s\"", fbuf);
239                                  error(SYSTEM, errmsg);
240                          }
241 + #ifdef MSDOS
242 +                        setmode(fileno(stdout), O_BINARY);
243 + #endif
244                          dupheader();
245                  }
246                  hres = hresolu; vres = vresolu; pa = pixaspect;
# Line 328 | Line 332 | char  *zfile, *oldfile;
332                          sprintf(errmsg, "cannot open z file \"%s\"", zfile);
333                          error(SYSTEM, errmsg);
334                  }
335 + #ifdef MSDOS
336 +                setmode(zfd, O_BINARY);
337 + #endif
338                  for (i = 0; i <= psample; i++) {
339                          zbar[i] = (float *)malloc(hres*sizeof(float));
340                          if (zbar[i] == NULL)
# Line 498 | Line 505 | int  x, y;
505   int  xlen, ylen;
506   int  b;
507   {
501        extern double  fabs();
508          double  ratio;
509          double  z;
510          COLOR  ctmp;
# Line 586 | Line 592 | char  *oldfile;
592                  error(WARNING, errmsg);
593                  return(0);
594          }
595 + #ifdef MSDOS
596 +        setmode(fileno(fp), O_BINARY);
597 + #endif
598                                  /* discard header */
599          getheader(fp, NULL);
600                                  /* get picture size */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines