1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
16 |
|
|
17 |
|
#include "resolu.h" |
18 |
|
|
19 |
+ |
#include "paths.h" |
20 |
+ |
|
21 |
|
VIEW stdview = STDVIEW; /* default view parameters */ |
22 |
|
|
23 |
|
|
278 |
|
{ |
279 |
|
#define check(c,l) if ((av[0][c]&&av[0][c]!=' ') || \ |
280 |
|
badarg(ac-1,av+1,l)) return(-1) |
279 |
– |
extern double atof(); |
281 |
|
|
282 |
|
if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v') |
283 |
|
return(-1); |
339 |
|
int na; |
340 |
|
int nvopts = 0; |
341 |
|
|
342 |
< |
while (*s == ' ') |
343 |
< |
s++; |
342 |
> |
if (*s != '-') |
343 |
> |
s = sskip(s); |
344 |
|
while (*s) { |
345 |
|
ac = 0; |
346 |
|
do { |
374 |
|
} |
375 |
|
|
376 |
|
|
377 |
< |
static char *altname[] = {NULL,"rpict","rview","pinterp",VIEWSTR,NULL}; |
377 |
> |
int |
378 |
> |
isview(s) /* is this a view string? */ |
379 |
> |
char *s; |
380 |
> |
{ |
381 |
> |
static char *altname[]={NULL,VIEWSTR,"rpict","rview","pinterp",NULL}; |
382 |
> |
extern char *progname; |
383 |
> |
register char *cp; |
384 |
> |
register char **an; |
385 |
> |
/* add program name to list */ |
386 |
> |
if (altname[0] == NULL) { |
387 |
> |
for (cp = progname; *cp; cp++) |
388 |
> |
; |
389 |
> |
while (cp > progname && !ISDIRSEP(cp[-1])) |
390 |
> |
cp--; |
391 |
> |
altname[0] = cp; |
392 |
> |
} |
393 |
> |
/* skip leading path */ |
394 |
> |
cp = s; |
395 |
> |
while (*cp && *cp != ' ') |
396 |
> |
cp++; |
397 |
> |
while (cp > s && !ISDIRSEP(cp[-1])) |
398 |
> |
cp--; |
399 |
> |
for (an = altname; *an != NULL; an++) |
400 |
> |
if (!strncmp(*an, cp, strlen(*an))) |
401 |
> |
return(1); |
402 |
> |
return(0); |
403 |
> |
} |
404 |
|
|
405 |
+ |
|
406 |
|
struct myview { |
407 |
|
VIEW *hv; |
408 |
|
int ok; |
414 |
|
char *s; |
415 |
|
register struct myview *v; |
416 |
|
{ |
417 |
< |
register char **an; |
418 |
< |
|
391 |
< |
for (an = altname; *an != NULL; an++) |
392 |
< |
if (!strncmp(*an, s, strlen(*an))) { |
393 |
< |
if (sscanview(v->hv, s+strlen(*an)) > 0) |
394 |
< |
v->ok++; |
395 |
< |
return; |
396 |
< |
} |
417 |
> |
if (isview(s) && sscanview(v->hv, s) > 0) |
418 |
> |
v->ok++; |
419 |
|
} |
420 |
|
|
421 |
|
|
425 |
|
VIEW *vp; |
426 |
|
RESOLU *rp; |
427 |
|
{ |
406 |
– |
extern char *progname; |
428 |
|
struct myview mvs; |
429 |
|
FILE *fp; |
430 |
|
|
431 |
|
if ((fp = fopen(fname, "r")) == NULL) |
432 |
|
return(-1); |
433 |
|
|
413 |
– |
altname[0] = progname; |
434 |
|
mvs.hv = vp; |
435 |
|
mvs.ok = 0; |
436 |
|
|