summaryrefslogtreecommitdiff
path: root/bertfix
diff options
context:
space:
mode:
Diffstat (limited to 'bertfix')
-rwxr-xr-xbertfix23
1 files changed, 23 insertions, 0 deletions
diff --git a/bertfix b/bertfix
new file mode 100755
index 0000000..d2f761f
--- /dev/null
+++ b/bertfix
@@ -0,0 +1,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 *
+