46    if (names && *s > 
'9') {
 
   47        for (i = 0; names[i]; i++) {
 
   48            if (!strcasecmp(s, names[i])) {
 
   55    if (sscanf(s, 
"%2d", &i) == 1 && i >= 1 && i <= 
max) {
 
 
   65static unsigned get_range(
char *src, 
int max, 
const char * 
const names[], 
const char *msg)
 
   68    unsigned int mask = 0;
 
   73        return (1 << 
max) - 1;
 
   76    while ((part = 
strsep(&src, 
"&"))) {
 
   78        char *endpart = strchr(part, 
'-');
 
   97        while (start != 
end) {
 
 
  110    char *endpart, *part;
 
  114    int minute_start, minute_end;
 
  123        for (x = 0; x < 48; x++) {
 
  129    while ((part = 
strsep(×, 
"&"))) {
 
  130        if (!(endpart = strchr(part, 
'-'))) {
 
  131            if (sscanf(part, 
"%2d:%2d", &st_h, &st_m) != 2 || st_h < 0 || st_h > 23 || st_m < 0 || st_m > 59) {
 
  135            i->
minmask[st_h * 2 + (st_m >= 30 ? 1 : 0)] |= (1 << (st_m % 30));
 
  140        while (*endpart && !isdigit(*endpart)) {
 
  147        if (sscanf(part, 
"%2d:%2d", &st_h, &st_m) != 2 || st_h < 0 || st_h > 23 || st_m < 0 || st_m > 59) {
 
  151        if (sscanf(endpart, 
"%2d:%2d", &endh, &endm) != 2 || endh < 0 || endh > 23 || endm < 0 || endm > 59) {
 
  155        minute_start = st_h * 60 + st_m;
 
  156        minute_end = endh * 60 + endm;
 
  158        for (x = minute_start; x != minute_end; x = (x + 1) % (24 * 60)) {
 
  159            i->
minmask[x / 30] |= (1 << (x % 30));
 
  162        i->
minmask[x / 30] |= (1 << (x % 30));
 
 
  168static const char * 
const days[] =
 
 
  200    int j, num_fields, last_sep = -1;
 
  213    for (j = 0, num_fields = 1; info[j] != 
'\0'; j++) {
 
  214        if (info[j] == 
'|' || info[j] == 
',') {
 
  221    if (num_fields == 5) {
 
 
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
Support for logging to various files, console and syslog Configuration in file logger....
Custom localtime functions for multiple timezones.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Core PBX routines and definitions.
int ast_build_timing(struct ast_timing *i, const char *info_in)
Construct a timing bitmap, for use in time-based conditionals.
int ast_check_timing(const struct ast_timing *i)
Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified.
int ast_destroy_timing(struct ast_timing *i)
Deallocates memory structures associated with a timing bitmap.
int ast_check_timing2(const struct ast_timing *i, const struct timeval tv)
Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified.
static int lookup_name(const char *s, const char *const names[], int max)
Helper for get_range. return the index of the matching entry, starting from 1. If names is not suppli...
static void get_timerange(struct ast_timing *i, char *times)
store a bitmask of valid times, one bit each 1 minute
static const char *const months[]
static const char *const days[]
static unsigned get_range(char *src, int max, const char *const names[], const char *msg)
helper function to return a range up to max (7, 12, 31 respectively). names, if supplied,...
String manipulation functions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().