用于解析/更新 UNIX 配置文件的 API

发布于 2024-08-25 13:26:47 字数 279 浏览 3 评论 0原文

Unix 配置文件有各种形式。我知道 Webmin 有一个 Perl API,可以轻松地以编程方式解析和修改最常见的配置,同时保留可能手动进行的更改。

是否有任何其他库具有类似的功能,也许适用于其他语言(Python、Ruby、C、C++ 等)?

Unix configuration files come in all shapes and forms. I know that Webmin has a Perl API that makes it easy to parse and modify most common configuration programmatically, while preserving changes that might have been made by hand.

Are there any other libraries that has similar functionality, perhaps for other languages (Python, Ruby, C, C++, etc)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

闻呓 2024-09-01 13:26:47

至少对于 Python 来说,有许多旨在简化解析的库。最简单的之一可能是 picoparse (http://github.com/brehaut/picoparse),它是构造为提供直接的解析,而不需要正则表达式。

另一个值得一看的可能是 funcparselib (http://code.google.com/p/funcparserlib/ )也适用于Python。

如果您打算使用 C,构建解析器的最常用工具是 Yacc 和 Flex。这些工具比较复杂,使用门槛也比较高。

At least for Python there are numerous libraries that intends to simplify parsing. One of the simplest might be picoparse (http://github.com/brehaut/picoparse) which is constructed to provide straight forward parsing without the need of regexps.

Another one worth a look might be funcparselib (http://code.google.com/p/funcparserlib/) also for python.

If you intend to use C the most common tools for building parsers are Yacc and Flex. These tools are rather complex and has a rather high threshold before being usable.

遇到 2024-09-01 13:26:47

Ajenti,用 Python 编写的 Webmin 的替代方案,使用 重新配置

它不像 Webmin 及其 API 那样成熟和完整,但重新配置看起来是我能找到的这个问题的最好答案。

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

It is not as mature and complete as Webmin and it's API, but reconfigure looks like as good an answer to this question as I am able to find.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文