Rev 15829 | Rev 16711 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 10 | reyssat | 1 | /* Copyright (C) 1998-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis |
| 2 | * |
||
| 3 | * This program is free software; you can redistribute it and/or modify |
||
| 4 | * it under the terms of the GNU General Public License as published by |
||
| 5 | * the Free Software Foundation; either version 2 of the License, or |
||
| 6 | * (at your option) any later version. |
||
| 7 | * |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 11 | * GNU General Public License for more details. |
||
| 12 | * |
||
| 13 | * You should have received a copy of the GNU General Public License |
||
| 14 | * along with this program; if not, write to the Free Software |
||
| 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||
| 16 | */ |
||
| 17 | |||
| 18 | /* WWW multipurpose server, header definitions */ |
||
| 19 | |||
| 8185 | bpr | 20 | #include "Lib/libwims.h" |
| 10 | reyssat | 21 | #include "config.h" |
| 22 | #include "includes.h" |
||
| 23 | #include "wimsdef.h" |
||
| 24 | |||
| 8185 | bpr | 25 | #define evalue strevalue |
| 26 | |||
| 27 | /* limit of query_string. */ |
||
| 10 | reyssat | 28 | #define QUERY_STRING_LIMIT 204799 |
| 8185 | bpr | 29 | /* maximal length of deposited file */ |
| 10 | reyssat | 30 | #define MAX_DEPOSITLEN (8*1024*1024) |
| 8185 | bpr | 31 | /* maximal number of registered variables */ |
| 10 | reyssat | 32 | #define MAX_VAR_NUM 512 |
| 8185 | bpr | 33 | /* length limit for public_html/bin executable names */ |
| 10 | reyssat | 34 | #define MAX_EXEC_NAME 31 |
| 8185 | bpr | 35 | /* max level of nested fors */ |
| 8303 | bpr | 36 | #define MAX_FOR_LEVEL 12 |
| 8185 | bpr | 37 | /* max nested read; to avoid infinite loop */ |
| 10 | reyssat | 38 | #define MAX_READNEST 20 |
| 8185 | bpr | 39 | /* number of cached working files */ |
| 10 | reyssat | 40 | #define MAX_MCACHE 32 |
| 8185 | bpr | 41 | /* max sort items. */ |
| 10 | reyssat | 42 | #define MAX_SORT_ITEM 5000 |
| 8185 | bpr | 43 | /* max randperm() items. Should be compatible to MAX_LINELEN. */ |
| 10 | reyssat | 44 | #define MAX_RANDPERM 2000 |
| 8185 | bpr | 45 | /* Number of session random numbers */ |
| 10 | reyssat | 46 | #define MAX_SESRANDOM 64 |
| 8286 | bpr | 47 | /* Limit of output length. This can be configured. */ |
| 15829 | bpr | 48 | #define OUTPUT_LENGTH_LIMIT (1024*1024*8) |
| 8286 | bpr | 49 | /* limit of items in value lists */ |
| 10 | reyssat | 50 | #define MAX_VALUE_LIST 2048 |
| 8284 | bpr | 51 | /* We fix a limit for the number of goto's (or for jumps) executed, |
| 52 | * in order to avoid infinite loop or DOS attack. |
||
| 53 | */ |
||
| 54 | #define GOTO_LIMIT 500000 |
||
| 55 | /* maximal nesting level of substitutions. */ |
||
| 56 | #define SUBST_LIMIT 16 |
||
| 57 | /* Limit for instex, insplot, insPLOT. */ |
||
| 58 | #define INS_LIMIT 500 |
||
| 8185 | bpr | 59 | /* file to hold last output */ |
| 60 | #define lastout "last.html" |
||
| 61 | /* Access policy configuration file */ |
||
| 10 | reyssat | 62 | #define ACCESS_CONF "../log/wims.conf.access" |
| 8185 | bpr | 63 | /* Should not be changed */ |
| 10 | reyssat | 64 | #define SESSION_BASE "sessions" |
| 65 | #define S2_BASE "s2" |
||
| 66 | |||
| 8185 | bpr | 67 | /* Prefix char for exec functions */ |
| 10 | reyssat | 68 | #define exec_prefix_char '!' |
| 8185 | bpr | 69 | /* Prefix char for calc functions */ |
| 10 | reyssat | 70 | #define calc_prefix_char '!' |
| 8185 | bpr | 71 | /* Prefix char for goto labels */ |
| 10 | reyssat | 72 | #define label_prefix_char ':' |
| 8185 | bpr | 73 | /* Prefix for tags in data files */ |
| 10 | reyssat | 74 | #define tag_prefix_char ':' |
| 8185 | bpr | 75 | /* Prefix char for comment lines */ |
| 10 | reyssat | 76 | #define comment_prefix_char '#' |
| 8185 | bpr | 77 | /* prefix to user variable names */ |
| 78 | #define var_prefix "w_" |
||
| 79 | /* (user) prefix for mathematical fonts */ |
||
| 80 | #define mathfont_prefix "m_" |
||
| 81 | /* prefix for internal variables */ |
||
| 10 | reyssat | 82 | #define wims_prefix "wims_" |
| 83 | #define wpflen strlen(wims_prefix) |
||
| 8185 | bpr | 84 | /* name of variable definition file */ |
| 10 | reyssat | 85 | #define default_var_def "var.def" |
| 8185 | bpr | 86 | /* Not configured */ |
| 10 | reyssat | 87 | #define error_data_string "wims_error_data" |
| 8185 | bpr | 88 | /* Name of files containing error messages. */ |
| 10 | reyssat | 89 | #define user_error_msg_file "msg/user_error.phtml" |
| 90 | #define module_error_msg_file "msg/module_error.msg" |
||
| 8185 | bpr | 91 | /* directory containing log files */ |
| 10 | reyssat | 92 | #define log_dir "../log" |
| 93 | #define class_base "../log/classes" |
||
| 8185 | bpr | 94 | /* What should indicate that a file name given by the user |
| 95 | * would allow him to go upstairs in the directory tree? |
||
| 96 | * We shouldn't use "../", otherwise the user may just specify |
||
| 97 | * ".." as name and go upstairs one step. |
||
| 98 | */ |
||
| 10 | reyssat | 99 | #define parent_dir_string ".." |
| 8185 | bpr | 100 | /* This one is stronger. */ |
| 10 | reyssat | 101 | #define PARENT_DIR_STRING "/../" |
| 8185 | bpr | 102 | /* kernel daemon socket file. Should match that of wimslogd. */ |
| 10 | reyssat | 103 | #define ksockfile "../tmp/log/.wimslogd" |
| 8185 | bpr | 104 | /* this directory should not exist. Do not change the definition! */ |
| 10 | reyssat | 105 | #define sysmask_trigger_dir "sysmask/stat/trigger" |
| 106 | |||
| 107 | typedef struct { |
||
| 108 | int lineno; /* line number */ |
||
| 8185 | bpr | 109 | /* long fpt; */ /* position in the file */ |
| 10 | reyssat | 110 | char varname[MAX_NAMELEN+1]; |
| 8185 | bpr | 111 | double varval, varend, step; |
| 10 | reyssat | 112 | char *list_pt, *bufpt; |
| 8185 | bpr | 113 | int from; /* from ... to ... if 0, list if 1 */ |
| 10 | reyssat | 114 | } FOR_STACK; |
| 115 | |||
| 116 | typedef struct { |
||
| 117 | char *address; |
||
| 118 | short int execcode, varcode; |
||
| 119 | int isstart; /* bit 0: start line; bit 1: exec; bit 2: label. bit 3: hard comment. bit 4: soft comment */ |
||
| 120 | unsigned int llen; |
||
| 121 | } LINE_STRUCT; |
||
| 122 | |||
| 123 | typedef struct { |
||
| 124 | char name[MAX_FNAME+1]; |
||
| 125 | int l; |
||
| 126 | int linepointer; |
||
| 10051 | bpr | 127 | char filepath[MAX_FNAME+1]; |
| 8185 | bpr | 128 | /* nocache bits: 0. !nocache; 1. hard nocache; 2. isfromcache; 3. isbase; */ |
| 10 | reyssat | 129 | short int for_idx, nocache; |
| 130 | int linecnt; |
||
| 131 | char *textbuf; |
||
| 132 | LINE_STRUCT *lines; |
||
| 133 | FOR_STACK *for_stack; |
||
| 134 | } WORKING_FILE; |
||
| 135 | |||
| 8185 | bpr | 136 | /* from auth.c */ |
| 137 | extern char loadavg[64]; |
||
| 138 | void check_load(int th); |
||
| 139 | void auth(void); |
||
| 140 | void checkrafale(void); |
||
| 141 | void access_check(int isclass); |
||
| 10 | reyssat | 142 | |
| 8185 | bpr | 143 | /* from calc.c */ |
| 144 | void calc_tolower(char *p); |
||
| 145 | void calc_toupper(char *p); |
||
| 146 | void calc_lookup(char *p); |
||
| 147 | void calc_randitem(char *p); |
||
| 148 | void calc_mexec(char *p); |
||
| 149 | void _calc_exec(char *p, char *arg0, char *arg1, int n); |
||
| 150 | void calc_detag(char *p); |
||
| 13757 | bpr | 151 | void calc_html2iso(char *p); |
| 8185 | bpr | 152 | typedef struct MYFUNCTION { |
| 153 | char *name; |
||
| 154 | int tag; |
||
| 155 | void (*routine) (char *p); |
||
| 156 | } MYFUNCTION; |
||
| 157 | |||
| 158 | extern MYFUNCTION calc_routine[]; |
||
| 159 | extern int CALC_FN_NO; |
||
| 160 | |||
| 161 | void calc_append(char *p); |
||
| 162 | void calc_charof(char *p); |
||
| 15588 | bpr | 163 | void calc_checkallpar(char *p); |
| 8185 | bpr | 164 | void calc_checkhost(char *p); |
| 165 | void calc_columnof(char *p); |
||
| 166 | void calc_daemon(char *p); |
||
| 167 | void calc_date(char *p); |
||
| 168 | void calc_debug(char *p); |
||
| 169 | void calc_declosing(char *p); |
||
| 170 | void calc_defof(char *p); |
||
| 171 | void calc_embraced(char *p); |
||
| 172 | void calc_evalsubst(char *p); |
||
| 173 | void calc_exec(char *p); |
||
| 12047 | bpr | 174 | void calc_fileexists(char *p); |
| 8185 | bpr | 175 | void calc_hex(char *p); |
| 176 | void calc_imgrename(char *p); |
||
| 177 | void calc_itemof(char *p); |
||
| 178 | void calc_leveldata(char *p); |
||
| 179 | void calc_lineof(char *p); |
||
| 180 | void calc_listfile(char *p); |
||
| 181 | void calc_listintersect(char *p); |
||
| 182 | void calc_listunion(char *p); |
||
| 183 | void calc_listuniq(char *p); |
||
| 184 | void calc_mailurl(char *p); |
||
| 185 | void calc_makelist(char *p); |
||
| 186 | void calc_mathsubst(char *p); |
||
| 187 | void calc_module(char *p); |
||
| 188 | void calc_nonempty(char *p); |
||
| 189 | void calc_pos(char *p); |
||
| 190 | void calc_product(char *p); |
||
| 191 | void calc_recordof(char *p); |
||
| 192 | void calc_recursion(char *p); |
||
| 193 | void calc_reinput(char *p); |
||
| 194 | void calc_replace(char *p); |
||
| 195 | void calc_rowof(char *p); |
||
| 196 | void calc_rows2lines(char *p); |
||
| 197 | void calc_select(char *p); |
||
| 198 | void calc_solve(char *p); |
||
| 199 | void calc_sort(char *p); |
||
| 200 | void calc_sum(char *p); |
||
| 201 | void calc_translate(char *p); |
||
| 202 | void calc_trim(char *p); |
||
| 203 | void calc_wordof(char *p); |
||
| 204 | void calc_values(char *p); |
||
| 205 | |||
| 206 | /* from config.c */ |
||
| 10 | reyssat | 207 | void setsesdir(char *p); |
| 8185 | bpr | 208 | extern int threshold2, threshold1, rafalvl, modlog; |
| 209 | extern char session_dir[MAX_FNAME+1], s2_dir[MAX_FNAME+1]; |
||
| 210 | extern char temp_log[MAX_FNAME+1]; /* temp log file name */ |
||
| 211 | extern char *cgi_name; |
||
| 212 | extern int idle_time, idle_time2, idle_time3, OLD_LOG_FILES, GEN_LOG_LIMIT, MODULE_LOG_LIMIT; |
||
| 15509 | bpr | 213 | extern int LOG_DELETE; |
| 8185 | bpr | 214 | extern int backup_hour, site_accounting, examlog_limit; |
| 8284 | bpr | 215 | extern int ANIM_LIMIT; |
| 8185 | bpr | 216 | extern char *header_menu, *insplot_processor; |
| 217 | extern char *home_referer, *home_referer_user, *header_menu_supervisor, |
||
| 218 | *header_menu_user, *home_referer_supervisor, *title_page, *html_file; |
||
| 219 | extern char *aliased_cgi, *insdraw_processor, *mail_opt; |
||
| 8490 | bpr | 220 | extern int mathalign_base; |
| 8185 | bpr | 221 | unsigned long create_job_ident(void); |
| 222 | void module_index(void); |
||
| 223 | extern char *module_about_file, *main_var_proc_file, *var_init_file, *special_font; |
||
| 224 | extern char var_def_file[256], *var_def_buf; |
||
| 225 | void define_html_header(void); |
||
| 226 | extern char *usecookie, *bgcolor; |
||
| 227 | extern int spec_font; |
||
| 228 | extern char *config_file; /* Main configure file, this name cannot be configured! */ |
||
| 229 | extern char *intro_file; /* Introduction page name */ |
||
| 230 | extern char *ref_file; /* Reference page */ |
||
| 231 | typedef struct CONFIG_DATA { char *name; int is_integer; void *address; } CONFIG_DATA; |
||
| 232 | extern CONFIG_DATA main_config[]; |
||
| 233 | extern int MAIN_CONFIG_NO; |
||
| 234 | extern char *modindex[]; |
||
| 235 | extern int MODINDEX_NO; |
||
| 236 | void main_configure(void); |
||
| 237 | void set_rlimits(void); |
||
| 238 | void module_configure(void); |
||
| 239 | void set_job_ident(void); |
||
| 10 | reyssat | 240 | |
| 8185 | bpr | 241 | /* from compare.c */ |
| 242 | int compare(char *p, int numeric, int lvl); |
||
| 8880 | bpr | 243 | char *bufprep(char *p); |
| 10 | reyssat | 244 | |
| 15542 | bpr | 245 | /* from evalue.c and Lib/evalue.c */ |
| 10 | reyssat | 246 | double evalue(char *p); |
| 247 | char *substit(char *p); |
||
| 8185 | bpr | 248 | enum {for_in, for_from}; |
| 249 | struct forstruct { |
||
| 250 | char var[MAX_NAMELEN+1]; |
||
| 251 | int type; |
||
| 252 | double list[MAX_VALUE_LIST]; |
||
| 253 | char *pos[MAX_VALUE_LIST]; |
||
| 254 | double from, to, step; |
||
| 14873 | georgesk | 255 | }; |
| 256 | extern struct forstruct forstruct; |
||
| 257 | |||
| 8185 | bpr | 258 | int cutfor(char *p, char *bufp); |
| 259 | void float2str(double d, char *p); |
||
| 10 | reyssat | 260 | |
| 8185 | bpr | 261 | /* from exam.c */ |
| 262 | void calc_examdep(char *p); |
||
| 263 | double currexamscore(int sh); |
||
| 264 | void check_exam(void); |
||
| 10 | reyssat | 265 | |
| 8185 | bpr | 266 | /* from exec.c */ |
| 267 | void exec_main(char *p); |
||
| 268 | void exec_set(char *name); |
||
| 12011 | bpr | 269 | void exec_setseed(char *p); |
| 8185 | bpr | 270 | extern MYFUNCTION exec_routine[]; |
| 271 | extern int EXEC_FN_NO; |
||
| 272 | extern struct distr_cmd { char *name; int (*routine) (char *p, char *list[], int max); |
||
| 273 | } distr_cmd[]; |
||
| 274 | extern int distr_cmd_no; |
||
| 275 | void exec_tail(char *p); |
||
| 8216 | bpr | 276 | void exec_read(char *p); |
| 8185 | bpr | 277 | |
| 278 | /* from files.c */ |
||
| 279 | void secure_exec(void); |
||
| 280 | void fileappend(char *p); |
||
| 281 | void filewrite(char *p); |
||
| 282 | |||
| 283 | /* from html.c */ |
||
| 284 | void exec_formbar(char *p); |
||
| 285 | void exec_formbar(char *p); |
||
| 286 | void exec_formcheckbox(char *p); |
||
| 287 | void exec_formradio(char *p); |
||
| 288 | void exec_formselect(char *p); |
||
| 289 | |||
| 290 | /* from insmmath.c */ |
||
| 291 | void insmath(char *p); |
||
| 292 | int instex_ready(char *p, char *n); |
||
| 293 | char *instex_check_static(char *p); |
||
| 294 | void calc_instexst(char *p); |
||
| 295 | |||
| 296 | /* from lines.c */ |
||
| 297 | void accessfile(char *content, char *type, char *s,...); |
||
| 298 | int checkhostt(char bf2[]); |
||
| 299 | extern int untrust; |
||
| 300 | void module_error(char msg[]); |
||
| 301 | int trusted_module(void); |
||
| 302 | int checkhost(char *hlist); |
||
| 303 | void _getdef(char buf[], char *name, char value[]); |
||
| 304 | void getdef(char *fname, char *name, char value[]); |
||
| 305 | void _daemoncmd(char *p); |
||
| 306 | int datafile_check(char *name); |
||
| 307 | extern int is_class_module; |
||
| 308 | int find_module_file(char *fname, char buf[], int mode); |
||
| 309 | int call_ssh(char *s,...); |
||
| 310 | int _http2env(char outs[], char ins[]); |
||
| 311 | void slashsubst(char *p); |
||
| 312 | void internal_error(char msg[]); |
||
| 313 | char *readfile(char *fname, char buf[], long int buflen); /* mathfonts.c */ |
||
| 314 | int call_sh(char *s,...); |
||
| 315 | unsigned int datafile_recordnum(char *p); |
||
| 316 | char *datafile_fnd_record(char *p, int n, char bf[]); |
||
| 317 | int execredirected(char *cmdf, char *inf, char *outf, char *errf, char *arg[]); |
||
| 318 | char *mkfname(char buf[], char *s,...); |
||
| 319 | extern char *trusted_modules; |
||
| 320 | enum{is_file, is_dir, is_exec, is_fifo, is_socket, is_unknown}; |
||
| 321 | extern struct mxtab { |
||
| 322 | char cmd[MAX_EXEC_NAME+1]; |
||
| 323 | unsigned int fd1, fd2; |
||
| 324 | int pipe_stdin[2], pipe_stdout[2], pipe_stderr[2]; |
||
| 325 | } mxtab[MAX_MULTIEXEC]; |
||
| 326 | int ftest(char *fname); |
||
| 327 | int multiexec(char *cmd, char **abuf); |
||
| 328 | int wgetline(char buf[], size_t buflen, WORKING_FILE *f); |
||
| 329 | int open_working_file(WORKING_FILE *f, char *fname); |
||
| 330 | void close_working_file(WORKING_FILE *f, int cache); |
||
| 331 | void read_tmp_file(char *p, const char *fname); |
||
| 332 | void initalarm(void); |
||
| 333 | extern int var_noexport; /* do not export variable */ |
||
| 14873 | georgesk | 334 | |
| 335 | enum Name_Modes {mode_default, mode_popup, mode_raw}; |
||
| 336 | extern enum Name_Modes NAME_MODES; |
||
| 337 | |||
| 8185 | bpr | 338 | extern char *manager_site; |
| 339 | void flushoutput(void); |
||
| 340 | extern char pidbuf[32]; |
||
| 341 | extern char lastdatafile[MAX_FNAME+1]; |
||
| 342 | extern char lastftest[MAX_FNAME+1]; |
||
| 343 | int kerneld(char *p, int bufsize); |
||
| 344 | void _setdef(char buf[], char *name, char *value); |
||
| 345 | void output0(char buf[]); |
||
| 346 | void nph_header(int code); |
||
| 347 | void delete_pid(void); |
||
| 348 | void setdef(char *fname, char *name); |
||
| 349 | void instex_flush(void); |
||
| 14873 | georgesk | 350 | extern char *DEFAULT_INS_FORMAT; |
| 8185 | bpr | 351 | void tex_nospace(char *p); |
| 352 | int get_cached_file(char *name); |
||
| 353 | extern off_t ftest_size; |
||
| 354 | void putlastout(void); |
||
| 355 | void bad_ident(void); |
||
| 356 | void create_pid(void); |
||
| 357 | extern struct sockaddr_un sun; |
||
| 358 | extern char *lastdata; |
||
| 359 | extern char *outptr; |
||
| 360 | extern char outbuf[8192]; |
||
| 361 | extern int http2env(char outs[], char ins[]); |
||
| 362 | |||
| 363 | /* from log.c */ |
||
| 10 | reyssat | 364 | void user_log(char *p); |
| 365 | void write_logs(void); |
||
| 366 | void mail_log(char *p); |
||
| 367 | void flushlog(void); |
||
| 8185 | bpr | 368 | void post_log(void); |
| 369 | void checklogd(void); |
||
| 10 | reyssat | 370 | |
| 8185 | bpr | 371 | /* from mathfonts.c */ |
| 10 | reyssat | 372 | void fix_tex_size(void); |
| 8185 | bpr | 373 | extern int current_tex_size, texbasesize; |
| 374 | void _output_(char *s); |
||
| 375 | void output(char *s,...); |
||
| 376 | char *mathfont(char *fontname); |
||
| 377 | extern int usertexsize; |
||
| 10 | reyssat | 378 | |
| 8185 | bpr | 379 | /* from mathml.c */ |
| 380 | int mathml(char *p, int option); |
||
| 10 | reyssat | 381 | |
| 8185 | bpr | 382 | /* from matrix.c */ |
| 383 | void rawmatrix(char *p); |
||
| 384 | |||
| 385 | /* from pedia.c */ |
||
| 386 | void pedia(char *p); |
||
| 387 | |||
| 388 | /* from rawmath.c */ |
||
| 389 | void htmlmath(char *p); |
||
| 390 | void mathmlmath(char *p); |
||
| 391 | void tohttpquery(char *p); |
||
| 392 | void rawmath(char *p); |
||
| 393 | void texmath(char *p); |
||
| 394 | extern int rawmath_easy; |
||
| 395 | extern struct mathname { char *name; int style; char *replace; } mathname[]; |
||
| 396 | extern int mathname_no; |
||
| 397 | |||
| 398 | /* from hmname.c */ |
||
| 399 | extern struct hmname { char *name; char *replace; char *replacem;} hmname[]; |
||
| 400 | extern int hmname_no; |
||
| 401 | |||
| 402 | /* from score.c */ |
||
| 403 | void calc_getscorelast(char *p); |
||
| 404 | void calc_getscore(char *p); |
||
| 405 | void calc_getscoremean(char *p); |
||
| 406 | void calc_getscoreremain(char *p); |
||
| 407 | void calc_getscorerequire(char *p); |
||
| 408 | void calc_getscoreweight(char *p); |
||
| 409 | void calc_getscorelast(char *p); |
||
| 410 | void calc_getscoretry(char *p); |
||
| 12197 | bpr | 411 | void calc_getscorealltries(char *p); |
| 12213 | bpr | 412 | void calc_getscoremaxexotry(char *p); |
| 8185 | bpr | 413 | void calc_getscorebest(char *p); |
| 414 | void calc_getscorelevel(char *p); |
||
| 415 | void calc_getscorepercent(char *p); |
||
| 416 | void calc_getscorestatus(char *p); |
||
| 417 | void calc_examscore(char *p); |
||
| 12273 | bpr | 418 | void calc_getseedlast(char *p); |
| 419 | void calc_getseedscorelast(char *p); |
||
| 12295 | bpr | 420 | void calc_getseedlastcnt(char *p); |
| 12273 | bpr | 421 | void calc_getseedscores(char *p); |
| 8185 | bpr | 422 | void exam_currscore(int esh); |
| 16696 | bpr | 423 | extern double exam_scoredata[MAX_EXAMS]; |
| 8185 | bpr | 424 | int exam_depcheck(char *deps, int exam); |
| 425 | int getscorestatus(char *classe, int sheet); |
||
| 426 | int depcheck(char *sh, int exo, char *deps); |
||
| 12213 | bpr | 427 | int gettrycheck (char *class, char *user, int sh, int ex); |
| 12273 | bpr | 428 | char* getseedscore (char *class, char *user, int sh, int ex); |
| 8185 | bpr | 429 | extern char rscore_class[MAX_CLASSLEN+1]; |
| 430 | extern char rscore_user[MAX_NAMELEN+1]; |
||
| 431 | |||
| 432 | /* from test.c */ |
||
| 10 | reyssat | 433 | void exec_test(char *p); |
| 434 | |||
| 8185 | bpr | 435 | /* from texmath.c */ |
| 436 | void _replace_matrix ( char *p , char *s_mat1, char *s_mat2); |
||
| 437 | extern struct tmathfn { |
||
| 438 | char *name; int expind; char *left, *right; void (*routine) (char *p); |
||
| 439 | } tmathfn[]; |
||
| 440 | extern int tmathfn_no; |
||
| 441 | extern struct tmathvar { char *name, *tex; } tmathvar[]; |
||
| 442 | extern int tmathvar_no; |
||
| 443 | |||
| 444 | /* from var.c */ |
||
| 10 | reyssat | 445 | int force_setvar(char *vname,char *vvalue); |
| 8185 | bpr | 446 | char *getvar(char *name); |
| 447 | int setvar(char *vname, char *vval); |
||
| 448 | void debug_output(void); |
||
| 449 | void exportall(void); |
||
| 450 | void unsetvar(char *vname); |
||
| 451 | void get_var_privileges(void); |
||
| 452 | char *_getvar(char *vname); |
||
| 453 | int varsuite(char *stem, int beg, int end, char *pbuf[], int pbuflen); |
||
| 454 | void lessrafale(void); |
||
| 455 | extern char *exportvars[]; /* wims_ variables that should be exported */ |
||
| 456 | extern int exportvarcnt; |
||
| 10 | reyssat | 457 | |
| 8185 | bpr | 458 | /* from variables.c */ |
| 10 | reyssat | 459 | int var_def_check(char *name); |
| 8185 | bpr | 460 | void var_proc(char *fname,int cache); |
| 461 | void phtml_put(char *fname,int cache); |
||
| 462 | void phtml_put_base(char *fname,int cache); |
||
| 463 | void set_module_prefix(void); |
||
| 464 | extern int ispriority; |
||
| 465 | extern char *sed_prog, *tr_prog, *tex2gif; |
||
| 466 | void get_static_session_var(void); |
||
| 467 | void parse_ro_names(void); |
||
| 468 | int var_def_name(char *n, int v); |
||
| 469 | void set_init_parm(void); |
||
| 470 | int session_exists(char *s); |
||
| 471 | int set_session_prefix(void); |
||
| 472 | int check_session(void); |
||
| 473 | void trap_check(char *s); |
||
| 474 | void set_protocol(void); |
||
| 475 | void main_phtml_put(char *mname); |
||
| 476 | void var_init(void); /* initialisation */ |
||
| 477 | void set_variables(void); |
||
| 478 | void save_session_vars(void); |
||
| 12011 | bpr | 479 | void seed_time(void); |
| 10 | reyssat | 480 | |
| 8185 | bpr | 481 | /* from wims.c */ |
| 482 | void user_error(char msg[]); |
||
| 483 | extern int robot_access, wrapexec, good_httpd, multiexec_index, outputing; |
||
| 484 | extern int rlimit_cpu, new_session, hostcquota, manageable, cmd_type, exec_is_module; |
||
| 485 | extern int available_lang_no, WORKFILE_LIMIT, isclassmodule, mode, module_defined; |
||
| 486 | extern char session_prefix[], s2_prefix[]; |
||
| 487 | extern char lang[16]; |
||
| 488 | extern char *remote_addr; |
||
| 489 | extern time_t nowtime, limtime, limtimex; |
||
| 490 | extern char *ro_name[]; |
||
| 491 | extern char *mathalign_sup1, *mathalign_sup2; /* see mathalign_base */ |
||
| 492 | extern char *module_dir; |
||
| 493 | extern char tmplbuf[MAX_LINELEN+1]; /* for temporary uses not thru subroutines. */ |
||
| 494 | extern char cwdbuf[MAX_FNAME+1]; /* store current working directory */ |
||
| 495 | extern char ins_alt[MAX_LINELEN+1]; /* dynamic insertion alternative text */ |
||
| 496 | extern char *bin_dir; /* directory containing executable scripts and programs. */ |
||
| 15573 | bpr | 497 | extern char *tmp_debug, *tmp_debug_var, *tmp_debug_use_var; |
| 8185 | bpr | 498 | extern char *instex_style; |
| 499 | extern char session_prefix[MAX_FNAME+1], s2_prefix[MAX_FNAME+1], module_prefix[MAX_FNAME+1]; |
||
| 500 | extern char multiexec_random[64]; |
||
| 501 | extern char class_dir[MAX_FNAME+1]; /* directory name of this class */ |
||
| 502 | extern char *devel_modules, *robot_session; |
||
| 503 | extern int manager_https, confset, rlimit_fsize, rlimit_as, rlimit_data, rlimit_stack, rlimit_core; |
||
| 504 | extern int rlimit_rss, rlimit_nproc, rlimit_nofile, rlimit_memlock; |
||
| 505 | extern int sesrandomtab[MAX_SESRANDOM]; /* session random values */ |
||
| 506 | extern char job_identifier[32]; |
||
| 507 | extern int print_precision, substnest, getvar_len; |
||
| 508 | extern char pre_language[4]; |
||
| 10051 | bpr | 509 | extern FILE * trace_file; |
| 11104 | bpr | 510 | extern int trace_indent; |
| 12011 | bpr | 511 | /* the following list must be in the same order as *ro_name in wims.c */ |
| 14873 | georgesk | 512 | enum Ro_Names{ |
| 8185 | bpr | 513 | ro_cmd, ro_empty, ro_lang, ro_module, ro_session, ro_special_parm, |
| 12273 | bpr | 514 | ro_special_parm2, ro_special_parm3, ro_special_parm4, ro_useropts, ro_wsession, |
| 515 | ro_subsession, ro_win, ro_worksheet |
||
| 14873 | georgesk | 516 | }; |
| 517 | extern enum Ro_Names RO_NAMES; |
||
| 8185 | bpr | 518 | extern char *home_module; |
| 519 | extern char class_dir[MAX_FNAME+1]; /* directory name of this class */ |
||
| 14873 | georgesk | 520 | extern char available_lang[MAX_LANGUAGES][4]; |
| 8185 | bpr | 521 | |
| 14873 | georgesk | 522 | enum _commands { |
| 8185 | bpr | 523 | cmd_intro, cmd_new, cmd_renew, cmd_reply, cmd_config, cmd_hint, cmd_help, |
| 524 | cmd_resume, cmd_next, cmd_getins, cmd_getframe, cmd_getfile, cmd_close, |
||
| 525 | cmd_ref |
||
| 14873 | georgesk | 526 | }; |
| 527 | extern enum _commands COMMANDS; |
||
| 8185 | bpr | 528 | extern char tmp_dir[MAX_FNAME+1]; /* temporary directory */ |
| 529 | |||
| 530 | extern char ref_name[2048], ref_base[2048]; |
||
| 531 | |||
| 532 | struct user_variable { |
||
| 533 | char *name; |
||
| 534 | char *value; |
||
| 14873 | georgesk | 535 | }; |
| 536 | extern struct user_variable user_variable[MAX_VAR_NUM]; |
||
| 8185 | bpr | 537 | |
| 538 | extern int user_var_no; |
||
| 539 | /* Destinated to module error messages */ |
||
| 14873 | georgesk | 540 | extern WORKING_FILE m_file; |
| 541 | extern WORKING_FILE svar_file; |
||
| 542 | extern WORKING_FILE mcache[MAX_MCACHE]; |
||
| 8185 | bpr | 543 | |
| 544 | extern int isexam, direct_datafile; |
||
| 545 | extern char *unsetvars[], *commands[]; |
||
| 546 | extern char exam_sheetexo[32]; /* sheet data of an exam */ |
||
| 547 | extern char nowstr[32]; |
||
| 548 | extern int CMD_NO; |
||
| 549 | extern int simuxam, parm_restore, exodepOK, user_error_nolog; |
||
| 550 | extern char examlogd[MAX_FNAME+1]; /* examlog file name */ |
||
| 14873 | georgesk | 551 | extern char examlogf[MAX_FNAME+1]; /* examlog file name */ |
| 552 | extern char mpboundary[1024]; |
||
| 553 | extern char *stdinbuf; |
||
| 8185 | bpr | 554 | extern char **environ; /* table of environment variables */ |
| 555 | extern char cookiegot[256], cookieheader[64]; |
||
| 556 | extern int executed_gotos; /* number of goto's executed. to check with GOTO_LIMIT. */ |
||
| 557 | extern int noout, execnt, direct_exec, ismhelp; |
||
| 558 | extern int readnest; /* nested read count */; |
||
| 559 | extern char *default_form_method; |
||
| 560 | extern int insert_no, lastout_file, instex_cnt; |
||
| 561 | extern char instex_src[MAX_LINELEN+1], instex_fname[MAX_LINELEN+1]; |
||
| 562 | extern char *instex_processor; |
||
| 563 | extern int instex_usedynamic, httpd_type, mcachecnt, mfilecnt; |
||
| 564 | extern char *mathalign_sup1, *mathalign_sup2; /* see mathalign_base */ |
||
| 565 | enum {httpd_apache, httpd_wims}; |
||
| 566 | extern int output_length; /* length of the output. */ |
||
| 567 | extern int backslash_insmath, killpid, is_multiexec, exec_wait, getwimstexsize; |
||
| 568 | extern char *remote_host; |
||
| 569 | extern char *var_readable, *var_writable, *var_nr, *var_nw, *var_pfx; |
||
| 12381 | bpr | 570 | extern int RO_NAME_NO, INTERNAL_NAME_NO, INTERNALDEF_NAME_NO; |
| 8185 | bpr | 571 | extern struct internal_name { |
| 572 | char *name; int stat; |
||
| 573 | } internal_name[]; |
||
| 574 | extern char var_hacking; |
||
| 575 | extern long int startmtime2; |
||
| 576 | extern int setcookie, forceresume, user_lang, form_access, session_serial; |
||
| 577 | extern char *protocol; |
||
| 578 | void useropts(void); |
||
| 579 | extern char cookiegot[256], cookieset[256]; |
||
| 9286 | bpr | 580 | extern struct tm *now; /* time of request */ |
| 8185 | bpr | 581 | extern int isdevelmodule, defined_var_total, deplen, wims_sheet, wims_exo; |
| 582 | struct VAR_DEF { |
||
| 583 | char *name; short int beg,end; |
||
| 584 | char allow, log_num, defined_in_parm, unused_padding; |
||
| 14873 | georgesk | 585 | }; |
| 586 | extern struct VAR_DEF var_def[MAX_VAR_NUM]; |
||
| 8185 | bpr | 587 | |
| 588 | |||
| 10 | reyssat | 589 | #if !HAVE_SETENV |
| 590 | int setenv(const char *name, const char *value, int overwrite); |
||
| 591 | void unsetenv(const char *name); |
||
| 592 | #endif |