summaryrefslogtreecommitdiff
path: root/bertfix
blob: d2f761fc8d734c96e5a2dc510f9dff9478ba32f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# unbertfix: unzip and fix files from bert
# - unzips
# - dos2unix-es
# - fix code format using lazy sed

INPUT_ZIP="$1"

unzip -qj "$INPUT_ZIP"
rm -f *.log *.log *.sln *.vcxproj *.vcxproj.filters stdafx.cpp stdafx.h targetver.h
dos2unix -q *
sed -z \
	-e 's/\n\s*{/ {/g' \
	-e 's/( /(/g' \
	-e 's/ )/)/g' \
	-e 's/    /\t/g' \
	-e 's/#include "stdafx.h"\n//g' \
	-e 's/#include "targetver.h"\n//g' \
	-e 's/\([^\n\t]\)\t\t*/\1 /g' \
	-e 's/  */ /g' \
	-e 's/\n\n\n*/\n\n/g' \
	-i *