#!/bin/tcsh set myname = iconv16to8 set do_debug = 0 if ( "x$1" == "x-debug" ) then set do_debug = 1 shift endif if ( $#argv != 2 ) goto showusage if ( "x$1" == "x-h" ) goto showusage # ------------------------------------------------------------ # Check on two files, inputFna and otputFna, where # inputFna must exist and otputFna must not exist. # Display all errors before exiting on any error. # Use retval to set the exit status. set ENOERR = 0 set ENOENT = 2 set EEXIST = 17 set retval = $ENOERR set inputFna = "$1" set otputFna = "$2" set errmsg = "" if ( ! -f "$inputFna" ) then set errmsg = "${errmsg}$myname - ERRR - cannot find input file $inputFna\n" set retval = $ENOENT endif if ( -f "$otputFna" ) then set errmsg = "${errmsg}$myname - ERRR - will not overwrite output file $otputFna\n" set retval = $EEXIST endif if ( $retval ) then echo "\n$errmsg\n" exit $retval # <--------------<<< endif iconv -f utf-16 -t utf-8 $inputFna > $otputFna set iconv_status = $status exit $iconv_status # ----------------------------------------------------------------------------- showusage: cat << GMWB $myname from a UTF-16 file, create an ASCII file intended for use in converting VS2010 dot-rc files to a format which can be used by grep, since VS2010 seems to not care (but grep does). note - outputFna must not already exist usage: $myname inputFna outputFna GMWB exit 1