diff --git a/1985/sicherman/sicherman.c b/1985/sicherman/sicherman.c index 3bf29ef24..716c27aab 100644 --- a/1985/sicherman/sicherman.c +++ b/1985/sicherman/sicherman.c @@ -9,7 +9,7 @@ main(/*C,V) char **V;*/ /* C program. (If you don't * understand it look it - * up.) (In the C manual*/) + * up.) (In the C Manual*/) { char _,__; while (read(0,&__,1) & write((_=(_=~' '&__,/*/)), diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 0de537aa2..2c40cc5e1 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -236,12 +236,59 @@ Cody fixed this _very twisted entry_ to not require `-traditional-cpp`. Fixing to refer you to the original file [sicherman.orig.c](1985/sicherman/sicherman.orig.c) and he suggests that you then compare it to [sicherman.c](1985/sicherman/sicherman.c) for some good old -C-fashioned fun! +C-fashioned fun (alternatively, see below explanation)! Later on Cody improved the fix so that it looks much more like the [original entry](1985/sicherman/sicherman.c). He did this one more time and it's about as close to the original as one can get without causing a compilation error. +To get this to all work the following changes were made. If you really want to +understand this you can do the following from the directory: + +```sh +make diff_orig_prog +``` + +- The `C` macro was changed from `/b/` (which is `/*/`) to `/**/`. It could not +be changed to use the token paste C preprocessor operator for reasons that will +be explained below. No other macro had to be changed. +- The code: + + C="Lint says "argument Manual isn't used." What's that + mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+ + + had to be changed to: + + "Lint says argument Manual isn't used." "What's that\ + mean?"; while (write((read(('"'-'/*"'/*"*/))?__:__-_+ + + because C cannot be assigned to (see above) and because the string is broken + up where it has symbols that are not strings. +- In that function, `subr()`, although `C` could stay in the arg list, since it +translates to `/**` it cannot have a type. Nothing else had to change in the +function except that the variables previously only in `main()`, `_` and `__`, +had to be at the top of the file (in addition to the ones in `main()`). +- The args to `main()` had to be commented out along with the code `up.) (In the +C Manual)`. +- The code in `main()` is the significant change as the macros had to be +replaced for actual code so that instead of having the while loop condition as: + + while (read(0,&__,1) & write((_=(_=C_C_(__),C)), + _C_,1)) _=C-V+subr(&V); + + we have it as: + + while (read(0,&__,1) & write((_=(_=~' '&__,/*/)), + _C_,1)) _=/*/-('\b'*'\b'>=_|_>'\t'*'\n'))?__:__-_+ + '\b'*'\b'|((_-52)%('\b'*'\b'+~' '&'\t'*'\n')+1),1), + &_,1))/*_=C-V+subr(&V)*/; + +- Finally, the function `subr()` cannot be called in the body of the `while()` +loop as calling it will result in incorrect output, once you even get it to +compile. See above where the loop has a body but the modification only has it +commented out. + + ## [1986/hague](1986/hague/hague.c) ([README.md](1986/hague/README.md]))