Simplify fix of 2004/newbern + format/typo checks

This should complete the review of 2004/newbern.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-18 11:01:47 -08:00
1 parent 1d8c7abf09
commit 8236f9ac54
3 files changed
+13 -13

No files matched your search

+4 -1
View File
@@ -28,7 +28,8 @@ data file.
## Author's remarks: ## Author's remarks:
This is a configurable banner-like program. This is a configurable `banner(1)`-like program.
### Examples: ### Examples:
@@ -45,6 +46,7 @@ This is a configurable banner-like program.
./newbern data_file a_string ./newbern data_file a_string
``` ```
### Extra functionality ### Extra functionality
The program can also act as a Morse encoder, unarguably. The program can also act as a Morse encoder, unarguably.
@@ -52,6 +54,7 @@ The program can also act as a Morse encoder, unarguably.
It also has double-super-secret encryption capabilities. It also has double-super-secret encryption capabilities.
Decryption is left as an exercise for the reader. Decryption is left as an exercise for the reader.
### Portability ### Portability
The program assumes an ASCII operating environment. The program assumes an ASCII operating environment.
+8 -8
View File
@@ -11,7 +11,7 @@
#define y fclose #define y fclose
#define end static #define end static
t(signed)char U;t(struct) b(O,); t()char U;t(struct) b(O,);
t( U*) t( U*)
H; t(O H; t(O
@@ -29,8 +29,8 @@ isspace(g); } H D(H s){H p,r;if(!s)G 0;for(p=(H)s;*p &&
{ m(D(d)); l(f++, q); Z(*d && !P(*d { m(D(d)); l(f++, q); Z(*d && !P(*d
)) d++; Z(*d && P(*d)) d++; } G b(,0);} )) d++; Z(*d && P(*d)) d++; } G b(,0);}
void k() { static U b(c,;) ?R(c):(c='\n'); } void k() { static U b(c,;) ?R(c):(c='\n'); }
i main (i Q, char**ll){static o i main (i Q, U**l){static o
X;i t,j; switch (Q X;i t,j; switch (Q
){ case 1: { H ){ case 1: { H
*p, I [] ={ *p, I [] ={
"aH" " " "aH" " "
@@ -60,7 +60,7 @@ isspace(g); } H D(H s){H p,r;if(!s)G 0;for(p=(H)s;*p &&
t = (w == 200) ? 10:getchar(); t = (w == 200) ? 10:getchar();
switch(t) { case 0xa: switch(t) { case 0xa:
case EOF: if(w-- case EOF: if(w--
){R(1[ll ][0]) ){R(1[l ][0])
;for(i =0, ;for(i =0,
p=e;i <=w p=e;i <=w
;i+= 6){ ;i+= 6){
@@ -79,7 +79,7 @@ p++ =0;
}if((++w%6)==0)p++;}e( }if((++w%6)==0)p++;}e(
0)}case 3:{O*u,*q,*x;U s[0400]; 0)}case 3:{O*u,*q,*x;U s[0400];
i i;FILE*F; j:j=1;if(!(X=calloc(6<< i i;FILE*F; j:j=1;if(!(X=calloc(6<<
6,sizeof(O*)))) e(1) if(!(F=fopen(j[ll], 6,sizeof(O*)))) e(1) if(!(F=fopen(j[l],
"r")))e(1)Z(fgets(s,j<<8,F))(*s)&&h(X,s+j,*s "r")))e(1)Z(fgets(s,j<<8,F))(*s)&&h(X,s+j,*s
);j=b(i,=)&0xff; i:u=0;x=X[i]; );j=b(i,=)&0xff; i:u=0;x=X[i];
Z(x){q=Y(*( o)x)=Y(u) Z(x){q=Y(*( o)x)=Y(u)
@@ -100,7 +100,7 @@ end i i
x<X +255);*x=m; x<X +255);*x=m;
} }
}default:if(!(t }default:if(!(t
=*2[ll]++))break;case 0 =*2[l]++))break;case 0
:{H p;i i,c,n;O *a;u:c=n=0;Z(c< :{H p;i i,c,n;O *a;u:c=n=0;Z(c<
10){c++b(;,n:n++)}if(n<='&'){c-=(n% 10){c++b(;,n:n++)}if(n<='&'){c-=(n%
7);goto n;}else n++;a=*(X+t);Z(a){p=(H) 7);goto n;}else n++;a=*(X+t);Z(a){p=(H)
@@ -109,10 +109,10 @@ end i i
break;R(32+ (i&1)*3); break;R(32+ (i&1)*3);
}}R(10);a =a->l; }}R(10);a =a->l;
}if(Q<2 )goto }if(Q<2 )goto
D;if(* ll[2 D;if(* l[2
]){R( 10) ]){R( 10)
;main (4, ;main (4,
ll); }}} l); }}}
Z(Q ++< Z(Q ++<
1){ X+= 1){ X+=
t; if t; if
+1 -4
View File
@@ -2745,10 +2745,7 @@ happens when art more like a letter is fed to the program.
## [2004/newbern](2004/newbern/newbern.c) ([README.md](2004/newbern/README.md])) ## [2004/newbern](2004/newbern/newbern.c) ([README.md](2004/newbern/README.md]))
Cody and Landon individually fixed this to work with clang. Cody then turned the Cody and Landon individually fixed this to work with clang.
second arg to main, which clang requires to be a `char **`, to be not the same
name as a function defined earlier in the code and to use that variable which
`main()` used.
## [2004/vik2](2004/vik2/vik2.c) ([README.md](2004/vik2/README.md)) ## [2004/vik2](2004/vik2/vik2.c) ([README.md](2004/vik2/README.md))