Format, typo and other fixes in 1990/tbr/README.md

The typo of most importance (maybe the only typo) was that when I linked
to the archive tarball I left off /archive in the link.

Noted in the judges' comments that in the smaller version provided by
the author the exit() returns void problem is fixed but it still uses
gets(), not fgets(). I don't see the reason to do that as it'll compile
and it's really only an aside and not the entry.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-09 05:40:09 -07:00
1 parent 88257dc777
commit 5adf8b8efb
1 file changed
+31 -26
+31 -26
View File
@@ -1,16 +1,16 @@
# Best Utility # Best Utility
Byron Rakitzis Byron Rakitzis
Princeton University Princeton University
5707 Old Lodge Dr. 5707 Old Lodge Dr.
Houston, TX 77066 Houston, TX 77066
USA USA
Sean Dorward Sean Dorward
Princeton University Princeton University
10274 Burleigh Cottage Lane 10274 Burleigh Cottage Lane
Ellicott City, MD 21043 Ellicott City, MD 21043
USA USA
## To build: ## To build:
@@ -28,7 +28,7 @@ due to the warning being interspersed with the program's output. Thank you Cody
for your assistance! for your assistance!
For the original version with `gets()` see the [archive For the original version with `gets()` see the [archive
tarball](/archive-1990.tar.bz2). tarball](/archive/archive-1990.tar.bz2).
## To run: ## To run:
@@ -44,13 +44,15 @@ or ctrl-c (or kill it from another terminal :-) ).
## Try: ## Try:
./tbr ```sh
ls -l tbr tbr.c ./tbr
# notice how the following does not work: ls -l tbr tbr.c
ls tbr* # notice how the following does not work:
# try figuring out how this entry works in an editor: ls tbr*
vi tbr.c # try figuring out how this entry works in an editor:
# then figure out how to exit vi :-) vi tbr.c
# then figure out how to exit vi :-)
```
What happens if you try using `cd -` to return to previous directory? What about What happens if you try using `cd -` to return to previous directory? What about
`cd` with no args? `cd` with no args?
@@ -68,22 +70,25 @@ Shell source was a major inspiration for the formation of the IOCCC back in
The author supplied us with a slightly smaller unformatted version The author supplied us with a slightly smaller unformatted version
of the program which we include below: of the program which we include below:
#define D ,close( ```c
char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]= #define D ,close(
32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);} char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]= 32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);}
*u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u= r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]=
++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o? *u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o?
0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D
1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;} 0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D
e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;} 1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;}
e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;}
```
It has the `exit()` returns void fix but not the `gets()` to `fgets()` fix
applied.
## Author's comments: ## Author's comments:
Rot13: ### Rot13:
Guvf cebtenz vf n ehqvzragnel furyy. Vg qbrf v/b erqverpgvba, cvcrf Guvf cebtenz vf n ehqvzragnel furyy. Vg qbrf v/b erqverpgvba, cvcrf
naq pq. Vg syntf reebef ba snvyrq puqve'f, bcra'f, perng'f naq pq. Vg syntf reebef ba snvyrq puqve'f, bcra'f, perng'f