📄 leave.c
字号:
/*
leave.c
For Free Chat
By Bill Kendrick, ported to NT by Patrick Stepp
kendrick@zippy.sonoma.edu, stepp@adelphia.net
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("C:/chat/who.dat", "r");
if (fi == NULL)
{
printf("System is down!\n");
exit(0);
}
fo = myopen("C:/chat/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("C:/chat/who.dat", "C:/chat/who.tmp");
/* Dump "thanks" page: */
dump("C:/chat/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -