[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master dfa2583c: Configuration files: name and value
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master dfa2583c: Configuration files: name and value can be separated by = |
Date: |
Sun, 7 May 2023 06:44:54 -0400 (EDT) |
branch: master
commit dfa2583c6962b12ec726e0cf9d037045d11a86d8
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Configuration files: name and value can be separated by =
Until now, only white-space characters could be used to separate an option
name and value in configuration files. But this was inconvenient when you
wanted to use the same configuration in a shell script or a Makefile (which
require a '=' between the name and value).
With this commit, the '=' characters is also accepted as a separator
between option names and values.
---
NEWS | 7 +++++++
doc/gnuastro.texi | 2 +-
lib/options.c | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index e881fd96..2c3618f5 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,13 @@ See the end of the file for license conditions.
** New features
+ Configuration files
+ - To separate the option name and value, you can now also use the '='
+ character. This allows your custom configuration files to also be
+ loaded into a shell (with 'source') or Make (with 'include'). Until
+ now, only white-space characters were allowed as separators of option
+ names and values.
+
** Removed features
** Changed features
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index e1c3842d..307975c6 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -11600,7 +11600,7 @@ When you download the source code, you can find them in
the same directory as th
Any line in the configuration file whose first non-white character is a
@key{#} is considered to be a comment and is ignored.
An empty line is also similarly ignored.
The long name of the option should be used as an identifier.
-The parameter name and parameter value have to be separated by any number of
`white-space' characters: space, tab or vertical tab.
+The option name and option value should be separated by any number of
`white-space' characters (space, tab or vertical tab) or an equal (@key{=}).
By default several space characters are used.
If the value of an option has space characters (most commonly for the
@option{hdu} option), then the full value can be enclosed in double quotation
signs (@key{"}, similar to the example in @ref{Arguments and options}).
If it is an option without a value in the @option{--help} output (on/off
option, see @ref{Options}), then the value should be @option{1} if it is to be
`on' and @option{0} otherwise.
diff --git a/lib/options.c b/lib/options.c
index 426444fe..edfb22a0 100644
--- a/lib/options.c
+++ b/lib/options.c
@@ -2495,7 +2495,7 @@ options_read_name_arg(char *line, char *filename, size_t
lineno,
do
switch(*line)
{
- case ' ': case '\t': case '\v': case '\n': case '\r':
+ case ' ': case '=': case '\t': case '\v': case '\n': case '\r':
if(inword) /* Only considered in a word, not in a quote*/
{
inword=0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master dfa2583c: Configuration files: name and value can be separated by =,
Mohammad Akhlaghi <=