/*** analog 1.9beta ***/ /* Please read Readme.html, or http://www.statslab.cam.ac.uk/~sret1/analog/ */ /*** formgen.c; generate a form for the analog form interface ***/ #include "analhea2.h" void genopts(FILE *outf, char name[17], char plural[16], int sortby, char codeletter) { fprintf(outf, "\n

%s options

\n\n", name); fprintf(outf, "Sort the %s \n\n"); fprintf(outf, "
(*) Include all %s with at least\n", plural); fprintf(outf, " requests\n", codeletter); fprintf(outf, "or the top "); fprintf(outf, " %s.\n", codeletter, plural); fprintf(outf, "
(*) Include all %s with at least\n", plural); fprintf(outf, " bytes\n", codeletter); fprintf(outf, "transferred or the top "); fprintf(outf, " %s.\n", codeletter, plural); } void formgen(void) { extern flag xq, mq, Wq, dq, Dq, hq, oq, Sq, iq, rq, Bq, bq, fq, eq, cq; extern char reportorder[]; extern int domsortby, dirsortby, hostsortby, reqsortby, refsortby; extern int browsortby, fullbrowsortby; extern int dirlevel, reqtype, kq; extern char hostname[], hosturl[], logourl[], commandname[]; extern char outfile[]; extern struct timestruct fromtime, totime; char *ro; FILE *outf; if (STREQ(outfile, "stdout")) outf = stdout; else if ((outf = fopen(outfile, "w")) == NULL) { fprintf(stderr, "%s: Error: failed to open output file %s for writing.\n", commandname, outfile); exit(ERR); /* shouldn't get here because also tested at the beginning */ } fprintf(outf, "\n"); fprintf(outf, "Analog form interface\n"); fprintf(outf, "\n\n"); fprintf(outf, "\n"); if (hosturl[0] == '-') fprintf(outf, "

\"\" Analog form interface for %s

\n", logourl, hostname); else fprintf(outf, "

\"\" Analog form interface for %s

\n", logourl, hosturl, hostname); fprintf(outf, "
\n"); fprintf(outf, "
You can set any options you like below. But they should all be set to\n"); fprintf(outf, "sensible default values, so you can ignore any of them too.\n"); fprintf(outf, "
\n

1. Report choices

\n"); fprintf(outf, "See the analog\n"); fprintf(outf, "home page for the meanings of the various reports.\n\n"); fprintf(outf, "

\n

Which reports do you want to see?

\n"); fprintf(outf, "General statistics?\n", xq?" checked":""); for (ro = reportorder; *ro != '\0'; ro++) { switch(*ro) { case 'b': fprintf(outf, "
Browser summary?\n", bq?" checked":""); break; case 'B': fprintf(outf, "
Browser report?\n", Bq?" checked":""); break; case 'c': fprintf(outf, "
Status code report?\n", cq?" checked":""); break; case 'd': fprintf(outf, "
Daily summary?\n", dq?" checked":""); break; case 'D': fprintf(outf, "
Daily report? (NB: Can be long)\n", Dq?" checked":""); break; case 'e': fprintf(outf, "
Error report?\n", eq?" checked":""); break; case 'f': fprintf(outf, "
Referer report?\n", fq?" checked":""); break; /* case 'H', hourly report, deliberately omitted */ case 'h': fprintf(outf, "
Hourly summary?\n", hq?" checked":""); break; case 'i': fprintf(outf, "
Directory report?\n", iq?" checked":""); break; case 'm': fprintf(outf, "
Monthly report?\n", mq?" checked":""); break; case 'o': fprintf(outf, "
Domain report?\n", oq?" checked":""); break; case 'r': fprintf(outf, "
Request report?\n", rq?" checked":""); break; case 'S': fprintf(outf, "
Host report? (NB: Can be long)\n", Sq?" checked":""); break; case 'W': fprintf(outf, "
Weekly report?\n", Wq?" checked":""); break; } } fprintf(outf, "

You can now fill in the options below for individual reports.\n"); fprintf(outf, "You can fill in the (+) or (*) in each section according to which sort method you select.\n"); fprintf(outf, "You can use bytes to mean 10 Megabytes etc.\n"); fprintf(outf, "


\n

2. Detailed report options

\n"); for (ro = reportorder; *ro != '\0'; ro++) { switch(*ro) { case 'b': genopts(outf, "Browser summary", "browsers", browsortby, 'b'); break; case 'B': genopts(outf, "Browser report", "browsers", fullbrowsortby, 'B'); break; case 'f': genopts(outf, "Referer report", "referring URLs", refsortby, 'f'); break; case 'i': genopts(outf, "Directory report", "directories", dirsortby, 'i'); fprintf(outf, "
Print directories to depth "); fprintf(outf, "\n", dirlevel); break; case 'o': genopts(outf, "Domain report", "domains", domsortby, 'o'); break; case 'r': genopts(outf, "Request report", "requests", reqsortby, 'r'); fprintf(outf, "
Show\n"); fprintf(outf, "\n; include links to\n"); fprintf(outf, "\n"); break; case 'S': genopts(outf, "Host report", "hosts", hostsortby, 'S'); break; } } fprintf(outf, "
\n\n

3. Analysing only part of the logfile

\n"); fprintf(outf, "Only certain dates\n"); fprintf(outf, "
You can analyse only the requests from certain dates.\n"); fprintf(outf, "Enter the range of dates below in the from yymmdd;\n"); fprintf(outf, "e.g., 950701 for 1st July 1995 (or fill in just one box\n"); fprintf(outf, "to limit the range of dates on just one side)."); fprintf(outf, "
From -INFINITY) fprintf(outf, " value=\"%02d%02d%02d\"", fromtime.year % 100, fromtime.monthno + 1, fromtime.date); fprintf(outf, ">\nto \n\n"); fprintf(outf, "

Only certain files\n"); fprintf(outf, "
Only look at the following files (list, separated by commas; can contain wild character *)\n"); fprintf(outf, "
\n"); fprintf(outf, "
Ignore the following files\n"); fprintf(outf, "
\n"); fprintf(outf, "


4. Layout

\n"); fprintf(outf, "Your organisation's name (for the title of the page)\n"); fprintf(outf, "\n", hostname); fprintf(outf, "

Your organisation's home page (leave blank for none)\n"); fprintf(outf, "
URL: \n", hosturl); fprintf(outf, "


\n", getenv("TZ")!=NULL?getenv("TZ"):""); /* gets it twice, but easy */ fprintf(outf, " "); fprintf(outf, "\n"); fprintf(outf, "
\n"); fprintf(outf, "

\n"); fprintf(outf, "\"HTML\n"); fprintf(outf, "\n"); }