【发布时间】:2015-07-10 22:45:57
【问题描述】:
我在 github 上有自己的 C 项目。我想通过使用 GNU getopt_long()(它有自己的 git 存储库)来添加长选项支持。我相信有 4 种方法可以做到这一点:
- 使用git submodule。
- 使用git subtree。
- 将当前 (2.22.6) 快照的源代码导入我自己的 git 存储库。
- 仅导入
getopt.c、getopt1.c和gnugetopt.h的getopt_long()源文件。
1 和 2 的优点是我跟踪 getopt_long()。 3 和 4 的优点是,如果 getopt_long() 的 git 存储库移动,它不会破坏我的存储库并且这样做更简单。
是否有推荐的“GNU 方式”来执行此操作?
【问题讨论】:
-
为什么完全导入源而不使用库?
-
因为它不是在所有平台上。
标签: c getopt getopt-long