Fix 2011/goren for macOS (64-bit)

On a hunch I wondered if the ints in function S() needed to be long and
it did indeed solve the problem. Tested it under linux and then I
noticed the author stated that it does not work for 64-bits (except that
it does work in 64-bit linux). Therefore I test compiled it with linux
as 32-bit too and both work.

I also noticed in git diff that it had CRLF line endings so I removed
those as well.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-14 11:46:00 -07:00
1 parent 5b25b77c9b
commit 036ddbd4f4
2 files changed
+15 -5

No files matched your search

+14 -4
View File
@@ -15,6 +15,12 @@ make
echo "some text" | ./goren echo "some text" | ./goren
``` ```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for macOS.
Before the fix it segfaulted. It worked fine under linux. After fixing it it was
noticed that the author stated it does not work for 64-bit so it was then tested
as a 32-bit binary (linux) and 64-bit binary (linux, macOS) and both work. Thank
you Cody!
## Try: ## Try:
```sh ```sh
@@ -29,11 +35,15 @@ In the words of [René François Ghislain Magritte Magritte](http://en.wikipedia
One may ask the surrealist question: One may ask the surrealist question:
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren ```sh
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
```
However if one takes a firm stand and declares: However if one takes a firm stand and declares:
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren ```sh
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
```
something happens! Why? something happens! Why?
@@ -50,8 +60,8 @@ a pipe. But what IS a pipe? This program tries to provide an answer.
Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images) is: Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images) is:
The famous pipe. How people reproached me for it! And yet, could > The famous pipe. How people reproached me for it! And yet, could
you stuff my pipe? No, it's just a representation, is it not? > you stuff my pipe? No, it's just a representation, is it not?
Accordingly, this program only approves pipes which can be used for Accordingly, this program only approves pipes which can be used for
stuffing data. stuffing data.
+1 -1
View File
@@ -1,5 +1,5 @@
typedef unsigned char t;t*F="%c",l[]="|\\/=_ \n](.\0(),*(.(=(}*.)[[*.",N='\n',* typedef unsigned char t;t*F="%c",l[]="|\\/=_ \n](.\0(),*(.(=(}*.)[[*.",N='\n',*
r;typedef(*H)();extern H Ar;Q(a){return(a|-a)>>31;}H S(c,a){return(H)(a&~c|(int r;typedef(*H)();extern H Ar;Q(a){return(a|-a)>>31;}H S(long c,long a){return(H)(a&~c|(long
)Ar&c);}extern t*ist;V(t*u){*u^=*u&2^(*u>>7)*185;}Z(t*u,t n){*u-=n;}e(t c,H h){ )Ar&c);}extern t*ist;V(t*u){*u^=*u&2^(*u>>7)*185;}Z(t*u,t n){*u-=n;}e(t c,H h){
R(h,Q(* r^c));} R(h,Q(* r^c));}
I(){r=l +7-4*Q( I(){r=l +7-4*Q(