Rev 16909 | Rev 17459 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16909 | Rev 17457 | ||
---|---|---|---|
Line 1245... | Line 1245... | ||
1245 | * it is possible to put a joker in the times |
1245 | * it is possible to put a joker in the times |
1246 | */ |
1246 | */ |
1247 | int checkhostt(char bf2[]) |
1247 | int checkhostt(char bf2[]) |
1248 | { |
1248 | { |
1249 | char *p1, *p2, *p3; |
1249 | char *p1, *p2, *p3; |
1250 | int i; |
1250 | int i,maxremain=1; |
1251 | /* compare with starting time */ |
1251 | /* compare with starting time */ |
1252 | for(p1=strchr(bf2,'>'); p1!=NULL; p1=strchr(p1+1,'>')) { |
1252 | for(p1=strchr(bf2,'>'); p1!=NULL; p1=strchr(p1+1,'>')) { |
1253 | if(p1>bf2 && !isspace(*(p1-1))) continue; |
1253 | if(p1>bf2 && !isspace(*(p1-1))) continue; |
1254 | p3=find_word_start(++p1); p2=find_word_end(p3); |
1254 | p3=find_word_start(++p1); p2=find_word_end(p3); |
1255 | if(p2-p3!=14) continue; |
1255 | if(p2-p3!=14) continue; |
Line 1262... | Line 1262... | ||
1262 | for(p1=strchr(bf2,'<'); p1!=NULL; p1=strchr(p1+1,'<')) { |
1262 | for(p1=strchr(bf2,'<'); p1!=NULL; p1=strchr(p1+1,'<')) { |
1263 | if(p1>bf2 && !isspace(*(p1-1))) continue; |
1263 | if(p1>bf2 && !isspace(*(p1-1))) continue; |
1264 | p3=find_word_start(++p1); p2=find_word_end(p3); |
1264 | p3=find_word_start(++p1); p2=find_word_end(p3); |
1265 | if(p2-p3!=14) continue; |
1265 | if(p2-p3!=14) continue; |
1266 | p3[8]='.'; p3[11]=':'; if(*p2) *p2++=0; |
1266 | p3[8]='.'; p3[11]=':'; if(*p2) *p2++=0; |
1267 | for (i=0; i<14; i++) if( |
1267 | for (i=0; i<14; i++) if(!isdigit(p3[i])) p3[i]=nowstr[i]; |
1268 | if(strncmp(nowstr,p3,14)>0) return 0; |
1268 | if(strncmp(nowstr,p3,14)>0) return 0; |
- | 1269 | /* added to calculate max time in exam */ |
|
- | 1270 | if (isexam) { |
|
- | 1271 | struct tm maxtime; |
|
- | 1272 | char tmp[8]; |
|
- | 1273 | unsigned long time; |
|
- | 1274 | snprintf(tmp,sizeof(tmp),"%c%c%c%c",p3[0],p3[1],p3[2],p3[3]); |
|
- | 1275 | maxtime.tm_year=atoi(tmp)-1900; |
|
- | 1276 | snprintf(tmp,sizeof(tmp),"%c%c",p3[4],p3[5]); |
|
- | 1277 | maxtime.tm_mon=atoi(tmp)-1; |
|
- | 1278 | snprintf(tmp,sizeof(tmp),"%c%c",p3[6],p3[7]); |
|
- | 1279 | maxtime.tm_mday=atoi(tmp); |
|
- | 1280 | snprintf(tmp,sizeof(tmp),"%c%c",p3[9],p3[10]); |
|
- | 1281 | maxtime.tm_hour=atoi(tmp); |
|
- | 1282 | snprintf(tmp,sizeof(tmp),"%c%c",p3[12],p3[13]); |
|
- | 1283 | maxtime.tm_min=atoi(tmp); |
|
- | 1284 | maxtime.tm_sec=0; |
|
- | 1285 | maxtime.tm_isdst=-1; |
|
- | 1286 | time=mktime(&maxtime); |
|
- | 1287 | maxremain=time-nowtime; |
|
- | 1288 | } |
|
- | 1289 | /* end add */ |
|
1269 | ovlstrcpy(p1-1,p2); p1-=2; |
1290 | ovlstrcpy(p1-1,p2); p1-=2; |
1270 | } |
1291 | } |
1271 | p1=find_word_start(bf2); if(*p1==0) return |
1292 | p1=find_word_start(bf2); if(*p1==0) return maxremain; |
1272 |
|
1293 | if (checkhost(p1)) return maxremain; else return 0; |
1273 | } |
1294 | } |
1274 | 1295 | ||
1275 | /* bad identification */ |
1296 | /* bad identification */ |
1276 | void bad_ident(void) |
1297 | void bad_ident(void) |
1277 | { |
1298 | { |