[m-rev.] diff: fix tr portability bug
Simon Taylor
stayl at cs.mu.OZ.AU
Tue May 7 20:25:54 AEST 2002
On 07-May-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 07-May-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > On 07-May-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > Estimated hours taken: 0.75
> > > Branches: main
> > >
> > > configure.in:
> > > Change "tr a-z A-Z" to "tr '[a-z]' '[A-Z]'". The former is
> > > Posix-conforming, but doesn't work on some non-Posix-conforming
> > > systems, in particular Solaris. The latter works on both Solaris
> > > and on Posix-conforming systems.
> >
> > It might be better to spell it out:
> > `tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
>
> Well, that would work, but I had hoped that it wouldn't be necessary.
>
> > For example /usr/xpg4/bin/tr on taifun doesn't support
> > character ranges properly.
>
> Are you sure? It seemed to work OK for me:
>
> $ echo FooBar | /usr/xpg4/bin/tr '[a-z]' '[A-Z]'
> FOOBAR
> $ echo Foo/Bar.c | /usr/xpg4/bin/tr '[a-z]./' '[A-Z]__'
> FOO_BAR_C
If you log in using rlogin, Solaris sets up variables LC_*
holding information about the locale. If you log in using ssh,
these variables aren't set up. So /usr/xpg4/bin/tr does handle
character ranges, but locale support is broken.
taifun: stayl> echo $LC_COLLATE
en_AU
taifun: stayl> echo Foo/Bar.c | /usr/xpg4/bin/tr '[a-z]./' '[A-Z]__'
Enn_AZq_b
taifun: stayl> unset LC_COLLATE
taifun: stayl> echo Foo/Bar.c | /usr/xpg4/bin/tr '[a-z]./' '[A-Z]__'
FOO_BAR_C
Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list