From faae654a23a0407923bc512c8e308f02e00edd7b Mon Sep 17 00:00:00 2001 From: David Blacka Date: Wed, 9 Feb 2011 23:58:54 +0000 Subject: [PATCH] make reading and writing to stdin/stdout work for most of the tools git-svn-id: https://svn.verisignlabs.com/jdnssec/tools/trunk@241 4cbd57fe-54e5-0310-bd9a-f30fe5ea5e6e --- src/com/verisignlabs/dnssec/cl/SignRRset.java | 2 +- src/com/verisignlabs/dnssec/cl/SignZone.java | 2 +- .../verisignlabs/dnssec/security/ZoneUtils.java | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/com/verisignlabs/dnssec/cl/SignRRset.java b/src/com/verisignlabs/dnssec/cl/SignRRset.java index 7835715..cade60b 100644 --- a/src/com/verisignlabs/dnssec/cl/SignRRset.java +++ b/src/com/verisignlabs/dnssec/cl/SignRRset.java @@ -414,7 +414,7 @@ public class SignRRset { } // default the output file, if not set. - if (state.outputfile == null) { + if (state.outputfile == null && !state.inputfile.equals("-")) { state.outputfile = state.inputfile + ".signed"; } diff --git a/src/com/verisignlabs/dnssec/cl/SignZone.java b/src/com/verisignlabs/dnssec/cl/SignZone.java index ed1f62c..2428985 100644 --- a/src/com/verisignlabs/dnssec/cl/SignZone.java +++ b/src/com/verisignlabs/dnssec/cl/SignZone.java @@ -809,7 +809,7 @@ public class SignZone } // default the output file, if not set. - if (state.outputfile == null) + if (state.outputfile == null && !state.zonefile.equals("-")) { if (zonename.isAbsolute()) { diff --git a/src/com/verisignlabs/dnssec/security/ZoneUtils.java b/src/com/verisignlabs/dnssec/security/ZoneUtils.java index 2e86be0..0d47080 100644 --- a/src/com/verisignlabs/dnssec/security/ZoneUtils.java +++ b/src/com/verisignlabs/dnssec/security/ZoneUtils.java @@ -56,11 +56,18 @@ public class ZoneUtils * @throws IOException * if something goes wrong reading the zone file. */ - public static List readZoneFile(String zonefile, Name origin) - throws IOException + public static List readZoneFile(String zonefile, Name origin) throws IOException { ArrayList records = new ArrayList(); - Master m = new Master(zonefile, origin); + Master m; + if (zonefile.equals("-")) + { + m = new Master(System.in); + } + else + { + m = new Master(zonefile, origin); + } Record r = null; @@ -81,8 +88,7 @@ public class ZoneUtils * @param zonefile * the file to write to. If null or equal to "-", System.out is used. */ - public static void writeZoneFile(List records, String zonefile) - throws IOException + public static void writeZoneFile(List records, String zonefile) throws IOException { PrintWriter out = null;