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

Comparing ray/src/common/fgetval.c (file contents):
Revision 2.1 by greg, Fri Jun 30 16:06:09 1995 UTC vs.
Revision 2.4 by greg, Tue Feb 25 02:47:21 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Read white space separated values from stream
6 + *
7 + *  External symbols declared in standard.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include  <stdio.h>
13  
14   #include  <math.h>
15  
16 < #include  <ctype.h>
16 > #include  <stdlib.h>
17  
18 + #include  <string.h>
19  
20 < #ifdef DCL_ATOF
19 < extern double   atof();
20 < #endif
21 < extern int      atoi();
22 < extern long     atol();
23 < extern char     *strcpy();
20 > #include  <ctype.h>
21  
22  
23 +
24   int
25   fgetval(fp, ty, vp)                     /* get specified data word */
26   register FILE   *fp;
27   int     ty;
28   char    *vp;
29   {
32        static char     delims[] = " \t\n\r\f#";
30          char    wrd[64];
31          register char   *cp;
32          register int    c;
# Line 55 | Line 52 | char   *vp;
52          *cp = '\0';
53          switch (ty) {                   /* check and convert it */
54          case 'h':                       /* short */
55 <                if (!isintd(wrd, delims))
55 >                if (!isint(wrd))
56                          return(0);
57                  *(short *)vp = c = atoi(wrd);
58                  if (*(short *)vp != c)
59                          return(0);
60                  return(1);
61          case 'i':                       /* integer */
62 <                if (!isintd(wrd, delims))
62 >                if (!isint(wrd))
63                          return(0);
64                  *(int *)vp = atoi(wrd);
65                  return(1);
66          case 'l':                       /* long */
67 <                if (!isintd(wrd, delims))
67 >                if (!isint(wrd))
68                          return(0);
69                  *(long *)vp = atol(wrd);
70                  return(1);
71          case 'f':                       /* float */
72 <                if (!isfltd(wrd, delims))
72 >                if (!isflt(wrd))
73                          return(0);
74                  *(float *)vp = atof(wrd);
75                  return(1);
76          case 'd':                       /* double */
77 <                if (!isfltd(wrd, delims))
77 >                if (!isflt(wrd))
78                          return(0);
79                  *(double *)vp = atof(wrd);
80                  return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines