generated from RISC-OS-Community/StandardRepoTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathros2win
executable file
·52 lines (44 loc) · 1.21 KB
/
ros2win
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
###################
# name: ros2win
# description: Simple script to generate a MS Windows firendly source
# file from a RISC OS source file.
# author: Paolo Fabio Zaino
# license: Copyright by Paolo Fabio Zaino, all rights reserved
# distributed under CDDL v1.1
#
# Long description:
# This script can be used to generate a MS Windows friendly source file
# from a RISC OS source file, where the \n is enriched with \r.
# This is useful when you want to use a Windows editor to edit
# RISC OS source files.
####################
path1="$1"
path2="$2"
# Display command usage:
function usage()
{
echo "Usage: ros2win [path1] [path2]"
echo "path1: path to the file to convert"
echo "path2: path to the converted file"
echo "Example: ros2win ./src/!Mk/Makefile ./src/!Mk/Makefile"
echo ""
echo "If path2 is not specified then the converted file will be"
echo "saved in the same directory as path1 with the same name"
}
if [ "${path1}" == "" ]
then
usage
exit 1
fi
if [ ! -f "${path1}" ]
then
echo "Error: ${path1} is not a file"
exit 1
fi
if [ "${path2}" == "" ]
then
path2="${path1}"
fi
awk 'sub("$", "\r")' ${path1} > ${path2}
exit $?