Please show how it must look right. I need to take one option from the config file, and then update this option. That's all. Doc says I must supply variable, section name and option name. This config_get proto dnsmasq nonegcache has everything it needs?
The dnsmasq section in the config is of "type" dnsmasq, but it is not "named" dnsmasq. A subtle but important difference.
If you can determine the actual name of the section (which will be cfgxxxxx as per dave's response) ahead of time, you can access it directly. Otherwise you will need to iterate through all sections of "type" dnsmasq, which is where config_foreach comes in. In most (all?) cases, there will be only a single dnsmasq section, so you shouldn't have to handle any weird or unexpected behaviour.
@lantis1008@dave14305 thank you very much for the information. Before asking for help here I spent several hours trying to get it working, reviewed a lot of examples (including live system) and my example I laid out above is based on what I have seen in those examples. I also have seen lots of mistakes in real files like performing include /lib/functions (without .sh) which I believe must not work properly (I did not test myself). I wonder why system does not display errors for such things, and does not have any 'debug' mode - it causes lots of problems in seemingly working scripts.
Finally I was not able to properly code using config_get. And switched to UCI. It has much better documentation, and I was able to test using CLI. As sections of my config file are hardcoded, I can address variable using fixed path. As I understand I will have to use UCI anyway because seen somewhere else that config_set is buggy and I must use uci set for proper and reliable result.