API for parsing / updating UNIX configuration files

Unix configuration files come in all forms and forms. I know that Webmin has a Perl API that simplifies the analysis and modifies the most common configuration programmatically, while preserving the changes that could be made manually.

Are there other libraries that have similar functions, possibly for other languages ​​(Python, Ruby, C, C ++, etc.)?

+4
source share
2 answers

At least for Python, there are many libraries that intend to simplify parsing. One of the simplest can be picoparse ( http://github.com/brehaut/picoparse ), which is built for direct analysis without the need for regular expressions.

Another noteworthy might be funcparselib ( http://code.google.com/p/funcparserlib/ ) also for python.

If you intend to use C, the most common tools for creating parsers are Yacc and Flex. These tools are quite complex and have a high enough threshold before they can be used.

+3
source

Ajenti , an alternative to Webmin written in Python, uses reconfigure .

It is not as mature and complete as Webmin and the API, but the reconfiguration looks like a good answer to this question that I can find.

+1
source

Source: https://habr.com/ru/post/1304683/


All Articles