summaryrefslogtreecommitdiff
path: root/ztmonitor.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-11-10 11:40:00 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-11-10 11:40:00 +0000
commit34bbd57691678faef310257dedfdb60035abdb27 (patch)
tree04ce999f3c43b02807493b07d3033801c11bd0fb /ztmonitor.c
parentfa06a0de0ed629daf50468dddbf49ff5148365bd (diff)
ztmonitor: Get rid of a pointless static buffer and strcpy.
And also give a more useful conversion message. Merged revisions 3222 via svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3223 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztmonitor.c')
-rw-r--r--ztmonitor.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/ztmonitor.c b/ztmonitor.c
index e882eeb..b759f45 100644
--- a/ztmonitor.c
+++ b/ztmonitor.c
@@ -259,7 +259,6 @@ int main(int argc, char *argv[])
int pfd[4] = {-1, -1, -1, -1};
short buf[8192];
short buf2[16384];
- char output_file[255];
int res, res2;
int visual = 0;
int multichannel = 0;
@@ -309,6 +308,8 @@ int main(int argc, char *argv[])
} else if ((!strcmp(argv[i], "-f") || !strcmp(argv[i], "-r") || !strcmp(argv[i], "-t")
|| !strcmp(argv[i], "-F") || !strcmp(argv[i], "-R") || !strcmp(argv[i], "-T"))
&& (i+1) < argc) {
+ char *output_file;
+
/* Set which file descriptor to use */
if (!strcmp(argv[i], "-f")) {
savefile = 1;
@@ -339,17 +340,15 @@ int main(int argc, char *argv[])
x = 0;
++i; /* we care about the file name */
- if (strlen(argv[i]) < 255 ) {
- strcpy(output_file, argv[i]);
- fprintf(stderr, "Output to %s\n", output_file);
- if ((ofh[x] = fopen(output_file, "w"))<0) {
- fprintf(stderr, "Could not open %s for writing: %s\n", output_file, strerror(errno));
- exit(1);
- }
- fprintf(stderr, "Run e.g., 'sox -r 8000 -s -w -c 1 %s file.wav' to convert.\n", output_file);
- } else {
- fprintf(stderr, "File Name %s too long\n",argv[i+1]);
+ output_file = argv[i];
+ fprintf(stderr, "Output to %s\n", output_file);
+ if ((ofh[x] = fopen(output_file, "w"))<0) {
+ fprintf(stderr, "Could not open %s for writing: %s\n",
+ output_file, strerror(errno));
+ exit(1);
}
+ fprintf(stderr, "Run e.g., 'sox -r 8000 -s -w -c 1 %s %s.wav' to convert.\n",
+ output_file, output_file);
} else if (!strcmp(argv[i], "-m")) {
multichannel = 1;
} else if (!strcmp(argv[i], "-o")) {