...
 
Commits (1)
  • Rob Swindell's avatar
    More Linux-DOSemu ease of use-isms (cmdline specifier magic) · 53883886
    Rob Swindell authored
    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.
    53883886
......@@ -850,11 +850,19 @@ enum { /* readmail and delmailidx which types */
#define EX_WILDCARD 0
#endif
/* Linux-DOSemu path/drive hackeroo */
#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:"
#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 */
#define TG_ECHO (1<<0) /* Turn on telnet echo */
......
......@@ -1883,10 +1883,23 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
strncat(cmd,ultoa((ulong)cur_cps*10,str,10), avail);
break;
case 'F': /* File path */
strncat(cmd,QUOTED_STRING(instr[i],fpath,str,sizeof(str)), avail);
#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);
break;
case 'G': /* Temp directory */
strncat(cmd,cfg.temp_dir, avail);
#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);
break;
case 'H': /* Socket Handle */
strncat(cmd,ultoa(client_socket_dup,str,10), avail);
......@@ -1897,7 +1910,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case 'J':
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_DATA_DRIVE "\\", avail);
strncat(cmd, DOSEMU_DATA_DIR, avail);
else
#endif
strncat(cmd,cfg.data_dir, avail);
......@@ -1905,7 +1918,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case 'K':
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_CTRL_DRIVE "\\", avail);
strncat(cmd, DOSEMU_CTRL_DIR, avail);
else
#endif
strncat(cmd,cfg.ctrl_dir, avail);
......@@ -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) */
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_NODE_DRIVE "\\", avail);
strncat(cmd, DOSEMU_NODE_DIR, avail);
else
#endif
strncat(cmd,cfg.node_dir, avail);
......@@ -1962,7 +1975,12 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
strncat(cmd,comspec, avail);
break;
case 'Z':
strncat(cmd,cfg.text_dir, avail);
#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);
break;
case '~': /* DOS-compatible (8.3) filename */
#ifdef _WIN32
......@@ -1977,7 +1995,7 @@ char* sbbs_t::cmdstr(const char *instr, const char *fpath, const char *fspec, ch
case '!': /* EXEC Directory */
#if defined(__linux__) && defined(USE_DOSEMU)
if(mode != EX_UNSPECIFIED && !(mode & EX_NATIVE))
strncat(cmd, DOSEMU_EXEC_DRIVE "\\", avail);
strncat(cmd, DOSEMU_EXEC_DIR, avail);
else
#endif
strncat(cmd,cfg.exec_dir, avail);
......
......@@ -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));
#elif defined(__linux__) && defined(USE_DOSEMU)
/* These drive mappings must match the Linux/DOSEMU patch in xtrn.cpp: */
SAFECOPY(node_dir, DOSEMU_NODE_DRIVE);
SAFECOPY(ctrl_dir, DOSEMU_CTRL_DRIVE);
SAFECOPY(data_dir, DOSEMU_DATA_DRIVE);
SAFECOPY(exec_dir, DOSEMU_EXEC_DRIVE);
SAFECOPY(node_dir, DOSEMU_NODE_DIR);
SAFECOPY(ctrl_dir, DOSEMU_CTRL_DIR);
SAFECOPY(data_dir, DOSEMU_DATA_DIR);
SAFECOPY(exec_dir, DOSEMU_EXEC_DIR);
SAFECOPY(text_dir, DOSEMU_TEXT_DIR);
SAFECOPY(temp_dir, DOSEMU_TEMP_DIR);
#endif
}
......