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

📄 glob.c

📁 Linux下的MUD客户端程序
💻 C
字号:
/* Autoconf patching by David Hedbor, neotron@lysator.liu.se *//* * match -- returns 1 if `string' satisfised `regex' and 0 otherwise * stolen from Spencer Sun: only recognizes * and \ as special characters */intmatch(regex, string)char *regex;char *string;{  char *rp = regex, *sp = string, ch, *save, *p;  int found;  while (*rp != '\0')  {    switch(ch = *rp++)    {      case '*':        if ('\0' == *sp)  /* match empty string at end of `string' */	  return ('\0' == *rp);  /* but only if we're done with the pattern */	/* greedy algorithm: save starting location, then find end of string */	save = sp;	sp += strlen(sp);	do	{	  if (match(rp, sp))  /* return success if we can match here */	    return 1;	} while (--sp >= save);  /* otherwise back up and try again */	/*	 * Backed up all the way to starting location (i.e. `*' matches	 * empty string) and we _still_ can't match here.  Give up.	 */	return 0;	/* break; not reached */      case '\\':	if ((ch = *rp++) != '\0')	{	  /* if not end of pattern, match next char explicitly */	  if (ch != *sp++)	    return 0;	  break;	}	/* else FALL THROUGH to match a backslash */      default:	/* normal character */	if (ch != *sp++)	  return 0;	break;    }  }  /*   * OK, we successfully matched the pattern if we got here.  Now return   * a match if we also reached end of string, otherwise failure   */  return ('\0' == *sp);}

⌨️ 快捷键说明

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