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 |
< |
sskip(s) /* skip word in string */ |
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, leaving on space */ |
41 |
+ |
register char *s; |
42 |
+ |
{ |
43 |
+ |
while (isspace(*s)) |
44 |
+ |
s++; |
45 |
|
while (*s && !isspace(*s)) |
46 |
|
s++; |
47 |
|
return(s); |
49 |
|
|
50 |
|
|
51 |
|
char * |
52 |
< |
iskip(s) /* skip integer in string */ |
53 |
< |
char *s; |
52 |
> |
sskip2(s, n) /* skip word(s) in string, leaving on word */ |
53 |
> |
register char *s; |
54 |
> |
register int n; |
55 |
|
{ |
56 |
< |
register char *cp = s; |
56 |
> |
while (isspace(*s)) |
57 |
> |
s++; |
58 |
> |
while (n-- > 0) { |
59 |
> |
while (*s && !isspace(*s)) |
60 |
> |
s++; |
61 |
> |
while (isspace(*s)) |
62 |
> |
s++; |
63 |
> |
} |
64 |
> |
return(s); |
65 |
> |
} |
66 |
|
|
67 |
< |
while (isspace(*cp)) |
68 |
< |
cp++; |
69 |
< |
if (*cp == '-' || *cp == '+') |
70 |
< |
cp++; |
71 |
< |
while (isdigit(*cp)) |
72 |
< |
cp++; |
73 |
< |
return(cp); |
67 |
> |
|
68 |
> |
char * |
69 |
> |
iskip(s) /* skip integer in string */ |
70 |
> |
register char *s; |
71 |
> |
{ |
72 |
> |
while (isspace(*s)) |
73 |
> |
s++; |
74 |
> |
if (*s == '-' || *s == '+') |
75 |
> |
s++; |
76 |
> |
if (!isdigit(*s)) |
77 |
> |
return(NULL); |
78 |
> |
do |
79 |
> |
s++; |
80 |
> |
while (isdigit(*s)); |
81 |
> |
return(s); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
char * |
86 |
|
fskip(s) /* skip float in string */ |
87 |
< |
char *s; |
87 |
> |
register char *s; |
88 |
|
{ |
89 |
< |
register char *cp = s; |
89 |
> |
register char *cp; |
90 |
|
|
91 |
< |
while (isspace(*cp)) |
92 |
< |
cp++; |
93 |
< |
if (*cp == '-' || *cp == '+') |
94 |
< |
cp++; |
91 |
> |
while (isspace(*s)) |
92 |
> |
s++; |
93 |
> |
if (*s == '-' || *s == '+') |
94 |
> |
s++; |
95 |
> |
cp = s; |
96 |
|
while (isdigit(*cp)) |
97 |
|
cp++; |
98 |
|
if (*cp == '.') { |
99 |
< |
cp++; |
99 |
> |
cp++; s++; |
100 |
|
while (isdigit(*cp)) |
101 |
|
cp++; |
102 |
|
} |
103 |
+ |
if (cp == s) |
104 |
+ |
return(NULL); |
105 |
|
if (*cp == 'e' || *cp == 'E') |
106 |
|
return(iskip(cp+1)); |
107 |
|
return(cp); |
114 |
|
register char *cp; |
115 |
|
|
116 |
|
cp = iskip(s); |
117 |
< |
return(cp > s && *cp == '\0'); |
117 |
> |
return(cp != NULL && *cp == '\0'); |
118 |
|
} |
119 |
|
|
120 |
|
|
124 |
|
register char *cp; |
125 |
|
|
126 |
|
cp = iskip(s); |
127 |
< |
return(cp > s && strchr(*cp, ds) != NULL); |
127 |
> |
return(cp != NULL && strchr(ds, *cp) != NULL); |
128 |
|
} |
129 |
|
|
130 |
|
|
134 |
|
register char *cp; |
135 |
|
|
136 |
|
cp = fskip(s); |
137 |
< |
return(cp > s && *cp == '\0'); |
137 |
> |
return(cp != NULL && *cp == '\0'); |
138 |
|
} |
139 |
|
|
140 |
|
|
144 |
|
register char *cp; |
145 |
|
|
146 |
|
cp = fskip(s); |
147 |
< |
return(cp > s && strchr(*cp, ds) != NULL); |
147 |
> |
return(cp != NULL && strchr(ds, *cp) != NULL); |
148 |
|
} |