Seppo Mustonen : Programming Survo in C

Functions in library SURVO.LIB

spfind
Summary

int spfind(name)
char *name;      /* specification to be found */
Description

The spfind function searches for the specification name from the **spa list which has been created by the sp_init function earlier.

Return Value

If name is found, spfind returns the index (say i) of name in the **spa list. spb[i] is then the pointer to the value of name and spshad[i] the pointer to the shadow characters of value. If name is not found, -1 is returned.

See Also

spec_init, sp_init

Example

int i,k,x_home,y_home;
char x[LLENGTH]; *px[2];

i=sp_init(r1+r-1);  /* r1+r-1 is the current line in the edit field */
if (i<0) return;
i=spfind("HOME");
if (i>=0)
  {
  strcpy(x,spb[i]);
  k=split(x,px,2);
  if (k<0)
    {
    sprintf(sbuf,"\nError in spec. HOME=%s",spb[i]);
    sur_print(sbuf); WAIT; return;
    }
  x_home=atoi(px[0]);
  y_home=atoi(px[1]);
  }
else x_home=y_home=0;


Front page of Survo C libraries