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

@ -385,7 +385,7 @@ Example configuration file:
```
# Defaults
baudrate = 9600
baudrate = 115200
databits = 8
parity = none
stopbits = 1
@ -393,15 +393,15 @@ color = 10
[rpi3]
device = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
baudrate = 115200
no-reconnect = enable
log = enable
no-reconnect = true
log = true
log-file = rpi3.log
line-pulse-duration = DTR=200,RTS=150
color = 11
[svf2]
device = /dev/ttyUSB0
baudrate = 9600
script = expect("login: "); send("root\n"); expect("Password: "); send("root\n")
color = 12