2013-12-04 21:33:17 +00:00
|
|
|
/*
|
|
|
|
* ntp_libopts.c
|
|
|
|
*
|
|
|
|
* Common code interfacing with Autogen's libopts command-line option
|
|
|
|
* processing.
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "ntp_libopts.h"
|
|
|
|
#include "ntp_stdlib.h"
|
|
|
|
|
|
|
|
extern const char *Version; /* version.c for each program */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2014-12-20 22:52:39 +00:00
|
|
|
* ntpOptionProcess() was a clone of libopts' optionProcess which
|
|
|
|
* overrode the --version output, appending detail from version.c
|
|
|
|
* which was not available at Autogen time. This is now done via
|
|
|
|
* AutoOpts' version-proc = override in copyright.def, so this
|
|
|
|
* routine is a straightforward wrapper of optionProcess().
|
2013-12-04 21:33:17 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
ntpOptionProcess(
|
|
|
|
tOptions * pOpts,
|
|
|
|
int argc,
|
|
|
|
char ** argv
|
|
|
|
)
|
|
|
|
{
|
2014-12-20 22:52:39 +00:00
|
|
|
return optionProcess(pOpts, argc, argv);
|
|
|
|
}
|
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
|
2014-12-20 22:52:39 +00:00
|
|
|
/*
|
|
|
|
* ntpOptionPrintVersion() replaces the stock optionPrintVersion() via
|
|
|
|
* version-proc = ntpOptionPrintVersion; in copyright.def. It differs
|
|
|
|
* from the stock function by displaying the complete version string,
|
|
|
|
* including compile time which was unknown when Autogen ran.
|
|
|
|
*
|
|
|
|
* Like optionPrintVersion() this function must exit(0) rather than
|
|
|
|
* return.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ntpOptionPrintVersion(
|
|
|
|
tOptions * pOpts,
|
|
|
|
tOptDesc * pOD
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNUSED_ARG(pOpts);
|
|
|
|
UNUSED_ARG(pOD);
|
2013-12-04 21:33:17 +00:00
|
|
|
|
2014-12-20 22:52:39 +00:00
|
|
|
printf("%s\n", Version);
|
|
|
|
fflush(stdout);
|
|
|
|
exit(EXIT_SUCCESS);
|
2013-12-04 21:33:17 +00:00
|
|
|
}
|