ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/image.c
Revision: 2.31
Committed: Fri Feb 18 17:42:14 2005 UTC (19 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R7P2, rad3R7P1
Changes since 2.30: +3 -1 lines
Log Message:
Added check for illegal view distance

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 greg 2.31 static const char RCSid[] = "$Id: image.c,v 2.30 2005/02/07 20:13:55 greg Exp $";
3 greg 1.1 #endif
4     /*
5     * image.c - routines for image generation.
6 greg 2.16 *
7     * External symbols declared in view.h
8     */
9    
10 greg 2.17 #include "copyright.h"
11 greg 1.1
12 schorsch 2.22 #include "rtio.h"
13 greg 2.28 #include "rtmath.h"
14 greg 2.27 #include "paths.h"
15 greg 1.1 #include "view.h"
16    
17 greg 2.4
18 greg 2.11 #define FEQ(x,y) (fabs((x)-(y)) <= FTINY)
19     #define VEQ(v,w) (FEQ((v)[0],(w)[0]) && FEQ((v)[1],(w)[1]) \
20     && FEQ((v)[2],(w)[2]))
21    
22 greg 1.5 VIEW stdview = STDVIEW; /* default view parameters */
23 greg 1.1
24 schorsch 2.26 static gethfunc gethview;
25    
26 greg 1.1
27     char *
28 greg 1.5 setview(v) /* set hvec and vvec, return message on error */
29     register VIEW *v;
30 greg 1.3 {
31 greg 1.12 static char ill_horiz[] = "illegal horizontal view size";
32     static char ill_vert[] = "illegal vertical view size";
33    
34 gwlarson 2.15 if (v->vaft < -FTINY || (v->vaft > FTINY && v->vaft <= v->vfore))
35 greg 2.7 return("illegal fore/aft clipping plane");
36    
37 greg 2.31 if (v->vdist <= FTINY)
38     return("illegal view distance");
39 greg 2.29 v->vdist *= normalize(v->vdir); /* normalize direction */
40     if (v->vdist == 0.0)
41 greg 1.1 return("zero view direction");
42    
43 greg 1.14 if (normalize(v->vup) == 0.0) /* normalize view up */
44     return("zero view up vector");
45    
46 greg 1.5 fcross(v->hvec, v->vdir, v->vup); /* compute horiz dir */
47    
48     if (normalize(v->hvec) == 0.0)
49 greg 1.14 return("view up parallel to view direction");
50 greg 1.1
51 greg 1.5 fcross(v->vvec, v->hvec, v->vdir); /* compute vert dir */
52    
53 greg 1.12 if (v->horiz <= FTINY)
54     return(ill_horiz);
55     if (v->vert <= FTINY)
56     return(ill_vert);
57    
58     switch (v->type) {
59     case VT_PAR: /* parallel view */
60 greg 1.5 v->hn2 = v->horiz;
61 greg 1.12 v->vn2 = v->vert;
62     break;
63     case VT_PER: /* perspective view */
64     if (v->horiz >= 180.0-FTINY)
65     return(ill_horiz);
66     if (v->vert >= 180.0-FTINY)
67     return(ill_vert);
68 greg 1.5 v->hn2 = 2.0 * tan(v->horiz*(PI/180.0/2.0));
69 greg 1.12 v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0));
70     break;
71 greg 2.9 case VT_CYL: /* cylindrical panorama */
72     if (v->horiz > 360.0+FTINY)
73     return(ill_horiz);
74     if (v->vert >= 180.0-FTINY)
75     return(ill_vert);
76     v->hn2 = v->horiz * (PI/180.0);
77     v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0));
78     break;
79 greg 1.12 case VT_ANG: /* angular fisheye */
80     if (v->horiz > 360.0+FTINY)
81     return(ill_horiz);
82     if (v->vert > 360.0+FTINY)
83     return(ill_vert);
84 greg 2.9 v->hn2 = v->horiz * (PI/180.0);
85     v->vn2 = v->vert * (PI/180.0);
86 greg 1.12 break;
87     case VT_HEM: /* hemispherical fisheye */
88     if (v->horiz > 180.0+FTINY)
89     return(ill_horiz);
90     if (v->vert > 180.0+FTINY)
91     return(ill_vert);
92     v->hn2 = 2.0 * sin(v->horiz*(PI/180.0/2.0));
93     v->vn2 = 2.0 * sin(v->vert*(PI/180.0/2.0));
94     break;
95     default:
96 greg 1.1 return("unknown view type");
97 greg 1.12 }
98 greg 1.13 if (v->type != VT_ANG) {
99 greg 2.9 if (v->type != VT_CYL) {
100     v->hvec[0] *= v->hn2;
101     v->hvec[1] *= v->hn2;
102     v->hvec[2] *= v->hn2;
103     }
104 greg 1.12 v->vvec[0] *= v->vn2;
105     v->vvec[1] *= v->vn2;
106     v->vvec[2] *= v->vn2;
107     }
108 greg 1.5 v->hn2 *= v->hn2;
109     v->vn2 *= v->vn2;
110 greg 1.1
111     return(NULL);
112     }
113    
114    
115 greg 2.16 void
116 greg 1.7 normaspect(va, ap, xp, yp) /* fix pixel aspect or resolution */
117     double va; /* view aspect ratio */
118     double *ap; /* pixel aspect in (or out if 0) */
119     int *xp, *yp; /* x and y resolution in (or out if *ap!=0) */
120 greg 1.6 {
121     if (*ap <= FTINY)
122 greg 1.7 *ap = va * *xp / *yp; /* compute pixel aspect */
123 greg 1.6 else if (va * *xp > *ap * *yp)
124 greg 1.10 *xp = *yp / va * *ap + .5; /* reduce x resolution */
125 greg 1.6 else
126 greg 1.10 *yp = *xp * va / *ap + .5; /* reduce y resolution */
127 greg 1.6 }
128    
129    
130 greg 2.7 double
131 greg 1.5 viewray(orig, direc, v, x, y) /* compute ray origin and direction */
132 greg 1.1 FVECT orig, direc;
133     register VIEW *v;
134     double x, y;
135     {
136 greg 1.12 double d, z;
137    
138 greg 1.5 x += v->hoff - 0.5;
139     y += v->voff - 0.5;
140 greg 1.1
141 greg 1.12 switch(v->type) {
142     case VT_PAR: /* parallel view */
143 greg 2.7 orig[0] = v->vp[0] + v->vfore*v->vdir[0]
144     + x*v->hvec[0] + y*v->vvec[0];
145     orig[1] = v->vp[1] + v->vfore*v->vdir[1]
146     + x*v->hvec[1] + y*v->vvec[1];
147     orig[2] = v->vp[2] + v->vfore*v->vdir[2]
148     + x*v->hvec[2] + y*v->vvec[2];
149 greg 1.1 VCOPY(direc, v->vdir);
150 greg 2.8 return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0);
151 greg 1.12 case VT_PER: /* perspective view */
152 greg 1.5 direc[0] = v->vdir[0] + x*v->hvec[0] + y*v->vvec[0];
153     direc[1] = v->vdir[1] + x*v->hvec[1] + y*v->vvec[1];
154     direc[2] = v->vdir[2] + x*v->hvec[2] + y*v->vvec[2];
155 greg 2.7 orig[0] = v->vp[0] + v->vfore*direc[0];
156     orig[1] = v->vp[1] + v->vfore*direc[1];
157     orig[2] = v->vp[2] + v->vfore*direc[2];
158     d = normalize(direc);
159 greg 2.8 return(v->vaft > FTINY ? (v->vaft - v->vfore)*d : 0.0);
160 greg 1.12 case VT_HEM: /* hemispherical fisheye */
161 greg 1.13 z = 1.0 - x*x*v->hn2 - y*y*v->vn2;
162 greg 1.12 if (z < 0.0)
163 greg 2.7 return(-1.0);
164 greg 1.12 z = sqrt(z);
165     direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0];
166     direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1];
167     direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2];
168 greg 2.7 orig[0] = v->vp[0] + v->vfore*direc[0];
169     orig[1] = v->vp[1] + v->vfore*direc[1];
170     orig[2] = v->vp[2] + v->vfore*direc[2];
171 greg 2.8 return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0);
172 greg 2.9 case VT_CYL: /* cylindrical panorama */
173     d = x * v->horiz * (PI/180.0);
174     z = cos(d);
175     x = sin(d);
176     direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0];
177     direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1];
178     direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2];
179     orig[0] = v->vp[0] + v->vfore*direc[0];
180     orig[1] = v->vp[1] + v->vfore*direc[1];
181     orig[2] = v->vp[2] + v->vfore*direc[2];
182     d = normalize(direc);
183     return(v->vaft > FTINY ? (v->vaft - v->vfore)*d : 0.0);
184 greg 1.12 case VT_ANG: /* angular fisheye */
185     x *= v->horiz/180.0;
186     y *= v->vert/180.0;
187     d = x*x + y*y;
188     if (d > 1.0)
189 greg 2.7 return(-1.0);
190 greg 1.12 d = sqrt(d);
191     z = cos(PI*d);
192 greg 2.6 d = d <= FTINY ? PI : sqrt(1 - z*z)/d;
193 greg 1.12 x *= d;
194     y *= d;
195     direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0];
196     direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1];
197     direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2];
198 greg 2.7 orig[0] = v->vp[0] + v->vfore*direc[0];
199     orig[1] = v->vp[1] + v->vfore*direc[1];
200     orig[2] = v->vp[2] + v->vfore*direc[2];
201 greg 2.8 return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0);
202 greg 1.1 }
203 greg 2.7 return(-1.0);
204 greg 1.1 }
205    
206    
207 greg 2.16 void
208 greg 1.17 viewloc(ip, v, p) /* find image location for point */
209     FVECT ip;
210 greg 1.3 register VIEW *v;
211     FVECT p;
212     {
213 gregl 2.13 double d, d2;
214 greg 1.3 FVECT disp;
215 greg 1.5
216 greg 1.3 disp[0] = p[0] - v->vp[0];
217     disp[1] = p[1] - v->vp[1];
218     disp[2] = p[2] - v->vp[2];
219    
220 greg 1.12 switch (v->type) {
221     case VT_PAR: /* parallel view */
222 greg 2.7 ip[2] = DOT(disp,v->vdir) - v->vfore;
223 greg 1.13 break;
224 greg 1.12 case VT_PER: /* perspective view */
225 greg 1.11 d = DOT(disp,v->vdir);
226 gregl 2.13 ip[2] = VLEN(disp);
227 greg 1.17 if (d < 0.0) { /* fold pyramid */
228     ip[2] = -ip[2];
229 greg 1.11 d = -d;
230 greg 2.7 }
231     if (d > FTINY) {
232 greg 1.11 d = 1.0/d;
233     disp[0] *= d;
234     disp[1] *= d;
235     disp[2] *= d;
236     }
237 greg 2.7 ip[2] *= (1.0 - v->vfore*d);
238 greg 1.13 break;
239 greg 1.12 case VT_HEM: /* hemispherical fisheye */
240     d = normalize(disp);
241 greg 1.17 if (DOT(disp,v->vdir) < 0.0)
242     ip[2] = -d;
243     else
244     ip[2] = d;
245 greg 2.7 ip[2] -= v->vfore;
246 greg 1.13 break;
247 greg 2.9 case VT_CYL: /* cylindrical panorama */
248     d = DOT(disp,v->hvec);
249 gregl 2.13 d2 = DOT(disp,v->vdir);
250     ip[0] = 180.0/PI * atan2(d,d2) / v->horiz + 0.5 - v->hoff;
251     d = 1.0/sqrt(d*d + d2*d2);
252     ip[1] = DOT(disp,v->vvec)*d/v->vn2 + 0.5 - v->voff;
253     ip[2] = VLEN(disp);
254 gwlarson 2.15 ip[2] *= (1.0 - v->vfore*d);
255 greg 2.9 return;
256 greg 1.12 case VT_ANG: /* angular fisheye */
257 greg 1.17 ip[0] = 0.5 - v->hoff;
258     ip[1] = 0.5 - v->voff;
259 greg 2.7 ip[2] = normalize(disp) - v->vfore;
260 greg 1.12 d = DOT(disp,v->vdir);
261     if (d >= 1.0-FTINY)
262     return;
263     if (d <= -(1.0-FTINY)) {
264 greg 2.7 ip[0] += 180.0/v->horiz;
265 greg 1.12 return;
266     }
267     d = acos(d)/PI / sqrt(1.0 - d*d);
268 greg 1.17 ip[0] += DOT(disp,v->hvec)*d*180.0/v->horiz;
269     ip[1] += DOT(disp,v->vvec)*d*180.0/v->vert;
270 greg 1.12 return;
271 greg 1.3 }
272 greg 1.17 ip[0] = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
273     ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
274 greg 1.3 }
275    
276    
277 greg 2.16 void
278 greg 1.17 pix2loc(loc, rp, px, py) /* compute image location from pixel pos. */
279 schorsch 2.18 RREAL loc[2];
280 greg 1.17 register RESOLU *rp;
281     int px, py;
282     {
283     register int x, y;
284    
285 greg 2.16 if (rp->rt & YMAJOR) {
286 greg 1.17 x = px;
287     y = py;
288     } else {
289     x = py;
290     y = px;
291     }
292 greg 2.16 if (rp->rt & XDECR)
293 greg 1.17 x = rp->xr-1 - x;
294 greg 2.16 if (rp->rt & YDECR)
295 greg 1.17 y = rp->yr-1 - y;
296     loc[0] = (x+.5)/rp->xr;
297     loc[1] = (y+.5)/rp->yr;
298     }
299    
300    
301 greg 2.16 void
302 greg 1.17 loc2pix(pp, rp, lx, ly) /* compute pixel pos. from image location */
303     int pp[2];
304     register RESOLU *rp;
305     double lx, ly;
306     {
307     register int x, y;
308    
309     x = lx * rp->xr;
310     y = ly * rp->yr;
311 greg 2.16 if (rp->rt & XDECR)
312 greg 1.17 x = rp->xr-1 - x;
313 greg 2.16 if (rp->rt & YDECR)
314 greg 1.17 y = rp->yr-1 - y;
315 greg 2.16 if (rp->rt & YMAJOR) {
316 greg 1.17 pp[0] = x;
317     pp[1] = y;
318     } else {
319     pp[0] = y;
320     pp[1] = x;
321     }
322     }
323    
324    
325 greg 1.5 int
326     getviewopt(v, ac, av) /* process view argument */
327     register VIEW *v;
328     int ac;
329     register char *av[];
330     {
331 greg 1.16 #define check(c,l) if ((av[0][c]&&av[0][c]!=' ') || \
332     badarg(ac-1,av+1,l)) return(-1)
333 greg 1.5
334 greg 1.9 if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v')
335 greg 1.5 return(-1);
336     switch (av[0][2]) {
337     case 't': /* type */
338     if (!av[0][3] || av[0][3]==' ')
339     return(-1);
340 greg 1.16 check(4,"");
341 greg 1.5 v->type = av[0][3];
342     return(0);
343     case 'p': /* point */
344 greg 1.16 check(3,"fff");
345 greg 1.5 v->vp[0] = atof(av[1]);
346     v->vp[1] = atof(av[2]);
347     v->vp[2] = atof(av[3]);
348     return(3);
349     case 'd': /* direction */
350 greg 1.16 check(3,"fff");
351 greg 1.5 v->vdir[0] = atof(av[1]);
352     v->vdir[1] = atof(av[2]);
353     v->vdir[2] = atof(av[3]);
354 greg 2.30 v->vdist = 1.;
355 greg 1.5 return(3);
356     case 'u': /* up */
357 greg 1.16 check(3,"fff");
358 greg 1.5 v->vup[0] = atof(av[1]);
359     v->vup[1] = atof(av[2]);
360     v->vup[2] = atof(av[3]);
361     return(3);
362     case 'h': /* horizontal size */
363 greg 1.16 check(3,"f");
364 greg 1.5 v->horiz = atof(av[1]);
365     return(1);
366     case 'v': /* vertical size */
367 greg 1.16 check(3,"f");
368 greg 1.5 v->vert = atof(av[1]);
369     return(1);
370 greg 2.7 case 'o': /* fore clipping plane */
371     check(3,"f");
372     v->vfore = atof(av[1]);
373     return(1);
374     case 'a': /* aft clipping plane */
375     check(3,"f");
376     v->vaft = atof(av[1]);
377     return(1);
378 greg 1.5 case 's': /* shift */
379 greg 1.16 check(3,"f");
380 greg 1.5 v->hoff = atof(av[1]);
381     return(1);
382     case 'l': /* lift */
383 greg 1.16 check(3,"f");
384 greg 1.5 v->voff = atof(av[1]);
385     return(1);
386     default:
387     return(-1);
388     }
389     #undef check
390     }
391    
392    
393     int
394     sscanview(vp, s) /* get view parameters from string */
395     VIEW *vp;
396 greg 1.1 register char *s;
397     {
398 greg 1.5 int ac;
399     char *av[4];
400     int na;
401     int nvopts = 0;
402    
403 greg 2.20 while (*s == ' ')
404 greg 2.19 s++;
405 greg 2.20 if (*s != '-')
406     s = sskip2(s,1);
407 greg 1.9 while (*s) {
408 greg 1.5 ac = 0;
409     do {
410 greg 2.21 if (ac || *s == '-')
411     av[ac++] = s;
412 greg 1.5 while (*s && *s != ' ')
413     s++;
414     while (*s == ' ')
415     s++;
416     } while (*s && ac < 4);
417     if ((na = getviewopt(vp, ac, av)) >= 0) {
418     if (na+1 < ac)
419     s = av[na+1];
420     nvopts++;
421 greg 1.9 } else if (ac > 1)
422     s = av[1];
423     }
424 greg 1.5 return(nvopts);
425 greg 1.1 }
426    
427    
428 greg 2.16 void
429 greg 1.1 fprintview(vp, fp) /* write out view parameters */
430     register VIEW *vp;
431     FILE *fp;
432     {
433     fprintf(fp, " -vt%c", vp->type);
434     fprintf(fp, " -vp %.6g %.6g %.6g", vp->vp[0], vp->vp[1], vp->vp[2]);
435 greg 2.29 fprintf(fp, " -vd %.6g %.6g %.6g", vp->vdir[0]*vp->vdist,
436     vp->vdir[1]*vp->vdist,
437     vp->vdir[2]*vp->vdist);
438 greg 1.1 fprintf(fp, " -vu %.6g %.6g %.6g", vp->vup[0], vp->vup[1], vp->vup[2]);
439     fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert);
440 greg 2.7 fprintf(fp, " -vo %.6g -va %.6g", vp->vfore, vp->vaft);
441 greg 1.9 fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff);
442 greg 2.11 }
443    
444    
445     char *
446     viewopt(vp) /* translate to minimal view string */
447     register VIEW *vp;
448     {
449     static char vwstr[128];
450     register char *cp = vwstr;
451    
452     if (vp->type != stdview.type) {
453     sprintf(cp, " -vt%c", vp->type);
454     cp += strlen(cp);
455     }
456     if (!VEQ(vp->vp,stdview.vp)) {
457     sprintf(cp, " -vp %.6g %.6g %.6g",
458     vp->vp[0], vp->vp[1], vp->vp[2]);
459     cp += strlen(cp);
460     }
461 greg 2.29 if (!FEQ(vp->vdist,stdview.vdist) || !VEQ(vp->vdir,stdview.vdir)) {
462 greg 2.11 sprintf(cp, " -vd %.6g %.6g %.6g",
463 greg 2.29 vp->vdir[0]*vp->vdist,
464     vp->vdir[1]*vp->vdist,
465     vp->vdir[2]*vp->vdist);
466 greg 2.11 cp += strlen(cp);
467     }
468     if (!VEQ(vp->vup,stdview.vup)) {
469     sprintf(cp, " -vu %.6g %.6g %.6g",
470     vp->vup[0], vp->vup[1], vp->vup[2]);
471     cp += strlen(cp);
472     }
473     if (!FEQ(vp->horiz,stdview.horiz)) {
474     sprintf(cp, " -vh %.6g", vp->horiz);
475     cp += strlen(cp);
476     }
477     if (!FEQ(vp->vert,stdview.vert)) {
478     sprintf(cp, " -vv %.6g", vp->vert);
479     cp += strlen(cp);
480     }
481     if (!FEQ(vp->vfore,stdview.vfore)) {
482     sprintf(cp, " -vo %.6g", vp->vfore);
483     cp += strlen(cp);
484     }
485     if (!FEQ(vp->vaft,stdview.vaft)) {
486     sprintf(cp, " -va %.6g", vp->vaft);
487     cp += strlen(cp);
488     }
489     if (!FEQ(vp->hoff,stdview.hoff)) {
490     sprintf(cp, " -vs %.6g", vp->hoff);
491     cp += strlen(cp);
492     }
493     if (!FEQ(vp->voff,stdview.voff)) {
494     sprintf(cp, " -vl %.6g", vp->voff);
495     cp += strlen(cp);
496     }
497     return(vwstr);
498 greg 1.1 }
499    
500    
501 greg 2.3 int
502     isview(s) /* is this a view string? */
503     char *s;
504     {
505 greg 2.25 static char *altname[]={NULL,VIEWSTR,"rpict","rview","rvu","rpiece","pinterp",NULL};
506 greg 2.5 extern char *progname;
507 greg 2.3 register char *cp;
508     register char **an;
509     /* add program name to list */
510 greg 2.5 if (altname[0] == NULL) {
511     for (cp = progname; *cp; cp++)
512     ;
513     while (cp > progname && !ISDIRSEP(cp[-1]))
514     cp--;
515     altname[0] = cp;
516     }
517 greg 2.3 /* skip leading path */
518     cp = s;
519     while (*cp && *cp != ' ')
520     cp++;
521 greg 2.5 while (cp > s && !ISDIRSEP(cp[-1]))
522 greg 2.3 cp--;
523     for (an = altname; *an != NULL; an++)
524     if (!strncmp(*an, cp, strlen(*an)))
525     return(1);
526     return(0);
527     }
528 greg 1.1
529 greg 2.3
530 greg 1.15 struct myview {
531     VIEW *hv;
532     int ok;
533     };
534 greg 1.1
535 greg 1.15
536 gwlarson 2.14 static int
537 schorsch 2.26 gethview( /* get view from header */
538     char *s,
539     void *v
540     )
541 greg 1.1 {
542 schorsch 2.26 if (isview(s) && sscanview(((struct myview*)v)->hv, s) > 0)
543     ((struct myview*)v)->ok++;
544 gwlarson 2.14 return(0);
545 greg 1.1 }
546    
547    
548     int
549 greg 1.17 viewfile(fname, vp, rp) /* get view from file */
550 greg 1.1 char *fname;
551     VIEW *vp;
552 greg 1.17 RESOLU *rp;
553 greg 1.1 {
554 greg 1.15 struct myview mvs;
555 greg 1.1 FILE *fp;
556    
557 greg 2.16 if (fname == NULL || !strcmp(fname, "-"))
558     fp = stdin;
559     else if ((fp = fopen(fname, "r")) == NULL)
560 greg 1.1 return(-1);
561    
562 greg 1.15 mvs.hv = vp;
563     mvs.ok = 0;
564 greg 1.1
565 schorsch 2.26 getheader(fp, gethview, &mvs);
566 greg 1.8
567 greg 1.17 if (rp != NULL && !fgetsresolu(rp, fp))
568 greg 1.15 mvs.ok = 0;
569 greg 1.1
570     fclose(fp);
571    
572 greg 1.15 return(mvs.ok);
573 greg 1.1 }