aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xisort8
1 files changed, 8 insertions, 0 deletions
diff --git a/isort b/isort
new file mode 100755
index 0000000..27a589d
--- /dev/null
+++ b/isort
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -p
+
+# isort -- sort C variable declarations separated by commas
+
+s/([^,]*?)(\S+[,;])/$2/; $prefix = $1;
+s/;$/,/; @words = sort split /\s+/;
+$_ = $prefix . (join ' ', @words) . "\n";
+s/,$/;/;