Replace inih with glib key file parser

After including the use of glib we might as well replace inih
with the glib key file parser.

All configuraiton file parsing has been reworked and also the options
parsing has been cleaned up, resulting in better and stricter
configuration file and option value checks.

Compared to old, configuration files now requires any default
configurations to be put in a group/section named [default].

Configuration file keywords such as "enable", "disable", "on",
"off", "yes", "no", "0", "1" have been retired. Now only "true" and
"false" apply to boolean configuration options. This is done to simplify
things and avoid any confusion.

The pattern option feature has been reworked so now the user can now
access the full match string and any matching subexpression using the
%mN syntax.

For example:

[usb devices]
pattern = usb([0-9]*)
device = /dev/ttyUSB%m1

Then when using tio:
$ tio usb12

   %m0 = 'usb12'  // Full match string
   %m1 = 12       // First match subexpression

Which results in device = /dev/ttyUSB12
This commit is contained in:
Martin Lund 2024-05-02 17:21:10 +02:00
parent 68d3b845b2
commit 65c5a068d8
23 changed files with 969 additions and 723 deletions

View file

@ -87,10 +87,18 @@ extern char ansi_format[];
{ \
if (print_tainted) \
putchar('\n'); \
if (option.color < 0) \
fprintf (stdout, "\r[%s] Error: " format "\r\n", timestamp_current_time(), ## args); \
else \
ansi_printf("[%s] Error: " format, timestamp_current_time(), ## args); \
if (option.color < 0) { \
if (error_normal) \
fprintf (stdout, "Error: " format "\n", ## args); \
else \
fprintf (stdout, "\r[%s] Error: " format "\r\n", timestamp_current_time(), ## args); \
} \
else { \
if (error_normal) \
{ ansi_printf("Error: " format, ## args); }\
else \
{ ansi_printf("[%s] Error: " format, timestamp_current_time(), ## args); }\
} \
print_tainted = false; \
} \
}