leave.c

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

C
98
字号
/*  leave.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 "cgi-util.h"#include "dump.h"#include "readline.h"#include "copyback.h"#include "defines.h"#include "whattime.h"#include "myopen.h"int main(int argc, char * argv[]){  FILE * fi, * fo;  char temp[STRLEN], name[STRLEN], xname[STRLEN], xemail[STRLEN],    xstarttime[STRLEN], xtime[STRLEN], time[STRLEN];      /* Initialize CGI Interface: */    cgiinit();  printf("Content-type: text/html\n\n");  getentry(name, "name");    whattime(time);      /* Remove them from the who's here list: */    fi = myopen("who.dat", "r");  if (fi == NULL)    {      printf("System is down!\n");      exit(0);    }    fo = myopen("who.tmp", "w");  if (fo == NULL)    {      printf("System is down!\n");      exit(0);    }    do    {      readline(fi, xname);      if (!feof(fi))	{	  readline(fi, xemail);	  readline(fi, xstarttime);	  readline(fi, xtime);	  readline(fi, temp);	  	  if (strcmp(name, xname) != 0)	    {	      fprintf(fo, "%s\n", xname);	      fprintf(fo, "%s\n", xemail);	      fprintf(fo, "%s\n", xstarttime);	      fprintf(fo, "%s\n", xtime);	      fprintf(fo, "\n");	    }	}    }  while (!feof(fi));    fclose(fo);  fclose(fi);    copyback("who.dat", "who.tmp");    /* Dump "thanks" page: */    dump("included/leave.html");      /* Let people know the person left: */    sprintf(temp, "%s has left.", name);  chatwrite(time, "LEAVE", temp);    exit(0);}

⌨️ 快捷键说明

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