Home

Awesome

jSH

jSH logo

A Javascript scripting engine for DOS

jSH is a script interpreter for DOS based operating systems like MS-DOS, FreeDOS or any DOS based Windows (like 95, 98, ME). The focus is on file io and text mode user interfaces.

jSH is a small side project to DOjS, a Javascript coding environment for MS-DOS supporting graphics, sound, etc. including a built in editor and much more

The following script e.g. renames all file extensions in a given directory:

if (args.length < 3) {
	Println("Usage:");
	Println("   jSH.exe renall.js <dir> <old ext> <new ext>");
	Exit(1);
}

var dir = args[0];
var oldExt = args[1].toUpperCase();
var newExt = args[2].toUpperCase();

var files = List(dir);
for (var i = 0; i < files.length; i++) {
	var oldName = files[i].toUpperCase();
	if (oldName.lastIndexOf(oldExt) != -1) {
		var baseName = oldName.substring(0, oldName.lastIndexOf(oldExt));
		var newName = baseName + newExt;
		Println(dir + "\\" + oldName + " => " + dir + "\\" + newName);
		Rename(dir + "\\" + oldName, dir + "\\" + newName);
	}
}
Println("All done...");

And can be run like this: JSH.EXE RENALL.JS SOMEDIR .FOO .BAR to rename all files ending in .FOO to .BAR.

jSH was only possible due to the work of these people/projects:

You can find me on Twitter if you want...

Download and quick start

You can find binary releases on the GitHub release page. Just extract the contents of the archive and run jSH.

jSH runs in Dosbox and on real hardware or a virtual machine with MS-DOS, FreeDOS or any DOS based Windows like Windows 95/98/ME.

If you run it on real hardware you need at least a 80386 with 4MB. I recommend a Pentium class machine with at least 8MB RAM.

The API is documented in the doc/html/ directory.

For now jSH comes only with a single bigger example: JsCommander. A minimal file manager in the style of the well known Norton Commander. jc screenshot

additional packages

jSH has a very simple integrated package manager (JPM). It can be started with JPM.BAT. A working packet driver is needed to connect to the package index and download packages using HTTPS. Packages (and the package index) are fetched from the DOjS/jSH package repository. Downloaded packages are put into JSBOOT.ZIP in the PACKAGE/ directory. Feel free to submit any packages you want to include in that repository using a pull request. DPM commands:

Compilation

You can compile jSH on any modern Linux (the instructions below are for Debian based distributions) or on Windows 10 using Windows Subsystem for Linux (WSL). Setup Windows Subsystem for Linux (WSL) according to this guide (I used Ubuntu 18.04 LTS).

Preparation

Build and install DJGPP 7.2.0 according to this guide. I used the following command lines to update/install my dependencies:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev g++ unzip htop screen git bash-completion build-essential npm python-yaml zip dos2unix python3
sudo npm install -g jsdoc
sudo npm install -g better-docs

And the following commands to build and install DJGPP to /home/ilu/djgpp.:

git clone https://github.com/andrewwutw/build-djgpp.git
cd build-djgpp
export DJGPP_PREFIX=/home/ilu/djgpp
./build-djgpp.sh 7.2.0

Make sure dxe3gen and dxe3res are installed as well and set DJPATH permanently to your installation directory of DJGPP.

Getting & Compiling jSH

Open a shell/command line in the directory where you want the source to reside.

Checkout jSH from Github:

git clone https://github.com/SuperIlu/jSH.git

Open the Makefile in a text editor and change the path to DJGPP according to your installation.

Now you are ready to compile jSH with make clean all. This might take some time as the dependencies are quite a large. make distclean will clean dependencies as well. make zip will create the distribution ZIP and make doc will re-create the HTML help.

Creating native libraries (DXEs)

Have a look at the example libraries in test.dxelib/ and test2.dxelib/. Some rules:

History

See the changelog for the projects history.

Licenses

jSH

All code from me is released under MIT license.

MuJS

MuJS is released under ISC license. See COPYING in the MuJS folder for details.

DZComm

DZComm serial library is release as gift-ware. See readme.txt in the dzcomm folder for details.

CWSDPMI.EXE

CWSDPMI DPMI host is licensed under GPL. The documentation states:

The files in this binary distribution may be redistributed under the GPL (with source) or without the source code provided.

zip code

zip is licensed by UNLICENSE

WATTCP

WATTCP - TCP/IP library routines

Copyright (c) 1990, 1991, 1992, 1993 Erick Engelke

Portions Copyright (c) 1993 Quentin Smart Portions Copyright (c) 1991 University of Waterloo Portions Copyright (c) 1990 National Center for Supercomputer Applications Portions Copyright (c) 1990 Clarkson University Portions Copyright (c) 1983, 1986, Imagen Corporation

This software is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

RESTRICTIONS You may freely use this library to produce programs which you may give away or sell in source format, or as compiled executables, or both.

You may not sell this library or a portion thereof or distribute modified versions the library code in either source or OBJect or LIBrary format without written permission from the author. The author still maintains copyright privileges and will assert the privileges of ownership for purposes of royalties such distributions.

Portions of this code were written or enhanced by others and offerred to me for distribution in WATTCP under my copyright. To my knowledge, all copyrights exercised are listed at the top of this file. If this is incorrect, please contact me so I can rectify the situation.

PCTIMER

PCTIMER is Freeware