File tree Expand file tree Collapse file tree 2 files changed +104
-0
lines changed
Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ##################
4+ # name: ros2win
5+ # description: Simple script to generate a MS Windows firendly source
6+ # file from a RISC OS source file.
7+ # author: Paolo Fabio Zaino
8+ # license: Copyright by Paolo Fabio Zaino, all rights reserved
9+ # distributed under CDDL v1.1
10+ #
11+ # Long description:
12+ # This script can be used to generate a MS Windows friendly source file
13+ # from a RISC OS source file, where the \n is enriched with \r.
14+ # This is useful when you want to use a Windows editor to edit
15+ # RISC OS source files.
16+ # ###################
17+
18+ path1=" $1 "
19+ path2=" $2 "
20+
21+ # Display command usage:
22+ function usage()
23+ {
24+ echo " Usage: ros2win [path1] [path2]"
25+ echo " path1: path to the file to convert"
26+ echo " path2: path to the converted file"
27+ echo " Example: ros2win ./src/!Mk/Makefile ./src/!Mk/Makefile"
28+ echo " "
29+ echo " If path2 is not specified then the converted file will be"
30+ echo " saved in the same directory as path1 with the same name"
31+ }
32+
33+ if [ " ${path1} " == " " ]
34+ then
35+ usage
36+ exit 1
37+ fi
38+
39+ if [ ! -f " ${path1} " ]
40+ then
41+ echo " Error: ${path1} is not a file"
42+ exit 1
43+ fi
44+
45+ if [ " ${path2} " == " " ]
46+ then
47+ path2=" ${path1} "
48+ fi
49+
50+ awk ' sub("$", "\r")' ${path1} > ${path2}
51+
52+ exit $?
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ##################
4+ # name: win2ros
5+ # description: Simple script to generate a RISC OS firendly source
6+ # file from a Windows source file.
7+ # author: Paolo Fabio Zaino
8+ # license: Copyright by Paolo Fabio Zaino, all rights reserved
9+ # distributed under CDDL v1.1
10+ #
11+ # Long description:
12+ # This script can be used to generate a RISC OS friendly source file
13+ # from a Windows source file, where the \n\r is replaced with \n.
14+ # This is useful when you want to use a Windows editor to edit
15+ # RISC OS source files.
16+ # ###################
17+
18+ path1=" $1 "
19+ path2=" $2 "
20+
21+ # Display command usage:
22+ function usage()
23+ {
24+ echo " Usage: win2ros [path1] [path2]"
25+ echo " path1: path to the file to convert"
26+ echo " path2: path to the converted file"
27+ echo " Example: win2ros ./src/!Mk/Makefile ./src/!Mk/Makefile"
28+ echo " "
29+ echo " If path2 is not specified then the converted file will be"
30+ echo " saved in the same directory as path1 with the same name"
31+ }
32+
33+ if [ " ${path1} " == " " ]
34+ then
35+ usage
36+ exit 1
37+ fi
38+
39+ if [ ! -f " ${path1} " ]
40+ then
41+ echo " Error: ${path1} is not a file"
42+ exit 1
43+ fi
44+
45+ if [ " ${path2} " == " " ]
46+ then
47+ path2=" ${path1} "
48+ fi
49+
50+ awk ' { sub("\r$", ""); print }' ${path1} > ${path2}
51+
52+ exit $?
You can’t perform that action at this time.
0 commit comments