From 51abe1d11a02f6854cf9917b4d6c32965c6e7be6 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 17 Feb 2017 13:19:17 +0100 Subject: [PATCH 1/3] Get default encoding from locale --- charhist/charhist.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/charhist/charhist.pl b/charhist/charhist.pl index 8460480..0cdcf58 100644 --- a/charhist/charhist.pl +++ b/charhist/charhist.pl @@ -1,11 +1,13 @@ #!/usr/bin/perl use warnings; use strict; -use Getopt::Long; -use Pod::Usage; use autodie; -my $encoding; +use Getopt::Long; +use I18N::Langinfo qw(langinfo CODESET); +use Pod::Usage; + +my $encoding = langinfo(CODESET); GetOptions('encoding=s', \$encoding) or pod2usage(); From fdd9010646e0ed803f64cf5a7721b63b950c0264 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 17 Feb 2017 13:20:05 +0100 Subject: [PATCH 2/3] Separate all fields with tabs --- charhist/charhist.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charhist/charhist.pl b/charhist/charhist.pl index 0cdcf58..a9748d3 100644 --- a/charhist/charhist.pl +++ b/charhist/charhist.pl @@ -21,7 +21,7 @@ if (@ARGV) { binmode STDOUT, ":encoding(UTF-8)"; for (sort keys %hist) { my $cp = ord; - printf("%x %d %o %s\t%d\n", $cp, $cp, $cp, /\p{Graph}/ ? $_ : ".", $hist{$_}); + printf("%x\t%d\t%o\t%s\t%d\n", $cp, $cp, $cp, /\p{Graph}/ ? $_ : ".", $hist{$_}); } sub readfile { From 75b3f4bea7864367f96ee01ab6d48928fecf5706 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Mon, 23 Jul 2018 12:15:59 +0200 Subject: [PATCH 3/3] Use install instead of cp --- charhist/GNUmakerules.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charhist/GNUmakerules.pl b/charhist/GNUmakerules.pl index 8f30daa..15db030 100644 --- a/charhist/GNUmakerules.pl +++ b/charhist/GNUmakerules.pl @@ -3,6 +3,6 @@ use warnings; use strict; print "\$(BINDIR)/%: %\n"; -print "\tcp \$^ \$@\n"; +print "\tinstall -m 755 \$^ \$@\n"; print "\$(MAN1DIR)/%: %\n"; -print "\tcp \$^ \$@\n"; +print "\tinstall -m 644 \$^ \$@\n";