Commit 5a193da5 authored by conrad's avatar conrad

oggz-merge: allow use of stdin as in input ("-") so that the output of

an encoder can be piped in and merged with an existing file.


git-svn-id: http://svn.annodex.net/liboggz/trunk@3785 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 2c4674bf
......@@ -328,6 +328,7 @@ main (int argc, char * argv[])
char * progname;
char * infilename = NULL, * outfilename = NULL;
FILE * infile = NULL, * outfile = NULL;
int used_stdin = 0; /* Flag usage of stdin, only use it once */
OMData * omdata;
int i;
......@@ -416,7 +417,15 @@ main (int argc, char * argv[])
while (optind < argc) {
infilename = argv[optind++];
infile = fopen (infilename, "rb");
if (strcmp (infilename, "-") == 0) {
if (used_stdin) continue;
infile = stdin;
used_stdin = 1;
} else {
infile = fopen (infilename, "rb");
}
if (infile == NULL) {
fprintf (stderr, "%s: unable to open input file %s\n", progname,
infilename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment