This is an old revision of the document!


Integrate Linux Shell Apps

Linux shell applications can be added to Synchronet by using the built in js function bbs.exec(); and must pass special command line arguments that instruct sbbs to pipe the shell i/o to the client terminal.

ie: bbs.exec('links2 "google.com/search?q='+google+'"', EX_STDIO|EX_NATIVE|EX_NOLOG);

This method can also be used to launch DOS/Windows executibles as well!

Links2 Web Browser

links2 an https compliant graphical text mode www browser typically run from in linux shell. For use with Synchronet we won't configure the graphics card and/or image support, so the output is monochrome and behaves more like a gopher client with enhanced features.

On a Debian system, make sure links2 is installed:

  $ sudo apt-get install links2

Add links2 to SBBS

Add links2 to sbbs as an external program as any other door:

[Links2 Web Browser]
 1: Name                       Links2 Web Browser
 2: Internal Code              LINKS2
 3: Start-up Directory
 4: Command Line               ?links2.js
 5: Clean-up Command Line
 6: Execution Cost             None
 7: Access Requirements
 8: Execution Requirements
 9: Multiple Concurrent Users  Yes
10: Intercept I/O              No
11: Native Executable/Script   No
12: Use Shell or New Context   No
13: Modify User Data           No
14: Execute on Event           No
15: Pause After Execution      No
16: BBS Drop File Type         None
17: Place Drop File In         Node Directory
18: Time Options...

Which (Help or Quit):           

Add to Synchronet Command Shell

edit your *.src command shell script and add:

ie: cmdkey /B
        exec_bin "links2.js"
        end_cmd

and recompile

/sbbs/exec $ ./baja myshell

add option to your menu *.ans; *.msg; *.asc, etc as appropriate.

links2 example script

load('sbbsdefs.js');
// links2.js

console.putmsg('\r\n\1n \1glinks v2.18 - text mode www browser\r\n\r\n');
console.putmsg(' \1gPressing [ESC] in Links2 for Menu or read Links2 in Text Section\r\n\r\n');
console.putmsg(' \1h\1yG\1n\1google Search  \1h\1gE\1n\1gnter URL \1h\1wor  \1rQ\1guit \1w');
var ch = console.getkeys("GEQ",K_UPPER);
if(ch === '') ch = 'G';

switch (ch) {
        case 'G':
                console.putmsg('\r\n \1gGoogle search term? \1h\1g');
                var google = console.getstr();
                if(google.length<1)
                        console.putmsg('\r\n\r\n\1g Search term omited, using default\r\n')
                else
                        console.putmsg('\r\n\r\n\1n \1gGoogling \1h\1y'+google+'\r\n');
                console.putmsg(' \1h\1yQ\1n\1guits the browser.\r\n\r\n');
                console.pause();
                google = google.replace(' ', '+');
                
                bbs.exec('links2 "google.com/search?q='+google+'"', EX_STDIO|EX_NATIVE|EX_NOLOG);
                console.putmsg('\r\n\r\n\1g  Returning to '+system.name);
                mswait(1000);
                exit();
        break;

        case 'E':
                console.putmsg('\r\n\r\n \1gEnter URL: \1h\1g');
                var url = console.getstr();
                var v =  url.indexOf(".")
                if (v < 0) {
                        url = 'http://www.aboutlinux.info/2007/02/links2-cross-platform-console-based-web.html';
                        mswait(1000);

                }
                console.putmsg('\r\n\r\n\1n \1gLoading links2 \r\n');
                console.putmsg(' \1h\1yQ\1n\1guits the browser.\r\n\r\n');
                console.pause();
                url = url.replace(' ', '+');
                bbs.exec('links2 "'+url+'"', EX_STDIO|EX_NATIVE|EX_NOLOG);
                console.putmsg('\r\n\r\n\1g  Returning to '+system.name);
                mswait(1000);
                exit();
        break;

        case 'Q':
                console.putmsg('\r\n\1g  Returning to '+system.name);
                mswait(1000);
                exit();
        break;

        case '^M':
        console.putmsg('\r\n\1g Returning to '+system.name);
        mswait(1000);
        exit();
        break;
}

See Also

howto/linuxapps.1619279936.txt · Last modified: 2021/04/24 08:58 by mortifis
Back to top
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0