[TUHS] the first busybox

Mary Ann Horton via TUHS tuhs at tuhs.org
Fri Oct 23 07:08:05 AEST 2026


In 3BSD, ex, edit, vi, and vedit were links to the same binary. ex.c 
looks for 'v ' (start in visual mode) or 'd' (safe edit) anywhere in 
argv[0], or 'a' in the first character. ('a' was a check for 'a.out' for 
debugging, later removed.) Bill Joy would have added the checks for 'v' 
and 'a', probably in 77 or 78. I added the 'd' for 'edit' or 'vedit' in 
78, arranging that novice users could invoke it that way to help protect 
them from common mistakes (like confusion about whether you were in 
input or command mode). Later I added a check for 'w' so 'view' would 
invoke the editor in readonly mode.

The 'd' was a follow-on from my version of ed ('hed', Horton's Editor) 
at U Wisconsin in 77. A hard link 'shed' started it as Safe Hed, with 
protections turned on.

I believe it was common practice back then to check argv[0] to allow a 
program to behave differently depending on the name it was called by. I 
certainly wasn't the first.

On 10/22/26 12:28, Diomidis Spinellis via TUHS wrote:
> The ex editor appeared in BSD 1, whereas compress appeared in BSD 4.3 
> [1].  The ex source code looks for 'd' in second or third string 
> position of the command invocation name [2] to change its behavior to 
> edit or nedit [3].  In this mode, ex disables some magic regular 
> expression characters, enables some notifications, and disables the 
> open and visual commands [4].  I couldn't find in the BSD 1 code for 
> invoking ex in visual mode as vi, although vi is documented as a 
> synonym for ex.


Thanks,

/Mary Ann Horton/ (she/her/ma'am)
       Keynote Speaker on Inclusion and Innovation
       Award Winning Author
maryannhorton.com <https://maryannhorton.com>





More information about the TUHS mailing list