summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormisi3k2003-07-09 16:33:55 (GMT)
committercvs2git2012-06-24 12:13:13 (GMT)
commita3fd1e929afd770991b3ab0608d39711dfa25e56 (patch)
tree77ce1e010dc0f0d581239d0909df29f239163112
parent32026ce44dfd5b38c2fe061dc4fa372125511c7c (diff)
downloadtypespeed-a3fd1e929afd770991b3ab0608d39711dfa25e56.zip
typespeed-a3fd1e929afd770991b3ab0608d39711dfa25e56.tar.gz
44c336086e1449c26c45a7aeaef53a89 typespeed-buff_over_fix.patch
Changed files: typespeed-buff_over_fix.patch -> 1.1
-rw-r--r--typespeed-buff_over_fix.patch184
1 files changed, 184 insertions, 0 deletions
diff --git a/typespeed-buff_over_fix.patch b/typespeed-buff_over_fix.patch
new file mode 100644
index 0000000..019fd6f
--- /dev/null
+++ b/typespeed-buff_over_fix.patch
@@ -0,0 +1,184 @@
+--- typespeed-0.4.1.orig/file.c
++++ typespeed-0.4.1/file.c
+@@ -4,6 +4,11 @@
+
+ #include "typespeed.h"
+
++#ifdef DEBIAN
++#define DEBIAN__HIGHSCORE "/var/games/typespeed"
++#define DEBIAN__WORDLIST "/usr/share/games/typespeed"
++#endif /* DEBIAN */
++
+ int loadwords(char *stringi)
+ {
+ FILE *wordfile;
+@@ -14,6 +19,9 @@
+ wordcount = -1;
+ nakkimakkara = 0;
+
++#ifdef DEBIAN
++chdir(DEBIAN__WORDLIST);
++#endif /* DEBIAN */
+ if ((wordfile = fopen(stringi, "r")) == NULL) {
+ return 1;
+ }
+@@ -59,7 +67,7 @@
+ int i;
+
+ for (i = 0; i < wordcount; i++)
+- free(word[wordcount]);
++ free(word[i]);
+
+ }
+
+@@ -77,7 +85,7 @@
+ char *info;
+ //char *thingie[50];
+ char thingie[WORDFILE_MAX][62];
+- char merkk;
++ int merkk;
+
+
+ filena = malloc(4 * sizeof(char));
+@@ -86,6 +94,9 @@
+ k = 0;
+ a = 1;
+
++#ifdef DEBIAN
++chdir(DEBIAN__WORDLIST);
++#endif /* DEBIAN */
+ dcolor_set(5, NULL);
+ n = scandir(".", &namelist, 0, alphasort);
+ tot = n;
+@@ -269,6 +280,9 @@
+ {"3l33t", "Pro", "VeryGood", "Good", "Average", "NoGood", "ADP-Pro", "Looser", "None", "None"};
+
+
++#ifdef DEBIAN
++chdir(DEBIAN__HIGHSCORE);
++#endif /* DEBIAN */
+ filetys = (char *) malloc(sizeof(char) * (strlen(sanafile) + strlen(".high") + 1));
+ strcpy(filetys, "");
+ strcat(filetys, "high.");
+@@ -308,6 +322,9 @@
+ float typoratio;
+ char faim[21];
+ } high;
++#ifdef DEBIAN
++chdir(DEBIAN__HIGHSCORE);
++#endif /* DEBIAN */
+ filetys = (char *) malloc(sizeof(char) * (strlen(sanafile) + strlen(".high") + 1));
+ strcpy(filetys, "");
+ strcat(filetys, "high.");
+@@ -383,6 +400,9 @@
+ strlen(".high")
+ + 1));
+
++#ifdef DEBIAN
++chdir(DEBIAN__HIGHSCORE);
++#endif /* DEBIAN */
+ dcolor_set(5, NULL);
+ strcpy(filet, "");
+ strcat(filet, "high.");
+@@ -485,7 +505,7 @@
+ {
+
+ FILE *conffile;
+- char wordhakemisto[81];
++ char wordhakemisto[1025];
+ char tmp[10];
+ char *userhome;
+
+@@ -493,14 +513,16 @@
+ sprintf(userhome,getenv("HOME"));
+ strcat(userhome,"/");
+ strcat(userhome,LOCALCONF);
+- hakemisto = malloc(82 * sizeof(char));
+- getcwd(hakemisto, 80);
++ hakemisto = malloc(1026 * sizeof(char));
++ getcwd(hakemisto, 1024);
+ conffile = fopen(CONFIGFILE, "r");
+ if (conffile != NULL) {
+ // didn't work | fgets(wordhakemisto,80,conffile);
+ // we use fscanf then :D | fgets(tmp,6,conffile);
+- fscanf(conffile, "%s", wordhakemisto);
+- fscanf(conffile, "%s", tmp);
++ fgets(wordhakemisto, 1024, conffile);
++ while (iscntrl(wordhakemisto[strlen(wordhakemisto)-1]))
++ wordhakemisto[strlen(wordhakemisto)-1] = '\0';
++ fgets(tmp, 6, conffile);
+ if (!strcmp(tmp, "cheat"))
+ opt.cheat = 1;
+ fclose(conffile);
+@@ -508,8 +530,10 @@
+ }
+ conffile = fopen(userhome, "r");
+ if (conffile != NULL) {
+- fscanf(conffile, "%s", wordhakemisto);
+- fscanf(conffile, "%s", tmp);
++ fgets(wordhakemisto, 1024, conffile);
++ while (iscntrl(wordhakemisto[strlen(wordhakemisto)-1]))
++ wordhakemisto[strlen(wordhakemisto)-1] = '\0';
++ fgets(tmp, 6, conffile);
+ if (!strcmp(tmp, "cheat"))
+ opt.cheat = 1;
+ fclose(conffile);
+@@ -523,6 +547,9 @@
+ struct dirent **namelist;
+ int n;
+
++#ifdef DEBIAN
++chdir(DEBIAN__WORDLIST);
++#endif /* DEBIAN */
+ n = scandir(".", &namelist, 0, alphasort);
+ if (n < 0) {
+ printf("scandir failed.\n");
+--- typespeed-0.4.1.orig/network.c
++++ typespeed-0.4.1/network.c
+@@ -243,7 +243,7 @@
+ }
+ }
+
+- number=malloc(10*sizeof(char));
++ number=malloc(80*sizeof(char));
+ temp=malloc(80*sizeof(char));
+
+ i=0;
+@@ -266,7 +266,7 @@
+ }
+ free(temp);
+
+- number=malloc(10*sizeof(char));
++ number=malloc(80*sizeof(char));
+ strncpy(number,temp2,strcspn(temp2," "));
+ stat2->speed=(float) atof(number);
+ free(number);
+@@ -279,7 +279,7 @@
+ }
+ free(temp2);
+
+- number=malloc(10*sizeof(char));
++ number=malloc(80*sizeof(char));
+ strncpy(number,temp,strcspn(temp," "));
+ stat2->totalspeed= (float) atof(number);
+ temp2=malloc(80*sizeof(char));
+--- typespeed-0.4.1.orig/typespeed.c
++++ typespeed-0.4.1/typespeed.c
+@@ -622,7 +622,7 @@
+ int wheretogo=0;
+ int want_help = 0;
+
+- char serv[64];
++ char serv[256];
+
+ opt.cheat = DEFAULT_CHEAT;
+ opt.training = DEFAULT_TRAINING;
+@@ -672,7 +672,7 @@
+ opt.client = 1;
+ if (!optarg)
+ abort(); /* getopt should handle this... */
+- strcpy(serv, optarg);
++ strncpy(serv, optarg, 255);
+ break;
+ case 'p':
+ if (optarg) opt.port = atoi(optarg);