summaryrefslogtreecommitdiffstats
path: root/libxml2/dbgenattr.pl
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-19 18:22:05 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-19 18:22:05 (GMT)
commit34be72f9ed749a5c013d3f7f47d810e8caf652cb (patch)
tree2f75b6050c088da53d774b3da3fb71e7fa49ec78 /libxml2/dbgenattr.pl
parent604eac5688c5d437ed6d585ee63e53fba6f558c0 (diff)
parent0f851b6f17365c29b56d6a17564d58a33120508a (diff)
downloadblt-34be72f9ed749a5c013d3f7f47d810e8caf652cb.zip
blt-34be72f9ed749a5c013d3f7f47d810e8caf652cb.tar.gz
blt-34be72f9ed749a5c013d3f7f47d810e8caf652cb.tar.bz2
Merge commit '0f851b6f17365c29b56d6a17564d58a33120508a' as 'libxml2'
Diffstat (limited to 'libxml2/dbgenattr.pl')
-rwxr-xr-xlibxml2/dbgenattr.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/libxml2/dbgenattr.pl b/libxml2/dbgenattr.pl
new file mode 100755
index 0000000..dce11cd
--- /dev/null
+++ b/libxml2/dbgenattr.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+$size = shift;
+
+if ($size eq "")
+{
+ die "usage: dbgen.pl [size]\n";
+}
+
+@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood",
+ "George", "Hank", "Inki", "James");
+@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman",
+ "Franklin", "Grice", "Haverford", "Ilvedson", "Jones");
+@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
+ "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
+ "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
+ "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
+ "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
+
+print "<?xml version=\"1.0\"?>\n";
+print "\n";
+print "<table>\n";
+
+for ($i=0; $i<$size; $i++)
+{
+ $first = $firstnames [$i % 10];
+ $last = $lastnames [($i / 10) % 10];
+ $state = $states [($i / 100) % 50];
+ $zip = 22000 + $i / 5000;
+
+ printf " <row\n";
+ printf " id='%04d'\n", $i;
+ printf " firstname='$first'\n", $i;
+ printf " lastname='$last'\n", $i;
+ printf " street='%d Any St.'\n", ($i % 100) + 1;
+ printf " city='Anytown'\n";
+ printf " state='$state'\n";
+ printf " zip='%d'/>\n", $zip;
+}
+
+print "</table>\n";
+