diff options
author | Francois Pons <fpons@mandriva.com> | 2001-01-16 16:39:46 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-01-16 16:39:46 +0000 |
commit | 0679f11fe6ad987d65afa871e885205b80a07c73 (patch) | |
tree | 24f79a104246dd7b83c3ec3b894484db3a370e0a | |
parent | 738b780f9dc91ea137fd20e79b1369e169060b58 (diff) | |
download | rpmtools-0679f11fe6ad987d65afa871e885205b80a07c73.tar rpmtools-0679f11fe6ad987d65afa871e885205b80a07c73.tar.gz rpmtools-0679f11fe6ad987d65afa871e885205b80a07c73.tar.bz2 rpmtools-0679f11fe6ad987d65afa871e885205b80a07c73.tar.xz rpmtools-0679f11fe6ad987d65afa871e885205b80a07c73.zip |
added --output options.
-rw-r--r-- | parsehdlist.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/parsehdlist.c b/parsehdlist.c index 16e5c5d..9027aee 100644 --- a/parsehdlist.c +++ b/parsehdlist.c @@ -189,7 +189,17 @@ int main(int argc, char **argv) else if (strcmp(argv[i], "--conflicts") == 0) print_conflicts = 1; else if (strcmp(argv[i], "--obsoletes") == 0) print_obsoletes = 1; else if (strcmp(argv[i], "--prereqs") == 0) print_prereqs = 1; - else if (strcmp(argv[i], "--all") == 0) { + else if (strcmp(argv[i], "--output") == 0) { + if (i+1 >= argc || !argv[i+1] || !argv[i+1][0]) { + fprintf(stderr, "option --output need a valid filename after it\n"); + exit(1); + } + if (!freopen(argv[i+1], "w", stdout)) { + unlink(argv[i+1]); + fprintf(stderr, "unable to redirect output to [%s]\n", argv[i+1]); + exit(1); + } else ++i; /* avoid parsing filename as an argument */ + } else if (strcmp(argv[i], "--all") == 0) { print_name = 1; print_group = 1; print_provides = 1; |