--- capa/capa51/pProj/allcapaid.c 1999/09/28 21:26:21 1.1 +++ capa/capa51/pProj/allcapaid.c 1999/10/13 18:45:28 1.2 @@ -104,6 +104,9 @@ void usage() printf(" -Sec 3:7 : from section 3 to section 7\n"); printf(" -i : don't create files, print to the screen\n"); printf(" -p 2 : output 6 charatcer capaidplus instead of capaid\n"); + printf(" -checkopen : check if set is open, fail if it isn't.\n"); + printf(" -checkdue : check if set is due, fail if it isn't.\n"); + printf(" -checkans : check if set's answers are available, fail if they aren't.\n"); printf(" -h : prints this message\n"); printf(" CAPA version %s, %s\n",CAPA_VER,COMPILE_DATE); } @@ -112,14 +115,14 @@ void usage() #define F_STUDENT 3 int main (int argc, char **argv) { - T_student *students_p,*s_p; + T_student *students_p,*s_p,student_data; int i, setIdx, numStudents, count, tmp_num, StartSec=1,EndSec=999; int StartSet = 1, EndSet = 10, classnameOK=0,outputDir=0,plus=0; int SecCntArry[MAX_SECTION_COUNT], sectionIdx; char filename[MAX_BUFFER_SIZE], path[MAX_BUFFER_SIZE], outputPath[MAX_BUFFER_SIZE], fullpath[MAX_BUFFER_SIZE]; - char StuNum[MAX_STUDENT_NUMBER+1]; - int ForWhat=F_CLASS, interactive=0; + char StuNum[MAX_STUDENT_NUMBER+1], fmt[16]; + int ForWhat=F_CLASS, interactive=0,CheckOpen=0,CheckDue=0,CheckAns=0; FILE *dfp; if( argc == 0 ) { @@ -155,6 +158,9 @@ int main (int argc, char **argv) if( EndSet > 999 ) EndSet = 99; break; case 'c': + if (strcmp(argv[0],"-checkopen")==0) { CheckOpen=1; break; } + if (strcmp(argv[0],"-checkdue" )==0) { CheckDue=1; break; } + if (strcmp(argv[0],"-checkans" )==0) { CheckAns=1; break; } strcpy(path,argv[1]); if( capa_access(path, F_OK) == -1 ) { printf("No such class [%s] please specify it again:\n",path); @@ -211,7 +217,26 @@ int main (int argc, char **argv) printf("%4d ", setIdx ); } printf("\n"); + if (CheckOpen || CheckDue || CheckAns) { + sprintf(fmt,"%%%ds ",plus+4); + if ( capa_get_student(StuNum,&student_data) == 0 ) { + fprintf(stderr,"Unable to find student, %s.\n",StuNum); + exit(1); + } + } for(setIdx = StartSet; setIdx <= EndSet; setIdx++) { + if ( CheckOpen && ( capa_check_date(CHECK_OPEN_DATE,StuNum, + student_data.s_sec,setIdx) < 0)) { + printf(fmt,"Open");continue; + } + if ( CheckDue && ( capa_check_date(CHECK_DUE_DATE,StuNum, + student_data.s_sec,setIdx) < 0)) { + printf(fmt,"Due");continue; + } + if ( CheckAns && ( capa_check_date(CHECK_ANS_DATE,StuNum, + student_data.s_sec,setIdx) < 0)) { + printf(fmt,"Ans");continue; + } if (plus) print_capaidplus(stdout,StuNum,setIdx,plus); else @@ -222,6 +247,9 @@ int main (int argc, char **argv) case F_CLASS: StartSec=1;EndSec=999; case F_SECTIONS: + if (CheckOpen || CheckDue || CheckAns) { + printf("Can only check dates in single student mode\n"); + } if ((count = capa_get_section_count( SecCntArry )) != 0 ) { if (count == -1 ) { printf("classl file not found in %s\n",path);