| 29 |
|
int ty; |
| 30 |
|
char *vp; |
| 31 |
|
{ |
| 32 |
– |
static char delims[] = " \t\n\r\f#"; |
| 32 |
|
char wrd[64]; |
| 33 |
|
register char *cp; |
| 34 |
|
register int c; |
| 54 |
|
*cp = '\0'; |
| 55 |
|
switch (ty) { /* check and convert it */ |
| 56 |
|
case 'h': /* short */ |
| 57 |
< |
if (!isintd(wrd, delims)) |
| 57 |
> |
if (!isint(wrd)) |
| 58 |
|
return(0); |
| 59 |
|
*(short *)vp = c = atoi(wrd); |
| 60 |
|
if (*(short *)vp != c) |
| 61 |
|
return(0); |
| 62 |
|
return(1); |
| 63 |
|
case 'i': /* integer */ |
| 64 |
< |
if (!isintd(wrd, delims)) |
| 64 |
> |
if (!isint(wrd)) |
| 65 |
|
return(0); |
| 66 |
|
*(int *)vp = atoi(wrd); |
| 67 |
|
return(1); |
| 68 |
|
case 'l': /* long */ |
| 69 |
< |
if (!isintd(wrd, delims)) |
| 69 |
> |
if (!isint(wrd)) |
| 70 |
|
return(0); |
| 71 |
|
*(long *)vp = atol(wrd); |
| 72 |
|
return(1); |
| 73 |
|
case 'f': /* float */ |
| 74 |
< |
if (!isfltd(wrd, delims)) |
| 74 |
> |
if (!isflt(wrd)) |
| 75 |
|
return(0); |
| 76 |
|
*(float *)vp = atof(wrd); |
| 77 |
|
return(1); |
| 78 |
|
case 'd': /* double */ |
| 79 |
< |
if (!isfltd(wrd, delims)) |
| 79 |
> |
if (!isflt(wrd)) |
| 80 |
|
return(0); |
| 81 |
|
*(double *)vp = atof(wrd); |
| 82 |
|
return(1); |