logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: b1ab2e7a54d9c51e57a72b286d355eecb6d7b09c
parent ed9fba8753c688aa8542ea56356ae70eed808670
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 30 Jun 2025 19:06:39 +0200

cmd/{touch,date}.1.in: Put datetime_parse details into a dedicated section

Diffstat:

Mcmd/date.1.in13++++++++-----
Mcmd/touch.1.in17++++++++++++-----
Mlibutils/datetime_parse.mdoc4----
3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/cmd/date.1.in b/cmd/date.1.in @@ -27,7 +27,7 @@ .Sh DESCRIPTION When .Nm -is invoked without arguments it displays the current datetime +is invoked without arguments it displays the current time Otherwise, depending on the options specified, will print the datetime in a user-defined way. .Sh OPTIONS @@ -35,8 +35,9 @@ will print the datetime in a user-defined way. .It Fl d Ar datetime Use .Ar datetime -instead of current datetime. -include(libutils/datetime_parse.mdoc) +instead of current time, see +.Sx DATETIME FORMAT +section for more details. .It Fl f Ar now_format Use .Ar now_format @@ -44,7 +45,7 @@ as the .Xr strptime 3 format string for .Ar now , -which will be used instead of the current datetime. +which will be used instead of the current time. .It Fl I Ar iso_fmt Set the ISO-8601 resolution to format at with setting .Ar iso_fmt @@ -72,7 +73,7 @@ Use UTC (coordinated universal time) instead of the local time. Use .Ar epoch (seconds relative to 1970-01-01 00:00:00 UTC) -instead of current datetime. +instead of current time. .It Fl R Set the default value of .Ar format @@ -111,6 +112,8 @@ with additionally Otherwise defaults to .Ql %c .El +.Sh DATETIME FORMAT +include(libutils/datetime_parse.mdoc) .Sh ENVIRONMENT Look at the manual page of .Xr strftime 3 diff --git a/cmd/touch.1.in b/cmd/touch.1.in @@ -10,13 +10,14 @@ .Sh SYNOPSIS .Nm .Op Fl acfhm -.Op Fl d Ar isotime | Fl t Ar datetime | Fl r Ar ref_file +.Op Fl d Ar datetime | Fl t Ar timestamp | Fl r Ar ref_file .Ar file... .Sh DESCRIPTION .Nm changes the date modification and access times on each .Ar file it is given. +.Sh OPTIONS .Bl -tag -width Ds .It Fl a Change the access time, no changes to modification time unless @@ -35,17 +36,21 @@ in 2011, .Fx in 2012. .\" Let's not publicly document too much that illumos still supports it -.It Fl d Ar isotime -include(libutils/datetime_parse.mdoc) +.It Fl d Ar datetime +Use +.Ar datetime +instead of current time, see +.Sx DATETIME FORMAT +section for more details. .It Fl h Do not follow symlinks. .It Fl m Change the modification time, no changes to access time unless .Fl a is also given. -.It Fl t Ar datetime +.It Fl t Ar timestamp Use the specified -.Ar datetime +.Ar timestamp instead of the current time, with the form .Oo Oo CC Oc Ns YY Oc Ns MMDDhhmm Ns Oo \.SS Oc where: @@ -67,6 +72,8 @@ Use the corresponding times of the file at .Ar ref_file instead of the current time. .El +.Sh DATETIME FORMAT +include(libutils/datetime_parse.mdoc) .Sh EXIT STATUS .Ex -std Note: Will exit with failure when diff --git a/libutils/datetime_parse.mdoc b/libutils/datetime_parse.mdoc @@ -2,10 +2,6 @@ .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> .\" SPDX-License-Identifier: MPL-2.0 .\" -.\" Example: -.\" .Fl d Ar datetime -.\" .so lib/datetime_parse.mdoc -.\" Should be formatted either with a leading @ (at) symbol followed by the Unix timestamp (number of seconds before and after 1970-01-01 00:00:00Z), for example