tools.c
来自「台湾大学的一个mgcp 协议的实现源码,对研究mgcp协议很有帮助!」· C语言 代码 · 共 35 行
C
35 行
/*
* Copyright (C) 1999-2000 Computer & Communications Research Laboratories,
* Industrial Technology Research Institute
*/
/*
* tools.c
*/
#include <string.h>
#include <stdlib.h>
/* copy string s, mapping to uppercase */
char* copyUp(char* s)
{
char* copy;
char* c;
if( s==NULL ) return NULL;
copy = malloc(strlen(s)+1);
c = copy;
while( ((*c++)=toupper(*s++)) != 0 );
return copy;
}
/* return true if pattern appears in s */
/* ??? check and see if strstr is reasonably efficient
* probably will be replaced by simple data structure
*/
int contains(char*s, char*pattern)
{
return s!=NULL && strstr(s,pattern) != NULL;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?