[TUHS] the first busybox

Steffen Nurpmeso via TUHS tuhs at tuhs.org
Fri Oct 23 07:21:43 AEST 2026


Mary Ann Horton via TUHS wrote in
 <d7bd61d9-2359-46a1-a197-cbb446666104 at mhorton.net>:
 |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.

And today "they" ("we") are about to add some getexecpath() into
standards, and certain BSDs have week long runs to remove argv[0]
in favour of that function in all programs (at least daemons) of
the base system.  (Not to distress anyone again because of my
shock not to ever have though about that argv can be NULL.)

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the TUHS mailing list