1 From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
2 Date: Thu, 8 Oct 2015 21:29:45 +0200
3 Subject: oggdec: Write to stdout instead of "-.wav" when reading from stdin
4 and not output file name is given.
6 In bug #263762 it was reported that the behavior of oggdec was inconsistent
7 with its documentation: According to the man page, "oggdec" should write to
8 stdout, when reading its input from stdin and no output file name is given.
9 The "oggdec" executable writes to "-.wav" instead.
11 I adjusted the behavior of "oggdec" instead of adjusting the documentation
12 because it seems more sensible to write to stdout than to write to a file
13 called "-.wav". The code changes themselves are simple enough to be
16 Bug-Debian: https://bugs.debian.org/263762
17 Forwarded: https://trac.xiph.org/ticket/1678#comment:1
19 oggdec/oggdec.c | 27 ++++++++++++++++-----------
20 1 file changed, 16 insertions(+), 11 deletions(-)
22 diff --git a/oggdec/oggdec.c b/oggdec/oggdec.c
23 index 3f2ae7b..84047de 100644
26 @@ -443,16 +443,21 @@ int main(int argc, char **argv)
30 - char *end = strrchr(argv[i], '.');
31 - end = end?end:(argv[i] + strlen(argv[i]) + 1);
33 - out = malloc(strlen(argv[i]) + 10);
34 - strncpy(out, argv[i], end-argv[i]);
35 - out[end-argv[i]] = 0;
37 - strcat(out, ".raw");
39 - strcat(out, ".wav");
40 + if(!strcmp(argv[i], "-")) {
44 + char *end = strrchr(argv[i], '.');
45 + end = end?end:(argv[i] + strlen(argv[i]) + 1);
47 + out = malloc(strlen(argv[i]) + 10);
48 + strncpy(out, argv[i], end-argv[i]);
49 + out[end-argv[i]] = 0;
51 + strcat(out, ".raw");
53 + strcat(out, ".wav");
57 infile = open_input(in);
58 @@ -469,7 +474,7 @@ int main(int argc, char **argv)
63 + if(!outfilename && out)