[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checking whether program foo supports option --bar

From: Sébastien Hinderer
Subject: Checking whether program foo supports option --bar
Date: Tue, 1 Mar 2022 18:08:09 +0100

Dear all,

Is there a conventional / recommended way to test whether a program
supports a given command-line option?

I understand the test needs to be somehow program-specific but I still
wonder whether there are some macros around that can be used to make
writing this test simpler.

To be more specific, I need to test whether diff supports the -u and
--strip-trailing-cr options.

I intend to call diff with two times the same argument, namely a file in the
source tree, so that the call fails only if the option is not supported.

Does this make sense to you?

Ultimately the code will have to be flexible enough for the test to work
even when configure is not called from the top source directory.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]