+my $errorcount = 0;
+my $openssl = $ENV{OPENSSL} || "openssl";
+my $pwd;
+my $x509hash = "-subject_hash";
+my $crlhash = "-hash";
+my $verbose = 0;
+my $symlink_exists=eval {symlink("",""); 1};
+my $removelinks = 1;
+
+## Parse flags.
+while ( $ARGV[0] =~ /^-/ ) {
+ my $flag = shift @ARGV;
+ last if ( $flag eq '--');
+ if ( $flag eq '-old') {
+ $x509hash = "-subject_hash_old";
+ $crlhash = "-hash_old";
+ } elsif ( $flag eq '-h' || $flag eq '-help' ) {
+ help();
+ } elsif ( $flag eq '-n' ) {
+ $removelinks = 0;
+ } elsif ( $flag eq '-v' ) {
+ $verbose++;
+ }
+ else {
+ print STDERR "Usage error; try -h.\n";
+ exit 1;
+ }
+}