Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> Enrico Forestieri <forenr <at> ...> 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,

No, it does not work on Solaris.

> you
> could also use
> 
> sed '/^#undef QT_NO_COMPAT$/a\
> #include <config.h>'
> 
> which appends the missing include after the specified regex.

This works when done in the following way:

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

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

This works when done as follows:

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

You're a sed master :)

> 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?

Perfectly. But wait, are you saying that there is no way to achieve
that by directly patching the .ui files?

--
Enrico



Reply via email to