234 |
|
int ac; |
235 |
|
register char *av[]; |
236 |
|
{ |
237 |
< |
#define check(c,n) if ((av[0][c]&&av[0][c]!=' ') || n>=ac) return(-1) |
237 |
> |
#define check(c,l) if ((av[0][c]&&av[0][c]!=' ') || \ |
238 |
> |
badarg(ac-1,av+1,l)) return(-1) |
239 |
|
extern double atof(); |
240 |
|
|
241 |
|
if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v') |
244 |
|
case 't': /* type */ |
245 |
|
if (!av[0][3] || av[0][3]==' ') |
246 |
|
return(-1); |
247 |
< |
check(4,0); |
247 |
> |
check(4,""); |
248 |
|
v->type = av[0][3]; |
249 |
|
return(0); |
250 |
|
case 'p': /* point */ |
251 |
< |
check(3,3); |
251 |
> |
check(3,"fff"); |
252 |
|
v->vp[0] = atof(av[1]); |
253 |
|
v->vp[1] = atof(av[2]); |
254 |
|
v->vp[2] = atof(av[3]); |
255 |
|
return(3); |
256 |
|
case 'd': /* direction */ |
257 |
< |
check(3,3); |
257 |
> |
check(3,"fff"); |
258 |
|
v->vdir[0] = atof(av[1]); |
259 |
|
v->vdir[1] = atof(av[2]); |
260 |
|
v->vdir[2] = atof(av[3]); |
261 |
|
return(3); |
262 |
|
case 'u': /* up */ |
263 |
< |
check(3,3); |
263 |
> |
check(3,"fff"); |
264 |
|
v->vup[0] = atof(av[1]); |
265 |
|
v->vup[1] = atof(av[2]); |
266 |
|
v->vup[2] = atof(av[3]); |
267 |
|
return(3); |
268 |
|
case 'h': /* horizontal size */ |
269 |
< |
check(3,1); |
269 |
> |
check(3,"f"); |
270 |
|
v->horiz = atof(av[1]); |
271 |
|
return(1); |
272 |
|
case 'v': /* vertical size */ |
273 |
< |
check(3,1); |
273 |
> |
check(3,"f"); |
274 |
|
v->vert = atof(av[1]); |
275 |
|
return(1); |
276 |
|
case 's': /* shift */ |
277 |
< |
check(3,1); |
277 |
> |
check(3,"f"); |
278 |
|
v->hoff = atof(av[1]); |
279 |
|
return(1); |
280 |
|
case 'l': /* lift */ |
281 |
< |
check(3,1); |
281 |
> |
check(3,"f"); |
282 |
|
v->voff = atof(av[1]); |
283 |
|
return(1); |
284 |
|
default: |