SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,37 @@
#! /usr/bin/perl
# a small script that takes a sqlite3 schema and creates
# a normalized version (zaps extraneous spaces, rewrites
# everything as lowercase, sorts by table/view name)
use v5.36;
my ($object, $comment);
my $stmt = '';
while(<STDIN>) {
chomp;
$stmt .= " ".lc($_);
if (m/\;/) {
$stmt =~ s/\s+/ /g;
$stmt =~ s/^\s//;
$stmt =~ s/\s?\(\s?/\(/g;
$stmt =~ s/\s?\)\s?/\)/g;
if ($stmt =~ m/^create table (\S+)/) {
$object->{$1} = $stmt;
} elsif ($stmt =~ m/^create view (\S+)/) {
$object->{$1} = $stmt;
} else {
say $stmt;
}
$stmt = '';
}
}
for my $k (sort keys %$object) {
if ($object->{$k} =~ m,\s/\*,) {
say "$`\n/*$'\n";
} else {
say $object->{$k}, "\n";
}
}