#! /bin/sh /usr/share/dpatch/dpatch-run ## 02_pathes.dpatch by Thomas Günther <tom@toms-cafe.de> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Set pathes for bc executable and temporary files. Remove temporary files. @DPATCH@ --- calc-0.0.1-rc5/calc.c +++ calc-0.0.1-rc5/calc.c @@ -486,12 +486,12 @@ { FILE *f; // printf("inOperand1 %s inOperand2 %s operator %c\n",inOperand1,inOperand2,cOperator); - f = fopen("./bc_in.dat","w"); + f = fopen("/tmp/bc_in.dat","w"); fprintf(f,"scale = 10\n"); fprintf(f,"%s%c%s\n",inOperand1,cOperator,inOperand2); fclose(f); - system("bc <./bc_in.dat >./bc_out.dat"); - f = fopen("./bc_out.dat","r"); + system("/usr/bin/bc </tmp/bc_in.dat >/tmp/bc_out.dat"); + f = fopen("/tmp/bc_out.dat","r"); if (f != NULL) { fscanf(f,"%s",outOperand); @@ -499,6 +499,8 @@ } else printf("VDR-Calc : bc run failed !!\n"); + remove("/tmp/bc_in.dat"); + remove("/tmp/bc_out.dat"); } void cCalcMain::CalculateResultTrig(char* inOperand1, char *outOperand, char cOperator, gradType calculateGradType) @@ -512,7 +514,7 @@ CalculateResult(inOperand1, "(3.1415926535/200)",inOperand1, '*'); // printf("inOperand1 %s inOperand2 %s operator %c\n",inOperand1,inOperand2,cOperator); - f = fopen("./bc_in.dat","w"); + f = fopen("/tmp/bc_in.dat","w"); fprintf(f,"scale = 10\n"); // only valid for cOperator == s, c, t (for sin,cos,tan) @@ -525,8 +527,8 @@ fprintf(f,"s(%s)/c(%s)\n",inOperand1,inOperand1); } fclose(f); - system("bc -l <./bc_in.dat >./bc_out.dat"); - f = fopen("./bc_out.dat","r"); + system("/usr/bin/bc -l </tmp/bc_in.dat >/tmp/bc_out.dat"); + f = fopen("/tmp/bc_out.dat","r"); if (f != NULL) { fscanf(f,"%s",outOperand); @@ -534,6 +536,8 @@ } else printf("VDR-Calc : bc run failed !!\n"); + remove("/tmp/bc_in.dat"); + remove("/tmp/bc_out.dat"); clearOutputForNextDigit = true; }