Coverage Report

Created: 2023-05-19 06:16

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