// jis to euc converter by Murata // Usage: jis2euc [InputFile [OutputFile]] import java.io.*; class jis2euc { public static void main(String args[]) { InputStream fi = System.in; OutputStream fo = System.out; boolean kmode = false; int ESC = 0x1b, kin = '$', kout = '('; int ci; try{ if(args.length>0) fi = (InputStream)(new FileInputStream(args[0])); if(args.length>1) fo = (OutputStream)(new FileOutputStream(args[1])); while( (ci = fi.read()) != -1){ if(!kmode){ if(ci == ESC){ if(fi.read() == kin) kmode = true; fi.read(); }else{ fo.write(ci); } }else{ if(ci == ESC){ if(fi.read() == kout) kmode = false; fi.read(); }else{ fo.write(ci | 0x80); fo.write(fi.read() | 0x80); } } } }catch(IOException e){ System.out.println(e.toString()); System.exit(1); }finally{ try{ fo.close(); fi.close(); }catch(IOException e){} } } }