bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: built-in printf %f parameter format depend on LC_NUMERIC


From: Dennis Clarke
Subject: Re: built-in printf %f parameter format depend on LC_NUMERIC
Date: Fri, 12 Jul 2019 20:47:25 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.0

On 7/12/19 4:45 PM, Chet Ramey wrote:
On 7/12/19 4:26 PM, Martijn Dekker wrote:
Op 12-07-19 om 21:46 schreef Dennis Clarke:
Well the man page for XPG6 bc in Solaris 10 claims :

ENVIRONMENT VARIABLES
       See environ(5) for descriptions of the following environment
       variables  that  affect  the  execution of bc: LANG, LC_ALL,
       LC_CTYPE, LC_MESSAGES, and NLSPATH.

Really?

Note the absence of LC_NUMERIC in that paragraph.

Yeah, but LC_ALL overrides LC_NUMERIC anyway.


Maybe.

    setlocale ( LC_ALL, "" );

Undoes all that in a jiffy.

I just cracked open the sources to XPG6/XPG4 dc which is the backend to
 bc and guess what ?


/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/*        All Rights Reserved   */

.
.
.

int
main(int argc, char **argv)
{
        (void) setlocale(LC_ALL, "");
        (void) textdomain(TEXT_DOMAIN);

        init(argc, argv);
        commnds();
        /* NOTREACHED */
}

.
.
.



So there you see it in all its glory.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional



reply via email to

[Prev in Thread] Current Thread [Next in Thread]