1d54cfbdroberto/*
2d54cfbdroberto * ntp_libopts.c
3d54cfbdroberto *
4d54cfbdroberto * Common code interfacing with Autogen's libopts command-line option
5d54cfbdroberto * processing.
6d54cfbdroberto */
7d54cfbdroberto#ifdef HAVE_CONFIG_H
8d54cfbdroberto# include <config.h>
9d54cfbdroberto#endif
10d54cfbdroberto
11d54cfbdroberto#include <stdio.h>
12d54cfbdroberto#include <stddef.h>
13d54cfbdroberto#include "ntp_libopts.h"
14d54cfbdroberto#include "ntp_stdlib.h"
15d54cfbdroberto
16d54cfbdrobertoextern const char *Version;	/* version.c for each program */
17d54cfbdroberto
18d54cfbdroberto
19d54cfbdroberto/*
20047f369cy * ntpOptionProcess() was a clone of libopts' optionProcess which
21047f369cy * overrode the --version output, appending detail from version.c
22047f369cy * which was not available at Autogen time.  This is now done via
23047f369cy * AutoOpts' version-proc = override in copyright.def, so this
24047f369cy * routine is a straightforward wrapper of optionProcess().
25d54cfbdroberto */
26d54cfbdrobertoint
27d54cfbdrobertontpOptionProcess(
28d54cfbdroberto	tOptions *	pOpts,
29d54cfbdroberto	int		argc,
30d54cfbdroberto	char **		argv
31d54cfbdroberto	)
32d54cfbdroberto{
33047f369cy	return optionProcess(pOpts, argc, argv);
34047f369cy}
35047f369cy
36d54cfbdroberto
37047f369cy/*
38047f369cy * ntpOptionPrintVersion() replaces the stock optionPrintVersion() via
39047f369cy * version-proc = ntpOptionPrintVersion; in copyright.def.  It differs
40047f369cy * from the stock function by displaying the complete version string,
41047f369cy * including compile time which was unknown when Autogen ran.
42047f369cy *
43047f369cy * Like optionPrintVersion() this function must exit(0) rather than
44047f369cy * return.
45047f369cy */
46047f369cyvoid
47047f369cyntpOptionPrintVersion(
48047f369cy	tOptions *	pOpts,
49047f369cy	tOptDesc *	pOD
50047f369cy	)
51047f369cy{
52047f369cy	UNUSED_ARG(pOpts);
53047f369cy	UNUSED_ARG(pOD);
54d54cfbdroberto
55047f369cy	printf("%s\n", Version);
56047f369cy	fflush(stdout);
57047f369cy	exit(EXIT_SUCCESS);
58d54cfbdroberto}
59