[sr-dev] [kamailio/kamailio] Dump Configuration and Exit (new flag -C [filename]) (#2546)

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 10 14:37:00 CET 2020


On 10.11.20 13:16, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> Very important - for now the `--cfg-print` works if the main
>> configuration file has the first line: 
>> #!KAMAILIO
> Can there be other stuff on the line after #!KAMAILIO?
The parsing state is switched to printing config on matching #!KAMAILIO
(and I just added the other variants #!SER, #!ALL, ...), which is
expected to be in the first line. What is before, it is not printed (but
actually parsed as usual).

I didn't want to mess very much the INITIAL state parsing, because any
token defined in cfg.lex can theoretically be in the first line, so will
make it too complex by adding conditions to each of them to check if
--cfg-print is on or not.

The other variant is to try to start in another state, then on first
char switch to INITIAL or CFGPRINTMODE, but I didn't have the time to
dig into it, I went on easy way trying not to break anything.

So for now, if someone doesn't want the #!KAMAILIO (or the other
variants) in the first line, can add it temporarily only when it uses
the --cfg-print, then remove it. Of course, if someone wants to look
more into it, is more than welcome to make pull requests.

Cheers,
Daniel


>
> For example emacs can be told about the major mode used in the file by
> checking if first non-blank line contains  -*-<something>-*-.
>
> So I would like the definition go like this:
>
> `--cfg-print` works if the main configuration file starts with
>
> #!KAMAILIO


-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla




More information about the sr-dev mailing list