summaryrefslogtreecommitdiff
path: root/sntp/libopts
diff options
context:
space:
mode:
Diffstat (limited to 'sntp/libopts')
-rw-r--r--sntp/libopts/Makefile.in14
-rw-r--r--sntp/libopts/autoopts.h4
-rw-r--r--sntp/libopts/autoopts/options.h10
-rw-r--r--sntp/libopts/configfile.c12
-rw-r--r--sntp/libopts/enum.c8
-rw-r--r--sntp/libopts/file.c4
-rw-r--r--sntp/libopts/find.c4
-rw-r--r--sntp/libopts/init.c13
-rw-r--r--sntp/libopts/load.c2
-rw-r--r--sntp/libopts/m4/libopts.m424
-rw-r--r--sntp/libopts/makeshell.c16
-rw-r--r--sntp/libopts/nested.c14
-rw-r--r--sntp/libopts/numeric.c2
-rw-r--r--sntp/libopts/parse-duration.c4
-rw-r--r--sntp/libopts/pgusage.c2
-rw-r--r--sntp/libopts/reset.c2
-rw-r--r--sntp/libopts/save.c20
-rw-r--r--sntp/libopts/tokenize.c2
-rw-r--r--sntp/libopts/usage.c4
19 files changed, 86 insertions, 75 deletions
diff --git a/sntp/libopts/Makefile.in b/sntp/libopts/Makefile.in
index 111bc0f..feb2e0f 100644
--- a/sntp/libopts/Makefile.in
+++ b/sntp/libopts/Makefile.in
@@ -39,8 +39,6 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
- $(top_srcdir)/libevent/m4/openldap-thread-check.m4 \
- $(top_srcdir)/libevent/m4/openldap.m4 \
$(top_srcdir)/m4/hms_search_lib.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
@@ -60,8 +58,10 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_prog_cc.m4 $(top_srcdir)/m4/ntp_sntp.m4 \
$(top_srcdir)/m4/ntp_sysexits.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
- $(top_srcdir)/m4/os_cflags.m4 $(top_srcdir)/m4/snprintf.m4 \
- $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
+ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -187,6 +187,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
LDFLAGS_NTP = @LDFLAGS_NTP@
@@ -302,6 +303,11 @@ TIMETRIM_DL = @TIMETRIM_DL@
TIMETRIM_DS = @TIMETRIM_DS@
TIMETRIM_MS = @TIMETRIM_MS@
TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
VERSION = @VERSION@
VER_SUFFIX = @VER_SUFFIX@
abs_builddir = @abs_builddir@
diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h
index ac0a199..6987958 100644
--- a/sntp/libopts/autoopts.h
+++ b/sntp/libopts/autoopts.h
@@ -258,7 +258,7 @@ typedef struct {
#define AGALOC(c, w) ao_malloc((size_t)c)
#define AGREALOC(p, c, w) ao_realloc((void*)p, (size_t)c)
-#define AGFREE(_p) free((void *)_p)
+#define AGFREE(p) free((void *)(intptr_t)p)
#define AGDUPSTR(p, s, w) (p = ao_strdup(s))
static void *
@@ -452,7 +452,7 @@ typedef enum { AOFLAG_TABLE } ao_flags_t;
#undef _aof_
static char const zNil[] = "";
-static arg_types_t argTypes = { NULL };
+static arg_types_t argTypes = { 0 };
static char line_fmt_buf[32];
static bool displayEnum = false;
static char const pkgdatadir_default[] = PKGDATADIR;
diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h
index 0d6f2c3..32397eb 100644
--- a/sntp/libopts/autoopts/options.h
+++ b/sntp/libopts/autoopts/options.h
@@ -600,9 +600,17 @@ struct options {
char * pzCurOpt; ///< current option text
/// Public, the full path of the program
+#if AUTOOPTS_INTERNAL
+ char const * pzProgPath;
+#else
char const * const pzProgPath;
+#endif
/// Public, the name of the executable, without any path
+#if AUTOOPTS_INTERNAL
+ char const * pzProgName;
+#else
char const * const pzProgName;
+#endif
/// Public, the upper-cased, shell variable syntax-ed program name
char const * const pzPROGNAME;
/// the name of the "rc file" (configuration file)
@@ -1222,7 +1230,7 @@ extern void optionResetOpt(tOptions*, tOptDesc*);
extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int);
-extern void optionShowRange(tOptions*, tOptDesc*, void *, int);
+extern void optionShowRange(tOptions*, tOptDesc*, const void *, int);
extern void optionStackArg(tOptions*, tOptDesc*);
diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c
index d4bc4fe..0409446 100644
--- a/sntp/libopts/configfile.c
+++ b/sntp/libopts/configfile.c
@@ -184,7 +184,7 @@ optionFindValue(const tOptDesc * odesc, char const * name, char const * val)
else do {
tArgList* argl = odesc->optCookie;
int argct = argl->useCt;
- void ** poptv = (void**)(argl->apzArgs);
+ void ** poptv = (void**)(intptr_t)(argl->apzArgs);
if (argct == 0) {
errno = ENOENT;
@@ -266,7 +266,7 @@ optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
else do {
tArgList* argl = odesc->optCookie;
int ct = argl->useCt;
- void** poptv = (void**)argl->apzArgs;
+ void** poptv = (void**)(intptr_t)argl->apzArgs;
while (--ct >= 0) {
tOptionValue* pOV = *(poptv++);
@@ -326,7 +326,7 @@ optionGetValue(tOptionValue const * oov, char const * vname)
if (arg_list->useCt > 0) {
int ct = arg_list->useCt;
- void ** ovlist = (void**)(arg_list->apzArgs);
+ void ** ovlist = (void**)(intptr_t)(arg_list->apzArgs);
if (vname == NULL) {
res = (tOptionValue*)*ovlist;
@@ -385,7 +385,7 @@ optionNextValue(tOptionValue const * ov_list,tOptionValue const * oov )
arg_list = ov_list->v.nestVal;
{
int ct = arg_list->useCt;
- void ** o_list = (void**)(arg_list->apzArgs);
+ void ** o_list = (void**)(intptr_t)(arg_list->apzArgs);
while (ct-- > 0) {
tOptionValue * nov = *(o_list++);
@@ -931,7 +931,7 @@ handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir)
switch (*txt) {
case ' ':
case '\t':
- txt = (void *)parse_attrs(
+ txt = (void *)(intptr_t)parse_attrs(
opts, SPN_WHITESPACE_CHARS(txt), &mode, &valu);
if (txt == NULL)
return txt;
@@ -1138,7 +1138,7 @@ optionFileLoad(tOptions * opts, char const * prog)
*/
{
char const ** pp =
- (char const **)(void *)&(opts->pzProgName);
+ (char const **)(void *)(intptr_t)&(opts->pzProgName);
*pp = prog;
}
diff --git a/sntp/libopts/enum.c b/sntp/libopts/enum.c
index 299ffb1..e759e8c 100644
--- a/sntp/libopts/enum.c
+++ b/sntp/libopts/enum.c
@@ -189,11 +189,11 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
* The result gets stashed in a char* pointer.
*/
uintptr_t res = name_ct;
- size_t len = strlen((char*)name);
+ size_t len = strlen((const char*)name);
uintptr_t idx;
if (IS_DEC_DIGIT_CHAR(*name)) {
- char * pz = (char *)(void *)name;
+ char * pz = (char *)(void *)(intptr_t)name;
unsigned long val = strtoul(pz, &pz, 0);
if ((*pz == NUL) && (val < name_ct))
return (uintptr_t)val;
@@ -215,7 +215,7 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
* Multiple partial matches means we have an ambiguous match.
*/
for (idx = 0; idx < name_ct; idx++) {
- if (strncmp((char*)paz_names[idx], (char*)name, len) == 0) {
+ if (strncmp((char*)(intptr_t)paz_names[idx], (char*)(intptr_t)name, len) == 0) {
if (paz_names[idx][len] == NUL)
return idx; /* full match */
@@ -521,7 +521,7 @@ optionMemberList(tOptDesc * od)
uintptr_t sv = od->optArg.argIntptr;
char * res;
(*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
- res = (void *)od->optArg.argString;
+ res = (void *)(intptr_t)od->optArg.argString;
od->optArg.argIntptr = sv;
return res;
}
diff --git a/sntp/libopts/file.c b/sntp/libopts/file.c
index ec740c5..d5fdb4a 100644
--- a/sntp/libopts/file.c
+++ b/sntp/libopts/file.c
@@ -107,7 +107,7 @@ open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
/* NOTREACHED */
if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
- pOD->optCookie = (void *)pOD->optArg.argString;
+ pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
else
AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
@@ -131,7 +131,7 @@ fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
/* NOTREACHED */
if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
- pOD->optCookie = (void *)pOD->optArg.argString;
+ pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
else
AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
diff --git a/sntp/libopts/find.c b/sntp/libopts/find.c
index 1ec02e5..8d47896 100644
--- a/sntp/libopts/find.c
+++ b/sntp/libopts/find.c
@@ -80,7 +80,7 @@ parse_opt(char const ** nm_pp, char ** arg_pp, char * buf, size_t bufsz)
buf[res] = NUL;
*nm_pp = buf;
- *arg_pp = (char *)p;
+ *arg_pp = (char *)(intptr_t)p;
return res;
default:
@@ -711,7 +711,7 @@ find_opt(tOptions * opts, tOptState * o_st)
* strip off the "const" quality of the "default_opt" field.
*/
while (*(++pz) == '-') ;
- def_opt = (void *)&(opts->specOptIdx.default_opt);
+ def_opt = (void *)(intptr_t)&(opts->specOptIdx.default_opt);
def = *def_opt;
*def_opt = NO_EQUIVALENT;
res = opt_find_long(opts, pz, o_st);
diff --git a/sntp/libopts/init.c b/sntp/libopts/init.c
index e038ed7..9374528 100644
--- a/sntp/libopts/init.c
+++ b/sntp/libopts/init.c
@@ -101,20 +101,17 @@ validate_struct(tOptions * opts, char const * pname)
*/
if (opts->pzProgName == NULL) {
char const * pz = strrchr(pname, DIRCH);
- char const ** pp =
- (char const **)(void **)&(opts->pzProgName);
if (pz != NULL)
- *pp = pz+1;
+ opts->pzProgName = pz+1;
else
- *pp = pname;
+ opts->pzProgName = pname;
- pz = pathfind(getenv("PATH"), (char *)pname, "rx");
+ pz = pathfind(getenv("PATH"), (char *)(intptr_t)pname, "rx");
if (pz != NULL)
- pname = (void *)pz;
+ pname = (void *)(intptr_t)pz;
- pp = (char const **)(void **)&(opts->pzProgPath);
- *pp = pname;
+ opts->pzProgPath = pname;
/*
* when comparing long names, these are equivalent
diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c
index 5c29d96..0654492 100644
--- a/sntp/libopts/load.c
+++ b/sntp/libopts/load.c
@@ -225,7 +225,7 @@ add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path)
if (strchr(prg_path, DIRCH) != NULL)
path = prg_path;
else {
- path = pathfind(getenv("PATH"), (char*)prg_path, "rx");
+ path = pathfind(getenv("PATH"), (char*)(intptr_t)prg_path, "rx");
if (path == NULL)
return false;
diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4
index 4a4ca18..352098b 100644
--- a/sntp/libopts/m4/libopts.m4
+++ b/sntp/libopts/m4/libopts.m4
@@ -216,7 +216,7 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
LIBREGEX_LIBS=""
AC_MSG_CHECKING([whether libregex functions properly])
AC_CACHE_VAL([libopts_cv_with_libregex],[
- AC_RUN_IFELSE([@%:@include <stdio.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
@%:@include <stdlib.h>
@%:@include <sys/types.h>
@%:@include REGEX_HEADER
@@ -235,7 +235,7 @@ int main() {
fputs( "error: regex -->.<-- did not match\n", stderr );
return 1;
}
- return 0; }],
+ return 0; }])],
[libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
[libopts_cv_with_libregex=no]) # end of AC_RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
@@ -260,12 +260,12 @@ libopts_cv_with_libregex=no
AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
AC_MSG_CHECKING([whether pathfind(3) works])
AC_CACHE_VAL([libopts_cv_run_pathfind],[
- AC_RUN_IFELSE([@%:@include <string.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <string.h>
@%:@include <stdlib.h>
int main (int argc, char** argv) {
char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
return (pz == 0) ? 1 : 0;
-}],
+}])],
[libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
@@ -303,7 +303,7 @@ echo ${dzero}`
AC_DEFUN([LIBOPTS_RUN_REALPATH],[
AC_MSG_CHECKING([whether we have a functional realpath(3C)])
AC_CACHE_VAL([libopts_cv_run_realpath],[
- AC_RUN_IFELSE([@%:@include <limits.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <limits.h>
@%:@include <stdlib.h>
int main (int argc, char** argv) {
@%:@ifndef PATH_MAX
@@ -313,7 +313,7 @@ choke me!!
@%:@endif
char *pz = realpath(argv@<:@0@:>@, zPath);
return (pz == zPath) ? 0 : 1;
-}],
+}])],
[libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
@@ -330,7 +330,7 @@ choke me!!
AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
AC_MSG_CHECKING([whether strftime() works])
AC_CACHE_VAL([libopts_cv_run_strftime],[
- AC_RUN_IFELSE([@%:@include <time.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <time.h>
@%:@include <string.h>
char t_buf@<:@ 64 @:>@;
int main() {
@@ -346,7 +346,7 @@ int main() {
tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
tm.tm_isdst = 1; /* flag for daylight savings time */
strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
- return (strcmp( t_buf, z ) != 0); }],
+ return (strcmp( t_buf, z ) != 0); }])],
[libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
@@ -363,10 +363,10 @@ int main() {
AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
AC_MSG_CHECKING([whether fopen accepts "b" mode])
AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
- AC_RUN_IFELSE([@%:@include <stdio.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
int main (int argc, char** argv) {
FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
-return (fp == NULL) ? 1 : fclose(fp); }],
+return (fp == NULL) ? 1 : fclose(fp); }])],
[libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
@@ -386,10 +386,10 @@ return (fp == NULL) ? 1 : fclose(fp); }],
AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
AC_MSG_CHECKING([whether fopen accepts "t" mode])
AC_CACHE_VAL([libopts_cv_run_fopen_text],[
- AC_RUN_IFELSE([@%:@include <stdio.h>
+ AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
int main (int argc, char** argv) {
FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
-return (fp == NULL) ? 1 : fclose(fp); }],
+return (fp == NULL) ? 1 : fclose(fp); }])],
[libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c
index a0bfcac..baef8fc 100644
--- a/sntp/libopts/makeshell.c
+++ b/sntp/libopts/makeshell.c
@@ -396,13 +396,13 @@ emit_usage(tOptions * opts)
/* Copy the program name into the time/name buffer */
for (;;) {
- if ((*pzPN++ = (char)tolower(*pz++)) == NUL)
+ if ((*pzPN++ = (char)tolower((unsigned char)*pz++)) == NUL)
break;
}
- pp = (char **)(void *)&(opts->pzProgPath);
+ pp = (char **)(void *)(intptr_t)&(opts->pzProgPath);
*pp = tm_nm_buf;
- pp = (char **)(void *)&(opts->pzProgName);
+ pp = (char **)(void *)(intptr_t)&(opts->pzProgName);
*pp = tm_nm_buf;
}
@@ -653,7 +653,7 @@ emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts)
* They must not be the same. They cannot be, because it would
* not compile correctly if they were.
*/
- while (toupper(od->pz_Name[match_ct]) == toupper(name[match_ct]))
+ while (toupper((unsigned char)od->pz_Name[match_ct]) == toupper((unsigned char)name[match_ct]))
match_ct++;
if (match_ct > min_match_ct)
@@ -666,8 +666,8 @@ emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts)
continue;
match_ct = 0;
- while ( toupper(od->pz_DisableName[match_ct])
- == toupper(name[match_ct]))
+ while ( toupper((unsigned char)od->pz_DisableName[match_ct])
+ == toupper((unsigned char)name[match_ct]))
match_ct++;
if (match_ct > min_match_ct)
min_match_ct = match_ct;
@@ -901,11 +901,11 @@ genshelloptUsage(tOptions * opts, int exit_cd)
*/
{
char * pz;
- char ** pp = (char **)(void *)&(optionParseShellOptions->pzProgName);
+ char ** pp = (char **)(void *)(intptr_t)&(optionParseShellOptions->pzProgName);
AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "prog name");
*pp = pz;
while (*pz != NUL) {
- *pz = (char)tolower(*pz);
+ *pz = (char)tolower((unsigned char)*pz);
pz++;
}
}
diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c
index 0ec8f08..96e4553 100644
--- a/sntp/libopts/nested.c
+++ b/sntp/libopts/nested.c
@@ -645,7 +645,7 @@ unload_arg_list(tArgList * arg_list)
char const ** pnew_val = arg_list->apzArgs;
while (ct-- > 0) {
- tOptionValue* new_val = (tOptionValue*)(void*)*(pnew_val++);
+ tOptionValue* new_val = (tOptionValue*)(void*)(intptr_t)*(pnew_val++);
if (new_val->valType == OPARG_TYPE_HIERARCHY)
unload_arg_list(new_val->v.nestVal);
AGFREE(new_val);
@@ -675,7 +675,7 @@ optionUnloadNested(tOptionValue const * opt_val)
unload_arg_list(opt_val->v.nestVal);
- AGFREE((void*)opt_val);
+ AGFREE((void*)(intptr_t)opt_val);
}
/**
@@ -694,8 +694,8 @@ sort_list(tArgList * arg_list)
*/
for (ix = 0; ++ix < lm;) {
int iy = ix-1;
- tOptionValue * new_v = C(tOptionValue *, arg_list->apzArgs[ix]);
- tOptionValue * old_v = C(tOptionValue *, arg_list->apzArgs[iy]);
+ tOptionValue * new_v = C(tOptionValue *, (intptr_t)arg_list->apzArgs[ix]);
+ tOptionValue * old_v = C(tOptionValue *, (intptr_t)arg_list->apzArgs[iy]);
/*
* For as long as the new entry precedes the "old" entry,
@@ -704,7 +704,7 @@ sort_list(tArgList * arg_list)
*/
while (strcmp(old_v->pzName, new_v->pzName) > 0) {
arg_list->apzArgs[iy+1] = (void*)old_v;
- old_v = (tOptionValue*)(void*)(arg_list->apzArgs[--iy]);
+ old_v = (tOptionValue*)(void*)(intptr_t)(arg_list->apzArgs[--iy]);
if (iy < 0)
break;
}
@@ -837,7 +837,7 @@ optionNestedVal(tOptions * opts, tOptDesc * od)
av = arg_list->apzArgs;
while (--ct >= 0) {
- void * p = (void *)*(av++);
+ void * p = (void *)(intptr_t)*(av++);
optionUnloadNested((tOptionValue const *)p);
}
@@ -872,7 +872,7 @@ get_special_char(char const ** ppz, int * ct)
base = 16;
pz++;
}
- retch = (int)strtoul(pz, (char **)&pz, base);
+ retch = (int)strtoul(pz, (char **)(intptr_t)&pz, base);
if (*pz != ';')
return '&';
base = (int)(++pz - *ppz);
diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c
index 9baba65..471cb93 100644
--- a/sntp/libopts/numeric.c
+++ b/sntp/libopts/numeric.c
@@ -42,7 +42,7 @@
* Show information about a numeric option with range constraints.
=*/
void
-optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
+optionShowRange(tOptions * pOpts, tOptDesc * pOD, const void * rng_table, int rng_ct)
{
const struct {long const rmin, rmax;} * rng = rng_table;
diff --git a/sntp/libopts/parse-duration.c b/sntp/libopts/parse-duration.c
index ff3fe42..2536a06 100644
--- a/sntp/libopts/parse-duration.c
+++ b/sntp/libopts/parse-duration.c
@@ -60,14 +60,14 @@ typedef enum {
static unsigned long
str_const_to_ul (cch_t * str, cch_t ** ppz, int base)
{
- return strtoul (str, (char **)ppz, base);
+ return strtoul (str, (char **)(intptr_t)ppz, base);
}
/* Wrapper around strtol that does not require a cast. */
static long
str_const_to_l (cch_t * str, cch_t ** ppz, int base)
{
- return strtol (str, (char **)ppz, base);
+ return strtol (str, (char **)(intptr_t)ppz, base);
}
/* Returns BASE + VAL * SCALE, interpreting BASE = BAD_TIME
diff --git a/sntp/libopts/pgusage.c b/sntp/libopts/pgusage.c
index 80a89a7..a385b4d 100644
--- a/sntp/libopts/pgusage.c
+++ b/sntp/libopts/pgusage.c
@@ -88,7 +88,7 @@ mk_pager_cmd(char const * fname)
bfsz = strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN;
res = AGALOC(bfsz, "more cmd");
snprintf(res, bfsz, PAGE_USAGE_FMT, pager, fname);
- AGFREE((void*)fname);
+ AGFREE((void*)(intptr_t)fname);
return res;
}
}
diff --git a/sntp/libopts/reset.c b/sntp/libopts/reset.c
index df81cd7..1e959a1 100644
--- a/sntp/libopts/reset.c
+++ b/sntp/libopts/reset.c
@@ -113,7 +113,7 @@ optionResetOpt(tOptions * pOpts, tOptDesc * pOD)
assert(0 == 1);
}
} else {
- succ = opt_find_long(pOpts, (char *)pzArg, &opt_state);
+ succ = opt_find_long(pOpts, (char *)(intptr_t)pzArg, &opt_state);
if (! SUCCESSFUL(succ)) {
fprintf(stderr, zIllOptStr, pOpts->pzProgPath, pzArg);
pOpts->pUsageProc(pOpts, EXIT_FAILURE);
diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c
index 19c4c5b..dd51d60 100644
--- a/sntp/libopts/save.c
+++ b/sntp/libopts/save.c
@@ -183,7 +183,7 @@ find_file_name(tOptions * opts, int * p_free_name)
fprintf(stderr, zsave_warn, opts->pzProgName);
fprintf(stderr, zNoStat, errno, strerror(errno), pzDir);
if (free_dir_name)
- AGFREE((void*)pzDir);
+ AGFREE(pzDir);
return NULL;
}
@@ -223,7 +223,7 @@ find_file_name(tOptions * opts, int * p_free_name)
sprintf(pzPath, "%s/%s", pzDir, opts->pzRcName);
#endif
if (free_dir_name)
- AGFREE((void*)pzDir);
+ AGFREE(pzDir);
pzDir = pzPath;
free_dir_name = 1;
}
@@ -237,7 +237,7 @@ find_file_name(tOptions * opts, int * p_free_name)
fprintf(stderr, zsave_warn, opts->pzProgName);
fprintf(stderr, zNoStat, errno, strerror(errno),
pzDir);
- AGFREE((void*)pzDir);
+ AGFREE(pzDir);
return NULL;
}
@@ -255,7 +255,7 @@ find_file_name(tOptions * opts, int * p_free_name)
if (! S_ISREG(stBuf.st_mode)) {
fprintf(stderr, zsave_warn, opts->pzProgName, pzDir);
if (free_dir_name)
- AGFREE((void*)pzDir);
+ AGFREE(pzDir);
return NULL;
}
@@ -377,7 +377,7 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
/*
* set membership strings get allocated
*/
- AGFREE((void*)pOD->optArg.argString);
+ AGFREE(pOD->optArg.argString);
}
}
@@ -453,7 +453,7 @@ prt_val_list(FILE * fp, char const * name, tArgList * al)
if (al == NULL)
return;
opt_ct = al->useCt;
- opt_list = (void **)al->apzArgs;
+ opt_list = (void **)(intptr_t)al->apzArgs;
if (opt_ct <= 0) {
fprintf(fp, OPEN_CLOSE_FMT, name);
@@ -488,7 +488,7 @@ prt_nested(FILE * fp, tOptDesc * p)
return;
opt_ct = al->useCt;
- opt_list = (void **)al->apzArgs;
+ opt_list = (void **)(intptr_t)al->apzArgs;
if (opt_ct <= 0)
return;
@@ -534,12 +534,12 @@ open_sv_file(tOptions * opts)
fprintf(stderr, zsave_warn, opts->pzProgName);
fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName);
if (free_name)
- AGFREE((void*) pzFName );
+ AGFREE(pzFName);
return fp;
}
if (free_name)
- AGFREE((void*)pzFName);
+ AGFREE(pzFName);
}
fputs("# ", fp);
@@ -629,7 +629,7 @@ prt_enum_arg(FILE * fp, tOptDesc * od)
* bit flag values back into a string suitable for printing.
*/
(*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
- prt_entry(fp, od, (void*)(od->optArg.argString));
+ prt_entry(fp, od, (void*)(intptr_t)(od->optArg.argString));
od->optArg.argEnum = val;
}
diff --git a/sntp/libopts/tokenize.c b/sntp/libopts/tokenize.c
index 34abf83..a0db4cb 100644
--- a/sntp/libopts/tokenize.c
+++ b/sntp/libopts/tokenize.c
@@ -57,7 +57,7 @@ copy_cooked(ch_t** ppDest, char const ** ppSrc)
case NUL: *ppSrc = NULL; return;
case '"': goto done;
case '\\':
- pSrc += ao_string_cook_escape_char((char*)pSrc, (char*)&ch, 0x7F);
+ pSrc += ao_string_cook_escape_char((char*)(intptr_t)pSrc, (char*)(intptr_t)&ch, 0x7F);
if (ch == 0x7F)
break;
/* FALLTHROUGH */
diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c
index 206235d..bb33b35 100644
--- a/sntp/libopts/usage.c
+++ b/sntp/libopts/usage.c
@@ -435,7 +435,7 @@ print_one_paragraph(char const * text, bool plain, FILE * fp)
else {
char const * t = optionQuoteString(text, LINE_SPLICE);
fprintf(fp, PUTS_FMT, t);
- AGFREE((void *)t);
+ AGFREE(t);
}
}
@@ -546,7 +546,7 @@ optionPrintParagraphs(char const * text, bool plain, FILE * fp)
buf = scan;
}
}
- AGFREE((void *)text);
+ AGFREE(text);
}
/*=export_func optionUsage