我想在ntpd中添加一个新的选项,但是在向ntpd/ntpd-opts{.c, .h}添加了一些行之后,我找不到如何生成ntpd/ntpdbase-opts.def。
$ git diff ntpd/ntpdbase-opts.def
diff --git a/ntpd/ntpdbase-opts.def b/ntpd/ntpdbase-opts.def
index 66b953528..a790cbd51 100644
--- a/ntpd/ntpdbase-opts.def
+++ b/ntpd/ntpdbase-opts.def
@@ -479,3 +479,13 @@ flag = {
the server to be discovered via mDNS client lookup.
_EndOfDoc_;
};
+
+flag = {
+ name = foo;
+ value = F;
+ arg-type = number;
+ descrip = "Some new option";
+ doc = <<- _EndOfDoc_
+ For testing purpose only.
+ _EndOfDoc_;
+};你有什么想法吗?
发布于 2022-02-25 08:55:59
如何在向ntpd/ntpdbase-opts.def中添加一些行之后生成ntpd/ntpdbase{.c,.h}
它只是在构建脚本中。只需正常编译https://github.com/ntp-project/ntp/blob/master-no-authorname/INSTALL#L30,并将其取出来。
https://github.com/ntp-project/ntp/blob/master-no-authorname/ntpd/Makefile.am#L304
https://github.com/ntp-project/ntp/blob/master-no-authorname/ntpd/Makefile.am#L183
发布于 2022-02-25 16:43:55
除了@KamilCuk的回答之外,我们还需要执行以下操作来添加自定义选项:
*.def文件bootstrap脚本configure脚本具有--disable-local-libopts选项H 210H 111Run make>H 212G 213例如,
$ git diff ntpd/ntpdbase-opts.def
diff --git a/ntpd/ntpdbase-opts.def b/ntpd/ntpdbase-opts.def
index 66b953528..a790cbd51 100644
--- a/ntpd/ntpdbase-opts.def
+++ b/ntpd/ntpdbase-opts.def
@@ -479,3 +479,13 @@ flag = {
the server to be discovered via mDNS client lookup.
_EndOfDoc_;
};
+
+flag = {
+ name = foo;
+ value = F;
+ arg-type = number;
+ descrip = "Some new option";
+ doc = <<- _EndOfDoc_
+ For testing purpose only.
+ _EndOfDoc_;
+};这一变化产生:
$ ./ntpd --help
ntpd - NTP daemon program - Ver. 4.2.8p15
Usage: ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
- prohibits the option 'ipv6'
...
-F Num foo Some new option
opt version output version information and exit
-? no help display extended usage information and exit
-! no more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
...https://stackoverflow.com/questions/71262037
复制相似问题