From patchwork Mon Oct 7 10:50:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52089 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:938f:0:b0:48e:c0f8:d0de with SMTP id z15csp1845841vqg; Mon, 7 Oct 2024 04:16:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWd9OiRhia9R9ENG92GU06+MG6/M00M2MMbasRb2a9JfF6mfZgnbJ2SxeBoi2OGMoI/TGNG2g2ip2eWc3d25uN0@gmail.com X-Google-Smtp-Source: AGHT+IFg5nrRv5VekrJ4txIWg1nYD87RDLriQdazlMOqIxwDnrEv9/oXFWouPi+5tCpVpvT6Lxso X-Received: by 2002:a05:6512:12c3:b0:530:ab86:3 with SMTP id 2adb3069b0e04-539ab84a49bmr4753708e87.1.1728299788064; Mon, 07 Oct 2024 04:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728299788; cv=none; d=google.com; s=arc-20240605; b=QsxJM3twe5aCqyiG7O33apiQxpgNyaacOM2EyRShGs42b9Vq5hPbAQ8h7GMYlHIIpj 3tqUkKVtjXJ4mVLfQfpppcUqpgo10wT3ImjvjrztP/CET1RTSLga1/LP0vZ7/Wk3Lsw6 Wb9UrwmU36AWRwawY+j+90Y3a9FS5e2qsyKzWPRLJqBX00wH8OucnlTu4FVuL0s2SNuE W0h0eYUO1FwaeyUPMpKqlRYkQF4JbdHRVygMDyYJpS177V510kT+YTXXCAqcjREGpXTP ks3c84XAXgAuErwRvB01nuUBsAhEYDkUeT3V4db4uSpOnP80bZEAzxD9mtfS3LngvGQj ndUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=ydPwpn2Bo3v0dprW9Hw7iW5MLY0Ut5Dl8vTDkKwoEmg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=D4oCzYGgCNoDpRg0zvTFkMqfTLOwdKLce6Y9+gv1Q0KbI62bTXPG0EGBW8XG7DXAwW Zl4lvn2ukVJu6W3fwhujYFajYwp2rRAyN778kEu2jLEWKMZUoigNZM9KVAdQQ6jJdXxA C92fn+mN1hAL2HoR9O72WSeoWFzRDex2tmzYIwUOgdjez+N3GjLMd/VWNnDYstHt8Yx+ GZPemI3BWJgO+axRqKpopPWV9dak7mRgagpcanY9taI0IEiD3Imeb5KVNoSaDIZL2H5N kmCYzie71TlP6oEYcoWuGlr5IKcqF9n7Pt46OOX0DcEh6l8LBsWt2RMSvOrkcV28JfxD wC3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=i+eqY6Oi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a992e81c64esi428854166b.924.2024.10.07.04.16.04; Mon, 07 Oct 2024 04:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=i+eqY6Oi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6E2E868DB0E; Mon, 7 Oct 2024 13:50:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB24E68DA16 for ; Mon, 7 Oct 2024 13:50:38 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=i+eqY6Oi; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 5435C4E1B for ; Mon, 7 Oct 2024 12:50:38 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 1BGKsY4vGhtm for ; Mon, 7 Oct 2024 12:50:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1728298236; bh=WEi9ASks6UgxTONmdTeFspInDn6yDaHenjWETa4yuho=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i+eqY6OibqVVPPj0GkTxjFfUNs4mylgtSF670yMVTLTx/AbAYx2ouKaBtjEgCn5vB 1jKqM3lMUYL+rvh2FwZRz1xPHJe9Rnjwm4/aLfJC2/L8C+JEpBd5vEmtK7+DhSQOL5 s9pVisNst4Xw5d8mSLTHDnOMI4ELkZHmSssu9fVNcnJYO+q7sOIqSQjhr3OWhb7TLX rU0EEdjMnnCEmIBVeKtIF1VKLURC407RhRDESYllVHMqd/OzUe9g4whTQMktZO++Z8 GF9aZXQrKCmQdIXTjI9rlCZl0fqzkR8w8zR+g6eXYK/w3g4QwxXGLA484nPBfhYz4L mLEEfgkPckUNg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id C5407EFF for ; Mon, 7 Oct 2024 12:50:36 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 6A6593A0F02 for ; Mon, 07 Oct 2024 12:50:30 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Oct 2024 12:50:13 +0200 Message-ID: <20241007105016.1597-2-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007105016.1597-1-anton@khirnov.net> References: <20241007105016.1597-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: do not treat single '-' as an option in locate_option() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gKRlLl0uZ3Z4 Fixes early parsing of trailing -v/-loglevel while using '-' to output to stdout. --- fftools/cmdutils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 9eb49dbf20..8ac20bf049 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -492,8 +492,9 @@ int locate_option(int argc, char **argv, const OptionDef *options, for (i = 1; i < argc; i++) { const char *cur_opt = argv[i]; - if (*cur_opt++ != '-') + if (!(cur_opt[0] == '-' && cur_opt[1])) continue; + cur_opt++; po = find_option(options, cur_opt); if (!po->name && cur_opt[0] == 'n' && cur_opt[1] == 'o')