1#!@PERL@
2
3# gpgkeys_test - keyserver code tester
4# Copyright (C) 2001 Free Software Foundation, Inc.
5#
6# This file is part of GnuPG.
7#
8# GnuPG is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# GnuPG is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, see <http://www.gnu.org/licenses/>.
20use Getopt::Std;
21$Getopt::Std::STANDARD_HELP_VERSION=1;
22
23$|=1;
24
25sub VERSION_MESSAGE ()
26{
27    print STDOUT "gpgkeys_test (GnuPG) @VERSION@\n";
28}
29
30sub HELP_MESSAGE ()
31{
32    print STDOUT <<EOT
33
34--help     Print this help
35--version  Print the version
36EOT
37}
38
39
40getopts('o:');
41
42print STDERR "gpgkeys_test starting\n";
43
44if(defined($opt_o))
45{
46    print STDERR "Using output file $opt_o\n";
47    open(STDOUT,">$opt_o") || die "Can't open output file $opt_o\n";
48}
49
50if(@ARGV)
51{
52    print STDERR "Using input file $ARGV[0]\n";
53    open(STDIN,$ARGV[0]) || die "Can't open input file $ARGV[0]\n";
54}
55
56# Get the command block
57
58print STDERR "Command block:\n";
59
60while(<STDIN>)
61{
62    last if($_ eq "\n");
63    print STDERR "--command-> $_";
64
65    if(/^COMMAND (\w+)/)
66    {
67	$command=$1;
68    }
69}
70
71# Get the keylist block
72
73print STDERR "Keylist block:\n";
74
75while(<STDIN>)
76{
77    last if($_ eq "\n");
78    print STDERR "--keylist-> $_";
79}
80
81# If it's a SEND, then get the key material
82
83if($command eq "SEND")
84{
85    print STDERR "Key material to send:\n";
86
87    while(<STDIN>)
88    {
89	print STDERR "$_";
90    }
91}
92
93printf STDERR "gpgkeys_test finished\n";
94
95# Local Variables:
96# mode:perl
97# End:
98