File: to_dos

package info (click to toggle)
blender 2.49.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 89,664 kB
  • ctags: 113,718
  • sloc: ansic: 738,048; cpp: 231,960; python: 104,955; asm: 33,960; sh: 16,233; ml: 12,962; makefile: 4,477; perl: 3,474; fortran: 108; java: 8
file content (33 lines) | stat: -rwxr-xr-x 548 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh -e
#Tag 1538
# $Id: to_dos 2 2002-10-12 11:37:38Z hans $
#
# convert a UNIX ASCII file to a DOS ASCII file by appending ^M at the
# end of each line and ^Z at the end of the file

TMPFILE=/tmp/to_dos$$

if [ $# -gt 2 ]
then
	echo "usage: to_dos [<unix_file> [<dos_file>]]"
	exit 1
fi


if [ $# -gt 0 ]
then
	nawk '{printf("%s\r\n", $0);}' "$1" > $TMPFILE
else
	nawk '{printf("%s\r\n", $0);}' > $TMPFILE
fi

# Stick on the EOF character
echo '\c' >> $TMPFILE

if [ $# -eq 2 ]
then
	mv -f $TMPFILE "$2"
else
	cat $TMPFILE
	rm $TMPFILE
fi