#
# kanji: kanji code conversing mailer support
#
# (this file should be included before "mailer", "mailer.v1")

REVISION_ID='@(#)kanji	3.2 (motonori/WIDE) 08 Jun 1996'

#|# kanji code conversing local mailer
#|#KANJI_CONVERSION=no
#|# mailer path definitions
#|#LOCAL_MAILER_PATH='/bin/binmail.kc'
#|#LOCAL_MAILER_ARGS='mail $h -d $u'
#|##KANJI_J_USERS='user1 user2'			# describe just in one line
#|##KANJI_J_USERS='/etc/sendmail.jis_users'
#|##KANJI_S_USERS='user3 user4'			# describe just in one line
#|##KANJI_S_USERS='/etc/sendmail.sjis_users'
#|##KANJI_E_USERS='user5 user6'			# describe just in one line
#|##KANJI_E_USERS='/etc/sendmail.euc_users'
#|##KANJI_N_USERS='user7 user8'			# describe just in one line
#|##KANJI_N_USERS='/etc/sendmail.nc_users'

: ${KANJI_CONVERSION=no}
if [ "$KANJI_CONVERSION" = yes ]
then

	if [ "$REVISION_ID_LIST" ]
	then
		REVISION_ID_LIST="$REVISION_ID_LIST\\
# $REVISION_ID"
	else
		REVISION_ID_LIST="# $REVISION_ID"
	fi

	: ${LOCAL_MAILER_PATH='/bin/binmail.kc'}
	: ${LOCAL_MAILER_ARGS='mail $h -d $u'}

	if [ "$KANJI_J_USERS" ]
	then
		# allocate class character
		_ALLOC_MODE=normal
		_ALLOC_TYPE=class
		_ALLOC_DIR=down
		_ALLOC_USAGE='kanji conversion [kanji]'
		. $MASTERDIR/$CHARALLOC

		CLASS=
		case "$KANJI_J_USERS" in
		/*|-*)	# file definition
			CLASS="F$_ALLOC_CHAR$KANJI_J_USERS" ;;
		"") ;;
		*)	# definition in .cf
		CLASS=`echo $KANJI_J_USERS | sed 's/^/C'$_ALLOC_CHAR' /'` ;;
		esac

HDRKANJI="$HDRKANJI""# users who need to be converted to JIS (ISO-2022-JP)\\
$CLASS\\
"

S5KANJIRULE="$S5KANJIRULE"'R$='"$_ALLOC_CHAR"'			$:$1.jis\
'

	fi

	if [ "$KANJI_S_USERS" ]
	then
		# allocate class character
		_ALLOC_MODE=normal
		_ALLOC_TYPE=class
		_ALLOC_DIR=down
		_ALLOC_USAGE='kanji conversion [kanji]'
		. $MASTERDIR/$CHARALLOC

		CLASS=
		case "$KANJI_S_USERS" in
		/*|-*)	# file definition
			CLASS="F$_ALLOC_CHAR$KANJI_S_USERS" ;;
		"") ;;
		*)	# definition in .cf
		CLASS=`echo $KANJI_S_USERS | sed 's/^/C'$_ALLOC_CHAR' /'` ;;
		esac

HDRKANJI="$HDRKANJI""# users who need to be converted to Shift JIS\\
$CLASS\\
"

S5KANJIRULE="$S5KANJIRULE"'R$='"$_ALLOC_CHAR"'			$:$1.sjis\
'

	fi

	if [ "$KANJI_E_USERS" ]
	then
		# allocate class character
		_ALLOC_MODE=normal
		_ALLOC_TYPE=class
		_ALLOC_DIR=down
		_ALLOC_USAGE='kanji conversion [kanji]'
		. $MASTERDIR/$CHARALLOC

		CLASS=
		case "$KANJI_E_USERS" in
		/*|-*)	# file definition
			CLASS="F$_ALLOC_CHAR$KANJI_E_USERS" ;;
		"") ;;
		*)	# definition in .cf
		CLASS=`echo $KANJI_E_USERS | sed 's/^/C'$_ALLOC_CHAR' /'` ;;
		esac

HDRKANJI="$HDRKANJI""# users who need to be converted to EUC-Japan\\
$CLASS\\
"

S5KANJIRULE="$S5KANJIRULE"'R$='"$_ALLOC_CHAR"'			$:$1.euc\
'

	fi

	if [ "$KANJI_N_USERS" ]
	then
		# allocate class character
		_ALLOC_MODE=normal
		_ALLOC_TYPE=class
		_ALLOC_DIR=down
		_ALLOC_USAGE='kanji conversion [kanji]'
		. $MASTERDIR/$CHARALLOC

		CLASS=
		case "$KANJI_N_USERS" in
		/*|-*)	# file definition
			CLASS="F$_ALLOC_CHAR$KANJI_N_USERS" ;;
		"") ;;
		*)	# definition in .cf
		CLASS=`echo $KANJI_N_USERS | sed 's/^/C'$_ALLOC_CHAR' /'` ;;
		esac

HDRKANJI="$HDRKANJI""# users who need not to be converted\\
$CLASS\\
"

S5KANJIRULE="$S5KANJIRULE"'R$='"$_ALLOC_CHAR"'			$:$1.nc\
'

	fi

S0KANJIRULE='# mailer dispatching rules for kanji conversion\
R$*.jis			$#local$@-jis$:$1			JIS(ISO-2022-JP)\
R$*.sjis		$#local$@-sjis$:$1			shift JIS\
R$*.euc			$#local$@-euc$:$1			EUC-Japan\
R$*.nc			$#local$@-nc$:$1			no conversion'

fi
