Enrico Forestieri <[EMAIL PROTECTED]> writes:

> 
> Angus Leeming <leeming <at> ...> writes:
> 
> > Well, given that these are generated files, it should be easy enough to fix
> > them. Fancy putting together a patch?
> 
> The _moc.C files are generated from .h files that in turn are generated
> form .ui files that I don't grok (is it XML?).
> 
> So, you will not like my patch (pasted at the bottom). Given the presence
> of '\n', that would force the use of GNU sed, but it could also be done
> using ed with an HERE script.

Actually, I think that \n on the replacement side is perfectly OK. However, you
could also use

sed '/^#undef QT_NO_COMPAT$/a\
#include <config.h>'

which appends the missing include after the specified regex.

It's almost equivalent to (my improved version of your command):
sed '/^#undef QT_NO_COMPAT$/s/$/\\
#include <config.h>/'

the difference being that the s/// command modifies the existing pattern space
(which can be further modified by subsequent commands) whereas the a command
outputs the extra text to stdout.

Make sense?

Angus


Reply via email to