1

I'm looking for the exact way to implement the SDL environment variable from a perl script that is the front end for launching a dosbox BBS.

I have the right approach from this link: running-dosbox-completely-headless

I'm just not sure how to implement it from inside the perl script.

export SDL_VIDEODRIVER=dummy

I'm launching dosbox with this script: telnetbbs-0.5

Here's the header. I assume it would need to go somewhere just before or after the first section.

#!/usr/bin/perl -wT
BEGIN {
        delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)};
        $ENV{PATH} = "/bin:/usr/bin";
        $|++;
#        $SIG{__DIE__} = sub { require Carp; Carp::confess(@_); }
      }

I assumed I could manually edit the beginning of the script to set the variable, but that's where I'm stuck.

I have tried adding

$sdl = "export SDL_VIDEODRIVER=dummy";
system($sdl);

Maybe that is the right syntax for running a command from a perl script, but not the way to set the SDL environment variable.

I get the error "Can't exec export": No such file or directory at ./telnetbbs.pl "

I don't want to change SDL globally, just when the script is executed, as I might want to launch the BBS locally, as my pi is connected to a monitor and keyboard. I just don't want it to tie up a user desktop session. In the end I want to create a separate user and have that execute the script and launch dosbox upon connection, with the ability to log on as other users at the same time.

Any help would be greatly appreciated.

1
  • I don’t know Perl, but the $ENV{PATH} = "/bin:/usr/bin"; statement seems to be setting the PATH environment variable. You probably need to do something like that. Commented Aug 1, 2019 at 16:22

1 Answer 1

1

I glanced through the Perl script. It seems to me you should edit this part of the config file, not the Perl script:

##
## This is the command that will launch dosbox and pass it the configuration
## file.  You can add custom dosbox options to the command line below.
##
bbs_cmd = DISPLAY=__DISPLAY__  /usr/bin/dosbox -conf 

Add the environment variable alongside DISPLAY:

bbs_cmd = DISPLAY=__DISPLAY__ SDL_VIDEODRIVER=dummy /usr/bin/dosbox -conf 

This ensures the environment variable is tied to DOSBox. Since you only need it for that single command, there's no need to export it in the Perl code.

2
  • That doesn't seem to work, the window still opens. Could I get some tips on how to set SDL globally or in the Perl script to see if maybe the command line is not setting it properly?
    – Stettin
    Commented Aug 2, 2019 at 3:05
  • I started fiddling with my BBS again and followed these instructions, but this time it worked. One difference is I started off by opening a SSH session, then using "screen" to launch a bash prompt, then launching the telnetbbs.pl script. I marked this as accepted now.
    – Stettin
    Commented Jan 25 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .