Fix 1991/buzzard and add alt code
There were two crashes that I noticed, both due to atoi(3) being called on an arg without a type which ended up being an implicit int rather than a 'char *'. This is for the x and y coordinates. I don't have an example command line to test different configurations but now the program shouldn't crash unless the file cannot be opened. See bugs.md for details there (whether it should crash or not on not being able to open the file is debatable I suppose but I left it in as a feature, not a bug; the others made the program unusable which is why they were fixed). The alt version can be more at home for those familiar with vi(m) (it certainly is for me): instead of 'f' for forwards, 'l' for left and 'r' for right it is now 'k', 'h' and 'l' respectively. The program does not allow one to go backwards so this was not touched but if it did it would have been 'j': because we vi(m) users are strange :-) The README.md has been format and typo fixed.
This commit is contained in:
1 parent
e00d20111d
commit
40c0a6a74a
5 files changed
+79
-12
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#define X(s) (!(s&3)-((s&3)==2))
|
||||
#define W while
|
||||
char Z[82][82],A,B,f,g=26;z(q){return atoi(q);}m(d,l){return
|
||||
char Z[82][82],A,B,f,g=26;z(q)char**q;{return atoi(q);}m(d,l){return
|
||||
Z[ B + X ( f +
|
||||
3) * d+l *X(f+ 2 )][ A+X ( f ) * d +
|
||||
l* X ( f + 3 ) ] ;}int
|
||||
@@ -10,7 +10,7 @@ h= 0;D(p,s)char*s; {W(h>>3<p>> 3 ) {putchar('\t'
|
||||
)&~7 ;}W(h < p ){putchar(' ');++h; }(void)printf(
|
||||
"%s" , s ) ;h+=strlen(s);}main(x,a)char **a; {
|
||||
# define P(x) (x?(5-(x))*(6-(x ))/2:11)
|
||||
int b; { char b[256],i, j=0; FILE*F;F=fopen(x-1?a[1]:"buzzard.c","r");W(
|
||||
int b; { char b[256],i, j=0; FILE*F;F=fopen(x-1?a[1]:__FILE__,"r");W(
|
||||
fgets( b ,256 ,F)){for(i=0;b[ i];++ i)
|
||||
Z[j][i ] =( b [ i ] ==' '?1:2*(b[i]==(x>2?*a[2]:'\\')));++j;}fclose
|
||||
(F);}A =4 ; B = 3 ; f = 1;x >3? A=z(a[3]),B=z(a[4]):0;b='\n';do{if(b=='\n'
|
||||
|
||||
Reference in new issue
Block a user