/usr/bin/ujguess is in libunicode-japanese-perl 0.47-1+b4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
## ----------------------------------------------------------------------------
# ujguess
# -----------------------------------------------------------------------------
# Mastering programmed by YAMASHINA Hio
#
# Copyright 2005 YAMASHINA Hio
# -----------------------------------------------------------------------------
# $Id: ujguess 4697 2007-09-14 06:17:00Z pho $
# -----------------------------------------------------------------------------
package Unicode::Japanese::UJGuess;
use strict;
use Unicode::Japanese;
our $VERSION = '0.02';
if( !caller )
{
__PACKAGE__->do_work(@ARGV);
}
# -----------------------------------------------------------------------------
# main.
#
sub do_work
{
my $pkg = shift;
my $string;
my @files;
my $no_filename;
while(@_)
{
my $key = shift;
if( $key !~ /^-/ )
{
push(@files,$key);
next;
}elsif( $key eq '--' )
{
push(@files,@_);
last;
}
if( $key eq '--no-filename' )
{
$no_filename = 1;
next;
}elsif( $key eq '--show-filename' )
{
$no_filename = 0;
next;
}elsif( $key eq '-s' )
{
my $value = shift;
push(@files,[$key,$value]);
next;
}elsif( $key =~ /^(-h|--help)$/ )
{
print_usage();
return 1;
}elsif( $key =~ /^(-V|--version)$/ )
{
print_version();
return 1;
}else
{
die "unkown argument [$key]";
}
}
!defined($no_filename) and $no_filename = @files<=1;
Unicode::Japanese->new(); # load stub.
local($/) = undef;
if( !@files )
{
my $text = <STDIN>;
$no_filename or print "-:";
print Unicode::Japanese->getcode($text)."\n";
}
foreach my $file (@files)
{
my $filename;
my $text;
if( ref($file) )
{
$filename = join(' ',@$file);
$text = $file->[1];
}elsif( $file eq '-' )
{
$filename = '-';
$text = <STDIN>;
}else
{
$filename = $file;
open(FILE,$file) or die "could not open file [$file] : $!";
$text = <FILE>;
close(FILE);
}
$no_filename or print "$filename:";
print Unicode::Japanese->getcode($text)."\n";
}
1;
}
# -----------------------------------------------------------------------------
# print_usage();
#
sub print_usage
{
print "usage: ujguess [options] [files...]\n";
print "options:\n";
print " --no-filename print only the name of character set\n";
print " --show-filename print both names of the file and character set\n";
print " -h|--help print this message\n";
print " -V|--version print the version of ujguess\n";
}
# -----------------------------------------------------------------------------
# print_version();
#
sub print_version
{
print "ujguess $VERSION\n";
print "Unicode::Janaese $Unicode::Japanese::VERSION\n";
}
__END__
=head1 NAME
ujguess -- Guess encoding of given files
=head1 SYNOPSIS
ujguess [files..]
=head1 VERSION
ujguess 0.02
=head1 DESCRIPTION
B<ujguess> guesses encoding of given files.
=over 4
=item --no-filename
Don't prepend file name to each results.
This is the default behavior if there is just one file to be processed.
=item --show-filename
Prepend file name to each results.
This is the default behavior if there are two or more files to be processed.
=item -h,--help
Print a short help message.
=item -V,--version
Print the version of B<ujguess>.
=back
=head1 SEE ALSO
L<Unicode::Japanese>,
L<ujconv>
=cut
# -----------------------------------------------------------------------------
# End of File.
# -----------------------------------------------------------------------------
|