1: /* ======================================================================== */
2: /* Feb. 10 1997 Isaac Tsai */
3: /* ======================================================================== */
4:
5: #include <stdio.h>
6: #include <ctype.h>
7: #include <sys/types.h>
8: #include <sys/stat.h>
9: #include <signal.h>
10: #include <time.h>
11: #include <math.h>
12: #include <string.h>
13: #include <unistd.h>
14:
15: extern char *optarg;
16: extern int optind, opterr, optout;
17:
18: #define YES 1
19:
20: #include "capaCommon.h"
21:
22: char *progname;
23: char *import_prefix="/res/capa";
24:
25: void
26: print_answer(FILE *o_fp,int ans_cnt,char *ans,char *lower,char *upper,char *unit)
27: {
28: if (unit && (strlen(unit)>0))
29: if(ans_cnt==2) fprintf(o_fp,"ANS:%s %s %s %s\n",ans,lower,upper,unit);
30: else fprintf(o_fp,"ANS:%s %s\n",lower,unit);
31: else
32: if(ans_cnt==2) fprintf(o_fp,"ANS:%s %s %s\n",ans,lower,upper);
33: else fprintf(o_fp,"ANS:%s\n",lower);
34: }
35:
36: void print_question (FILE *o_fp,char *question)
37: {
38: fprintf(o_fp,"BQES:\n%s\nEQES:\n",question);
39: }
40:
41: int get_options ( int argc, char **argv, char ** filename)
42: {
43: int opt;
44: /*opterr=0;*/
45: while ((opt=getopt(argc,argv,"i:f:"))!=-1) {
46: switch (opt) {
47: case 'i':
48: import_prefix=optarg;
49: break;
50: case 'f':
51: *filename=optarg;
52: break;
53: case '?':
54: return -1;
55: break;
56: }
57: }
58: return 0;
59: }
60:
61: int main (int argc, char **argv)
62: {
63: extern int Parsemode_f;
64:
65: /* unused
66: extern int managermode;
67: int num_answers, q_idx;
68: char lower[ANSWER_STRING_LENG], upper[ANSWER_STRING_LENG];
69: int StartSet = 1, EndSet = 1;
70: char tmp_str[ANSWER_STRING_LENG];
71: double tmp_ans;
72: T_student a_student;
73: Problem_t *p;
74: */
75: Problem_t *first_prob;
76: int result, setIdx = 1, q_cnt;
77: char * filename=NULL;
78:
79: Parsemode_f=ASCII_MODE;
80:
81: if ( get_options(argc,argv,&filename) == -1 || filename==NULL ) {
82: printf("USAGE: %s [-i prefix] -f filename\n",argv[0]);
83: exit(-1);
84: }
85:
86: result = capa_parse(setIdx, &first_prob, filename ,&q_cnt,NULL);
87:
88: return (0);
89: }
90:
91:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>