From 246d7d6e4386b686327163d621c7c8b398b7d479 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 4 Jan 2010 21:12:49 -0700 Subject: [PATCH] new tool for converting unix to dos file format --- tools/unix2dos | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/unix2dos diff --git a/tools/unix2dos b/tools/unix2dos new file mode 100755 index 0000000..31fa7c6 --- /dev/null +++ b/tools/unix2dos @@ -0,0 +1,22 @@ +#!/bin/sh + +# An implementation of unix2dos using sed. +# Written by Charles McGarvey; released into the public domain. + +if [ -f "$1" ]; +then + TMPFILE="$1.$$" + sed 's/\r*$/\r/' "$1" >$TMPFILE + if [ ! "$2" ]; + then + cp -f "$TMPFILE" "$1" + else + cp -f "$TMPFILE" "$2" + fi + rm -f "$TMPFILE" +else + echo "`basename $0` infile [outfile]" + echo " convert a file from unix to dos file format" + exit 1 +fi + -- 2.43.0