From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3E8B39C636 for ; Mon, 2 Mar 2026 10:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772446743; cv=none; b=JOOmmqzNy8v/H8TKnaM0nvz8N/XV0LeNnRhgKLN/qcKzqbF+ftOqIAbkOpg0+wJt56iSD0N30hps/36xmgBBPcFbbn63VndKpKNvD4jJSu32y1mz15sO2+8VluQYpMvk0fGu3RQ7qkSYOzXAtnprcnzw2lZJqwdSrELgxdV+A/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772446743; c=relaxed/simple; bh=o/E44RG64+ZwVcYj7B9fCVBrrBAckLj412Timlk1+ks=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NYq4axbSrZ/ljcYl/YUfy+JoEKCTkygruZjQRw7OdKvL1FTjmAUfFqQju71Nib4Y+KAv1tGHaCzHJloX8ieCyRbnuHDb8Fnu7T7AA4JZhq88GvaoNRq0y2o6g0G0OhGw7Tv/b/3M2VoH/kN81Kb3Zbig2Bh5TV4e9MAI/FryPSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=QCizkjLk; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="QCizkjLk" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vx0MZ-003Bdf-IW; Mon, 02 Mar 2026 11:18:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From; bh=nmKYQ75Xj4T+FTlGUs6avSWf8c41BEjTyS/XIEM2MAw=; b=QCizkjLk8XA7kUAK+KTR/VpP8R g4JqAA5IM3ug8L1xwPYjvXGip9+CK3r5O9Le6QboeVOpogBA+LvY4bW2kzvvmsDHSeVdYchztlEGw TEMlCe3wVVNaIMKDgTsSAhMMJNTnF/xqZsuFPMLbZMu9C5gcQLKZfkvy5O+9OenONF9qD7zSK2JSC VuhhtxhDPEOk071f2YYeYyKti4wRgO2mHFVbGaDDgM9ecwUnaVRPL40Q1vB3OKjiyBQFyLy88Lf7f loG99mbRcdpid6LJRZrPIlLw5F/CC7DNNVVqbAv3tPD9yx8gDJqrIetn/HYL9LabLQmR1TpFRNQPF IoQIokrA==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vx0MZ-0002z7-7c; Mon, 02 Mar 2026 11:18:55 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vx0MD-006y7o-6U; Mon, 02 Mar 2026 11:18:33 +0100 From: david.laight.linux@gmail.com To: Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org, Cheng Li Cc: David Laight Subject: [PATCH v4 next 18/23] tools/nolibc/printf: Add support for conversion flags space and plus Date: Mon, 2 Mar 2026 10:18:10 +0000 Message-Id: <20260302101815.3043-19-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260302101815.3043-1-david.laight.linux@gmail.com> References: <20260302101815.3043-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: David Laight Flags ' ' and '+' are sign characters for positive numbers. Signed-off-by: David Laight --- v4: Split from the previous patch and support for the # flag. tools/include/nolibc/stdio.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h index fb310b7d023f..5d75e8530ce2 100644 --- a/tools/include/nolibc/stdio.h +++ b/tools/include/nolibc/stdio.h @@ -296,7 +296,7 @@ int fseek(FILE *stream, long offset, int whence) * - %% generates a single % * - %m outputs strerror(errno). * - %X outputs a..f the same as %x. - * - The modifiers [#-+ 0] are currently ignored. + * - The modifiers [#-0] are currently ignored. * - No support for precision or variable widths. * - No support for floating point or wide characters. * - Invalid formats are copied to the output buffer. @@ -456,6 +456,10 @@ int __nolibc_printf(__nolibc_printf_cb cb, void *state, const char *fmt, va_list sign_prefix = '-'; v = -(signed_v + 1); v++; + } else if (_NOLIBC_PF_FLAGS_CONTAIN(flags, '+')) { + sign_prefix = '+'; + } else if (_NOLIBC_PF_FLAGS_CONTAIN(flags, ' ')) { + sign_prefix = ' '; } } -- 2.39.5