From 3b245881a4e76f12046dddfadfee14c99973fa23 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 21 Mar 2022 18:48:29 -0400 Subject: README, build: Generate list of formats --- diff --git a/Makefile.am b/Makefile.am index a82029d..0048520 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,7 +59,7 @@ bin_PROGRAMS = @ EXTRA_@_DEPENDENCIES = version.c CLEANFILES = version.c CONFIG_CLEAN_FILES = -EXTRA_DIST = autogen.sh +EXTRA_DIST = autogen.sh FORMATS V_REDIR = $(V_REDIR_$(V)) V_REDIR_ = $(V_REDIR_$(AM_DEFAULT_VERBOSITY)) @@ -84,6 +84,23 @@ if IN_GIT 1>>'$(distdir)/ChangeLog~' mv '$(distdir)/ChangeLog~' '$(distdir)/ChangeLog' endif +if ENABLE_TESTS +if CROSS_COMPILING + if ! [ -f 'FORMATS' ]; then \ + printf 'Error: "FORMATS" file cannot be generated when %s' \ + 'cross compiling' 1>&2; \ + exit 1; \ + fi +else !CROSS_COMPILING + $(srcdir)/@ -d '1969-12-31 19:00:01' -F 1>FORMATS +endif !CROSS_COMPILING +else !ENABLE_TESTS + if ! [ -f 'FORMATS' ]; then \ + printf 'Error: "FORMATS" file cannot be generated without %s' \ + 'test suite support' 1>&2; \ + exit 1; \ + fi +endif !ENABLE_TESTS release: sed "s/^Released: ????-??-??\$$/Released: $$(date '+%Y-%m-%d')/" \ diff --git a/README b/README index 74ccb04..82796f6 100644 --- a/README +++ b/README @@ -18,79 +18,12 @@ user interaction. Date/Time Formats ----------------- -@ currently supports 705 date/time formats, any one of which may be -specified on the command line in one or more arguments. All spaces -shown below are optional. +@ currently supports 4341 date/time formats, any one of which may be +specified on the command line in one or more arguments. The date may be +omitted or specified before or after the time. -A time may be specified in any of the following eight formats: - - * 7:00:01 PM - * 19:00:01 - * 7:00 PM - * 19:00 - * 70001 PM - * 190001 - * 700 PM - * 1900 - -A date may be omitted or specified (before or after the time) in any of -the following 43 formats: - - * Wed - * 1969-12-31 - * 1969/12/31 - * 12-31-1969 - * 12-31 - * 12/31/1969 - * 12/31 - * 31 Dec 1969 - * 31 Dec - * 31-Dec-1969 - * 31-Dec - * 31/Dec/1969 - * 31/Dec - * Wed 31 Dec 1969 - * Wed 31 Dec - * Wed 31-Dec-1969 - * Wed 31-Dec - * Wed 31/Dec/1969 - * Wed 31/Dec - * Wed, 31 Dec 1969 - * Wed, 31 Dec - * Wed, 31-Dec-1969 - * Wed, 31-Dec - * Wed, 31/Dec/1969 - * Wed, 31/Dec - * Dec 31, 1969 - * Dec 31 - * Dec-31-1969 - * Dec-31 - * Dec/31/1969 - * Dec/31 - * Wed Dec 31, 1969 - * Wed Dec 31 - * Wed Dec-31-1969 - * Wed Dec-31 - * Wed Dec/31/1969 - * Wed Dec/31 - * Wed, Dec 31, 1969 - * Wed, Dec 31 - * Wed, Dec-31-1969 - * Wed, Dec-31 - * Wed, Dec/31/1969 - * Wed, Dec/31 - -Additionally, the following nine date/time formats are supported: - - * 1969-12-31T19:00:01 - * 1969-12-31T19:00 - * 19691231T190001 - * 19691231T1900 - * 19691231 70001 PM - * 19691231 190001 - * 19691231 700 PM - * 19691231 1900 - * Wed Dec 31 19:00:01 1969 +See the `FORMATS` file for a list of supported formats. All spaces +shown are optional. Development ----------- diff --git a/TODO b/TODO index 80653a8..66697c8 100644 --- a/TODO +++ b/TODO @@ -3,6 +3,5 @@ spaces between specifiers in strptime() formats -- strftime()? parsing: copy format one char at a time, changing placeholder to space test with other libc's (newlib? musl? fbsd? obsd?) `./@ 7:00 PM` doesn't work with musl strptime() -update formats in README (or move to another file?) test other times gettext? diff --git a/configure.ac b/configure.ac index bd957da..cb1f0ce 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,8 @@ AM_CONDITIONAL([IN_GIT], AM_CONDITIONAL([OUT_OF_TREE], [test x"${srcdir}" != x'.' ]) +AM_CONDITIONAL([CROSS_COMPILING], [! test x"${build_alias}" = x"${host_alias}"]) + save_CFLAGS="${CFLAGS-}" AC_PROG_CC() AM_PROG_CC_C_O() -- cgit v0.9.1