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

More Linux-DOSemu ease of use-isms (cmdline specifier magic)

Support temp_dir (%g) and text_dir %(z) expansion to magic DOSemu drives/paths.
Use DOSemu-compatible temp_dir and text_dir paths in drop files.
Automatically recognize native node_dir paths in %f (e.g. editor temp files) and replace with DOSemu equivalent.
parent ae36a7b4
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #792 passed
...@@ -850,11 +850,19 @@ enum { /* readmail and delmailidx which types */ ...@@ -850,11 +850,19 @@ enum { /* readmail and delmailidx which types */
#define EX_WILDCARD 0 #define EX_WILDCARD 0
#endif #endif
/* Linux-DOSemu path/drive hackeroo */
#define DOSEMU_NODE_DRIVE "D:" #define DOSEMU_NODE_DRIVE "D:"
#define DOSEMU_XTRN_DRIVE "E:" // Parent of xtrn's startup-dir #define DOSEMU_XTRN_DRIVE "E:" // Parent of xtrn's startup-dir
#define DOSEMU_CTRL_DRIVE "F:" #define DOSEMU_CTRL_DRIVE "F:"
#define DOSEMU_DATA_DRIVE "G:" #define DOSEMU_DATA_DRIVE "G:"
#define DOSEMU_EXEC_DRIVE "H:" #define DOSEMU_EXEC_DRIVE "H:"
#define DOSEMU_NODE_DIR DOSEMU_NODE_DRIVE "\\"
#define DOSEMU_XTRN_DIR DOSEMU_XTRN_DRIVE "\\"
#define DOSEMU_CTRL_DIR DOSEMU_CTRL_DRIVE "\\"
#define DOSEMU_DATA_DIR DOSEMU_DATA_DRIVE "\\"
#define DOSEMU_EXEC_DIR DOSEMU_EXEC_DRIVE "\\"
#define DOSEMU_TEMP_DIR DOSEMU_NODE_DRIVE "\\TEMP\\"
#define DOSEMU_TEXT_DIR DOSEMU_CTRL_DRIVE "\\..\\TEXT\\"
/* 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 */
......
...@@ -1883,9 +1883,22 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1883,9 +1883,22 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
strncat(cmd,ultoa((ulong)cur_cps*10,str,10), avail); strncat(cmd,ultoa((ulong)cur_cps*10,str,10), avail);
break; break;
case 'F': /* File path */ case 'F': /* File path */
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE)
&& strncmp(fpath, cfg.node_dir, strlen(cfg.node_dir)) == 0) {
strncat(cmd, DOSEMU_NODE_DIR, avail);
strncat(cmd, fpath + strlen(cfg.node_dir), avail);
}
else
#endif
strncat(cmd,QUOTED_STRING(instr[i],fpath,str,sizeof(str)), avail); strncat(cmd,QUOTED_STRING(instr[i],fpath,str,sizeof(str)), avail);
break; break;
case 'G': /* Temp directory */ case 'G': /* Temp directory */
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_TEMP_DIR, avail);
else
#endif
strncat(cmd,cfg.temp_dir, avail); strncat(cmd,cfg.temp_dir, avail);
break; break;
case 'H': /* Socket Handle */ case 'H': /* Socket Handle */
...@@ -1897,7 +1910,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1897,7 +1910,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case 'J': case 'J':
#if defined(__linux__) && defined(USE_DOSEMU) #if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE)) if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_DATA_DRIVE "\\", avail); strncat(cmd, DOSEMU_DATA_DIR, avail);
else else
#endif #endif
strncat(cmd,cfg.data_dir, avail); strncat(cmd,cfg.data_dir, avail);
...@@ -1905,7 +1918,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1905,7 +1918,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case 'K': case 'K':
#if defined(__linux__) && defined(USE_DOSEMU) #if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE)) if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_CTRL_DRIVE "\\", avail); strncat(cmd, DOSEMU_CTRL_DIR, avail);
else else
#endif #endif
strncat(cmd,cfg.ctrl_dir, avail); strncat(cmd,cfg.ctrl_dir, avail);
...@@ -1919,7 +1932,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1919,7 +1932,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case 'N': /* Node Directory (same as SBBSNODE environment var) */ case 'N': /* Node Directory (same as SBBSNODE environment var) */
#if defined(__linux__) && defined(USE_DOSEMU) #if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE)) if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_NODE_DRIVE "\\", avail); strncat(cmd, DOSEMU_NODE_DIR, avail);
else else
#endif #endif
strncat(cmd,cfg.node_dir, avail); strncat(cmd,cfg.node_dir, avail);
...@@ -1962,6 +1975,11 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1962,6 +1975,11 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
strncat(cmd,comspec, avail); strncat(cmd,comspec, avail);
break; break;
case 'Z': case 'Z':
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_TEXT_DIR, avail);
else
#endif
strncat(cmd,cfg.text_dir, avail); strncat(cmd,cfg.text_dir, avail);
break; break;
case '~': /* DOS-compatible (8.3) filename */ case '~': /* DOS-compatible (8.3) filename */
...@@ -1977,7 +1995,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch ...@@ -1977,7 +1995,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case '!': /* EXEC Directory */ case '!': /* EXEC Directory */
#if defined(__linux__) && defined(USE_DOSEMU) #if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE)) if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_EXEC_DRIVE "\\", avail); strncat(cmd, DOSEMU_EXEC_DIR, avail);
else else
#endif #endif
strncat(cmd,cfg.exec_dir, avail); strncat(cmd,cfg.exec_dir, avail);
......
...@@ -193,10 +193,12 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl ...@@ -193,10 +193,12 @@ 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, DOSEMU_NODE_DRIVE); SAFECOPY(node_dir, DOSEMU_NODE_DIR);
SAFECOPY(ctrl_dir, DOSEMU_CTRL_DRIVE); SAFECOPY(ctrl_dir, DOSEMU_CTRL_DIR);
SAFECOPY(data_dir, DOSEMU_DATA_DRIVE); SAFECOPY(data_dir, DOSEMU_DATA_DIR);
SAFECOPY(exec_dir, DOSEMU_EXEC_DRIVE); SAFECOPY(exec_dir, DOSEMU_EXEC_DIR);
SAFECOPY(text_dir, DOSEMU_TEXT_DIR);
SAFECOPY(temp_dir, DOSEMU_TEMP_DIR);
#endif #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment