Annotation of capa/capa51/GUITools/webpage.funct.c, revision 1.1
1.1 ! albertel 1: /*
! 2: * quizzer.funct.c
! 3: * Copyright Guy Albertelli II 1996
! 4: * Portions Copyright Issac Tsai
! 5: */
! 6: #include <stdio.h>
! 7: #include <tcl.h>
! 8: #include <Capa/capaCommon.h>
! 9: #include <webpage.h>
! 10:
! 11: int emailcapaid(int argc, char** argv)
! 12: {
! 13: char studentNum[MAX_STUDENT_NUMBER+1];
! 14: int i,setId,pin;
! 15: T_student student_data;
! 16: time_t curtime;
! 17:
! 18: if (argc != 4) {
! 19: printf("USAGE: webpage -emailcapaid stunum setId\n",argv[0]);
! 20: return 0;
! 21: }
! 22:
! 23: strncpy(studentNum,argv[2],MAX_STUDENT_NUMBER);
! 24: setId=atoi(argv[3]);
! 25: if ( setId > 99 || setId < 1 ) {
! 26: printf("InvalidSetId");
! 27: return 0;
! 28: }
! 29: pin=capa_PIN(studentNum, setId,0);
! 30: i=capa_get_student(studentNum,&student_data);
! 31: if ( i > 0 ) {
! 32: time(&curtime);
! 33: if( capa_check_date(CHECK_OPEN_DATE,studentNum,
! 34: student_data.s_sec,setId) < 0 ) {
! 35: printf("NotOpen");
! 36: } else {
! 37: printf("%d %s",pin,student_data.s_email);
! 38: }
! 39: } else {
! 40: printf("NotFound");
! 41: }
! 42: return 0;
! 43: }
! 44:
! 45: int getid(int argc, char** argv)
! 46: {
! 47: char studentNum[MAX_STUDENT_NUMBER+1];
! 48: int i,setId,oldCapaID=-1,oldSetId,found=1,pin;
! 49: T_student student_data;
! 50: time_t curtime;
! 51:
! 52: if (argc>5 || argc<4) {
! 53: printf("USAGE: webpage -getid stunum setId oldCapaID\n");
! 54: return 0;
! 55: }
! 56:
! 57: strncpy(studentNum,argv[2],MAX_STUDENT_NUMBER);
! 58: setId=atoi(argv[3]);
! 59: if ( setId > 99 || setId < 1 ) {
! 60: printf("InvalidSetId");
! 61: return 0;
! 62: }
! 63: if ( argc == 5 ) {
! 64: found=0;
! 65: oldCapaID=atoi(argv[4]);
! 66: if ( oldCapaID < 1000 || oldCapaID > 9999 ) {
! 67: printf("InvalidOldCapaID");
! 68: return 0;
! 69: }
! 70: for(i=1;(i<setId)&&(!found);i++) if (capa_PIN(studentNum,i,oldCapaID)) found=i;
! 71: }
! 72: /* old line printf("%d",capa_PIN(studentNum, setId,0)); else printf("NotFound");*/
! 73: if ( found ) {
! 74: pin=capa_PIN(studentNum, setId,0);
! 75: if ( capa_get_student(studentNum,&student_data) > 0 ) {
! 76: time(&curtime);
! 77: if( capa_check_date(CHECK_OPEN_DATE,studentNum,
! 78: student_data.s_sec,setId) < 0 ) {
! 79: printf("NotOpen");
! 80: } else {
! 81: printf("%d",pin);
! 82: }
! 83: } else {
! 84: printf("NotFound");
! 85: }
! 86: } else {
! 87: printf("NotFound");
! 88: }
! 89: return 0;
! 90: }
! 91:
! 92:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>