File PhantomasPC-0.9-recordfile.patch of Package PhantomasPC
--- src/records.c
+++ src/records.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -6,12 +7,14 @@
#include "trans.h"
#include "control.h"
+static char* recordfile;
RECORDS *ph_init_records(void)
{
RECORDS *aux;
int i;
+ asprintf(&recordfile,"%s/.phantpc/%s",getenv("HOME"),RECORDFILE);
aux=(struct RECORDS *)malloc(sizeof(struct RECORDS));
if (aux==NULL) ph_log_memory_error((char *)"records.c",(char *)"ph_init_records",(char *)"aux",sizeof(struct RECORDS));
memset(aux,0,sizeof(struct RECORDS));
@@ -41,6 +44,7 @@
free(rec->r[i]);
free(rec->aux);
free(rec);
+ free(recordfile);
}
@@ -125,7 +129,7 @@
FILE *f;
int i;
- f=fopen(RECORDFILE,"wb");
+ f=fopen(recordfile,"wb");
for (i=0;i<MAXRECS;i++)
{
@@ -141,7 +145,7 @@
FILE *f;
int i;
- f=fopen(RECORDFILE,"rt");
+ f=fopen(recordfile,"rt");
if (f==NULL)
{
ph_set_records_default(rec);