diff options
Diffstat (limited to 'make_servers_charset.pl')
-rwxr-xr-x | make_servers_charset.pl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/make_servers_charset.pl b/make_servers_charset.pl new file mode 100755 index 0000000..bddba8b --- /dev/null +++ b/make_servers_charset.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl +# SPDX-License-Identifier: GPL-2.0-or-later + +use warnings; +use strict; + +while (<>) { + chomp; + s/#.*$//; + s/^\s+//; s/\s+$//; + next if /^$/; + + die "format error: $_" if not + (my ($a, $b, $c) = /^([a-z0-9.-]+)\s+([a-z0-9-]+)(?:\s+(.+))?$/); + + if ($c) { + print qq| { "$a",\t"$b",\t"$c" },\n|; + } else { + print qq| { "$a",\t"$b",\tNULL },\n|; + } +} + |