Skip to content
Snippets Groups Projects
Commit 1b604da8 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Simplify Linux-DOSEMU door setup

Allows %f (drop file) and %s (startup-directory) to be specified on the external program's command-line and expand to the paths that DOSEMU will understand. No more hard-coding "D:\" or "E:\" and the drop filename on the command-line required.

Also (for all builds), include the door's startup directory for %s specifier on the clean-up command-line. This just seems like an oversight.
parent 5830a25b
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #788 passed
...@@ -849,6 +849,12 @@ enum { /* readmail and delmailidx which types */ ...@@ -849,6 +849,12 @@ enum { /* readmail and delmailidx which types */
#define EX_WILDCARD 0 #define EX_WILDCARD 0
#endif #endif
#define DOSEMU_NODE_DRIVE "D:"
#define DOSEMU_XTRN_DRIVE "E:" // Parent of xtrn's startup-dir
#define DOSEMU_CTRL_DRIVE "F:"
#define DOSEMU_DATA_DRIVE "G:"
#define DOSEMU_EXEC_DRIVE "H:"
/* telnet_gate() mode bits */ /* telnet_gate() mode bits */
#define TG_ECHO (1<<0) /* Turn on telnet echo */ #define TG_ECHO (1<<0) /* Turn on telnet echo */
#define TG_CRLF (1<<1) /* Expand sole CR to CRLF */ #define TG_CRLF (1<<1) /* Expand sole CR to CRLF */
......
...@@ -1216,11 +1216,11 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir) ...@@ -1216,11 +1216,11 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
/* Default locations that can be overridden by /* Default locations that can be overridden by
* the sysop in emusetup.bat */ * the sysop in emusetup.bat */
const char nodedrive[] = "D:"; const char nodedrive[] = DOSEMU_NODE_DRIVE;
const char xtrndrive[] = "E:"; const char xtrndrive[] = DOSEMU_XTRN_DRIVE;
const char ctrldrive[] = "F:"; const char ctrldrive[] = DOSEMU_CTRL_DRIVE;
const char datadrive[] = "G:"; const char datadrive[] = DOSEMU_DATA_DRIVE;
const char execdrive[] = "H:"; const char execdrive[] = DOSEMU_EXEC_DRIVE;
SAFECOPY(str,startup_dir); SAFECOPY(str,startup_dir);
if(*(p=lastchar(str))=='/') /* kill trailing slash */ if(*(p=lastchar(str))=='/') /* kill trailing slash */
......
...@@ -193,10 +193,10 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl ...@@ -193,10 +193,10 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl
GetShortPathName(cfg.temp_dir,temp_dir,sizeof(temp_dir)); GetShortPathName(cfg.temp_dir,temp_dir,sizeof(temp_dir));
#elif defined(__linux__) && defined(USE_DOSEMU) #elif defined(__linux__) && defined(USE_DOSEMU)
/* These drive mappings must match the Linux/DOSEMU patch in xtrn.cpp: */ /* These drive mappings must match the Linux/DOSEMU patch in xtrn.cpp: */
SAFECOPY(node_dir, "D:"); SAFECOPY(node_dir, DOSEMU_NODE_DRIVE);
SAFECOPY(ctrl_dir, "F:"); SAFECOPY(ctrl_dir, DOSEMU_CTRL_DRIVE);
SAFECOPY(data_dir, "G:"); SAFECOPY(data_dir, DOSEMU_DATA_DRIVE);
SAFECOPY(exec_dir, "H:"); SAFECOPY(exec_dir, DOSEMU_EXEC_DRIVE);
#endif #endif
} }
...@@ -1606,17 +1606,33 @@ bool sbbs_t::exec_xtrn(uint xtrnnum) ...@@ -1606,17 +1606,33 @@ bool sbbs_t::exec_xtrn(uint xtrnnum)
removecase(str); /* reason it's there */ removecase(str); /* reason it's there */
} }
char drop_file[MAX_PATH + 1];
char startup_dir[MAX_PATH + 1];
#if defined(__linux__) && defined(USE_DOSEMU)
if(!(cfg.xtrn[xtrnnum]->misc & XTRN_NATIVE)) {
SAFEPRINTF(startup_dir, "%s\\%s", DOSEMU_XTRN_DRIVE, getdirname(cfg.xtrn[xtrnnum]->path));
backslash(startup_dir);
if(cfg.xtrn[xtrnnum]->misc & STARTUPDIR)
SAFEPRINTF(drop_file, "%s%s", startup_dir, getfname(path));
else
SAFEPRINTF(drop_file, "%s\\%s", DOSEMU_NODE_DRIVE, getfname(path));
}
else
#endif
{
SAFECOPY(startup_dir, cfg.xtrn[xtrnnum]->path);
SAFECOPY(drop_file, path);
}
start=time(NULL); start=time(NULL);
external(cmdstr(cfg.xtrn[xtrnnum]->cmd,path external(cmdstr(cfg.xtrn[xtrnnum]->cmd, drop_file, startup_dir, NULL)
,cfg.xtrn[xtrnnum]->path
,NULL)
,mode ,mode
,cfg.xtrn[xtrnnum]->path); ,cfg.xtrn[xtrnnum]->path);
end=time(NULL); end=time(NULL);
if(cfg.xtrn[xtrnnum]->misc&FREETIME) if(cfg.xtrn[xtrnnum]->misc&FREETIME)
starttime+=end-start; starttime+=end-start;
if(cfg.xtrn[xtrnnum]->clean[0]) { if(cfg.xtrn[xtrnnum]->clean[0]) {
external(cmdstr(cfg.xtrn[xtrnnum]->clean,path,nulstr,NULL) external(cmdstr(cfg.xtrn[xtrnnum]->clean, drop_file, startup_dir, NULL)
,mode&~(EX_STDIN|EX_CONIO), cfg.xtrn[xtrnnum]->path); ,mode&~(EX_STDIN|EX_CONIO), cfg.xtrn[xtrnnum]->path);
} }
/* Re-open the logfile */ /* Re-open the logfile */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment