示例#1
0
文件: str.c 项目: hollow/lucid
int str_check(const char *str, int allowed)
{
	int i, n;

	if (!str)
		return 1;

	n = str_len(str);

	for (i = 0; i < n; i++) {
		if (allowed & CC_ALNUM  && char_isalnum (str[i])) continue;
		if (allowed & CC_ALPHA  && char_isalpha (str[i])) continue;
		if (allowed & CC_ASCII  && char_isascii (str[i])) continue;
		if (allowed & CC_BLANK  && char_isblank (str[i])) continue;
		if (allowed & CC_CNTRL  && char_iscntrl (str[i])) continue;
		if (allowed & CC_DIGIT  && char_isdigit (str[i])) continue;
		if (allowed & CC_GRAPH  && char_isgraph (str[i])) continue;
		if (allowed & CC_LOWER  && char_islower (str[i])) continue;
		if (allowed & CC_PRINT  && char_isprint (str[i])) continue;
		if (allowed & CC_PUNCT  && char_ispunct (str[i])) continue;
		if (allowed & CC_SPACE  && char_isspace (str[i])) continue;
		if (allowed & CC_UPPER  && char_isupper (str[i])) continue;
		if (allowed & CC_XDIGIT && char_isxdigit(str[i])) continue;

		return 0;
	}

	return 1;
}
示例#2
0
文件: loaddb.c 项目: dong1/testsize
/*
 * ldr_check_file_name_and_line_no - parse schema file option
 *    return: void
 */
static int
ldr_check_file_name_and_line_no (void)
{
  char *p, *q;

  if (Schema_file[0] != 0)
    {
      if ((p = (char *) strchr (Schema_file, ':')) != NULL)
	{
	  for (q = p + 1; *q; q++)
	    if (!char_isdigit (*q))
	      break;
	  if (*q == 0)
	    {
	      schema_file_start_line = atoi (p + 1);
	      *p = 0;
	    }
	}
    }

  if (Index_file[0] != 0)
    {
      if ((p = (char *) strchr (Index_file, ':')) != NULL)
	{
	  for (q = p + 1; *q; q++)
	    if (!char_isdigit (*q))
	      break;
	  if (*q == 0)
	    {
	      index_file_start_line = atoi (p + 1);
	      *p = 0;
	    }
	}
    }

  return 0;
}
示例#3
0
static int
str_8bit_isdigit (const char *text)
{
    return char_isdigit (text[0]);
}