Skip to content

Commit

Permalink
bug 1294417 - Make certdata.perl take input/output as command-line pa…
Browse files Browse the repository at this point in the history
…rameters. r=wtc
  • Loading branch information
luser committed Aug 16, 2016
1 parent 4365cb2 commit 3194bb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ckfw/builtins/Makefile
Expand Up @@ -51,4 +51,4 @@ endif

$(OBJDIR)/certdata.c: $(NSS_CERTDATA_TXT) certdata.perl
@$(MAKE_OBJDIR)
$(PERL) certdata.perl < $(NSS_CERTDATA_TXT) > $@
$(PERL) certdata.perl $(NSS_CERTDATA_TXT) $@
12 changes: 12 additions & 0 deletions lib/ckfw/builtins/certdata.perl
Expand Up @@ -14,6 +14,18 @@
$constants{CK_TRUE} = "static const CK_BBOOL ck_true = CK_TRUE;\n";
$constants{CK_FALSE} = "static const CK_BBOOL ck_false = CK_FALSE;\n";

if( scalar @ARGV == 0 ) {
print STDERR "Usage: $0 <input-file> [output-file]\n";
exit 1;
}

open(STDIN, '<', $ARGV[0])
or die "Could not open input file '$ARGV[0]' $!";
if( scalar @ARGV > 1 ) {
open(STDOUT, '>', $ARGV[1])
or die "Could not open output file '$ARGV[1]' $!";
}

while(<>) {
my @fields = ();
my $size;
Expand Down

0 comments on commit 3194bb6

Please sign in to comment.