clean.c

来自「Free Chat beta release 2 fot linux,采用C语言」· C语言 代码 · 共 59 行

C
59
字号
/*  clean.c    For Free Chat    By Bill Kendrick  kendrick@zippy.sonoma.edu  http://zippy.sonoma.edu/kendrick/    September 29, 1996 - June 10, 1997*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "clean.h"#include "defines.h"void clean(char * str){  char newstr[STRLEN], temp[10];  int i, l;  int c;    strcpy(newstr, "");    for (i = 0; i < strlen(str); i++)    {      c = str[i];            if ((c < 32 || c > 127) && INTERNATIONAL == NO)	c = ' ';          if (c == '<')	strcat(newstr, "&lt;");      else if (c == '>')	strcat(newstr, "&gt;");      else if (c == '&')	strcat(newstr, "&amp;");      else	{	  sprintf(temp, "%c", c);	  strcat(newstr, temp);	}    }    while (isspace(newstr[0]))    {      strcpy(str, newstr + 1);      strcpy(newstr, str);    }    while (isspace(newstr[strlen(newstr) - 1]))    newstr[strlen(newstr) - 1] = '\0';    strcpy(str, newstr);}

⌨️ 快捷键说明

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