From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id CF9C43857C43 for ; Tue, 20 Oct 2020 05:45:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF9C43857C43 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-210-67tK5lYRNz-G-UHPIfHACg-1; Tue, 20 Oct 2020 01:45:18 -0400 X-MC-Unique: 67tK5lYRNz-G-UHPIfHACg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA456186DD21; Tue, 20 Oct 2020 05:45:17 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-119.ams2.redhat.com [10.36.112.119]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AD2227CD3; Tue, 20 Oct 2020 05:45:16 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-help Subject: Re: Is there a way to use vsnprintf_l? Would it possibly be considered for an addition one day, if missing? References: Date: Tue, 20 Oct 2020 07:45:14 +0200 In-Reply-To: (Adhemerval Zanella via Libc-help's message of "Mon, 19 Oct 2020 18:01:25 -0300") Message-ID: <87sga95u39.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 05:45:23 -0000 * Adhemerval Zanella via Libc-help: > If the idea is to provide a concise support for printf_l family function, > I think we should add not only snprintf_l or vsnprintf_l, but rather all = the=20 > stdio functions for both printf *and* scanf along with the wchar_t family > as well. It means to add support for: > > int fprintf_l (FILE *, locale_t, const char *, ...) > int fscanf_l (FILE * , locale_t, const char *, ...) > int printf_l (locale_t, const char *, ...) > int scanf_l (locale_t, const char *, ...) > int sprintf_l (char *, locale_t, const char * , ...) > int sscanf_l (const char *, locale_t, const char * , ...) > int vfprintf_l (FILE *, locale_t, const char * , __va_list) > int vprintf_l (locale_t, const char *, __va_list) > int vsprintf_l (char * , locale_t, const char *, __va_list); > int snprintf_l (char *, size_t, locale_t, const char * , ...) > int vfscanf_l (FILE * , locale_t, const char * , __va_list) > int vscanf_l (locale_t, const char *, __va_list) > int vsnprintf_l (char *, size_t, locale_t, const char *, va_list) > int vsscanf_l (const char *, locale_t, const char *, va_list); > int dprintf_l (int, locale_t, const char *, ...) > int vdprintf_l (int, locale_t, const char *, __va_list) > int asprintf_l (char **, locale_t, const char *, ...) > int vasprintf_l (char **, locale_t, const char *, __va_list) > > int fwprintf_l (FILE *, locale_t, const wchar_t *, ...) > int fwscanf_l (FILE * , locale_t, const wchar_t *, ...) > int wprintf_l (locale_t, const wchar_t *, ...) > int wscanf_l (locale_t, const wchar_t *, ...) > int wsprintf_l (char *, locale_t, const wchar_t * , ...) > int swscanf_l (const char *, locale_t, const wchar_t * , ...) > int vfwprintf_l (FILE *, locale_t, const wchar_t * , __va_list) > int vwprintf_l (locale_t, const wchar_t *, __va_list) > int vswprintf_l (wchar_t * , locale_t, const wchar_t *, __va_list); > int snwprintf_l (wchar_t *, size_t, locale_t, const wchar_t * , ...) > int vfwscanf_l (FILE * , locale_t, const wchar_t * , __va_list) > int vwscanf_l (locale_t, const char *, __va_list) > int vsnwprintf_l (wchar_t *, size_t, locale_t, const wchar_t *, va_list= ) > int vswscanf_l (const wchar_t *, locale_t, const wchar_t *, va_list); > int dwprintf_l (int, locale_t, const wchar_t *, ...) > int vdwprintf_l (int, locale_t, const wchar_t *, __va_list) > int aswprintf_l (wchar_t **, locale_t, const wchar_t *, ...) > int vaswprintf_l (wchar_t **, locale_t, const wchar_t *, __va_list) Not sure how you generated this list. swprintf already behaves like snprintf, so there is no need for a separate =E2=80=9Cn=E2=80=9D variant. = A wide-character version of dprintf seems unlikely to be implemented anytime soon. You did not list the fortify variants of these functions. I would prefer to wait for standardization: it is not quite clear what should happen if you use fwprintf_l on a wide stream that already uses a different charset. Thanks, Florian --=20 Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'N= eill