#!/bin/sh 
#
#  dos2u dos-file -- strip \r characters from file

if [[ $# -ne 1 ]]; then
    echo -e "Usage: dos2u dos-file"
elif [[ ! $TMP ]]; then
    echo 'dos2u: Error: $TMP is not defined'
else
    cat "$1" | tr -d '\r' >$TMP/dos2u.$$
    if [[ -s $TMP/dos2u.$$ ]]; then
	mv $TMP/dos2u.$$ "$1"
    fi
fi

