added per-override run feature

This commit is contained in:
Evgeniy Kozhuhovskiy
2005-10-24 14:04:37 +00:00
parent e55de5023e
commit 40556b610a
8 changed files with 44 additions and 11 deletions
+5
View File
@@ -1,3 +1,8 @@
2005-10-24 Evgeniy Kozhuhovskiy <ugenk@mgts.by>
* bforce/sess_call.c (call_system): added possibility to run
external script for each line in override
2005-09-03 Andrey Slusar <anray@users.sourceforge.net>
* bforce/prot_emsi_misc.c (emsi_parsedat): correct time_t arg
+7
View File
@@ -375,6 +375,13 @@ static int proc_override(s_override *dest, char *value)
(*p)->sIpaddr = xstrcpy(arg);
key = NULL;
}
else if( strcasecmp(key, "run") == 0)
{
if( (*p)->run )
free((*p)->run);
(*p)->run = xstrcpy(arg);
key = NULL;
}
else if( strcasecmp(key, "worktime") == 0 )
{
if( timevec_parse_list(&((*p)->worktime), arg) == -1 )
+9 -1
View File
@@ -538,7 +538,8 @@ int call_system_tcpip(void)
int call_system(s_faddr addr, const s_bforce_opts *opts)
{
int rc = 0;
int rc = 0;
int runrc = 0;
char abuf[BF_MAXADDRSTR+1];
char *p_lockdir = NULL;
char *errmsg = NULL;
@@ -668,6 +669,13 @@ do_session:
errmsg = "cannot lock address";
gotoexit(BFERR_SYSTEM_LOCKED);
}
if( strlen(state.override.run) > 0 )
{
if ( (runrc = system(state.override.run) != 0 ))
{
logerr("run script \"%s\" executed with non-zero return value", state.override.run);
}
}
setproctitle("bforce calling %.32s, %.32s",
ftn_addrstr(abuf, state.node.addr), state.node.phone);
+2 -1
View File
@@ -141,7 +141,8 @@ typedef struct override {
char *sPhone;
char *sFlags;
s_timevec worktime;
s_timevec freqtime;
s_timevec freqtime;
char *run;
struct override *hidden; /* Hidden lines list */
} s_override;