summaryrefslogtreecommitdiff
path: root/utilities/perl
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
commit03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (patch)
tree847326a4de82f0241ac87cbbc427a1b92a696a02 /utilities/perl
parentd7469385b05b9510338407fa123e9ad090f80af6 (diff)
Imported Upstream version 1.5.11
Diffstat (limited to 'utilities/perl')
-rw-r--r--utilities/perl/Makefile.am6
-rwxr-xr-xutilities/perl/cipherkeygen.pl24
-rwxr-xr-xutilities/perl/linkvers.pl44
-rwxr-xr-xutilities/perl/localecap.pl23
-rwxr-xr-xutilities/perl/mkvsmod.pl21
5 files changed, 118 insertions, 0 deletions
diff --git a/utilities/perl/Makefile.am b/utilities/perl/Makefile.am
new file mode 100644
index 0000000..d9c9556
--- /dev/null
+++ b/utilities/perl/Makefile.am
@@ -0,0 +1,6 @@
+swperlutildir = $(top_srcdir)/utilities/perl
+
+EXTRA_DIST += $(swperlutildir)/cipherkeygen.pl
+EXTRA_DIST += $(swperlutildir)/linkvers.pl
+EXTRA_DIST += $(swperlutildir)/localecap.pl
+EXTRA_DIST += $(swperlutildir)/mkvsmod.pl
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..caf3192
--- /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.\n");
+}
+
+$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);