#!/bin/csh -f # "@(#) chgcode.sh R2.0 200/01/26" # Copyright(C)2000 ASH multimedia lab. (http://ash.jp/) # # chgcode: change code to euc/sjis/jis # goto main usage: echo "Usage: chgcode [-e][-s][-j] files" exit main: while ($#argv) switch ("$1") case -e: shift set opt="-e" goto chgcode break case -s: shift set opt="-s" goto chgcode break case -j: shift set opt="-j" goto chgcode break case -*: goto usage break default: goto usage break endsw end chgcode: if ($#argv == 0) goto usage foreach file ($*) if (-d $file) continue if (-e $file) then echo $file\: else echo "$file: not found." continue endif set work="/tmp/chgcode.$$" cp $file $work if ("$opt" == "-e") then nkf $opt $work | tr -d "\015" > $file else nkf $opt $work > $file endif rm $work end exit