summaryrefslogtreecommitdiff
path: root/thanks-gen
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
commit70e9163c9c18e995515598085cb824e554eb7ae7 (patch)
treea42dc8b2a6c031354bf31472de888bfc8a060132 /thanks-gen
parentcbf5993c43f49281173f185863577d86bfac6eae (diff)
downloadcoreutils-tarball-70e9163c9c18e995515598085cb824e554eb7ae7.tar.gz
Diffstat (limited to 'thanks-gen')
-rwxr-xr-xthanks-gen16
1 files changed, 16 insertions, 0 deletions
diff --git a/thanks-gen b/thanks-gen
new file mode 100755
index 0000000..f1c11b3
--- /dev/null
+++ b/thanks-gen
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -nl
+# Use Perl's multi-byte alignment code, via sprintf, while
+# performing a rudimentary check for duplicate names and
+# removing duplicate name,email pairs.
+use Encode;
+
+BEGIN { my (%seen, %name) }
+
+chomp;
+my ($name, $email) = split '\0', decode ('UTF-8', $_);
+
+$seen{$name}++
+ and warn "$0: THANKS.in: duplicate name: $name\n";
+
+print encode ('UTF-8', sprintf ('%-36s', $name)), $email
+ unless $seen{"$name\0$email"}++;