Subversion Repositories wimsdev

Rev

Rev 16391 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16391 Rev 16704
Line 231... Line 231...
231
  //class_dump(cd);
231
  //class_dump(cd);
232
  if(stat("exams/.exams",&st)==0) cd->modif=st.st_mtime; else return cd;
232
  if(stat("exams/.exams",&st)==0) cd->modif=st.st_mtime; else return cd;
233
  wlogdaccessfile(buf,"r","exams/.exams");
233
  wlogdaccessfile(buf,"r","exams/.exams");
234
  if(buf[0]==0) return cd;
234
  if(buf[0]==0) return cd;
235
  if(buf[0]==':') p1=buf-1; else p1=strstr(buf,"\n:");
235
  if(buf[0]==':') p1=buf-1; else p1=strstr(buf,"\n:");
236
  for(n=m=0,k=cd->exam.indstart; p1 && k<MAX_CLASSEXOS && m<MAX_EXOS; p1=p2,m++,k++) {
236
  for(n=m=0,k=cd->exam.indstart; p1 && k<MAX_CLASSEXOS && m<MAX_EXAMS; p1=p2,m++,k++) {
237
    p1+=2;
237
    p1+=2;
238
    p2=strstr(p1,"\n:"); if(p2) *p2=0;
238
    p2=strstr(p1,"\n:"); if(p2) *p2=0;
239
    //      if(*find_word_start(p1)<'1') continue;      /* status */
239
    //      if(*find_word_start(p1)<'1') continue;      /* status */
240
    fnd_line(p1,3,buf2); if(buf2[0]==0) continue;
240
    fnd_line(p1,3,buf2); if(buf2[0]==0) continue;
241
    q1=find_word_start(buf2); q2=find_word_end(q1);
241
    q1=find_word_start(buf2); q2=find_word_end(q1);
Line 244... Line 244...
244
    i=atoi(q1); j=atoi(q2); if(i<=0 || j<=0) continue;
244
    i=atoi(q1); j=atoi(q2); if(i<=0 || j<=0) continue;
245
    cd->exos[k].weight=i; cd->exos[k].require=j;      /* weight: duration. require: retries */
245
    cd->exos[k].weight=i; cd->exos[k].require=j;      /* weight: duration. require: retries */
246
    fnd_line(p1,6,buf2); q1=find_word_start(buf2);
246
    fnd_line(p1,6,buf2); q1=find_word_start(buf2);
247
    singlespace(q1); strip_trailing_spaces(q1);
247
    singlespace(q1); strip_trailing_spaces(q1);
248
    cd->ctptr[m]=n; cd->ctbuf[n]=0;
248
    cd->ctptr[m]=n; cd->ctbuf[n]=0;
249
    if(n+strlen(q1)>CTBUFLEN-MAX_EXOS-16) *q1=0;      /* silent truncation */
249
    if(n+strlen(q1)>CTBUFLEN-MAX_EXAMS-16) *q1=0;      /* silent truncation */
250
    l=strlen(q1)+1; memmove(cd->ctbuf+n,q1,l); n+=l;
250
    l=strlen(q1)+1; memmove(cd->ctbuf+n,q1,l); n+=l;
251
  }
251
  }
252
  cd->examcnt=m; // number of exos in all exams
252
  cd->examcnt=m; // number of exos in all exams
253
  cd->exocnt+=m; // number of all exos without multiplicity
253
  cd->exocnt+=m; // number of all exos without multiplicity
254
  cd->exam.exocnt=m;
254
  cd->exam.exocnt=m;