⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 char.c

📁 代码检索工具GLOBAL源码。可用来浏览分析LINUX源码。
💻 C
字号:
/* * Copyright (c) 2003 Tama Communications Corporation * * This file is part of GNU GLOBAL. * * GNU GLOBAL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * GNU GLOBAL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA. */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "char.h"#include "strbuf.h"static char regexchar[256];static int init;#define ISREGEXCHAR(c)  (regexchar[(unsigned char)(c)])/* initialize for isregex() */static voidinitialize(void){	regexchar['^'] = regexchar['$'] = regexchar['{'] =	regexchar['}'] = regexchar['('] = regexchar[')'] =	regexchar['.'] = regexchar['*'] = regexchar['+'] =	regexchar['['] = regexchar[']'] = regexchar['?'] =	regexchar['\\'] = init = 1;}/* * isregexchar: test whether or not regular expression char. * *	i)	c	char *	r)		1: is regex, 0: not regex */intisregexchar(c)	int c;{	if (!init)		initialize();	return ISREGEXCHAR(c);}/* * isregex: test whether or not regular expression * *	i)	s	string *	r)		1: is regex, 0: not regex */intisregex(s)	const char *s;{	int c;	if (!init)		initialize();	while ((c = *s++) != '\0')		if (ISREGEXCHAR(c))			return 1;	return 0;}/* * quote string. * *	'aaa' => \'\a\a\a\' */const char *quote_string(s)	const char *s;{	STATIC_STRBUF(sb);	strbuf_clear(sb);	for (; *s; s++) {		strbuf_putc(sb, '\\');		strbuf_putc(sb, *s);	}	return strbuf_value(sb);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -