Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8769637416B for ; Tue, 17 Mar 2026 10:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773744600; cv=none; b=PhDjsAbs3nVlPnrHvcqDFIlhIp5928usKSadhcu36oo+wl3KxjOXr6DxKmTZhG5obGpAdlf4G5RDN4tAp/oTHbDIMJWNFdSUkgB5CqWvYzkXgprGj3KzperxUeq/c8UNoltkAQbFxUDfPopGOSbxhzS8iMpg2IGy9Vw0FkRpTcs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773744600; c=relaxed/simple; bh=6CUGFJsFEqQR+fbwAP4Y0YRN5YUQSPjCjwlNCK97BMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B+R59GhxtYphWuzQ/1T34YIjLeiZO7qasTKflyWtPGsJZmGkrboCa2/Mx4897Z5GDfHVqGvYctvrI4+785zmp2I0nn165aP7cq9oq3tvac8d5Oj2LiG5aLfWdR41BOrP5eu/z8rylYcBs9jliRKmjqqAK2U58JyHh850LrXSXM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ZLxJDvvM; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZLxJDvvM" Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 14F7A593; Tue, 17 Mar 2026 11:48:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1773744524; bh=6CUGFJsFEqQR+fbwAP4Y0YRN5YUQSPjCjwlNCK97BMU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZLxJDvvMO284JF00bbQYpffZKpn6x15AlOC16yxREWNO0TGfNhmY4JjYCi8fumHuB DYopzGHHKSS7ZlW4PubBpIoUbusgJHSBu8Rp/g3Mga36VOU3ByQcX2rpzOQVAih/rD k9Ys3+YIpTeNDrWTZUQz4GewSHF93i1QMEQNGzME= Date: Tue, 17 Mar 2026 12:49:54 +0200 From: Laurent Pinchart To: Sakari Ailus Cc: linux-media@vger.kernel.org, Jacopo Mondi , Mehdi Djait , Tomi Valkeinen Subject: Re: [raw2rgbpnm PATCH v4 04/11] Support long options and improve help text Message-ID: <20260317104954.GA302774@killaraus.ideasonboard.com> References: <20260310084615.1183141-1-sakari.ailus@linux.intel.com> <20260310084615.1183141-5-sakari.ailus@linux.intel.com> <20260316144151.GF31604@killaraus.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, Mar 17, 2026 at 11:49:14AM +0200, Sakari Ailus wrote: > Moi, > > On Mon, Mar 16, 2026 at 04:41:51PM +0200, Laurent Pinchart wrote: > > On Tue, Mar 10, 2026 at 10:46:10AM +0200, Sakari Ailus wrote: > > > Signed-off-by: Sakari Ailus > > > --- > > > raw2rgbpnm.c | 34 +++++++++++++++++++++++++--------- > > > 1 file changed, 25 insertions(+), 9 deletions(-) > > > > > > diff --git a/raw2rgbpnm.c b/raw2rgbpnm.c > > > index 14cfa7e7a46c..16ef64e984b9 100644 > > > --- a/raw2rgbpnm.c > > > +++ b/raw2rgbpnm.c > > > @@ -24,6 +24,7 @@ > > > */ > > > > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -836,6 +837,17 @@ static int parse_format(const char *p, int *w, int *h) > > > return 0; > > > } > > > > > > +static struct option options[] = { > > > + { "algo", required_argument, NULL, 'a', }, > > > + { "brightness", required_argument, NULL, 'b', }, > > > + { "format", required_argument, NULL, 'f', }, > > > + { "help", no_argument, NULL, 'h', }, > > > + { "high-bits", no_argument, NULL, 'g', }, > > > + { "size", required_argument, NULL, 's', }, > > > + { "swap-rb", no_argument, NULL, 'w', }, > > > + { 0 }, > > > +}; > > > + > > > int main(int argc, char *argv[]) > > > { > > > FILE *f; > > > @@ -849,7 +861,7 @@ int main(int argc, char *argv[]) > > > int width = -1; > > > > > > for (;;) { > > > - int c = getopt(argc, argv, "a:b:f:ghs:w"); > > > + int c = getopt_long(argc, argv, "a:b:f:ghs:w", options, NULL); > > > if (c==-1) break; > > > switch (c) { > > > case 'a': > > > @@ -889,14 +901,18 @@ int main(int argc, char *argv[]) > > > break; > > > case 'h': > > > printf("%s - Convert headerless raw image to RGB file (PNM)\n" > > > - "Usage: %s [-h] [-w] [-s XxY] \n" > > > - "-a Select algorithm, use \"-a ?\" for a list\n" > > > - "-b Set brightness (multiplier) to output image (float, default 1.0)\n" > > > - "-f Specify input file format format (-f ? for list, default UYVY)\n" > > > - "-g Use high bits for Bayer RAW 10 data\n" > > > - "-h Show this help\n" > > > - "-s Specify image size\n" > > > - "-w Swap R and B channels\n", progname, argv[0]); > > > + "Usage: %s [--algo|-a ] [--brightness|-b ]\n" > > > + " [--format|-f ] [--help|-h] [--high-bits|-g] [--size|-s XxY]\n" > > > + " [--swap-rb|-w] \n\n" > > > > That won't scale nicely, but I don't want to implement an options > > handling framework in C right now :-) > > > > > + "--algo, -a Select algorithm, use \"-a ?\" for a list\n" > > > + "--brightness, -b Set brightness (multiplier) to output image\n" > > > + " (float, default 1.0)\n" > > > > Do you know if this option is used by anyone ? It seems a bit out of > > place. Not an issue with this patch of course. > > I have no idea. But keeping it won't do any harm, will it? It's just an opportunity for cleaning up an unused feature :-) It looks out of place, as nothing else in raw2rgbpnm performs post-processing on the converted image (and rightfully so). > > > + "--format, -f Specify input file format format\n" > > > + " (-f ? for list, default UYVY)\n" > > > + "--help, -h Show this help\n" > > > + "--high-bits, -g Use high bits for Bayer RAW 10 data\n" > > > + "--size, -s Specify image size\n" > > > + "--swap-rb, -w Swap R and B channels\n", progname, argv[0]); > > > > I'd add a line break before progname. > > Sounds good. > > > Reviewed-by: Laurent Pinchart > > > > > exit(0); > > > case 's': > > > if (parse_format(optarg, &width, &height) < 0) { -- Regards, Laurent Pinchart