/* file zapchar.c */

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

void zapchar(char *text, char zapped)
/****************************************************/
/*  Removes occurences of zapped (plus a preceding  */
/* space if there is one) in *text.                 */
/****************************************************/
{char *proc = "zapchar";
 char *sx;
 int delta = 0; 
 db_enter_msg(proc,3);
if (db_level > 4) printf("%s before: '%s'\n",pdb,text);
 for (sx = text; *sx != '\0'; sx++)
   {if ((*sx == ' ')&&(*(sx+1) == zapped)) delta += 1;
    else
      if  (*sx == zapped) delta += 1;
      else
        *(sx-delta) = *(sx);
   }
 *(sx-delta) = '\0';
if (db_level > 4) printf("%s  after: '%s'\n",pdb,text);
 db_leave_msg(proc,3);
 return;
}
