diff --git a/sources/fifteen.c b/sources/fifteen.c index 05bae9c..36a3fe1 100644 --- a/sources/fifteen.c +++ b/sources/fifteen.c @@ -21,7 +21,9 @@ compile with -lncurses #endif typedef signed char byte; +#ifndef Plan9 byte size; +#endif byte py,px; byte ey,ex; //the empty tile chtype green=A_BOLD; //bold when there is no color @@ -192,7 +194,9 @@ int main(int argc, char** argv){ printf("Usage: %s [size]\n",argv[0]); return EXIT_SUCCESS; } +#ifndef Plan9 size=atoi(argv[1]); +#endif if(size<3 || size>7){ fprintf(stderr,"3<=size<=7\n"); return EXIT_FAILURE; diff --git a/sources/fisher.c b/sources/fisher.c index 21df6c2..f39a37b 100644 --- a/sources/fisher.c +++ b/sources/fisher.c @@ -16,7 +16,7 @@ #define HWID WID/2 #ifdef Plan9 -#define usleep(1000x) sleep(x) /*milliseconds*/ +#define usleep(x) sleep(x/1000000) #endif typedef signed char byte; diff --git a/sources/memoblocks.c b/sources/memoblocks.c index 9335f6a..3d1aa8a 100644 --- a/sources/memoblocks.c +++ b/sources/memoblocks.c @@ -23,7 +23,9 @@ compile with -lncurses typedef signed char byte; typedef unsigned char ubyte; +#ifndef Plan9 byte size,size2;//size2 is there to avoid a lot of multiplications +#endif byte py,px; byte fy,fx; //the first tile chtype colors[6]={0}; @@ -173,7 +175,9 @@ int main(int argc, char** argv){ size=8; #endif if(argc>=2){ +#ifndef Plan9 size=atoi(argv[1]); +#endif if(size<3 || size>19){ fprintf(stderr,"3<=size<=19\n"); return EXIT_FAILURE; diff --git a/sources/miketron.c b/sources/miketron.c index 34bd8e5..70e7c8b 100644 --- a/sources/miketron.c +++ b/sources/miketron.c @@ -28,6 +28,7 @@ compile with -lncurses #ifdef Plan9 #define len 10 #define wid 40 +#define usleep(x) sleep(x/1000000) #endif typedef signed char byte; @@ -353,7 +354,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc==3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; diff --git a/sources/mines.c b/sources/mines.c index 256b61a..94ecf5b 100644 --- a/sources/mines.c +++ b/sources/mines.c @@ -24,7 +24,11 @@ compile with -lncurses #endif typedef signed char byte; +#ifndef Plan9 int len,wid,py,px,flags; +#else +int py,px,flags; +#endif int untouched; int mscount; chtype colors[6]={0}; @@ -221,7 +225,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc>=3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; diff --git a/sources/mkfile b/sources/mkfile index b61fbcb..7e8fe7a 100644 --- a/sources/mkfile +++ b/sources/mkfile @@ -8,7 +8,7 @@ TARG=\ fifteen \ fisher \ jewels \ - memoblocks \ +# memoblocks \ miketron \ mines \ muncher \ diff --git a/sources/muncher.c b/sources/muncher.c index 4819b55..eaae2fc 100644 --- a/sources/muncher.c +++ b/sources/muncher.c @@ -26,10 +26,15 @@ compile with -lncurses #ifdef Plan9 #define len 10 #define wid 40 +#define usleep(x) sleep(x/1000000) #endif typedef signed char byte; +#ifndef Plan9 int len,wid,py,px; +#else +int py,px; +#endif int immunity; byte direction; long score; @@ -293,7 +298,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc==3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; @@ -309,6 +318,7 @@ int main(int argc, char** argv){ } initscr(); if(autoset){ +#ifndef Plan9 len=LINES-7; if(lenMAXWID) wid=MAXWID; +#endif } srand(time(NULL)%UINT_MAX); byte board[len][wid]; diff --git a/sources/pipes.c b/sources/pipes.c index 9c48199..f9edf06 100644 --- a/sources/pipes.c +++ b/sources/pipes.c @@ -35,7 +35,11 @@ compile with -lncurses typedef signed char byte; typedef unsigned char bitbox; +#ifndef Plan9 int len,wid,py,px,fy,fx;//p: pointer f: fluid +#else +int py,px,fy,fx;//p: pointer f: fluid +#endif bitbox tocome[5]={0};//the row of pipes in the left side chtype green=A_BOLD;//will use bold font instead of green if colors are not available long score; @@ -356,7 +360,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc==3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; diff --git a/sources/rabbithole.c b/sources/rabbithole.c index c26ee10..e187847 100644 --- a/sources/rabbithole.c +++ b/sources/rabbithole.c @@ -29,7 +29,11 @@ compile with -lncurses typedef signed char byte; typedef unsigned char bitbox; +#ifndef Plan9 int len,wid,py,px; +#else +int py,px; +#endif chtype colors[6]={0}; @@ -185,7 +189,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc==3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; diff --git a/sources/sos.c b/sources/sos.c index aa31b0b..3870c4e 100644 --- a/sources/sos.c +++ b/sources/sos.c @@ -22,7 +22,11 @@ compile with -lncurses #endif typedef signed char byte; +#ifndef Plan9 int len,wid,py,px; +#else +int py,px; +#endif chtype colors[6]={A_BOLD}; int score[2] ={0}; int computer[2]={0}; @@ -250,7 +254,11 @@ int main(int argc, char** argv){ return EXIT_FAILURE; } if(argc>=3){ +#ifndef Plan9 bool lool = sscanf(argv[1],"%d",&len) && sscanf(argv[2],"%d",&wid); +#else + bool lool = sscanf(argv[1],"%d",len) && sscanf(argv[2],"%d",wid); +#endif if(!lool){ puts("Invalid input."); return EXIT_FAILURE; diff --git a/sources/sudoku.c b/sources/sudoku.c index b886d6d..104d07d 100644 --- a/sources/sudoku.c +++ b/sources/sudoku.c @@ -26,7 +26,9 @@ NOTE: This program is only made for entertainment porpuses. The puzzles are gene typedef signed char byte; byte _wait=0, waitcycles=0;//apparently 'wait' conflicts with a variable in a library macOS includes by default +#ifndef Plan9 byte size,s;//s=size*size +#endif byte py,px; byte diff; unsigned int filled; @@ -245,7 +247,9 @@ void mouseinput(int sy, int sx){ getmouse(&m); #endif if( m.y < (3+1+size+s)-sy && m.x<(2*s+1)-sx ){//it's a shame to include math.h only for round() but it was the only moral way to make gcc shut up +#ifndef Plan9 py= round( (float)(size*(m.y-4-sy))/(size+1) );//these are derived from the formulas in draw() by simple algebra +#endif px=(m.x-1-sx)/2; } else @@ -317,8 +321,10 @@ int main(int argc,char** argv){ printf("2 <= size <= 7\n"); return EXIT_FAILURE; } +#ifndef Plan9 else size = *argv[1]-'0'; +#endif } else #ifndef Plan9