From 609b449d8fae6b59594ca22e408ac8a66d591b87 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 1 Nov 2023 09:36:27 -0700 Subject: [PATCH] Restore 2001/herrmann2 original code By some chance it was in .gitignore and was entirely missing so I restored it from the archive. I also updated the README.md file about the alt (which is the original in fact) not compiling with clang (something I fixed in the entry itself) in addition to it might not working in some systems (like 64-bit systems). --- 2001/herrmann2/.gitignore | 1 - 2001/herrmann2/README.md | 5 +++-- 2001/herrmann2/herrmann2.orig.c | 23 +++++++++++++++++++++++ thanks-for-fixes.md | 20 +++++++++++++------- 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 2001/herrmann2/herrmann2.orig.c diff --git a/2001/herrmann2/.gitignore b/2001/herrmann2/.gitignore index aac4388b1..007a0870a 100644 --- a/2001/herrmann2/.gitignore +++ b/2001/herrmann2/.gitignore @@ -1,4 +1,3 @@ herrmann2 -herrmann2.orig.c herrmann2.orig prog.orig diff --git a/2001/herrmann2/README.md b/2001/herrmann2/README.md index 0bd2d1695..11ee4975c 100644 --- a/2001/herrmann2/README.md +++ b/2001/herrmann2/README.md @@ -75,8 +75,9 @@ diff herrmann2.alt.c herrmann2.orig.c && echo "output matches with original code ## Alternate code: -If you wish to use the original version that does not work for all platforms, -you can make use of the [herrmann2.alt.c](herrmann2.alt.c) by running: +If you wish to use the original version that does not work for all platforms +(and will not even compile with some versions of clang), you can make use of the +[herrmann2.alt.c](herrmann2.alt.c) by running: ```sh make alt diff --git a/2001/herrmann2/herrmann2.orig.c b/2001/herrmann2/herrmann2.orig.c new file mode 100644 index 000000000..27e47aab7 --- /dev/null +++ b/2001/herrmann2/herrmann2.orig.c @@ -0,0 +1,23 @@ +char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char +e;b;*ad,a,c; te;b;*ad,a,c; te;*ad,a,c; w,te;*ad,a, w,te;*ad,and, w,te;*ad, +r,T; wri; ;*h; r,T; wri; ;*h; r; wri; ;*h;_, r; wri;*h;_, r; wri;*har;_, r; wri + ;on; ;l ;i(V) ;on; ;l ;i(V) ;o ;l ;mai(V) ;o ;mai(n,V) ;main (n,V) + {-!har ; {-!har ; {har =A; {h =A;ad =A;read +(0,&e,o||n -- +(0,&e,o||n -- +(0,&o||n ,o-- +(0,&on ,o-4,- +(0,n ,o-=94,- +(0,n +,l=b=8,!( te-*A,l=b=8,!( te-*A,l=b,!( time-*A,l=b, time)|-*A,l= time(0)|-*A,l= +~l),srand (l),~l),srand (l),~l),and ,!(l),~l),a ,!(A,l),~l) ,!(d=A,l),~l) +,b))&&+((A + te,b))&&+((A + te,b))+((A -A+ te,b))+A -A+ (&te,b+A -A+(* (&te,b+A +)=+ +95>e?(*& c)=+ +95>e?(*& c) +95>e?(*& _*c) +95>(*& _*c) +95>(*&r= _*c) +95> +5,r+e-r +_:2-195,r+e-r +_:2-195+e-r +_:2-1<-95+e-r +_-1<-95+e-r ++?_-1<-95+e-r +|(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d= + *( (char**)+V+ *( (char)+V+ *( (c),har)+V+ (c),har)+ (V+ (c),r)+ (V+ ( c), ++0,*d-7 ) -r+8)+0,*d-7 -r+8)+0,*d-c:7 -r+80,*d-c:7 -r+7:80,*d-7 -r+7:80,*d++-7 ++7+! r: and%9- +7+! rand%9-85 +7+! rand%95 +7+!! rand%95 +7+ rand()%95 +7+ r +-(r+o):(+w,_+ A-(r+o)+w,_+*( A-(r+o)+w,_+ A-(r=e+o)+w,_+ A-(r+o)+wri,_+ A-(r+o) ++(o)+b)),!write+(o)+b,!wri,(te+(o)+b,!write+(o=_)+b,!write+(o)+b,!((write+(o)+b +-b+*h)(1,A+b,!!-b+*h),A+b,((!!-b+*h),A+b,!!-b+((*h),A+b,!!-b+*h),A-++b,!!-b+*h) +, a >T^l,( o-95, a >T,( o-=+95, a >T,( o-95, a)) >T,( o-95, a >T,(w? o-95, a >T +++ &&r:b<<2+a ++ &&b<<2+a+w ++ &&b<<2+w ++ ) &&b<<2+w ++ &&b<<((2+w ++ && +!main(n*n,V) , !main(n,V) , !main(+-n,V) ,main(+-n,V) ) ,main(n,V) ) ,main),(n, +l)),w= +T-->o +l)),w= +T>o +l)),w=o+ +T>o +l,w=o+ +T>o;{ +l,w=o+T>o;{ +l,w &=o+ +!a;}return _+= !a;}return _+= !a;}return _+= !a;}return _+= !a;}return _+= !a;} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 40cc952c2..ce4fd7f07 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1904,15 +1904,21 @@ SC2248 (style): Prefer double quoting even when variables don't contain special errors/warnings. + ## [2001/herrmann2](2001/herrmann2/herrmann2.c) ([README.md](2001/herrmann2/README.md])) -Cody fixed this to work with both 64-bit and 32-bit compilers by changing most of -the `int`s (all but that in `main`) to `long`s. He also fixed it to compile with -clang by changing the args of main to be `int` and `char **`, respectively, and -changing specific references to the `argv` arg, casting to `long` (was `int` but -the 64-bit fix requires `long`) which was its old type. The original file, used -for demonstration purposes, as well as if you want to see if your system works -with the original code, is the alternate version. See the README.md for details. +Cody fixed this to work with both 64-bit and 32-bit compilers by changing most +of the `int`s (all but that in `main(int ...)`) to `long`s. He also fixed it to +compile with clang by changing the args of main to be `int` and `char **`, +respectively, and changing specific references to the `argv` arg, casting to +`long` (was `int` but the 64-bit fix requires `long`) which was its old type. + +The original file, used for demonstration purposes, as well as if you want to +see if your system works with the original code, is the alternate version. See +the README.md for details. + +For some reason the original code was missing (presumingly because it had been +added to `.gitignore` by accident) but Cody restored it from the archive. ## [2001/kev](2001/kev/kev.c) ([README.md](2001/kev/README.md]))