Esempio n. 1
0
// Return TRUE if there is a NULL terminated string starting at *mem.
static int is_varname(uint8_t *mem)
{
	int i=0;

	//printf("%i %i %i %02x\n", is_alnum(mem[i]) ? 1 : 0, is_allowed_char(mem[i]), mem[i], mem[i]);

	// The VAT can contain names starting with a number, they are hidden in Var-Link.
	if(!is_allowed_char(mem[0]))
		return 0;

	for(i=1; i<8; i++)
		if(!is_allowed_char(mem[i]) && mem[i])
			return 0;

	return !0;
}
Esempio n. 2
0
static int				count_words(const char *str, const char *forbidden)
{
  int					i;

  i = 0;
  while (str && *str)
    {
      if (str && *str && is_allowed_char(*str, forbidden))
	{
	  ++i;
	  while (str && *str && is_allowed_char(*str, forbidden))
	    str++;
	}
      if (*str)
	str++;
    }
  return (i);
}
Esempio n. 3
0
static char				*getWord(const char *str, const char *forbidden)
{
  char					*ret;
  int					i;

  i = 0;
  while (str && str[i] && is_allowed_char(str[i], forbidden))
    ++i;
  if ((ret = malloc(sizeof(*str) * (i + 1))) == NULL)
    return (NULL);
  i = 0;
  while (str && str[i] && is_allowed_char(str[i], forbidden))
    {
      ret[i] = str[i];
      ++i;
    }
  ret[i] = 0;
  return (ret);
}