Tweak games/blinken version 4.14.3
[dports.git] / games / block / files / patch-ab
1 --- block.c.orig        Wed Mar 24 01:39:36 1999
2 +++ block.c     Wed Jun 18 04:38:34 2003
3 @@ -12,6 +12,7 @@
4  
5  #include <string.h>
6  #include <stdlib.h>
7 +#include <unistd.h>
8  
9  /*heck - i started writing the thing using curses - then 
10           switched to ncurses, did not seem to make much
11 @@ -32,7 +33,7 @@
12  #define FF_HOME    4 
13  #define FF_OVEN    5
14  
15 -#define SCORE_FILE "/usr/games/lib/save/score"
16 +#define SCORE_FILE PREFIX "/share/block/save/score"
17  /* uncomment if you like lots of diagnostic garbage */
18  /* #define DEBUG 1                                  */
19  
20 @@ -92,17 +93,17 @@
21    } 
22  
23    
24 -  username = (char *) getlogin();
25 -  sprintf(buf,"/usr/games/lib/save/%s",username);
26 +  username = getlogin();
27 +  sprintf(buf, PREFIX "/share/block/%s",username);
28    fp = fopen( buf , "rt");
29    if( fp != NULL ) {
30        fscanf(fp , "%d", &level);
31        fclose(fp);
32    } 
33    if( level != 0 ) {
34 -      sprintf( buf , "/usr/games/lib/%d.block" , level);
35 +      sprintf( buf , PREFIX "/share/block/%d.block" , level);
36    } else {
37 -      sprintf( buf , "/usr/games/lib/1.block");
38 +      sprintf( buf , PREFIX "/share/block/1.block");
39        level=1;
40    }
41    strcpy(lname,buf); 
42 @@ -172,7 +173,7 @@
43               break;
44      case 1 : 
45      case 2 : printf("Hmmm... trouble reading file %s\n",lname);
46 -             sprintf(tmp,"/usr/games/lib/%s.block",lname);
47 +             sprintf(tmp, PREFIX "/share/block/%s.block",lname);
48               if(loadnext(&cw,tmp)){
49                 printf("Could not read %s either\n",tmp); 
50                 if(loadnext(&cw,"default")){
51 @@ -539,7 +540,7 @@
52                printw( "\t\t %2d. %8s       %4d         %5ld       %5ld\n", i+1, (char *)High[i].Name,High[i].Level,High[i].Score,High[i].Moves);
53              }
54              level++;
55 -             sprintf(buf,"/usr/games/lib/save/%s",username);
56 +             sprintf(buf,PREFIX "/share/block/save/%s",username);
57              fp = fopen(buf,"wt");
58              if( fp != NULL ) {
59                  fprintf(fp , "%d", level);
60 @@ -557,7 +558,7 @@
61    endwin();
62                 /*Hope they come back again*/
63    
64 -  sprintf(lname,"/usr/games/lib/%d.block",level);
65 +  sprintf(lname,PREFIX "/share/block/%d.block",level);
66    /* yuck - a messy kludge - the fname stores the name of the next game*/
67    moves=0;
68    if(looper)looper=2;    
69 @@ -756,7 +757,9 @@
70                                 High[j].Moves = High[j-1].Moves;
71                                 strncpy(High[j].Name,High[j-1].Name,10);
72                         }
73 +               #if 0
74                 cuserid((char *) High[i].Name);
75 +               #endif
76                 High[i].Score = ThisScore;
77                 High[i].Level = Level;
78                 High[i].Moves = Moves;