1*2b15cb3dSCy Schubert /*
2*2b15cb3dSCy Schubert * ntp_libopts.c
3*2b15cb3dSCy Schubert *
4*2b15cb3dSCy Schubert * Common code interfacing with Autogen's libopts command-line option
5*2b15cb3dSCy Schubert * processing.
6*2b15cb3dSCy Schubert */
7*2b15cb3dSCy Schubert #ifdef HAVE_CONFIG_H
8*2b15cb3dSCy Schubert # include <config.h>
9*2b15cb3dSCy Schubert #endif
10*2b15cb3dSCy Schubert
11*2b15cb3dSCy Schubert #include <stdio.h>
12*2b15cb3dSCy Schubert #include <stddef.h>
13*2b15cb3dSCy Schubert #include "ntp_libopts.h"
14*2b15cb3dSCy Schubert #include "ntp_stdlib.h"
15*2b15cb3dSCy Schubert
16*2b15cb3dSCy Schubert extern const char *Version; /* version.c for each program */
17*2b15cb3dSCy Schubert
18*2b15cb3dSCy Schubert
19*2b15cb3dSCy Schubert /*
20*2b15cb3dSCy Schubert * ntpOptionProcess() was a clone of libopts' optionProcess which
21*2b15cb3dSCy Schubert * overrode the --version output, appending detail from version.c
22*2b15cb3dSCy Schubert * which was not available at Autogen time. This is now done via
23*2b15cb3dSCy Schubert * AutoOpts' version-proc = override in copyright.def, so this
24*2b15cb3dSCy Schubert * routine is a straightforward wrapper of optionProcess().
25*2b15cb3dSCy Schubert */
26*2b15cb3dSCy Schubert int
ntpOptionProcess(tOptions * pOpts,int argc,char ** argv)27*2b15cb3dSCy Schubert ntpOptionProcess(
28*2b15cb3dSCy Schubert tOptions * pOpts,
29*2b15cb3dSCy Schubert int argc,
30*2b15cb3dSCy Schubert char ** argv
31*2b15cb3dSCy Schubert )
32*2b15cb3dSCy Schubert {
33*2b15cb3dSCy Schubert return optionProcess(pOpts, argc, argv);
34*2b15cb3dSCy Schubert }
35*2b15cb3dSCy Schubert
36*2b15cb3dSCy Schubert
37*2b15cb3dSCy Schubert /*
38*2b15cb3dSCy Schubert * ntpOptionPrintVersion() replaces the stock optionPrintVersion() via
39*2b15cb3dSCy Schubert * version-proc = ntpOptionPrintVersion; in copyright.def. It differs
40*2b15cb3dSCy Schubert * from the stock function by displaying the complete version string,
41*2b15cb3dSCy Schubert * including compile time which was unknown when Autogen ran.
42*2b15cb3dSCy Schubert *
43*2b15cb3dSCy Schubert * Like optionPrintVersion() this function must exit(0) rather than
44*2b15cb3dSCy Schubert * return.
45*2b15cb3dSCy Schubert */
46*2b15cb3dSCy Schubert void
ntpOptionPrintVersion(tOptions * pOpts,tOptDesc * pOD)47*2b15cb3dSCy Schubert ntpOptionPrintVersion(
48*2b15cb3dSCy Schubert tOptions * pOpts,
49*2b15cb3dSCy Schubert tOptDesc * pOD
50*2b15cb3dSCy Schubert )
51*2b15cb3dSCy Schubert {
52*2b15cb3dSCy Schubert UNUSED_ARG(pOpts);
53*2b15cb3dSCy Schubert UNUSED_ARG(pOD);
54*2b15cb3dSCy Schubert
55*2b15cb3dSCy Schubert printf("%s\n", Version);
56*2b15cb3dSCy Schubert fflush(stdout);
57*2b15cb3dSCy Schubert exit(EXIT_SUCCESS);
58*2b15cb3dSCy Schubert }
59