1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
20 |
|
|
21 |
|
|
22 |
|
char * |
23 |
+ |
atos(rs, nb, s) /* get next word from string */ |
24 |
+ |
char *rs; |
25 |
+ |
register int nb; |
26 |
+ |
register char *s; |
27 |
+ |
{ |
28 |
+ |
register char *cp = rs; |
29 |
+ |
|
30 |
+ |
while (isspace(*s)) |
31 |
+ |
s++; |
32 |
+ |
while (--nb > 0 && *s && !isspace(*s)) |
33 |
+ |
*cp++ = *s++; |
34 |
+ |
*cp = '\0'; |
35 |
+ |
return(rs); |
36 |
+ |
} |
37 |
+ |
|
38 |
+ |
|
39 |
+ |
char * |
40 |
|
sskip(s) /* skip word in string */ |
41 |
|
register char *s; |
42 |
|
{ |
44 |
|
s++; |
45 |
|
while (*s && !isspace(*s)) |
46 |
|
s++; |
47 |
+ |
while (isspace(*s)) |
48 |
+ |
s++; |
49 |
|
return(s); |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
char * |
54 |
|
iskip(s) /* skip integer in string */ |
55 |
< |
char *s; |
55 |
> |
register char *s; |
56 |
|
{ |
57 |
< |
register char *cp = s; |
58 |
< |
|
59 |
< |
while (isspace(*cp)) |
60 |
< |
cp++; |
61 |
< |
if (*cp == '-' || *cp == '+') |
62 |
< |
cp++; |
63 |
< |
while (isdigit(*cp)) |
64 |
< |
cp++; |
65 |
< |
return(cp); |
57 |
> |
while (isspace(*s)) |
58 |
> |
s++; |
59 |
> |
if (*s == '-' || *s == '+') |
60 |
> |
s++; |
61 |
> |
if (!isdigit(*s)) |
62 |
> |
return(NULL); |
63 |
> |
do |
64 |
> |
s++; |
65 |
> |
while (isdigit(*s)); |
66 |
> |
return(s); |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
|
char * |
71 |
|
fskip(s) /* skip float in string */ |
72 |
< |
char *s; |
72 |
> |
register char *s; |
73 |
|
{ |
74 |
< |
register char *cp = s; |
74 |
> |
register char *cp; |
75 |
|
|
76 |
< |
while (isspace(*cp)) |
77 |
< |
cp++; |
78 |
< |
if (*cp == '-' || *cp == '+') |
79 |
< |
cp++; |
76 |
> |
while (isspace(*s)) |
77 |
> |
s++; |
78 |
> |
if (*s == '-' || *s == '+') |
79 |
> |
s++; |
80 |
> |
cp = s; |
81 |
|
while (isdigit(*cp)) |
82 |
|
cp++; |
83 |
|
if (*cp == '.') { |
84 |
< |
cp++; |
84 |
> |
cp++; s++; |
85 |
|
while (isdigit(*cp)) |
86 |
|
cp++; |
87 |
|
} |
88 |
+ |
if (cp == s) |
89 |
+ |
return(NULL); |
90 |
|
if (*cp == 'e' || *cp == 'E') |
91 |
|
return(iskip(cp+1)); |
92 |
|
return(cp); |
99 |
|
register char *cp; |
100 |
|
|
101 |
|
cp = iskip(s); |
102 |
< |
return(cp > s && *cp == '\0'); |
102 |
> |
return(cp != NULL && *cp == '\0'); |
103 |
|
} |
104 |
|
|
105 |
|
|
109 |
|
register char *cp; |
110 |
|
|
111 |
|
cp = iskip(s); |
112 |
< |
return(cp > s && strchr(*cp, ds) != NULL); |
112 |
> |
return(cp != NULL && strchr(ds, *cp) != NULL); |
113 |
|
} |
114 |
|
|
115 |
|
|
119 |
|
register char *cp; |
120 |
|
|
121 |
|
cp = fskip(s); |
122 |
< |
return(cp > s && *cp == '\0'); |
122 |
> |
return(cp != NULL && *cp == '\0'); |
123 |
|
} |
124 |
|
|
125 |
|
|
129 |
|
register char *cp; |
130 |
|
|
131 |
|
cp = fskip(s); |
132 |
< |
return(cp > s && strchr(*cp, ds) != NULL); |
132 |
> |
return(cp != NULL && strchr(ds, *cp) != NULL); |
133 |
|
} |