From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9FE03A04C0;
	Mon, 28 Sep 2020 23:52:52 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 245231BBFD;
	Mon, 28 Sep 2020 23:51:45 +0200 (CEST)
Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com
 [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id 7F5021D6BF
 for <dev@dpdk.org>; Mon, 28 Sep 2020 23:51:37 +0200 (CEST)
Received: by mail-lf1-f68.google.com with SMTP id w11so3108841lfn.2
 for <dev@dpdk.org>; Mon, 28 Sep 2020 14:51:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=P0uoi6f92oyKfLz+Ug/C55wcAxwGLUdlQjXwBAS+h1c=;
 b=aBcWE4xMV2PXl6XjvYNOKdvXTzXZ32FNU70+a/IYpsf6zP8/diPRPRl8yy+COIVu7E
 u/HV8rhXsNyV+f7K9Z8rT/zxicmBp6kLZGpBdJ/8MBQp/d9qnppdLe2bzdt7GYIq1iMS
 yRqXa0Eo9FZC5GIC2bmlhsWRy8xX5cjp4CSDx6DDonUPwJGA6efZEhrH8kF6w6kyErKf
 SFTx3L2nq+baTP/0sB68T3suitq/AwFDI0baqvD0WWfmgZ0Em2zkK6LriOgHyZEXxVww
 u6/z3yiqCzl2EXtGsSeeoeNjgdz3GXHGZxIiTp8xfJK/O/0ksc12bZJB7IjKzTxf0mcG
 a0Rw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=P0uoi6f92oyKfLz+Ug/C55wcAxwGLUdlQjXwBAS+h1c=;
 b=HONNTujhFPxO6mtbJGGwfKrtpK7lGdIpo5lfjjD0h5wYU2FhZUusiYdKqKcziusoSW
 rEos46c3ycPq+C00h7PhfpRAatkgfDfqTvEcNr5YmgyYDX1Na8jMq7FXyEfbBUEAie3j
 bQEVTsxhTkVIIZ/70PZzlHgnYEGZ7knQrSIjSv1wGNQYUndNFf8iZx40zoP5Gyy6D63o
 X0cXJyZ0zSy49hah38pcxeXtOHaV9zpDDbzkdYzYlmmzRICPsgoAL3/D6HxMEdq8m0pM
 e0g8k+pW5PEaC8NZ+5d9HisQ5W9+dEEKLm0gF/u3FZ2+E64LSD0pAIdlkjAfk1ndcPzO
 Tfpw==
X-Gm-Message-State: AOAM530ew+8P0VuolwtZHC0XRGyc2RwfQecQkYlu04iUnhAHP6Lgb8HX
 RVilYMmHw/wg0yXkWmx93KT2nu2MNo+fz3XI
X-Google-Smtp-Source: ABdhPJxb+6iS11wr5J59gJF5q1iUpAOiPyHAvfvCH1zsNKjZ6vGz2UFNIT/23loPn2DWD/5tqapGoQ==
X-Received: by 2002:a19:402:: with SMTP id 2mr76520lfe.279.1601329895856;
 Mon, 28 Sep 2020 14:51:35 -0700 (PDT)
Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru.
 [37.110.65.23])
 by smtp.gmail.com with ESMTPSA id l11sm2954893lfk.113.2020.09.28.14.51.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 28 Sep 2020 14:51:35 -0700 (PDT)
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: dev@dpdk.org
Cc: "Kinsella, Ray" <mdr@ashroe.eu>, Khoa To <khot@microsoft.com>,
 Stephen Hemminger <stephen@networkplumber.org>,
 Ferruh Yigit <ferruh.yigit@intel.com>,
 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
 Olivier Matz <olivier.matz@6wind.com>
Date: Tue, 29 Sep 2020 00:50:49 +0300
Message-Id: <20200928215052.23627-5-dmitry.kozliuk@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <20200928215052.23627-1-dmitry.kozliuk@gmail.com>
References: <20200730210652.14568-1-dmitry.kozliuk@gmail.com>
 <20200928215052.23627-1-dmitry.kozliuk@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v3 4/7] cmdline: add internal wrapper for vdprintf
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Add internal wrapper for vdprintf(3) that is only available on Unix.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_cmdline/cmdline.c         | 2 +-
 lib/librte_cmdline/cmdline_os_unix.c | 6 ++++++
 lib/librte_cmdline/cmdline_private.h | 8 ++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 0b2e1e30b..49770869b 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -131,7 +131,7 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
 	if (cl->s_out < 0)
 		return;
 	va_start(ap, fmt);
-	vdprintf(cl->s_out, fmt, ap);
+	cmdline_vdprintf(cl->s_out, fmt, ap);
 	va_end(ap);
 }
 
diff --git a/lib/librte_cmdline/cmdline_os_unix.c b/lib/librte_cmdline/cmdline_os_unix.c
index a4916c197..64a945a34 100644
--- a/lib/librte_cmdline/cmdline_os_unix.c
+++ b/lib/librte_cmdline/cmdline_os_unix.c
@@ -45,3 +45,9 @@ cmdline_read_char(struct cmdline *cl, char *c)
 {
 	return read(cl->s_in, c, 1);
 }
+
+int
+cmdline_vdprintf(int fd, const char *format, va_list op)
+{
+	return vdprintf(fd, format, op);
+}
diff --git a/lib/librte_cmdline/cmdline_private.h b/lib/librte_cmdline/cmdline_private.h
index ac10de4f8..4d9ea33f0 100644
--- a/lib/librte_cmdline/cmdline_private.h
+++ b/lib/librte_cmdline/cmdline_private.h
@@ -5,6 +5,10 @@
 #ifndef _CMDLINE_PRIVATE_H_
 #define _CMDLINE_PRIVATE_H_
 
+#include <stdarg.h>
+
+#include <rte_common.h>
+
 #include <cmdline.h>
 
 /* Disable buffering and echoing, save previous settings to oldterm. */
@@ -19,4 +23,8 @@ int cmdline_poll_char(struct cmdline *cl);
 /* Read one character from input. */
 ssize_t cmdline_read_char(struct cmdline *cl, char *c);
 
+/* vdprintf(3) */
+__rte_format_printf(2, 0)
+int cmdline_vdprintf(int fd, const char *format, va_list op);
+
 #endif
-- 
2.28.0