2 These functions writen by Devrim SERAL <devrim@gazi.edu.tr>
4 Applicable format is : <day str><time str> [,|] <day str><time str> [,|] and so on
6 The accept parameter for day str is:
20 For example it's to be -> 0000-1200 or 1600-1700 or 1600-0800
22 License: This code is free software; you can redistribute it and/or modify it
23 under the terms of the GNU General Public License as published by the Free
24 Software Foundation; either version 2, or (at your option) any later version.
28 #include"time_limit.h"
34 time_limit_process(str)
40 tmp_str=(char *)strtok(str,",|");
41 while ( tmp_str != NULL) {
42 ret|=str_token_proc(tmp_str);
43 tmp_str=(char *)strtok(NULL,",");
54 /* Pass space characters */
55 while (isspace(*str)) str++;
64 if ( debug & DEBUG_AUTHEN_FLAG )
65 report(LOG_DEBUG,"Timestamp format incorrect");
80 int count=0,ret=0,i,j,localtm;
85 /* Pass space characters */
86 while (isspace(*str)) str++;
90 /* Count alphanumeric char */
91 while (isalpha(*str)) {
96 if ( count==0 || count%2 ) {
101 buf=(char *)malloc(count+1);
102 strncpy(buf,head,count);
106 for(i=1;i<=(count/2);i++) {
107 for (j=0;j<NUM;j++) {
108 if(!strncmp(gec,week_days[j],2)) {
109 ret=ret^week_day_val[j];
115 /* We finished to use buffer so free it */
120 localtm=(tms->tm_hour)*60+tms->tm_min;
121 ret=( week_day_val[tms->tm_wday] & ret ) && time_calc(str,localtm);
133 if(islower(*str)) *str=toupper(*str);
144 int say1,say2,count=0;
148 while (isdigit(*head) || *head=='-') {
153 if (*str=='\0' || count!= TPL ) {
158 t1=(char *) malloc(count);
159 strncpy(t1,str,count); /*Put str value to t1*/
161 t2=(char *) strstr(t1,"-"); /* Find next time part */
171 if ( strlen(t1)<4 || strlen(t2)<4 ) {
176 say1=antoi(t1,2)*60+antoi(t1+2,2);
177 say2=antoi(t2,2)*60+antoi(t2+2,2);
182 if( (lct>=say1) && (lct<=say2) ) return(1);
185 if( (lct>=say1) || (lct<=say2) ) return(1);
198 buf=(char *) malloc(n);