/* file pcindex_lsearch.c */

#if !defined(COMPILE_ENVIRONMENT)
#include <gp/stdcenvf.h> /* std compile environment for functions */
#endif

  PCIND_T pcindex_lsearch(char *astr, pcodeset *pc1, boolean *found)

  /*************************************************************************/
  /*  Returns the index for the item in pcodeset "pc" whose ASCII code     */
  /*  string matches astr.  Uses linear search.                            */
  /*  If there is no match, returns -1.                                    */
  /*************************************************************************/
   {int i;
    *found = F;
    i = 0; 
    while ((i <= pc1->ncodes) && (! *found))
      {if (pc1->separated)
         {if (streq(astr,pc1->pc[i].ac)) *found = T;
          else
            {if (streq(pc1->type_case,"immaterial"))
               {if (streqi(astr,pc1->pc[i].ac)) *found = T;
         }  }  }
       else /* not separated */
         {if ((strlen(pc1->pc[i].ac) == 1)
            &&(*astr == *(pc1->pc[i].ac))) *found = T;
         }
       if (!*found) i += 1;
      }
    if (!*found) i = -1;
    return i;
   }
