From 0358d5bf1c2e1cadcf6a0b855afc84bca8e1675f Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Mon, 28 Mar 2016 09:35:43 -0400 Subject: [PATCH 1/2] pbsh.s: prompt comment (cleared if input is regular file) --- src/other/pbsh.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/other/pbsh.s b/src/other/pbsh.s index 2301945..9e18983 100644 --- a/src/other/pbsh.s +++ b/src/other/pbsh.s @@ -475,7 +475,7 @@ iopt:argv0p: argv0 " initial value for nextarg, opt " ################ variables -prompt: <@ 040 " v1 prompt! +prompt: <@ 040 " v1 prompt! cleared if input is regular file redirect: .=.+1 " last file was a redirect (lt or gt) nextarg: .=.+1 " next slot in argv to fill From b6009395fa3cb44777ad8c20e97e8f5c2b07ef7b Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Mon, 28 Mar 2016 11:25:56 -0400 Subject: [PATCH 2/2] pbsh.s: Add more comments about how I chose what I did or did not do. --- src/other/pbsh.s | 56 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/other/pbsh.s b/src/other/pbsh.s index 9e18983..9d0aab4 100644 --- a/src/other/pbsh.s +++ b/src/other/pbsh.s @@ -5,34 +5,52 @@ " In particular, the newline/newcom/newarg/newchar processing loop(s) " are copied from the v1 shell: -" redirection must occur at the start of a name (after whitespace) +" 1. Redirection must occur at the start of a name (after whitespace) +" 2. In parroting the v1 shell code, I did NOT add whitespace removal +" after > and < " includes ';' and '&' (which are mentioned as added close after "fork") -" does NOT include quoting (backslash or single quote) -" No "globbing" (performed by /etc/glob in v1 shell); -" McIlroy's "Reader" paper reports that cp/mv syntax -" changed in response to the introduction of globbing, -" the the surviving "cp" command takes src dest pairs. +" does NOT include quoting (backslash or quotes), which are mentioned +" in the v1 shell man page: http://man.cat-v.org/unix-1st/1/sh -" cat.s seems to write error output on fd 8, *BUT* shell doesn't know -" what device is on stdout (passed by init, and init doesn't pass fd 8) -" and there isn't a "dup" call, an "indirect" device like /dev/tty, -" nor does init make an equivalent link!! +" does NOT implement >> (not mentioned in the v1 sh man page) + +" No "globbing" (performed by /etc/glob in v1 shell); McIlroy's +" "Reader" paper reports that cp/mv syntax changed in response to the +" introduction of globbing, the the surviving "cp" command takes src +" dest pairs. + +" v1 shell expects "-" as argument from init or login, will read a +" filename passed as the first argument. *BUT* the PDP-7 init.s +" doesn't set up an arg pointer at the top of memory, so it's unlikely +" the PDP-7 shell took command line arguments!!! + +" cat.s seems to write error output on fd 8, but "init" (which opened +" stdin and stdout) doesn't set it up, and the shell doesn't know what +" device is on stdout (passed by init, and init doesn't pass fd 8) and +" there isn't a "dup" call, or an "indirect" device like /dev/tty +" (nor does init make an equivalent link), so the shell doesn't have +" a way to open the correct device). + +" Direct exection of "runcom" files _could_ be implemented by reading +" the first block of the "binary" (into 010000) and seeing if any have +" any bits in 0300300 set before jumping into the "boostrap" code. + +" If that's the case, then the child could open "sh" instead of the +" command file, close stdin, and open the command file, read the first +" block of "sh" into 010000, and jumping into the bootstrap, but there +" isn't any evidence that this was the case. " Arguments for new processes are located at the end of memory. " Location 17777 points to a word with the argument count (argc), " followed by blocks of four words with (filename) arguments. -" Currently leave room for ONLY maxargs items. -" 10 is enough to build "cold start" system (sop + s1-9): -maxargs=10 -" v1 shell expects "-" as argument from init or login, will read -" filename passed as argument. *BUT* init.s doesn't set up the argv -" at the top of memory, so the v0 shell may not have taken command -" line arguments!!! You can still invoke "sh