Add default path for iso8601_leap_table_load()
This commit is contained in:
parent
b7d039a32c
commit
7ba82a2988
2
config
2
config
|
@ -32,5 +32,7 @@
|
||||||
source "scripts/paths"
|
source "scripts/paths"
|
||||||
|
|
||||||
# Project-specific variables below.
|
# Project-specific variables below.
|
||||||
|
[ -z "${DEFAULT_LEAP_TABLE}" ] && DEFAULT_LEAP_TABLE="${SHAREDIR}/libiso8601/leap-table"
|
||||||
|
|
||||||
[ -z "${CC}" ] && CC="gcc"
|
[ -z "${CC}" ] && CC="gcc"
|
||||||
[ -z "${CFLAGS}" ] && CFLAGS="-g -O2 -W -Wall"
|
[ -z "${CFLAGS}" ] && CFLAGS="-g -O2 -W -Wall"
|
||||||
|
|
|
@ -96,6 +96,8 @@ int iso8601_leap_table_load(const char* fname)
|
||||||
int fd, saved_errno, i, new_size, * days = 0;
|
int fd, saved_errno, i, new_size, * days = 0;
|
||||||
char buf[12];
|
char buf[12];
|
||||||
|
|
||||||
|
if(!fname) fname = DEFAULT_LEAP_TABLE;
|
||||||
|
|
||||||
if(stat(fname, &st)) return -1;
|
if(stat(fname, &st)) return -1;
|
||||||
if(st.st_size < 12) {
|
if(st.st_size < 12) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
|
@ -91,17 +91,19 @@ void iso8601_leap_table_set(int* new_table, int new_size) __attribute__((nonnull
|
||||||
|
|
||||||
/*! \brief Load new table of leap seconds from disk.
|
/*! \brief Load new table of leap seconds from disk.
|
||||||
|
|
||||||
\param fname Filename.
|
\param fname Filename. May be 0 for system default.
|
||||||
\retval 0 on success.
|
\retval 0 on success.
|
||||||
\retval -1 on error (and see \a errno).
|
\retval -1 on error (and see \a errno).
|
||||||
|
|
||||||
This function attempts to load a new table of leap seconds from disk, using the filename \a fname.
|
This function attempts to load a new table of leap seconds from disk, using the filename \a fname.
|
||||||
|
If \a fname is not specified, the system default (set at compile time) will be used.
|
||||||
|
|
||||||
If the table is loaded successfully, it will be set with \ref iso8601_leap_table_set(). On any
|
If the table is loaded successfully, it will be set with \ref iso8601_leap_table_set(). On any
|
||||||
error, -1 will be returned, and \a errno will be set appropriately. If \a errno is \c EINVAL, then
|
error, -1 will be returned, and \a errno will be set appropriately. If \a errno is \c EINVAL, then
|
||||||
the file does not contain a valid leap second table.
|
the file does not contain a valid leap second table.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int iso8601_leap_table_load(const char* fname) __attribute__((nonnull));
|
int iso8601_leap_table_load(const char* fname);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ then
|
||||||
libiso8601="obj/${libiso8601_BASE}.so.${SOMAJOR}.${SOMICRO}"
|
libiso8601="obj/${libiso8601_BASE}.so.${SOMAJOR}.${SOMICRO}"
|
||||||
libiso8601_DEP_CFLAGS=""
|
libiso8601_DEP_CFLAGS=""
|
||||||
libiso8601_DEP_LIBS="-lrt"
|
libiso8601_DEP_LIBS="-lrt"
|
||||||
SO_EXTRA="-std=gnu99 -D_GNU_SOURCE ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} -lc"
|
SO_EXTRA="-std=gnu99 -D_GNU_SOURCE -DDEFAULT_LEAP_TABLE=\"${DEFAULT_LEAP_TABLE}\" ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} -lc"
|
||||||
|
|
||||||
echo "Building library ${libiso8601}..."
|
echo "Building library ${libiso8601}..."
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue