b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / bin /
Filename/usr/bin/gnroff
Size2.34 kb
Permissionrwxr-xr-x
Ownerapache
Create time26-May-2024 11:04
Last modified20-May-2009 06:16
Last accessed20-May-2009 06:16
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
#!/bin/bash
# Emulate nroff with groff.

prog="$0"
charset_in=iso-8859-1
charset_out=`locale charmap 2>/dev/null`
opts="-mtty-char"
T=""

for i
do
case $1 in
-c)
opts="$opts -P-c" ;;
-h)
opts="$opts -P-h" ;;
-[mrnoT])
echo $"option $1 requires an argument" >&2
exit 1 ;;
-[iptSUC] | -[mrno]*)
opts="$opts $1" ;;
-Tascii | -Tlatin1 | -Tutf8 | -Tcp1047 | -Tascii8 | -Tnippon | -Tkorean)
T=$1 ;;
-[eq] | -s* | -u* | -T*)
# ignore these options
;;
-v | --version)
echo $"GNU nroff (groff) with Red Hat i18n/l10n support"
exit 0 ;;
--legacy)
shift
charset_in=$1 ;;
--help)
echo $"usage: $prog [-cChipt] [-mNAME] [-nNUM] [--legacy CHARSET] [-oLIST] [-rCN] [FILE...]"
exit 0 ;;
--)
shift
break ;;
-)
break ;;
-*)
echo $"$prog: invalid option $1" >&2
exit 1 ;;
*)
break ;;
esac
shift
done

# Don't convert encodings when -T is specified
[ -n "$T" ] && exec /usr/bin/groff $opts $T ${1+"$@"} 2>/dev/null

opts="$opts -Tutf8"

if TMPFILE=$(mktemp /tmp/man.XXXXXX 2>/dev/null); then
trap "rm -f $TMPFILE" 0 1 2 3 15
cat ${1+"$@"} >| $TMPFILE
else
buf=$(cat ${1+"$@"})
TMPFILE=buf
fi

if [ $TMPFILE = buf ]; then
echo -n "$buf" | iconv -f utf-8 -t utf-8 &>/dev/null && charset_in=utf-8
else
iconv -f utf-8 -t utf-8 $TMPFILE &>/dev/null && charset_in=utf-8
fi

if [ $charset_in != utf-8 ]; then
echo $"WARNING: old character encoding and/or character set" >&2
fi

# en_US is chosen arbitrarily; any UTF-8 locale should work
export LC_ALL=en_US.UTF-8

# This shell script is intended for use with man, so warnings are
# probably not wanted. Also load nroff-style character definitions.
if [ $charset_in = utf-8 -a $charset_out = UTF-8 ]; then
if [ $TMPFILE = buf ]; then
echo -n "$buf" | /usr/bin/groff $opts 2>/dev/null
else
exec < $TMPFILE
rm -f $TMPFILE
exec /usr/bin/groff $opts 2>/dev/null
fi
else
if [ $TMPFILE = buf ]; then
echo -n "$buf" | \
/usr/bin/iconv -f $charset_in -t utf-8 | \
/usr/bin/groff $opts 2>/dev/null | \
/usr/bin/iconv -f utf-8 -t ${charset_out}//translit
else
/usr/bin/iconv -f $charset_in -t utf-8 $TMPFILE | \
/usr/bin/groff $opts 2>/dev/null | \
/usr/bin/iconv -f utf-8 -t ${charset_out}//translit

rm -f $TMPFILE
fi
fi
# eof