Skip to content

Commit

Permalink
Changed "-o -" to be treated as -c.
Browse files Browse the repository at this point in the history
Writing to stdout has some special handling.  Instead of having -o handle writing to stout, use the existing -c code.
  • Loading branch information
whitwham committed Feb 19, 2024
1 parent dec62a3 commit 84419bd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bgzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,15 @@ int main(int argc, char **argv)
return 1;
}

if (write_fname && pstdout) {
fprintf(stderr, "[bgzip] Cannot write to %s and stdout at the same time.\n", write_fname);
return 1;
if (write_fname) {
if (pstdout) {
fprintf(stderr, "[bgzip] Cannot write to %s and stdout at the same time.\n", write_fname);
return 1;
} else if (strncmp(write_fname, "-", strlen(write_fname)) == 0) {
// stdout has special handling so treat as -c
pstdout = 1;
write_fname = NULL;
}
}

do {
Expand Down

0 comments on commit 84419bd

Please sign in to comment.