Skip to content

Instantly share code, notes, and snippets.

@false-git
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save false-git/7183d616527e8efda181 to your computer and use it in GitHub Desktop.
Save false-git/7183d616527e8efda181 to your computer and use it in GitHub Desktop.
FreeBSD のmanを日本語対応する
PDIR=`pwd`
fetch https://gist.githubusercontent.com/false-git/7183d616527e8efda181/raw/7613fcea21e1a00618bc395878586ec6189af964/man.patch
fetch https://gist.githubusercontent.com/false-git/7183d616527e8efda181/raw/53c7ab2196c61be336e910a66a6b9423457193b9/mdoc.local.add
fetch https://gist.githubusercontent.com/false-git/7183d616527e8efda181/raw/fe5aa7e9aa3e1e68a0bf780eb69dac01f41da44e/man.local.add
fetch http://distcache.FreeBSD.org/local-distfiles/hrs/tmac-20030521_2.tar.gz
cp /usr/bin/man /usr/local/bin/
cd /usr/local/bin/
patch < $PDIR/man.patch
cd /usr/local/share/groff/site-tmac
V=`uname -r|sed 's/-.*//'`
echo ".ds default-operating-system FreeBSD\\~$V" >> mdoc.local
cat $PDIR/mdoc.local.add >> mdoc.local
cat $PDIR/man.local.add >> man.local
tar xzOf $PDIR/tmac-20030521_2.tar.gz tmac-20030521_2/mdoc/ja.eucJP | iconv -f euc-jp -t utf-8 | sed s/japanese-iso-8bit/utf-8/ | /usr/local/bin/preconv > mdoc_ja.local
ln -s /usr/share/man/ja /usr/share/man/ja_JP.UTF-8
ln -s /usr/local/man/ja /usr/local/man/ja_JP.UTF-8
.if "\*[locale]"ja.UTF-8" \{\
.mso ja.tmac
.\}
*** /usr/bin/man 2015-03-26 18:06:08.000000000 +0900
--- /usr/local/bin/man 2015-03-30 10:53:27.000000000 +0900
***************
*** 330,336 ****
*) nroff_dev="ascii" ;;
esac
! NROFF="$NROFF -T$nroff_dev"
EQN="$EQN -T$nroff_dev"
# Iff the manpage is from the locale and not just the charset,
--- 330,336 ----
*) nroff_dev="ascii" ;;
esac
! NROFF="$NROFF -D$nroff_dev -T$nroff_dev"
EQN="$EQN -T$nroff_dev"
# Iff the manpage is from the locale and not just the charset,
***************
*** 382,387 ****
--- 382,391 ----
else
pipeline="$TBL"
fi
+ if [ "x$man_lang" = "xja" ]
+ then
+ pipeline="iconv -f euc-jp -t utf-8 | $pipeline"
+ fi
if [ -n "$tflag" ]; then
pipeline="$pipeline | $TROFF"
***************
*** 933,943 ****
# User's PATH setting decides on the groff-suite to pick up.
EQN=eqn
! NROFF='groff -S -P-h -Wall -mtty-char -man'
PIC=pic
REFER=refer
TBL=tbl
! TROFF='groff -S -man'
VGRIND=vgrind
LOCALE=/usr/bin/locale
--- 937,947 ----
# User's PATH setting decides on the groff-suite to pick up.
EQN=eqn
! NROFF='/usr/local/bin/groff -S -P-h -Wall -mtty-char -man'
PIC=pic
REFER=refer
TBL=tbl
! TROFF='/usr/local/bin/groff -S -man'
VGRIND=vgrind
LOCALE=/usr/bin/locale
.if "\*[locale]"ja.UTF-8" \{\
.mso mdoc_ja.local
.mso ja.tmac
.\}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment