]> Dogcows Code - chaz/yoink/commitdiff
new tool for converting unix to dos file format
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Tue, 5 Jan 2010 04:12:49 +0000 (21:12 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Tue, 5 Jan 2010 04:12:49 +0000 (21:12 -0700)
tools/unix2dos [new file with mode: 0755]

diff --git a/tools/unix2dos b/tools/unix2dos
new file mode 100755 (executable)
index 0000000..31fa7c6
--- /dev/null
@@ -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 
+
This page took 0.019969 seconds and 4 git commands to generate.