Annotation of loncom/homework/CAPA-converter/convert.c, revision 1.2
1.1 albertel 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:
14:
15: #define YES 1
16:
17: #include "capaCommon.h"
18:
19: char *progname;
20:
21:
22: void
23: print_answer(FILE *o_fp,int ans_cnt,char *ans,char *lower,char *upper,char *unit)
24: {
25: if (unit && (strlen(unit)>0))
26: if(ans_cnt==2) fprintf(o_fp,"ANS:%s %s %s %s\n",ans,lower,upper,unit);
27: else fprintf(o_fp,"ANS:%s %s\n",lower,unit);
28: else
29: if(ans_cnt==2) fprintf(o_fp,"ANS:%s %s %s\n",ans,lower,upper);
30: else fprintf(o_fp,"ANS:%s\n",lower);
31: }
32:
33: void print_question (FILE *o_fp,char *question)
34: {
35: fprintf(o_fp,"BQES:\n%s\nEQES:\n",question);
36: }
37:
38: int main (int argc, char **argv)
39: {
40: extern int Parsemode_f;
41: extern int managermode;
42:
43: Problem_t *first_prob,*p;
44: int q_cnt, num_answers, result, setIdx = 1, q_idx;
45: char lower[ANSWER_STRING_LENG], upper[ANSWER_STRING_LENG];
46: int StartSet = 1, EndSet = 1;
47: char tmp_str[ANSWER_STRING_LENG];
48: double tmp_ans;
49: T_student a_student;
50:
51: Parsemode_f=ASCII_MODE;
52: if ( argc > 3 || argc < 2 ) {
53: printf("USAGE: %s filename\n",
54: argv[0]);
55: exit(-1);
56: }
57:
58: result = capa_parse(setIdx, &first_prob, argv[1] ,&q_cnt,NULL);
59:
60: return (0);
61: }
62:
63:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>