summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxHire <xhire@tuxportal.cz>2008-10-27 23:22:01 +0100
committerxHire <xhire@tuxportal.cz>2008-10-27 23:22:01 +0100
commit96f0ce01dbb0703660d93b7d19ce078c6852ffbf (patch)
tree24a11094bafc60f276a70a97bb790570f7946ce5
parent6d62601ac17c8681f29fc37815fd0fb2b35b0c35 (diff)
Script for automatic code indentation to K&R
-rwxr-xr-xkr.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/kr.sh b/kr.sh
new file mode 100755
index 0000000..dbc1842
--- /dev/null
+++ b/kr.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ ! "$1" ]; then
+ echo "Help: this script indents code according to the K&R standard"
+ echo "Usage: $0 path/to/file.c"
+ exit 1
+elif [ ! -e "$1" ]; then
+ echo "Error: file '$1' doesn't exist!"
+ exit 1
+fi
+
+indent -kr -l79 -ts4 -ip4 -ppi 4 "$1"