Patch: include/paths.h --> include/inn/paths.h in inn-CURRENT

Adam J. Richter adam at yggdrasil.com
Tue Nov 21 08:09:56 UTC 2006


Hi Russ,                        

        Thank you for considering the argument about incremental
development so carefully and open-mindedly.

	Here is an updated shell script.  In addition to moving all of
the header files to the inn subdirectory, it also renames all of the
_PATH names to INN_PATH, one of the namespace clean-ups you wanted.  I
could submit these two steps separately, they both use the same
replace_everwhere shell function.  But, if you'd prefer for the
benefit of having a separate commit point in your revision history,
you can just run the old script from before, and I can send you a
separate script to do just the replacements of _PATH_ --> INN_PATH_.

	 I had another script that mostly replaced the various "#ifdef
_FOO_H...#endif" with "#ifdef INN_FOO_H...", but it was broken in the
case of one file, and I'd rather not mix a script and a patch, and the
changes that it makes result in a pretty succinct patch (unlike the
changes that the current script makes), so I'll submit those as a
patch in the next iteration.

	I'll also submit patches to eliminate $(PUBLIC) from
include/Makefile and incorporate that minor update to the TODO file,
but I'd like to wait for the next daily snapshot of inn-CURRENT
since the shell script also touched include/Makefile.

	I have verified that all of the .o files generated in
inn-CURRENT-20061118 by "./configure --prefix=/usr && make all && make
install", when stripped, are the same with and without having run this
script.  I have also briefly looked through the diff of the two before
and after directories, and the only problems that I noticed were a
couple of lines in the HACKING documentation file that now exceed 80
columns, which I can update in a separate patch later if that's okay.

	Thanks again.

Adam Richter

---------------------------------------------------------------------
#!/bin/sh
replace_everywhere()
{
	local pattern="$1"
	local replacement="$2"
	local file

	for file in $(find . -type f | xargs grep -l "$pattern") ; do
		ed -s $file << DONE
1,\$s|$pattern|$replacement|g
w
q
DONE
	done
}

for file_path in include/*.h{,.in} ; do
	actual_file=${file_path#include/}
	if [ "$actual_file" = nntp.h ] ; then
		continue
	fi
	include_name=${actual_file%.in}
	mv include/$actual_file include/inn/$actual_file
	pattern=$(echo $include_name | sed 's/\./\\./g')
	replace_everywhere "$pattern" "inn/$include_name"
done

symbols=$(egrep '^#define' < include/inn/paths.h.in | awk '{print $2}' | egrep ^_)
for symbol in $symbols ; do
	replace_everywhere "$symbol" "INN$symbol"
done

autoconf


More information about the inn-workers mailing list