diff options
author | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
commit | c9458897ebbb739d8db83c80e06512d8a612f743 (patch) | |
tree | f8c5381045887e34388cc6b26cfccc254bf766dc /utilities/perl | |
download | sword-sf-cvs-c9458897ebbb739d8db83c80e06512d8a612f743.tar.gz |
*** empty log message ***
Diffstat (limited to 'utilities/perl')
-rwxr-xr-x | utilities/perl/cipherkeygen.pl | 24 | ||||
-rwxr-xr-x | utilities/perl/linkvers.pl | 44 | ||||
-rwxr-xr-x | utilities/perl/localecap.pl | 23 | ||||
-rwxr-xr-x | utilities/perl/mkvsmod.pl | 21 |
4 files changed, 112 insertions, 0 deletions
diff --git a/utilities/perl/cipherkeygen.pl b/utilities/perl/cipherkeygen.pl new file mode 100755 index 0000000..db53d88 --- /dev/null +++ b/utilities/perl/cipherkeygen.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +# cipherkeygen.pl + +# generates a cipher key of the format \d{4}[a-zA-Z]{4}\d{4}[a-zA-Z]{4}. +# because I'm lazy and not random enough. +# and because the utilities/perl directory is kinda bare... + + +# let's get a base key of \d{4}[A-Z]{4}\d{4}[A-Z]{4} +$key = int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41); + +# now randomly lowercase the letters, printing as we go +foreach $c (unpack ("cccccccccccccccc", $key)) { + $c = chr($c); + if (rand() < 0.5) { + $c = lc($c); + } + print $c; +} +print "\n"; + + + diff --git a/utilities/perl/linkvers.pl b/utilities/perl/linkvers.pl new file mode 100755 index 0000000..751dc14 --- /dev/null +++ b/utilities/perl/linkvers.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +$vplfile = $ARGV[0]; + +if ($vplfile eq "") { + die("linkvers.pl Syntax:\n./linkvers.pl <vpl file> [1 - checking mode on].\nMust be run AFTER vpl2mod is completed.\ndied"); +} + +$check = $ARGV[1]; + +open(INF,$vplfile) or die; +while (<INF>) { + $line = $_; + + $line =~ /([\w ]+:[\d\-]+)\s+(.*)/; + $vref = $1; + + if ($vref =~ /\-/) { + $vref =~ /(.*:)(\d+)\-(\d+)/; + $ch = $1; + $fv = $2; + $lv = $3; + if ($fv + 1 == $lv) { + $sv = $lv; + } + else { + $sv = $fv + 1; + $sv .= "-" . $lv; + } + $first = $ch . $fv; + $last = $ch . $sv; + + if ($check ne "") { + print "$first\t\t$last\n"; + } else { + `addvs -l ./ \"$first\" \"$last\"`; + } + } +} +close(INF); + + + + diff --git a/utilities/perl/localecap.pl b/utilities/perl/localecap.pl new file mode 100755 index 0000000..f5d846e --- /dev/null +++ b/utilities/perl/localecap.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +# This tool is only for locales in Latin-1, not UTF-8 (should such locales be supported at a later date) + +use locale; + +$abbrevs = 0; + +open (INPUT, "$ARGV[0]") or print "Give the locale file as an argument.\n"; +@loc = <INPUT>; +close (INPUT); +open (OUTPUT, ">$ARGV[0]"); +foreach $line (@loc) { + + if ($line =~ /\[Book Abbrevs\]/) { + $abbrevs = 1; + } + elsif ($abbrevs == 1) { + $line = uc($line); + } + print OUTPUT $line; +} +close (OUTPUT); diff --git a/utilities/perl/mkvsmod.pl b/utilities/perl/mkvsmod.pl new file mode 100755 index 0000000..e44c27d --- /dev/null +++ b/utilities/perl/mkvsmod.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +open (INF, $ARGV[0]); + +`addvs -c ./`; +while (<INF>) { + + $line = $_; + $line =~ s/[\r\n]//g; + $line =~ /(.+\d+:\d+:?) +(.*)/; + $ref = $1; + $ver = $2; + open (BUF, ">buffer"); + print BUF "$ver"; + close (BUF); + $x = `addvs -a ./ \"$ref\" buffer`; + print "$ref\n"; + +} + +close (INF); |