From 1572f382abf4ca1bca4a5fd153d51a726097e7f9 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 14 Sep 2011 09:47:55 -0500 Subject: [PATCH] add the comment changing script --- devtools/commentchanger | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 devtools/commentchanger diff --git a/devtools/commentchanger b/devtools/commentchanger new file mode 100755 index 0000000..5a771de --- /dev/null +++ b/devtools/commentchanger @@ -0,0 +1,13 @@ +#!/bin/sh +# Simple script to change C++-style // comments to C style ones. +# Puts one space after (and if not present, before) the contents of the comment +# Not suitable for unattended use - inspect results before staging and committing. +# 2011 Ryan Pavlik + +# Handle comments with text before them. Explicitly excludes :// to not +# recklessly mangle license headers with URLs in them. +sed -i -r 's_([^:/])//[ ]?(.*)$_\1/* \2 */_' $@ + +# Handle comments that start at the beginning of the line. +sed -i -r 's_^//[ ]?(.*)$_/* \1 */_' $@ +