File:
[LON-CAPA] /
capa /
capa51 /
pProj /
capaHTML.c
Revision
1.7:
download - view:
text,
annotated -
select for diffs
Wed Oct 11 18:26:48 2000 UTC (23 years, 11 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_9_X,
version_2_9_99_0,
version_2_9_1,
version_2_9_0,
version_2_8_X,
version_2_8_99_1,
version_2_8_99_0,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_X,
version_2_7_99_1,
version_2_7_99_0,
version_2_7_1,
version_2_7_0,
version_2_6_X,
version_2_6_99_1,
version_2_6_99_0,
version_2_6_3,
version_2_6_2,
version_2_6_1,
version_2_6_0,
version_2_5_X,
version_2_5_99_1,
version_2_5_99_0,
version_2_5_2,
version_2_5_1,
version_2_5_0,
version_2_4_X,
version_2_4_99_0,
version_2_4_2,
version_2_4_1,
version_2_4_0,
version_2_3_X,
version_2_3_99_0,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_X,
version_2_2_99_1,
version_2_2_99_0,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_X,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
version_2_1_99_0,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
version_2_10_0_RC2,
version_2_10_0_RC1,
version_2_10_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
version_1_3_X,
version_1_3_3,
version_1_3_2,
version_1_3_1,
version_1_3_0,
version_1_2_X,
version_1_2_99_1,
version_1_2_99_0,
version_1_2_1,
version_1_2_0,
version_1_1_X,
version_1_1_99_5,
version_1_1_99_4,
version_1_1_99_3,
version_1_1_99_2,
version_1_1_99_1,
version_1_1_99_0,
version_1_1_3,
version_1_1_2,
version_1_1_1,
version_1_1_0,
version_1_0_99_3,
version_1_0_99_2,
version_1_0_99_1,
version_1_0_99,
version_1_0_3,
version_1_0_2,
version_1_0_1,
version_1_0_0,
version_0_99_5,
version_0_99_4,
version_0_99_3,
version_0_99_2,
version_0_99_1,
version_0_99_0,
version_0_6_2,
version_0_6,
version_0_5_1,
version_0_5,
version_0_4,
stable_2002_spring,
stable_2002_july,
stable_2002_april,
stable_2001_fall,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
conference_2003,
bz6209-base,
bz6209,
STABLE,
HEAD,
GCI_3,
GCI_2,
GCI_1,
CAPA_5-1-6,
CAPA_5-1-5,
CAPA_5-1-4_RC1,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
- GPL notice and capa version notice only went out in error documents.
1: /* wrapper for capasbin/html
2: Copyright (C) 1992-2000 Michigan State University
3:
4: The CAPA system is free software; you can redistribute it and/or
5: modify it under the terms of the GNU General Public License as
6: published by the Free Software Foundation; either version 2 of the
7: License, or (at your option) any later version.
8:
9: The CAPA system is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: General Public License for more details.
13:
14: You should have received a copy of the GNU General Public
15: License along with the CAPA system; see the file COPYING. If not,
16: write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: Boston, MA 02111-1307, USA.
18:
19: As a special exception, you have permission to link this program
20: with the TtH/TtM library and distribute executables, as long as you
21: follow the requirements of the GNU GPL in regard to all of the
22: software in the executable aside from TtH/TtM.
23: */
24:
25: /* ||>> ================================================================ <<|| */
26: /* 1 2 3 4 5 6 7 */
27: /* 45678901234567890123456789012345678901234567890123456789012345678901234567 */
28: /* created by Isaac Tsai 1996 */
29: /* ||>> ================================================================ <<|| */
30:
31: #include <signal.h>
32:
33: #include "capaParser.h"
34: #include "capaCommon.h"
35: #include "ranlib.h"
36:
37: #define _MAIN_PROGRAM_
38: #include "capaCGI.h"
39:
40: /* |>> ====================== begin of main() =========================== <<| */
41:
42: int main(int argc, char *argv[])
43: {
44: #ifdef __alpha
45: struct timespec a_ts, b_ts;
46: #endif
47: /*
48: time_t curtime;
49: char *time_str;
50: double tdiff;
51: long sec_diff, nsec_diff;
52: char log_str[FILE_NAME_LENGTH];
53: */
54: #ifdef CGI_DBUG
55: char filename[FILE_NAME_LENGTH];
56: #endif
57: int tmp_int;
58:
59: #ifdef __alpha
60: getclock(TIMEOFDAY, &a_ts);
61: #endif
62: signal(SIGFPE, SIG_IGN);
63: strcpy(g_prog_name,argv[0]);
64: setbuf(stdout,NULL); /* non-buffered STREAM io */
65:
66: #ifdef CGI_DBUG
67: sprintf(filename,"cgi.DBUG");
68: if ((g_cgi=fopen(filename,"a"))==NULL) {
69: fprintf(stdout,"Error : can't open cgi debug\n");
70: fflush(stdout); return 2;
71: }
72: setbuf(g_cgi,NULL); /* non-buffered STREAM io */
73: #endif /* CGI_DBUG */
74:
75: fprintf(stdout,"Content-type: text/html%c%c",LF,LF);
76: /* fprintf(stdout,"<HTML><HEAD>\n");
77: fprintf(stdout,"<BODY BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#EE1100\">\n");
78: fflush(stdout);
79: */
80:
81: /* HTML header can not be shown until input has been parsed, so that I can
82: be in the class directory */
83: tmp_int = w_get_input();
84: web_printheader(stdout);
85: #ifdef CAPA_WEB
86: fprintf(stdout,"<!-- capasbin, CAPA Version %s, %s -->\n",
87: CAPA_VER,COMPILE_DATE);
88: #else
89: fprintf(stdout,"<!-- capahtml, CAPA Version %s, %s -->\n",
90: CAPA_VER,COMPILE_DATE);
91: #endif
92: fprintf(stdout,"<!-- CAPA is released under the GNU GPL v2 see COPYING for details. -->\n");
93: if ((tmp_int!=0) && (!((tmp_int == 32)||(tmp_int == 64)||(tmp_int == (32|64))))) {
94: /* <== let's get rid of errcode 32 and 64, */
95: /* REMOTE_HOST */
96: fprintf(stdout,"<!-- w_get_input returned error code %d. -->\n",tmp_int);
97: fprintf(stdout,"<!-- getinput error -->\n"); fflush(stdout);
98: fprintf(stdout,"</BODY></HTML>\n");
99: #ifdef CGI_DBUG
100: fprintf(g_cgi,"w_get_input(): error\n"); fflush(g_cgi);
101: #endif /* CGI_DBUG */
102: web_printfooter(stdout);
103: return (1);
104: } else {
105: #ifdef CGI_DBUG
106: fprintf(g_cgi,"w_get_input(): %d error, run_mode=%d\n",tmp_int,
107: g_run_mode); fflush(g_cgi);
108: #endif /* CGI_DBUG */
109: switch( g_run_mode ) {
110: case 0: break;
111: case M_CHECKIN: print_mainmenu(g_class_name, g_student_number, g_entered_pin); break;
112: case M_TRYSET: process_mode(TRY_SET_MODE); break;
113: case M_VIEWPREV: process_mode(VIEW_PREVIOUS_MODE); break;
114: case M_VIEWSUMM: print_summary(g_cpath,g_class_name,g_student_number, g_entered_pin, g_login_set);
115: break;
116: case M_EXAMSUMM:
117: case M_QUIZSUMM: process_summary(g_run_mode); break;
118: #ifdef CAPA_WEB
119: case M_CHECKANS: process_mode(CHECK_ANSWER_MODE); break;
120: #endif
121: case M_TERMSCORE: print_termscore_page(g_cpath,g_class_name,g_student_number, g_entered_pin, g_login_set,stdout);
122: break;
123: default: break;
124: }
125: web_printfooter(stdout);
126: }
127:
128: /* fprintf(stdout,"</BODY></HTML>\n"); fflush(stdout);*/
129:
130: #ifdef CGI_DBUG
131: fflush(g_cgi); fclose(g_cgi);
132: #endif /* CGI_DBUG */
133:
134: /*
135: getclock(TIMEOFDAY, &b_ts);
136: sec_diff = b_ts.tv_sec - a_ts.tv_sec;
137: nsec_diff = b_ts.tv_nsec - a_ts.tv_nsec;
138: tdiff = (double)1000000000.0 * sec_diff + (double)nsec_diff;
139: sprintf(log_str,"%s %s %lg",getenv("REMOTE_HOST"),getenv("HTTP_USER_AGENT"),tdiff);
140: w_log_timing(g_student_number,g_login_set,g_student_data.s_sec,log_str);
141: */
142: return (0);
143: }
144:
145:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>