Files
lgcosta d3925f1521 Modernize the build system so it builds on current toolchains
The autotools setup could not bootstrap with modern autoconf/libtool:
`autoreconf -fi` failed with "possibly undefined macro: AC_PROG_LIBTOOL",
and several other macros used here were removed or deprecated long ago.

configure.ac:
  - AC_PROG_LIBTOOL -> LT_INIT (with AC_CONFIG_MACRO_DIRS/AC_CONFIG_AUX_DIR);
    add AM_PROG_AR required by newer libtool/automake.
  - AM_CONFIG_HEADER -> AC_CONFIG_HEADERS; AC_OUTPUT(files...) -> AC_OUTPUT
    with an explicit AC_CONFIG_FILES list.
  - AC_TRY_COMPILE -> AC_COMPILE_IFELSE; drop AC_HEADER_STDC,
    AC_PROG_GCC_TRADITIONAL, AC_STRUCT_ST_RDEV, AC_C_CONST and AC_C_INLINE
    (all obsolete or unconditionally available).
  - Drop AC_FUNC_MEMCMP/STRFTIME/VPRINTF; the corresponding HAVE_* macros
    were never referenced. Keep the register_printf_* check but test the
    ac_cv_func_* names that AC_CHECK_FUNCS actually sets.
  - Pin -std=gnu11 (the sources predate C99 and rely on implicit-int-era
    behaviour that newer C standards reject) and fix the -Wuninitialized
    probe, which never set its cache variable.
  - off_t/blkcnt_t sizeof fallbacks 64 -> 8 (bytes, not bits).

reiserfscore.pc.in: substitute @PACKAGE_VERSION@; REISERFSPROGS_VERSION was
never defined, so the generated .pc always carried an empty Version.

lib/parse_time.c: define _GNU_SOURCE, not _XOPEN_SOURCE. The valueless
_XOPEN_SOURCE disables _DEFAULT_SOURCE, which hides loff_t in <sys/types.h>
and broke the build. Every other translation unit already uses _GNU_SOURCE.

reiserfscore/xattr.c: drop the unused <sys/acl.h> include; no libacl symbol
is used (the reiserfs_acl_* structs come from reiserfs_fs.h), and the header
is not a declared build dependency.

Add autogen.sh to regenerate the build system after a fresh clone, and
update .gitignore for the build-aux/m4 layout and generated artifacts.

Verified: ./autogen.sh && ./configure && make completes on gcc 16 /
automake 1.18 / autoconf 2.72. mkreiserfs, reiserfsck --check,
debugreiserfs -S and reiserfstune all run against a freshly formatted
64 MiB image.
2026-11-11 21:29:42 -03:00

39 lines
864 B
C

#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "parse_time.h"
#include "misc.h"
#include "reiserfs_lib.h"
#include <time.h>
#include <stdio.h>
#include <string.h>
time_t parse_time(char *str)
{
struct tm ts;
if (strcmp(str, "now") == 0) {
return (time(NULL));
}
memset(&ts, 0, sizeof(ts));
#ifdef HAVE_STRPTIME
strptime(str, "%Y%m%d%H%M%S", &ts);
#else
sscanf(str, "%4d%2d%2d%2d%2d%2d", &ts.tm_year, &ts.tm_mon,
&ts.tm_mday, &ts.tm_hour, &ts.tm_min, &ts.tm_sec);
ts.tm_year -= 1900;
ts.tm_mon -= 1;
if (ts.tm_year < 0 || ts.tm_mon < 0 || ts.tm_mon > 11 ||
ts.tm_mday < 0 || ts.tm_mday > 31 || ts.tm_hour > 23 ||
ts.tm_min > 59 || ts.tm_sec > 61)
ts.tm_mday = 0;
#endif
if (ts.tm_mday == 0)
reiserfs_warning(stderr, "Couldn't parse date/time "
"specifier: %s", str);
return (mktime(&ts));
}