Saturday, January 13, 2018

A new alternative shell?

I've been thinking for a while that it would be awesome to have a modern alternative shell. The COMMAND.COM shell is the bog-standard DOS command shell. We have an alternative shell called 4DOS that was opened by JP Software—I helped them with that, but at the time I didn't have a lot of experience in open source software, and I gave them bad advice about licencing. So the current 4DOS system doesn't have a truly "open source software" license.

Maybe this is an opportunity to start fresh. Since people sometimes ask me how they can contribute to FreeDOS, I thought I'd share this idea here.

I'd love to see someone start from the ground up and write a replacement alternative shell. I don't think you have to start from complete scratch. I'd encourage a new developer to borrow features and code from the FreeDOS COMMAND.COM ("FreeCOM") and even from Unix shells like GNU Bash.

Of course, the shell should be a DOS shell, not a Unix shell. That means it must support the basic Internal Commands: EXIT, DIR, PATH, PROMPT, and CD/CHDIR. And the DOS Batch commands: CALL, FOR, GOTO, IF, REM, SET, and SHIFT.

If you compare that list to the standard list of DOS Internal Commands, you'll notice some commands are missing. But maybe you'll implement commands like MD/MKDIR, RD/RMDIR, CLS, and other traditionally-internal commands as external commands. Up to you.

My first systems administrator job was on an Apollo/DomainOS system, and the AEGIS display environment had terminal windows with a neat feature: input was always on the bottom. So the Apollo/DomainOS guy in me would suggest a terminal that looked sort of like this: (this is a mock-up)
C:\> CTMOUSE

CuteMouse loaded
Installed at PS/2 port

C:\> DIR

 Volume in drive C: is FREEDOS12
 Volume serial number is 2134-5678
 Directory of C:\

FDOS              [DIR]     01-06-2017 3:00pm
3DOS    .EXE     89,123     01-02-2018 5:25pm
3DOSAUTO.BAT        998     01-02-2018 5:25pm
AUTOEXEC.BAT      1,234     01-06-2017 3:12pm
BOOTSECT.BIN        512     01-06-2017 3:12pm
COMMAND .COM     66,945     01-20-2016 7:37pm
FDCONFIG.SYS        848     01-06-2017 3:12pm
KERNEL  .SYS     45,344     06-21-2016 8:39pm
HELLO   .BAT      1,123     01-01-2018 1:25pm
     8 file(s)
     1 dir(s)
    208,441 MB free

C:\> _
So that black-on-white bar at the bottom is the command line input. That makes it really easy to see where you are. Yes, you are always scrolling up from the bottom of the screen, but let's face it; 99% of the time, we're scrolling from the bottom of the screen anyway.

The black-on-white bar should be dynamic. Maybe as you type a command that goes over 80 characters, the bar expands so you have black-on-white as you edit the whole command.

And the colors should be customizable. Maybe you want white-on-blue for the display area on top, and bright-white-on-cyan on the command line. You should be able to set that.
C:\> CTMOUSE

CuteMouse loaded
Installed at PS/2 port

C:\> DIR

 Volume in drive C: is FREEDOS12
 Volume serial number is 2134-5678
 Directory of C:\

FDOS              [DIR]     01-06-2017 3:00pm
3DOS    .EXE     89,123     01-02-2018 5:25pm
3DOSAUTO.BAT        998     01-02-2018 5:25pm
AUTOEXEC.BAT      1,234     01-06-2017 3:12pm
BOOTSECT.BIN        512     01-06-2017 3:12pm
COMMAND .COM     66,945     01-20-2016 7:37pm
FDCONFIG.SYS        848     01-06-2017 3:12pm
KERNEL  .SYS     45,344     06-21-2016 8:39pm
HELLO   .BAT      1,123     01-01-2018 1:25pm
     8 file(s)
     1 dir(s)
    208,441 MB free

C:\> _
I'd love to see an alternative shell that integrates, or at least shares themes with, the PG pager. As you view a file with PG, it should feel like you're still in 3DOS. So maybe that means adjusting the theme for 3DOS, or for PG.

And of course, standard application behavior applies: F1 for help. Actually, I'd recommend to implement that as a set of macros, so users can set things to their preferences, such as F1 to insert the HELP command on the command line, or F5 to insert CLS on the command line. A really cool option would let you define if that macro executes the command automatically or just inserts the string. For example:
MACRO /X F1 HELP
MACRO    F2 HELP
MACRO /X F5 CLS
In that simple example, /X means execute after inserting the text. So tapping F1 would have the shell insert HELP wherever you on the command line, then "hit Enter" for you. But tapping F2 would just insert HELP without doing anything else. (For example, you can then give HELP an argument.)

Up/down arrows should let you edit command history, maybe via a selector pop-up window, so you can see the list of commands as you scroll through the command buffer.

I'll even suggest a name for this alternative shell: "3DOS." If you pronounce "3DOS" it sounds like "FreeDOS," which is kind of cool. And the name suggests that it's a replacement for 4DOS.

But it's critical that this alternative shell be made available under a free/open source software license. I strongly encourage the GNU GPL, which makes it really easy to borrow code from Bash. And for other reasons, I ask that anyone working on such an alternative shell should not view the 4DOS source code. Let's make this a "clean" effort. Looking at GNU GPL'd source code, and even copying GNU GPL'd source code, is fine—if the new shell is under the GNU GPL, you can re-use any GPL'd code. But don't examine or re-use 4DOS source code, since that's not under the GNU GPL.

Anyway, just an idea.

No comments:

Post a Comment