Diff for /capa/capa51/pProj/allcapaid.c between versions 1.1 and 1.6

version 1.1, 1999/09/28 21:26:21 version 1.6, 2000/08/07 20:47:29
Line 1 Line 1
   /* Generate all CAPA Ids for a class
      Copyright (C) 1992-2000 Michigan State University
   
      The CAPA system 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.
   
      The CAPA system 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 the CAPA system; see the file COPYING.  If not,
      write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
   
      As a special exception, you have permission to link this program
      with the TtH/TtM library and distribute executables, as long as you
      follow the requirements of the GNU GPL in regard to all of the
      software in the executable aside from TtH/TtM.
   */
   
 /* ========================================================================== */  
 /* ========================================================================== */  /* ========================================================================== */
 /*            allcapaid.c    created by Isaac Tsai                            */  /*            allcapaid.c    created by Isaac Tsai                            */
 /*                                1998, 1999 copyrighted by Isaac Tsai        */  
 /**************************************************************************** */  /**************************************************************************** */
 #ifdef NeXT  #ifdef NeXT
 #include <stdlib.h>  #include <stdlib.h>
Line 104  void usage() Line 125  void usage()
   printf("       -Sec 3:7        : from section 3 to section 7\n");    printf("       -Sec 3:7        : from section 3 to section 7\n");
   printf("       -i              : don't create files, print to the screen\n");    printf("       -i              : don't create files, print to the screen\n");
   printf("       -p 2            : output 6 charatcer capaidplus instead of capaid\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("       -h              : prints this message\n");
   printf("       CAPA version %s, %s\n",CAPA_VER,COMPILE_DATE);    printf("       CAPA version %s, %s\n",CAPA_VER,COMPILE_DATE);
     printf("       CAPA is released under the GNU GPL v2 see COPYING for details.\n");
 }  }
 #define  F_CLASS       1  #define  F_CLASS       1
 #define  F_SECTIONS    2  #define  F_SECTIONS    2
 #define  F_STUDENT     3  #define  F_STUDENT     3
 int main (int argc, char  **argv)   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         i, setIdx, numStudents, count, tmp_num, StartSec=1,EndSec=999;
   int         StartSet = 1, EndSet = 10, classnameOK=0,outputDir=0,plus=0;    int         StartSet = 1, EndSet = 10, classnameOK=0,outputDir=0,plus=0;
   int         SecCntArry[MAX_SECTION_COUNT], sectionIdx;       int         SecCntArry[MAX_SECTION_COUNT], sectionIdx;   
   char        filename[MAX_BUFFER_SIZE], path[MAX_BUFFER_SIZE],     char        filename[MAX_BUFFER_SIZE], path[MAX_BUFFER_SIZE], 
     outputPath[MAX_BUFFER_SIZE], fullpath[MAX_BUFFER_SIZE];      outputPath[MAX_BUFFER_SIZE], fullpath[MAX_BUFFER_SIZE];
   char        StuNum[MAX_STUDENT_NUMBER+1];    char        StuNum[MAX_STUDENT_NUMBER+1], fmt[16];
   int         ForWhat=F_CLASS, interactive=0;    int         ForWhat=F_CLASS, interactive=0,CheckOpen=0,CheckDue=0,CheckAns=0;
   FILE       *dfp;    FILE       *dfp;
       
   if( argc == 0 ) {    if( argc == 0 ) {
Line 155  int main (int argc, char  **argv) Line 180  int main (int argc, char  **argv)
  if( EndSet > 999 ) EndSet = 99;   if( EndSet > 999 ) EndSet = 99;
  break;   break;
       case 'c':        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]);   strcpy(path,argv[1]);
  if( capa_access(path, F_OK) == -1 ) {   if( capa_access(path, F_OK) == -1 ) {
   printf("No such class [%s] please specify it again:\n",path);    printf("No such class [%s] please specify it again:\n",path);
Line 211  int main (int argc, char  **argv) Line 239  int main (int argc, char  **argv)
       printf("%4d ", setIdx );        printf("%4d ", setIdx );
     }      }
     printf("\n");      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++) {      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)         if (plus) 
  print_capaidplus(stdout,StuNum,setIdx,plus);   print_capaidplus(stdout,StuNum,setIdx,plus);
       else         else 
Line 222  int main (int argc, char  **argv) Line 269  int main (int argc, char  **argv)
   case F_CLASS:    case F_CLASS:
     StartSec=1;EndSec=999;      StartSec=1;EndSec=999;
   case F_SECTIONS:    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 = capa_get_section_count( SecCntArry )) != 0 ) {
       if (count == -1 ) {        if (count == -1 ) {
  printf("classl file not found in %s\n",path);   printf("classl file not found in %s\n",path);

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


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