Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3568922rwe; Mon, 29 Aug 2022 14:48:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6PoDDLes4WHXVJJzGMvNrOisNAhOOmz56iNd8+BgVI9dwoKYMrC2l5+v+wHnRLJufoKoGn X-Received: by 2002:aa7:d814:0:b0:447:b848:9e53 with SMTP id v20-20020aa7d814000000b00447b8489e53mr17108319edq.64.1661809721926; Mon, 29 Aug 2022 14:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661809721; cv=none; d=google.com; s=arc-20160816; b=eVkHP9VGpqbOwBYqOfU/7Q/cHaTanJuaFB+r2za8IwoFaf/cBkVwPQfhidXs/7dOTx ByIQbTWKoOh8q5VaBtLFa26ztwqmcGWtGegqkXZoLM3DVb7BG67cCzibjO7wdC0VohA4 m0xm9MQf5D0dBbQ1vO8xDGa0i/k+9KFjsXqAwj6GbmqB+lX1ToVXPc16Jpa91ZeS9oj4 mkdVMSZR/B7F/4hATF2yx1V3J/9CVy80DY3SHhxm+Y0d1UuXfjdAww+HZPBEX6mORg2X 1Mpo8iehQrOY80A1wZTcY1rdzsjSy+Ejb/Z1U7Scy1GpMfTJ3v2u+Ni289uSbutCPt3z QdrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=EeANEH16Ms+JkkMMUAw9jnizxEOLZbp4y3uAH4CSXVI=; b=AxIlV+Fr/FznFR0vGbklu8VFMA+Gc65yVEXmTKIhYhLlilpmFixekdGM1xkXNjwVwv NSPYDJ8BDkgI2jimsaTB0VL652VZjVbUP636myalG1SBe+m2Ne5AvORWzbEmJHCVrtBG Dct3BzQjUpUJe+ZK7TQW34RZwLSMjGoh1z1zhbljl1PTri1huFWge4eb8XP0SHEMt075 rzfG6sQgQs+LFKgcvk8SYdlpf1n/GMsrQC0r97KEiFjU8Zh4O3cf9Z8/132fLtBd0BJl FCgWGJfg0dg/v8o3OvCnXLIj7W3RE22VBGz9miPYX+nB0Kq5GXrFqkdtXlIRHU/T+u3z FPXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=coeQ5XDg; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a17090660cc00b0073cf890c3a7si6913940ejk.341.2022.08.29.14.48.16; Mon, 29 Aug 2022 14:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=coeQ5XDg; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbiH2Vho (ORCPT + 99 others); Mon, 29 Aug 2022 17:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiH2Vhm (ORCPT ); Mon, 29 Aug 2022 17:37:42 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B74A82D19 for ; Mon, 29 Aug 2022 14:37:42 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id w88-20020a17090a6be100b001fbb0f0b013so9916968pjj.5 for ; Mon, 29 Aug 2022 14:37:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=EeANEH16Ms+JkkMMUAw9jnizxEOLZbp4y3uAH4CSXVI=; b=coeQ5XDgiBPBfpTCLTA5k3CaIGUF8wVYSbrUiqfdSy2gLZ61O4bIjunKVXjmkoX0IB iVeGCKRHhaqgTuq+w0g0kzA4gPFy8HWMsZydbORPZC4EGSe/11k3jSZ0xVE5uIV19xdN 0jz1zQlvoWylcPBvftTZ2HQ+d81Ke5qQ366vV7feVWVabpu+gxyA+Pj3FqRjE0xn0nXP xHbPoUWxz7nit5T6RxGQDgB3R97DuT43KvZuRVLJlgKCLzlewUrtbrmRVn2oTM38axgR YcFZzcQ8kOZqWmdaCfVJRxZD9bV8wniJFSWbpw+hHfRUUFwKSj8PaLTxKGE3SY3iuzX+ jDOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=EeANEH16Ms+JkkMMUAw9jnizxEOLZbp4y3uAH4CSXVI=; b=O7HhHbFGMOSoq8hfrnNXuBwmSIdbQebu+cLgKnaIEw+jONkJqYe06HSrnBLCDnh+Yd 4zkBKpzvdRDz9Ap12Zq34JIDI1k16H7lpp+36WoCQ+/6BgFO52nEKZQSIkQdlrxvkz9P wrkEaehBW2LtfyGz9aTRRJW/79+PtRZOKwwRyPK35RzX4Rujt3915H3W7LHmyH/BWjYn BUqVFA+jTtNcEc2vAjvOu7jDgHwjUFvRyy4X9Inb7ncHly2x18CDIua30yhOAapunkFy bXfgGTQutSrllRUnP7NTfIwXGOC3rR/TImcsye6uvO3adjxoU7dCPvgy377muEFw8wPw eAkA== X-Gm-Message-State: ACgBeo063LkmDdHmpkRCWksbVKQ6dfATY+ZshSyfgx3ov8uiBL3DCPnb KPQV00x5/caHOkRZkaH4KxXMPC3pGRTMUw== X-Received: by 2002:a17:902:d2c1:b0:16e:ea4e:36d3 with SMTP id n1-20020a170902d2c100b0016eea4e36d3mr18076660plc.98.1661809060843; Mon, 29 Aug 2022 14:37:40 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id p186-20020a62d0c3000000b005367c28fd32sm7722765pfg.185.2022.08.29.14.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 14:37:40 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] shell: Set empty argument if optarg is NULL Date: Mon, 29 Aug 2022 14:37:37 -0700 Message-Id: <20220829213738.779598-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This sets enmpty string ("") when argument don't set any optarg so the application can tell when an option was set or not. --- src/shared/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index dfda8128af91..4658819a4bde 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1158,7 +1158,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) return; } - *opt->optarg[index - offset] = optarg; + *opt->optarg[index - offset] = optarg ? : ""; } index = -1; -- 2.37.2