diff options
Diffstat (limited to 'fxotune.c')
-rw-r--r-- | fxotune.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -86,6 +86,8 @@ struct silence_info{ static short outbuf[TEST_DURATION]; static int debug = 0; +static FILE *debugoutfile = NULL; + /** * Makes sure that the line is clear. * Right now, we do this by relying on the user to specify how long after dialing the @@ -262,7 +264,6 @@ static int maptone(int whichzap, int freq, char *dialstr, int delayuntilsilence) short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */ FILE *outfile = NULL; - outfile = fopen("fxotune_dump.vals", "w"); if (!outfile) { fprintf(stdout, "Cannot create fxotune_dump.vals\n"); @@ -392,12 +393,9 @@ static int acim_tune2(int whichzap, int freq, char *dialstr, int delayuntilsilen struct zt_bufferinfo bi; short inbuf[TEST_DURATION]; - FILE *outfile = NULL; - - if (debug) { - outfile = fopen("fxotune.vals", "w"); - if (!outfile) { + if (debug && !debugoutfile) { + if (!(debugoutfile = fopen("fxotune.vals", "w"))) { fprintf(stdout, "Cannot create fxotune.vals\n"); return -1; } @@ -516,7 +514,7 @@ static int acim_tune2(int whichzap, int freq, char *dialstr, int delayuntilsilen echo ); - fprintf(outfile, "%s\n", result); + fprintf(debugoutfile, "%s\n", result); if (debug > 1) fprintf(stdout, "%s\n", result); } |