/usr/bin/nmzcat is in namazu2 2.0.21-21.
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 | #! /usr/bin/perl -w
#
# -*- Perl -*-
# nmzcat - print file content on the standard output.
#
# $Id: nmzcat.in,v 1.3.2.5 2008-06-02 09:48:13 opengl2772 Exp $
#
# Copyright (C) 2004 Yukio USUDA All rights reserved.
# Copyright (C) 2004-2008 Namazu Project All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versions 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA
require 5.004;
use strict;
use English;
if (@ARGV == 0) {
print "usage: nmzcat <target>...\n";
exit 1;
}
my $PKGDATADIR = $ENV{'pkgdatadir'} || "/usr/share/namazu";
my $LIBDIR = $PKGDATADIR . "/pl"; # directory where library etc. are in.
my $Document = undef;
unshift @INC, $LIBDIR;
require "util.pl" || die "unable to require \"util.pl\"\n";
require "document.pl" || die "unable to require \"document.pl\"\n";
require "var.pl" || die "unable to require \"var.pl\"\n";
require "conf.pl" || die "unable to require \"conf.pl\"\n";
require "ext.pl" || die "unable to require \"ext.pl\"\n";
my $tmpdir = "/tmp/NMZ$$";
if ($English::OSNAME eq "MSWin32") {
$tmpdir = "$ENV{'TMP'}/NMZ$$";
}
if (mkdir($tmpdir, 0700)) {
$var::OUTPUT_DIR = $tmpdir;
} else {
die "unable to make temporary directory \"$tmpdir\"\n";
}
util::set_lang();
if (util::islang("ja") && $conf::NKF =~ /^module_nkf/) {
require 'codeconv.pl';
require NKF || die "unable to require \"NKF\"\n";
util::dprint(_("code conversion: using NKF module\n"));
$var::USE_NKF_MODULE = 1;
}
$Document = mknmz::document->new();
$Document->init();
my $uri;
foreach my $fname (@ARGV) {
my $content = util::readfile($fname);
util::dprint("read file: $fname\n");
$Document->init_doc($uri, $fname, \$content, undef);
my $orig_filename = $Document->get_orig_filename();
my $author = $Document->get_field_info('author');
my $title = $Document->get_field_info('title');
my $contref= $Document->get_filtered_contentref();
my $mimetype = $Document->get_mimetype();
my $result = "";
$result = "filename: $orig_filename\n";
$result .= "mimetype: $mimetype\n";
$result .= "author : $author\n";
$result .= "title : $title\n";
$result .= "content :\n$$contref\n";
if (util::islang("ja") && ($English::OSNAME eq "MSWin32")) {
$result = codeconv::eucjp_to_shiftjis($result);
}
print $result;
}
rmdir $tmpdir or die "unable to remove temporary directory \"$tmpdir\"\n";
muda(
$var::USE_NKF_MODULE, $var::OUTPUT_DIR,
$conf::NKF
);
sub muda {};
|