/[radius]/radius/radiusd/timestr.c
ViewVC logotype

Diff of /radius/radiusd/timestr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by gray, Mon Jan 28 14:32:57 2002 UTC revision 1.13 by gray, Wed Apr 30 08:38:30 2003 UTC
# Line 1  Line 1 
1  /* This file is part of GNU RADIUS.  /* This file is part of GNU Radius
2     Copyright (C) 2001, Sergey Poznyakoff     Copyright (C) 2001, 2003, Sergey Poznyakoff
3        
4     This program is free software; you can redistribute it and/or modify     GNU Radius is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.     (at your option) any later version.
8        
9     This program is distributed in the hope that it will be useful,     GNU Radius is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.     GNU General Public License for more details.
13        
14     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software Foundation,     along with GNU Radius; if not, write to the Free Software Foundation,
16     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17    
 #ifndef lint  
 static char rcsid[] = "@(#) $Id$";  
 #endif  
   
18  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
19  # include <config.h>  # include <config.h>
20  #endif  #endif
# Line 48  static char rcsid[] = "@(#) $Id$"; Line 44  static char rcsid[] = "@(#) $Id$";
44  #define DAYMIN  (24*60)  #define DAYMIN  (24*60)
45  #define val(x)  (( (x) < '0' || (x) > '9') ? 0 : ((x) - '0'))  #define val(x)  (( (x) < '0' || (x) > '9') ? 0 : ((x) - '0'))
46    
47  static TIMESPAN *timespan_new(int start, int stop);  static TIMESPAN *
48  static void timespan_day(TIMESPAN **ts, int day, int start, int stop);  timespan_new(int start, int stop)
 static int timespan_parse(TIMESPAN **ts, char *s, char **endp);  
   
 TIMESPAN *  
 timespan_new(start, stop)  
         int start;  
         int stop;  
49  {  {
50          TIMESPAN *ts;          TIMESPAN *ts;
51    
# Line 66  timespan_new(start, stop) Line 56  timespan_new(start, stop)
56          return ts;          return ts;
57  }  }
58    
59  void  static void
60  timespan_day(ts, day, start, stop)  timespan_day(TIMESPAN **ts, int day, int start, int stop)
         TIMESPAN **ts;  
         int day;  
         int start;  
         int stop;  
61  {  {
62          TIMESPAN *tp, *prev;          TIMESPAN *tp, *prev;
63                    
# Line 130  timespan_day(ts, day, start, stop) Line 116  timespan_day(ts, day, start, stop)
116          }          }
117  }  }
118    
119  int  static int
120  timespan_parse(ts, s, endp)  timespan_parse(TIMESPAN **ts, char *s, char **endp)
         TIMESPAN **ts;  
         char *s;  
         char **endp;  
121  {  {
122          register int i, j;          register int i, j;
123          register char *p;          register char *p;
# Line 214  timespan_parse(ts, s, endp) Line 197  timespan_parse(ts, s, endp)
197  }  }
198    
199  void  void
200  ts_free(sp)  ts_free(TIMESPAN *sp)
         TIMESPAN *sp;  
201  {  {
202          TIMESPAN *next;          TIMESPAN *next;
203    
# Line 228  ts_free(sp) Line 210  ts_free(sp)
210    
211    
212  int  int
213  ts_parse(sp, str, endp)  ts_parse(TIMESPAN **sp, char *str, char **endp)
         TIMESPAN **sp;  
         char *str;  
         char **endp;  
214  {  {
215          *sp = NULL;          *sp = NULL;
216          while (1) {          while (1) {
# Line 252  ts_parse(sp, str, endp) Line 231  ts_parse(sp, str, endp)
231  }  }
232    
233  int  int
234  ts_match(timespan, time_now, rest)  ts_match(TIMESPAN *timespan, time_t *time_now, unsigned *rest)
         TIMESPAN *timespan;  
         time_t *time_now;  
         unsigned *rest;  
235  {  {
236          TIMESPAN *tp;          TIMESPAN *tp;
237          struct tm *tm, tms;          struct tm *tm, tms;
# Line 291  ts_match(timespan, time_now, rest) Line 267  ts_match(timespan, time_now, rest)
267  }  }
268    
269  int  int
270  ts_check(str, time, rest, endp)  ts_check(char *str, time_t *time, unsigned *rest, char **endp)
         char *str;  
         time_t *time;  
         unsigned *rest;  
         char **endp;  
271  {  {
272          TIMESPAN *ts;          TIMESPAN *ts;
273          int rc;          int rc;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26