Commit 0bf85543 authored by Michael Long's avatar Michael Long Committed by Rob Swindell

Improvements to linux dosemu support

The hardcoded external.bat file has been moved to a templated
/exec/external.bat which can be modified by the sysop. ENV
vars are in there to be able to customize as needed. emusetup.bat
is no longer needed, but still supported. The actual dosemu command line
is now stored in /exec/dosemulaunch.ini and can be customized for
fossil or i/o command lines. the keystroke is now only sent for i/o, and
only sent as \n instead of \r which would trigger undesired behavior in
certain programs. The above 2 files can also be placed in door dirs
to override. ansi.com has been removed as it was not needed. default
external.bat includes cmd lines for share, x00, etc. (user will still
need to provide these in xtrn/dosutils).
parent 572e4c33
$_cpu = "80486"
$_cpu_emu = "fullsim"
$_floppy_a = ""
$_cdrom = ""
$_xms = (1024)
$_ems = (1024)
$_ems_frame = (0xe000)
$_external_char_set = "cp437"
$_internal_char_set = "cp437"
$_term_updfreq = (8)
$_layout = "us"
$_rawkeyboard = (auto)
$_mouse_internal = (on)
$_mouse_dev = ""
$_joy_device = ""
$_lpt1 = ""
$_lp2 = ""
$_speaker = ""
$_sound = (off)
$_sb_dsp = ""
......@@ -98,8 +98,12 @@
; Must install install/termcap or terminfo to use the following TERM setting:
; ExternalTermANSI = ansi-bbs
ExternalTermDumb = dumb
; To change the default dosemu/doscmd path, uncomment and set:
; DOSemuPath =
; To setup the dosemu cmd path and ini:
UseDOSemu = false
DOSemuPath = /usr/bin/dosemu.bin
; leave off dir path to use ctrl dir
DOSemuConfPath = dosemu.conf
; At what size to send the current output buffer regardless of timeout
; ie: Send output whenever there are at least this many bytes waiting.
......
; This contains the command line to execute DOSEMU
;
; You can copy this file to customize for any specific external programs
; that need changes by placing a copy of this file into the external program's
; startup directory.
;
; The following substitutions will be performed on this file:
; $TERM sets 'TERM=linux' (used on events, etc.)
; $CTRLDIR = path to synchronet ctrl dir
; $NODEDIR = path to synchronet node dir
; $DOSEMUBIN = path to dosemu.bin
; $VIRTCONF = appends virtual when needed (ie fossil) (-I"serial { virtual com 1 }")
; $DOSEMUCONF = path to global dosemu conf
; $EXTBAT = batch file to execute (external.bat)
; $EXTLOG = external log (used on events)
; add -I'keystroke "\r"' if you need that behavior back
;
; for com/uart/fossil i/o external programs, put it in the global "cmd" key
; for intercept i/o programs, you can override by putting "cmd" key under [stdio] section
cmd=/usr/bin/env $TERM HOME=$CTRLDIR QUIET=1 DOSDRIVE_D=$NODEDIR NODEDIR=$NODEDIR $DOSEMUBIN -I"video { none }" $VIRTUALCONF -f$DOSEMUCONF -E$EXTBAT -o$NODEDIRdosemu_boot.log $EXTLOG
[stdio]
cmd=/usr/bin/env $TERM HOME=$CTRLDIR QUIET=1 DOSDRIVE_D=$NODEDIR NODEDIR=$NODEDIR $DOSEMUBIN -I"video { none }" -I'keystroke "\n"' $VIRTUALCONF -f$DOSEMUCONF -E$EXTBAT -o$NODEDIRdosemu_boot.log $EXTLOG
@lredir D: linux\fs$NODEDIR >NUL
@lredir E: linux\fs$XTRNDIR >NUL
@lredir F: linux\fs$CTRLDIR >NUL
@lredir G: linux\fs$DATADIR >NUL
@lredir H: linux\fs$EXECDIR >NUL
E:
REM Switch to startup dir, unless its not defined
REM If not defined, go to node dir (external editors use this)
IF "%STARTDIR%"=="" D:
IF NOT "%STARTDIR%"=="" CD %STARTDIR%
REM Optionally call emusetup.bat or put that stuff here for global (in NOEMU)
REM Looks in startup dir, then ctrl dir
IF EXIST EMUSETUP.BAT GOTO EMULOCAL
IF EXIST F:\EMUSETUP.BAT GOTO EMUGLOBAL
IF EXIST E:\DOSUTILS\NUL GOTO NOEMU
IF EXIST H:\DOSUTILS\NUL GOTO NOEMU
ECHO ERROR: No emusetup.bat in E:\%STARTDIR% or F, or DOSUTILS is missing
GOTO EXEC
:EMULOCAL
CALL EMUSETUP.BAT
GOTO EXEC
:EMUGLOBAL
CALL F:\EMUSETUP.BAT
GOTO EXEC
:NOEMU
@set PATH=%PATH%;E:\dosutils;H:\dosutils
REM fossil driver, such as x00, bnu, or dosemu fossil.com
rem IF "$RUNTYPE" == "FOSSIL" @fossil.com >NUL
rem IF "$RUNTYPE" == "FOSSIL" bnu.com /P1 /L0=11520 >NUL
IF "$RUNTYPE" == "FOSSIL" x00.exe eliminate >NUL
REM share.exe for multinode file locking
@share >NUL
GOTO EXEC
:EXEC
$CMDLINE
IF NOT "%1" == "TEST" exitemu
......@@ -28,7 +28,6 @@
# NO_X = Don't include build conio library (ciolib) for X
# NO_GTK = Don't build GTK-based sysop tools
# X_PATH = /path/to/X (if not /usr/X11R6)
# USE_DOSEMU = Set to 1 to enable Linux-DOSEMU support
# the magic bit:
MKFLAGS += MAKEFLAGS=
......@@ -131,10 +130,6 @@ ifdef X_PATH
MKFLAGS += X_PATH=$(X_PATH)
endif
ifdef USE_DOSEMU
MKFLAGS += USE_DOSEMU=$(USE_DOSEMU)
endif
# Check for GLADE
ifndef NO_GTK
ifeq ($(shell pkg-config libglade-2.0 --exists && echo YES),YES)
......
......@@ -5,11 +5,6 @@ cmake_minimum_required(VERSION 2.8.11)
INCLUDE (../build/SynchronetMacros.cmake)
INCLUDE (CheckFunctionExists)
if(UNIX)
set(SBBS_USE_DOSEMU FALSE
CACHE BOOL "Set if you intend on using dosemu on Linux"
)
endif()
set(SBBS_BUILD_JSDOCS FALSE
CACHE INTERNAL "DEVELOPER ONLY - Build only to run jsdocs.js (not a BBS)"
)
......
......@@ -11,8 +11,6 @@
# Optional build targets: dlls, utils, mono, all (default) #
#########################################################################
# $Id: GNUmakefile,v 1.248 2020/04/03 19:54:31 rswindell Exp $
PWD := $(shell pwd)
SRC_ROOT ?= ${PWD}/..
include $(SRC_ROOT)/build/Common.gmake
......@@ -43,10 +41,6 @@ ifdef PREFIX
CFLAGS += -DPREFIX=$(PREFIX)
endif
ifdef USE_DOSEMU
CFLAGS += -DUSE_DOSEMU
endif
ifdef DONT_BLAME_SYNCHRONET
CFLAGS += -DDONT_BLAME_SYNCHRONET
endif
......
......@@ -223,8 +223,11 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
result=_not;
if(startup->options&BBS_OPT_NO_DOS)
break;
#if defined(_WIN32) || (defined(__linux__) && defined(USE_DOSEMU)) || defined(__FreeBSD__)
#if defined(_WIN32) || defined(__FreeBSD__)
result=!_not;
#elif defined(__linux__)
if (startup->usedosemu)
result=!_not;
#endif
break;
case AR_WIN32:
......
......@@ -121,9 +121,6 @@ struct {
struct utsname name;
char sbbsuser[9]; /* Historical UName limit of 8 chars */
char sbbsgroup[17]; /* Can't find historical limit for group names */
#ifdef __linux__
BOOL use_dosemu;
#endif
} params; /* Build parameters */
#define MAKEFILE "/tmp/SBBSmakefile"
......@@ -230,9 +227,6 @@ int main(int argc, char **argv)
SAFECOPY(params.sbbsuser,p);
if((p=getenv("GROUP"))!=NULL)
SAFECOPY(params.sbbsgroup,p);
#ifdef __linux__
params.use_dosemu=FALSE;
#endif
sscanf("$Revision: 1.100 $", "%*s %s", revision);
umask(077);
......@@ -380,9 +374,7 @@ int main(int argc, char **argv)
sprintf(mopt[i++],"%-27.27s%s","Make Command-line",params.make_cmdline);
sprintf(mopt[i++],"%-27.27s%s","File Owner",params.sbbsuser);
sprintf(mopt[i++],"%-27.27s%s","File Group",params.sbbsgroup);
#ifdef __linux__
sprintf(mopt[i++],"%-27.27s%s","Integrate DOSEmu support",params.use_dosemu?"Yes":"No");
#endif
sprintf(mopt[i++],"%-27.27s","Start Installation...");
mopt[i][0]=0;
......@@ -488,26 +480,8 @@ int main(int argc, char **argv)
"\n";
uifc.input(WIN_MID,0,0,"",params.sbbsgroup,32,K_EDIT);
break;
#ifdef __linux__
case 11:
strcpy(opt[0],"Yes");
strcpy(opt[1],"No");
opt[2][0]=0;
i=params.use_dosemu?0:1;
uifc.helpbuf= "`Include DOSEmu Support`\n"
"\nToDo: Add help.";
i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0
,"Integrate DOSEmu support into Synchronet?",opt);
if(!i)
params.use_dosemu=TRUE;
else if(i==1)
params.use_dosemu=FALSE;
i=0;
break;
case 12:
#else
case 11:
#endif
install_sbbs(distlist[dist],distlist[dist]->type==LOCAL_FILE?NULL:distlist[dist]->servers[server]);
bail(0);
break;
......@@ -754,11 +728,6 @@ void install_sbbs(dist_t *dist,struct server_ent_t *server) {
sprintf(sbbsgroup,"SBBSGROUP=%s",params.sbbsgroup);
putenv(sbbsgroup);
}
#ifdef __linux__
if(params.use_dosemu==TRUE) {
putenv("USE_DOSEMU=1");
}
#endif
if(params.usebcc)
putenv("bcc=1");
......
......@@ -251,6 +251,7 @@ void sbbs_read_ini(
const char* section;
const char* default_term_ansi;
const char* default_dosemu_path;
const char* default_dosemuconf_path;
char value[INI_MAX_VALUE_LEN];
str_list_t list;
global_startup_t global_buf;
......@@ -366,10 +367,14 @@ void sbbs_read_ini(
default_dosemu_path="/usr/local/bin/doscmd";
#else
default_dosemu_path="/usr/bin/dosemu.bin";
default_dosemuconf_path="";
#endif
bbs->usedosemu=iniGetBool(list,section,"UseDOSemu",TRUE);
SAFECOPY(bbs->dosemu_path
,iniGetString(list,section,"DOSemuPath",default_dosemu_path,value));
SAFECOPY(bbs->dosemuconf_path
,iniGetString(list,section,"DOSemuConfPath",default_dosemuconf_path,value));
SAFECOPY(bbs->answer_sound
,iniGetString(list,section,strAnswerSound,nulstr,value));
......@@ -839,7 +844,10 @@ BOOL sbbs_write_ini(
break;
if(!iniSetString(lp,section,"DOSemuPath",bbs->dosemu_path,&style))
break;
if(!iniSetString(lp,section,"DOSemuConfPath",bbs->dosemuconf_path,&style))
break;
if(!iniSetBool(lp,section,"UseDOSemu",bbs->usedosemu,&style))
break;
if(!iniSetString(lp,section,strAnswerSound,bbs->answer_sound,&style))
break;
if(!iniSetString(lp,section,strHangupSound,bbs->hangup_sound,&style))
......
......@@ -113,12 +113,14 @@ typedef struct {
/* Paths */
char ctrl_dir[128];
char dosemu_path[128];
char dosemuconf_path[128];
char temp_dir[128];
char answer_sound[128];
char hangup_sound[128];
char ini_fname[128];
/* Miscellaneous */
BOOL usedosemu;
char xtrn_term_ansi[32]; /* external ANSI terminal type (e.g. "ansi-bbs") */
char xtrn_term_dumb[32]; /* external dumb terminal type (e.g. "dumb") */
char host_name[128];
......
......@@ -649,6 +649,79 @@ char* ascii_str(uchar* str)
return((char*)str);
}
char* replace_named_values(const char* src
,char* buf
,size_t buflen /* includes '\0' terminator */
,const char* escape_seq
,named_string_t* string_list
,named_int_t* int_list
,BOOL case_sensitive)
{
char val[32];
size_t i;
size_t esc_len=0;
size_t name_len;
size_t value_len;
char* p = buf;
int (*cmp)(const char*, const char*, size_t);
if(case_sensitive)
cmp=strncmp;
else
cmp=strnicmp;
if(escape_seq!=NULL)
esc_len = strlen(escape_seq);
while(*src && (size_t)(p-buf) < buflen-1) {
if(esc_len) {
if(cmp(src, escape_seq, esc_len)!=0) {
*p++ = *src++;
continue;
}
src += esc_len; /* skip the escape seq */
}
if(string_list) {
for(i=0; string_list[i].name!=NULL /* terminator */; i++) {
name_len = strlen(string_list[i].name);
if(cmp(src, string_list[i].name, name_len)==0) {
value_len = strlen(string_list[i].value);
if((p-buf)+value_len > buflen-1) /* buffer overflow? */
value_len = (buflen-1)-(p-buf); /* truncate value */
memcpy(p, string_list[i].value, value_len);
p += value_len;
src += name_len;
break;
}
}
if(string_list[i].name!=NULL) /* variable match */
continue;
}
if(int_list) {
for(i=0; int_list[i].name!=NULL /* terminator */; i++) {
name_len = strlen(int_list[i].name);
if(cmp(src, int_list[i].name, name_len)==0) {
SAFEPRINTF(val,"%d",int_list[i].value);
value_len = strlen(val);
if((p-buf)+value_len > buflen-1) /* buffer overflow? */
value_len = (buflen-1)-(p-buf); /* truncate value */
memcpy(p, val, value_len);
p += value_len;
src += name_len;
break;
}
}
if(int_list[i].name!=NULL) /* variable match */
continue;
}
*p++ = *src++;
}
*p=0; /* terminate string in destination buffer */
return(buf);
}
/****************************************************************************/
/* Condense consecutive white-space chars in a string to single spaces */
/****************************************************************************/
......
......@@ -39,6 +39,9 @@ DLLEXPORT char * remove_ctrl_a(const char* instr, char* outstr);
DLLEXPORT char ctrl_a_to_ascii_char(char code);
DLLEXPORT char * truncstr(char* str, const char* set);
DLLEXPORT char * ascii_str(uchar* str);
DLLEXPORT char * replace_named_values(const char* src ,char* buf, size_t buflen,
const char* escape_seq, named_string_t* string_list,
named_int_t* int_list, BOOL case_sensitive);
DLLEXPORT char * condense_whitespace(char* str);
DLLEXPORT char exascii_to_ascii_char(uchar ch);
DLLEXPORT BOOL findstr(const char *insearch, const char *fname);
......
......@@ -1763,7 +1763,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
#endif
break;
case AR_DOS:
#if defined(_WIN32) || (defined(__linux__) && defined(USE_DOSEMU)) || defined(__FreeBSD__)
#if defined(_WIN32) || defined(__linux__) || defined(__FreeBSD__)
result=!not;
#else
result=not;
......
This diff is collapsed.
......@@ -1595,7 +1595,7 @@ bool sbbs_t::exec_xtrn(uint xtrnnum)
char drop_file[MAX_PATH + 1];
char startup_dir[MAX_PATH + 1];
#if defined(__linux__) && defined(USE_DOSEMU)
#if defined(__linux__)
if(cfg.xtrn[xtrnnum]->cmd[0] != '?' && cfg.xtrn[xtrnnum]->cmd[0] != '*' && !(cfg.xtrn[xtrnnum]->misc & XTRN_NATIVE)) {
SAFEPRINTF2(startup_dir, "%s\\%s", DOSEMU_XTRN_DRIVE, getdirname(cfg.xtrn[xtrnnum]->path));
backslash(startup_dir);
......
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