Listing 1: Procedure main for latool
/*
* AUTHOR: Charles C. Bundy IV
* VERS : $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <utmp.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include "latool.h"
int main(argc, argv)
int argc;
char *argv[];
{
char line[80], value[80], cmd[80], LogFile[255], *ch;
FILE *fp;
char *RCSID;
int i;
printf("Content-TYPE: text/html\n\n");
fp = fopen("latool.ini", "r");
if (fp == NULL)
strcpy(LogFile,"/var/adm/wtmp");
else
fscanf(fp,"%s",LogFile);
fclose(fp);
ch = getenv("REQUEST_METHOD");
if (strcmp(ch,"POST"))
fillitForm(LogFile);
else
{
printf("<HTML>\n");
printf("<HEAD>\n");
printf("<TITLE>La Tool Results</TITLE>\n");
printf("</HEAD>\n");
printf("<BODY BACKGROUND=\"%s\">\n\n",BACK_URL);
scanf("%s",line);
ch = (char*) strstr(line,"=");
if (ch != NULL)
{
strcpy(value, ch+1);
i = strlen(value);
#ifdef SUNOS
value[i-1] = value[i];
#endif
printf("<pre>");
check(value, LogFile);
printf("</pre>");
}
printf("</BODY>\n");
printf("</HTML>\n");
}
RCSID = "$Id$";
}
/* End of File */
|