[FFmpeg-devel] [PATCH] configure's to_lower and to_upper fix on *bsd
Rich Felker
dalias
Fri Feb 8 19:46:21 CET 2008
On Fri, Feb 08, 2008 at 04:02:26PM +0100, Pierre d'Herbemont wrote:
> Hi,
>
> here, on Mac OS X, (should be a BSD issue):
> $ echo "hello z" | tr '[a-z]' '[A-Z]'
> HELLO ]
>
> This cause configure to generate a bad crafted config.h. Here is a fix
> for that, as suggested by the BSD tr's man page.
>
> Pierre.
>
> Index: configure
> ===================================================================
> --- configure (revision 11879)
> +++ configure (working copy)
> @@ -215,13 +215,12 @@
> exit 1
> }
>
> -# "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking
> "tr a-z A-Z"
> toupper(){
> - echo "$@" | tr '[a-z]' '[A-Z]'
> + echo "$@" | tr '[:lower:]' '[:upper:]'
> }
>
> tolower(){
> - echo "$@" | tr '[A-Z]' '[a-z]'
> + echo "$@" | tr '[:upper:]' '[:lower:]'
This is absolutely wrong. If the locale is Turkish then I will get
mapped to ? rather than i. Instead use:
tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
It may also be possible to override the locale in this specific case
as long as you know the contents of $@ will be ONLY ASCII but it's a
bad practice in general so my solution is preferred, I think.
Rich
More information about the ffmpeg-devel
mailing list