Diff for /loncom/homework/caparesponse/caparesponse.c between versions 1.6 and 1.8

version 1.6, 2001/10/29 21:15:45 version 1.8, 2003/05/27 15:29:02
Line 1 Line 1
   /* The LearningOnline Network with CAPA 
    * CAPA wrapper code
    * $Id$
    *
    * Copyright Michigan State University Board of Trustees
    *
    * This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    *
    * LON-CAPA is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    *
    * LON-CAPA is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with LON-CAPA; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    *
    * /home/httpd/html/adm/gpl.txt
    *
    * http://www.lon-capa.org/
    */
   
 #include <capaCommon.h>  #include <capaCommon.h>
 #include <ranlib.h>  #include <ranlib.h>
   
Line 49  int caparesponse_capa_check_answer(char Line 76  int caparesponse_capa_check_answer(char
   char *error=NULL,filename[FILE_NAME_LENGTH];    char *error=NULL,filename[FILE_NAME_LENGTH];
   FILE *fp;    FILE *fp;
   
   /*fprintf(stderr,"hi in caparesponse\n");*/    /* eed to initialize unit parser*/
   /*need to initialize unit parser*/  
   sprintf(filename,"/home/httpd/html/res/adm/includes/capa.units");    sprintf(filename,"/home/httpd/html/res/adm/includes/capa.units");
   if ((fp=fopen(filename,"r"))==NULL) {    if ((fp=fopen(filename,"r"))==NULL) {
     /* printf("Error: can't open %s\n",filename);*/      /* printf("Error: can't open %s\n",filename);*/
Line 77  int caparesponse_capa_check_answer(char Line 103  int caparesponse_capa_check_answer(char
   p.tolerance  = tolerance;    p.tolerance  = tolerance;
   p.sig_lbound = sig_lbound;    p.sig_lbound = sig_lbound;
   p.sig_ubound = sig_ubound;    p.sig_ubound = sig_ubound;
   strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1);    
   if (unit_str[0]!='\0') {    if (ans_fmt != NULL ) {
       strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1);
     }
     if (unit_str != NULL && unit_str[0]!='\0') {
     strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1);      strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1);
     p.ans_unit   = u_parse_unit(unit_str);      p.ans_unit   = u_parse_unit(unit_str);
   } else {    } else {
     p.unit_str[0]='\0';      p.unit_str[0]='\0';
     p.ans_unit=NULL;  
   }    }
   p.calc       = calc;    p.calc       = calc;
   
   
   result=capa_check_answer(&p,response,&error);    result=capa_check_answer(&p,response,&error);
   
   if (error!=NULL) {free(error);}    if (error!=NULL) {free(error);}

Removed from v.1.6  
changed lines
  Added in v.1.8


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>