All pastes #1298064 Raw Edit

Miscellany

public shellscript v1 · immutable
#1298064 ·published 2009-01-02 04:52 UTC
rendered paste body
#!/bin/shfixup_file() {	local path=$1	grep -q '//' $path || return	echo "found C++ style comments in $path"	# remove blank comments	sed -i 's@/\*\s*\*/@@' $path	# C style with extra leading /	sed -i 's@//\*\(.*\)\*/@/*\1*/@' $path	# nested C style within C++ style	sed -i 's@//\(.*\)/\*\(.*\)\*/@/*\1 \2*/@' $path	# C style bracketing with many C++ delimeters	sed -i 's@////*\([^/]*\)////*@/* \1 */@' $path	# nested C++ style within C++ style	sed -i 's@///*\(.*\)///*\(.*\)@//\1 \2@' $path	# C++ comment at beginning of line	sed -i 's@^//\(.*\)@/* \1 */@' $path	# C++ comment elsewhere in line, avoid url's	sed -i 's@\([^:]\)//\(.*\)@\1/* \2 */@' $path}# specific instance of schizophrenia in the AtomBios sourcesif [ -f AtomBios/includes/ObjectID.h ] ; then	sed -i 's@// Graphics@/* Graphics@' AtomBios/includes/ObjectID.hfifor f in $(find . -name '*.h') $(find . -name '*.c') ; do	fixup_file $fdone