Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 78c16095 authored by rswindell's avatar rswindell

Changed char event_t.mday to ulong event_t.mdays (bit mask) representing

multiple days of month on which to execute an event (or 0 for any).
parent b1aea7c3
......@@ -1644,7 +1644,8 @@ void event_thread(void* arg)
&& (now_tm.tm_hour*60)+now_tm.tm_min>=sbbs->cfg.event[i]->time
&& (now_tm.tm_mday!=tm.tm_mday || now_tm.tm_mon!=tm.tm_mon)))
&& sbbs->cfg.event[i]->days&(1<<now_tm.tm_wday)
&& (sbbs->cfg.event[i]->mday==0 || sbbs->cfg.event[i]->mday==now_tm.tm_mday)))
&& (sbbs->cfg.event[i]->mdays==0
|| sbbs->cfg.event[i]->mdays&(1<<now_tm.tm_mday))))
{
if(sbbs->cfg.event[i]->misc&EVENT_EXCL) { /* exclusive event */
......
......@@ -32,17 +32,37 @@
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
char *daystr(char days);
/****************************************************************************/
/* Synchronet configuration utility */
/****************************************************************************/
#include "scfg.h"
char *daystr(char days);
static void hotkey_cfg(void);
static char* mdaystr(long mdays)
{
int i;
char tmp[16];
static char str[256];
if(mdays==0 || mdays==1)
return("Any");
str[0]=0;
for(i=1;i<32;i++) {
if((mdays&(1<<i))==0)
continue;
if(str[0])
strcat(str," ");
sprintf(tmp,"%u",i);
strcat(str,tmp);
}
return(str);
}
static char* dropfile(int type, ulong misc)
{
static char str[128];
......@@ -341,8 +361,8 @@ This is the internal code for the timed event.
sprintf(opt[k++],"%-32.32s%.40s","Start-up Directory",cfg.event[i]->dir);
sprintf(opt[k++],"%-32.32s%.40s","Command Line",cfg.event[i]->cmd);
sprintf(opt[k++],"%-32.32s%u","Execution Node",cfg.event[i]->node);
sprintf(opt[k++],"%-32.32s%s","Execution Day of Month"
,cfg.event[i]->mday==0 ? "Any" : ultoa(cfg.event[i]->mday,tmp,10));
sprintf(opt[k++],"%-32.32s%s","Execution Days of Month"
,mdaystr(cfg.event[i]->mdays));
sprintf(opt[k++],"%-32.32s%s","Execution Days of Week",daystr(cfg.event[i]->days));
if(cfg.event[i]->freq) {
sprintf(str,"%u times a day",1440/cfg.event[i]->freq);
......@@ -445,18 +465,23 @@ This is the node number to execute the timed event.
case 4:
SETHELP(WHERE);
/*
`Day of Month to Execute Event:`
Specifies a day of the month (`1-31`) on which to execute this event,
or `Any` to execute event on any and all days of the month.
*/
if(cfg.event[i]->mday)
ultoa(cfg.event[i]->mday,str,10);
else
strcpy(str,"Any");
uifc.input(WIN_MID|WIN_SAV,0,0,"Day of Month to Execute Event (or Any)"
,str,3,K_EDIT);
cfg.event[i]->mday=atoi(str);
`Days of Month to Execute Event:`
Specifies the days of the month (`1-31`, separated by spaces) on which
to execute this event, or `Any` to execute event on any and all days of
the month.
*/
SAFECOPY(str,mdaystr(cfg.event[i]->mdays));
uifc.input(WIN_MID|WIN_SAV,0,0,"Days of Month to Execute Event (or Any)"
,str,16,K_EDIT);
cfg.event[i]->mdays=0;
for(p=str;*p;p++) {
if(!isdigit(*p))
continue;
cfg.event[i]->mdays|=(1<<atoi(p));
while(*p && isdigit(*p))
p++;
}
break;
case 5:
j=0;
......
......@@ -289,13 +289,13 @@ typedef struct { /* External Editors */
typedef struct { /* Generic Timed Event */
char code[LEN_CODE+1], /* Internal code */
days, /* week days to run event */
mday, /* day of month (if non-zero) to run event */
dir[LEN_DIR+1], /* Start-up directory */
cmd[LEN_CMD+1]; /* Command line */
ushort node, /* Node to execute event */
time, /* Time to run event */
freq; /* Frequency to run event */
ulong misc; /* Misc bits */
ulong misc, /* Misc bits */
mdays; /* days of month (if non-zero) to run event */
time_t last; /* Last time event ran */
} event_t;
......
......@@ -99,7 +99,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_fextrs=i;
/***************************/
......@@ -127,7 +127,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_fcomps=i;
/***********************/
......@@ -154,7 +154,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_fviews=i;
/***********************/
......@@ -182,7 +182,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_ftests=i;
/*******************/
......@@ -211,7 +211,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_dlevents=i;
......@@ -247,7 +247,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
/************************/
/* Alternate File Paths */
......@@ -309,7 +309,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<16;j++)
get_int(n,instream); /* 0xffff */
}
}
cfg->total_libs=i;
/********************/
......@@ -420,7 +420,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_txtsecs=i;
fclose(instream);
......@@ -495,7 +495,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
get_int(c,instream);
for(j=0;j<7;j++)
get_int(n,instream);
}
}
cfg->total_xedits=i;
......@@ -525,7 +525,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_xtrnsecs=i;
......@@ -566,7 +566,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
get_int(cfg->xtrn[i]->maxtime,instream);
for(j=0;j<7;j++)
get_int(n,instream);
}
}
cfg->total_xtrns=i;
......@@ -596,12 +596,11 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
get_int(cfg->event[i]->misc,instream);
get_str(cfg->event[i]->dir,instream);
get_int(cfg->event[i]->freq,instream);
get_int(cfg->event[i]->mday,instream);
get_int(cfg->event[i]->mdays,instream);
get_int(c,instream);
for(j=0;j<6;j++)
for(j=0;j<5;j++)
get_int(n,instream);
}
}
cfg->total_events=i;
/********************************/
......@@ -621,7 +620,8 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
if((cfg->natvpgm[i]=(natvpgm_t *)MALLOC(sizeof(natvpgm_t)))==NULL)
return allocerr(instream,error,offset,fname,sizeof(natvpgm_t));
get_str(cfg->natvpgm[i]->name,instream);
cfg->natvpgm[i]->misc=0; }
cfg->natvpgm[i]->misc=0;
}
cfg->total_natvpgms=i;
for(i=0;i<cfg->total_natvpgms;i++) {
if(feof(instream)) break;
......@@ -651,7 +651,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_hotkeys=i;
/************************************/
......@@ -706,7 +706,7 @@ BOOL read_chat_cfg(scfg_t* cfg, char* error)
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_chans=i;
......@@ -727,7 +727,7 @@ BOOL read_chat_cfg(scfg_t* cfg, char* error)
if((cfg->actset[i]=(actset_t *)MALLOC(sizeof(actset_t)))==NULL)
return allocerr(instream,error,offset,fname,sizeof(actset_t));
get_str(cfg->actset[i]->name,instream);
}
}
cfg->total_actsets=i;
......@@ -755,7 +755,7 @@ BOOL read_chat_cfg(scfg_t* cfg, char* error)
get_str(cfg->chatact[i]->out,instream);
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_chatacts=i;
......@@ -821,7 +821,7 @@ BOOL read_chat_cfg(scfg_t* cfg, char* error)
get_int(cfg->page[i]->misc,instream);
for(j=0;j<8;j++)
get_int(n,instream);
}
}
cfg->total_pages=i;
......@@ -871,7 +871,8 @@ long aftol(char *str)
while(str[c]) {
if(str[c]>='A' && str[c]<='Z')
l|=FLAG(str[c]);
c++; }
c++;
}
return(l);
}
......@@ -886,7 +887,8 @@ char *ltoaf(long l,char *str)
if(l&(long)(1L<<c))
str[c]='A'+c;
else str[c]=SP;
c++; }
c++;
}
str[c]=0;
return(str);
}
......
......@@ -1020,11 +1020,9 @@ BOOL DLLCALL write_xtrn_cfg(scfg_t* cfg, int backup_level)
put_int(cfg->event[i]->misc,stream);
put_int(cfg->event[i]->dir,stream);
put_int(cfg->event[i]->freq,stream);
put_int(cfg->event[i]->mday,stream);
c=0;
put_int(c,stream);
put_int(cfg->event[i]->mdays,stream);
n=0;
for(j=0;j<6;j++)
for(j=0;j<5;j++)
put_int(n,stream);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment