#!/usr/bin/perl
#=============================================================================
#    revdic
#        Version 1.00.03
#        Copyright (C)1998 Tomoto SHIMIZU
#-----------------------------------------------------------------------------
#  : ռ
#-----------------------------------------------------------------------------
#  ˡ: 
#
#    revdic [-dhv] <񥽡> ...
#
#     -d νʣ
#     -h إפɽ
#
#-----------------------------------------------------------------------------
#  :
#    νʣϡǽ˸줿Τͥ衣
#    ͤ˶򤬴ޤޤƤ硢ʹߤ̵뤵롣
#-----------------------------------------------------------------------------
#  This program is free software; ABSOLUTELY NO WARRANTY.
#  you can redistribute it and/or modify it under the terms of the GNU
#  General Public License, which may be found in the drpl 1.04 package.
#=============================================================================

#=============================================================================
# 
#=============================================================================

use Getopt::Std;
&getopts("dhv");

&HelpAndExit() if ($opt_h || $opt_v);

while (<>) {
	if (/^$/ || /^#/) {
		print;
	} else {
		chomp;
		($key, $value) = split;
		
		if ($opt_d && $check{$value}) {
			# supress
		} else {
			print "$value\t$key\n";
			$check{$value} = 1;
		}
	}
}


#=============================================================================
# إ
#=============================================================================

sub Help {
	open(SCRIPT, $0) || die "Cannot open '$0'\n";
	my($state);
	while (<SCRIPT>) {
		$state++ if (/=======================/);
		print if ($state >= 1);
		last  if ($state == 2);
	}
	close(SCRIPT);
}

sub HelpAndExit {
	&Help();
	exit;
}

