From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 26D221F454 for ; Mon, 11 Nov 2019 14:39:59 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=be0 rFbczm8WE7iR9N86ksJAHFOm7Ozo56X/GkLZ8dNNZUB5p698epejZbyZdodYmFK3 5YszaS+zAqLO42TelvF+bzMAWuB+pMT9FnvhBrhmF4gt/3iVT1/dntcfHjvfqCxv zalSoWlhzuqwbqdAeU4ZA5ZubLlQ84Nk9DszMqZM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=rWG55nXYm X0RvgJ3ik8yxRVU8qg=; b=GAcbT2hfr3xYW7yq8TCvBwrzosFnidJSsdJK4TO+A LlZcJ7M/CTKXE3XznzWU4C5NFnWV3clNZJr7X9zmvV3zK7jwfoPRy5H78yjmHowf Mru8k685VF942i9yxJxcOKbot9K+DtEnf6XLpLF4aqfHFSK7Rc91wzQSupEb/wLW 6E= Received: (qmail 94514 invoked by alias); 11 Nov 2019 14:39:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 94501 invoked by uid 89); 11 Nov 2019 14:39:56 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: aloka.lostca.se DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lostca.se; h=date:from:to :subject:message-id:mime-version:content-type :content-transfer-encoding; s=howrah; bh=rWG55nXYmX0RvgJ3ik8yxRV U8qg=; b=j2JbTWw8evUbkRu9r3iPswvgl4zOeExvUgfk6iSZ6Z/Q8GDG1WBwA32 NmnNSfmVCG15wAoFS4+qGXQmDygBolLbI/+MVwS70nroE6myw/8KcqtfUC6bG6zr h2ijFgDwEyqIQCZ7p+GS2YarFGFb0RvXfZMVJc4UB3SyoCnI7KuQ= Date: Mon, 11 Nov 2019 14:39:47 +0000 From: Arjun Shankar To: libc-alpha@sourceware.org Subject: [PATCH] support: Add xsetlocale function Message-ID: <20191111143946.GA5229@aloka.lostca.se> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Content-Transfer-Encoding: 7bit --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii; format=fixed Content-Disposition: inline From: Arjun Shankar --- support/Makefile | 1 + support/support.h | 1 + support/xsetlocale.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 support/xsetlocale.c --EeQfGwPcQSOJBaQU Content-Type: text/x-patch; charset=us-ascii; name="0001-support-Add-xsetlocale-function.patch" Content-Disposition: attachment; filename="0001-support-Add-xsetlocale-function.patch" Content-Transfer-Encoding: quoted-printable diff --git a/support/Makefile b/support/Makefile index a6081bba98..21a27cf863 100644 --- a/support/Makefile +++ b/support/Makefile @@ -169,6 +169,7 @@ libsupport-routines =3D \ xunlink \ xwaitpid \ xwrite \ + xsetlocale \ =20 libsupport-static-only-routines :=3D $(libsupport-routines) # Only build one variant of the library. diff --git a/support/support.h b/support/support.h index a9df6e9a3c..c10234404a 100644 --- a/support/support.h +++ b/support/support.h @@ -91,6 +91,7 @@ char *xasprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2), malloc)); char *xstrdup (const char *); char *xstrndup (const char *, size_t); +char *xsetlocale (int category, const char *locale); =20 /* These point to the TOP of the source/build tree, not your (or support's) subdirectory. */ diff --git a/support/xsetlocale.c b/support/xsetlocale.c new file mode 100644 index 0000000000..063ed4b0d6 --- /dev/null +++ b/support/xsetlocale.c @@ -0,0 +1,30 @@ +/* setlocale with error checking. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include + +char * +xsetlocale (int category, const char *locale) +{ + char *p =3D setlocale (category, locale); + if (p =3D=3D NULL) + FAIL_EXIT1 ("error: setlocale (%d, \"%s\")\n", category, locale); + return p; +} --EeQfGwPcQSOJBaQU--