Commit f3e82d4f authored by rswindell's avatar rswindell
Browse files

Added support for background event execution (for non-exclusive events) using new EX_BG mode.

parent e46abfda
......@@ -1207,7 +1207,7 @@ void event_thread(void* arg)
#endif
sbbs->external(
sbbs->cmdstr(sbbs->cfg.qhub[i]->call,nulstr,nulstr,NULL)
,EX_OFFLINE);
,EX_OFFLINE|EX_BG);
// status(STATUS_WFC);
}
}
......@@ -1249,7 +1249,7 @@ void event_thread(void* arg)
#endif
sbbs->external(
sbbs->cmdstr(sbbs->cfg.phub[i]->call,nulstr,nulstr,NULL)
,EX_OFFLINE);
,EX_OFFLINE|EX_BG);
// status(STATUS_WFC);
}
}
......@@ -1379,9 +1379,12 @@ void event_thread(void* arg)
}
strcpy(str,sbbs->cfg.event[i]->code);
eprintf("Running event: %s",strupr(str));
int ex_mode = EX_OFFLINE;
if(!(sbbs->cfg.event[i]->misc&EVENT_EXCL))
ex_mode |= EX_BG;
sbbs->external(
sbbs->cmdstr(sbbs->cfg.event[i]->cmd,nulstr,nulstr,NULL)
,EX_OFFLINE
,ex_mode
,sbbs->cfg.event[i]->dir);
sbbs->cfg.event[i]->last=time(NULL);
sprintf(str,"%stime.dab",sbbs->cfg.ctrl_dir);
......
......@@ -700,6 +700,7 @@ enum { /* readmail and delmailidx which types */
#define EX_POPEN (1<<7) /* Leave COM port open */
#define EX_OFFLINE (1<<8) /* Run this program offline */
#define EX_NATIVE (1<<9) /* Native 32-bit application */
#define EX_BG (1<<10) /* Back-ground/detached process */
#define OS2_POPEN (1<<0) /* Leave COM port open */
......
......@@ -218,7 +218,8 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
bool native=false; // DOS program by default
bool nt=false; // WinNT/2K?
bool was_online=true;
uint i;
bool rio_abortable_save;
uint i;
time_t hungup=0;
HANDLE vxd=INVALID_HANDLE_VALUE;
HANDLE rdslot=INVALID_HANDLE_VALUE;
......@@ -517,12 +518,14 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
ReleaseMutex(exec_mutex);
/* Disable Ctrl-C checking */
bool rio_abortable_save=rio_abortable;
rio_abortable=false;
if(!(mode&EX_OFFLINE)) {
rio_abortable_save=rio_abortable;
rio_abortable=false;
}
// Executing app, monitor
// Executing app in foreground?, monitor
retval=STILL_ACTIVE;
while(1) {
while(!(mode&EX_BG)) {
if(!online && !(mode&EX_OFFLINE)) { // Tell VXD/VDD and external that user hung-up
if(was_online) {
logline("X!","Hung-up in external program");
......@@ -709,7 +712,7 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
}
}
if(retval==STILL_ACTIVE)
if(!(mode&EX_BG) && retval==STILL_ACTIVE)
TerminateProcess(process_info.hProcess, GetLastError());
XTRN_CLEANUP;
......@@ -725,14 +728,17 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
}
}
curatr=0; // Can't guarantee current attributes
if(!(mode&EX_OFFLINE)) {
curatr=0; // Can't guarantee current attributes
rio_abortable=rio_abortable_save; // Restore abortable state
rio_abortable=rio_abortable_save; // Restore abortable state
/* Got back to Text/NVT mode */
sprintf(str,"%c%c%c",TELNET_IAC,TELNET_DONT,TELNET_BINARY);
putcom(str,3);
telnet_mode&=~TELNET_MODE_BIN_RX;
/* Got back to Text/NVT mode */
sprintf(str,"%c%c%c",TELNET_IAC,TELNET_DONT,TELNET_BINARY);
putcom(str,3);
telnet_mode&=~TELNET_MODE_BIN_RX;
}
// lprintf("%s returned %d",realcmdline, retval);
......
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