On Wed, May 21, 2008 at 05:18:49PM +0200, Jim Meyering wrote:
"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
> On Tue, May 20, 2008 at 03:51:53PM +0100, Daniel P. Berrange wrote:
>> +if GLIBC_RPCGEN
>> + mv $@ $@.bak
>> + sed -e 's/\t/ /g' $@.bak > $@
>> +endif
>
> I guess it doesn't matter in a generated file, but is the above
> correct? Probably better to use the 'expand' command, if it is
> available.
Thanks for bringing that up.
While I don't know how portable expand is,
(I've never used it in a portable build script or Makefile)
it's certain to be less portable than sed.
However, (to my constant chagrin) \t is not portable in sed regexps.
Makes me want to use perl -pe 's/...//' FILE instead.
With Perl, "\t" *does* work portably.
On the other hand, maybe using perl (or expand) would be ok here,
since the only time an end user runs those rules is if/when they
modify a dependent .x file.
We already use Perl extensively to post-process the .c file generated
from rpcgen, so I just switched to use perl for the .h file too, and
we can use its inplace edit to avoid the temporary file too, so I
committed with:
if GLIBC_RPCGEN
perl -i -p -e 's/\t/ /g' $@
endif
Dan.
--
|: Red Hat, Engineering, Boston -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|