commit: ed86b3a7785e5ffdb522229e68bdf683b4c672c6
parent 2b5177fa20637891eeca9aa969e33ca45e5dceb9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 5 Dec 2024 16:41:00 +0100
cmd/touch: add ignore for -f option
Diffstat:
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/cmd/touch.1.in b/cmd/touch.1.in
@@ -9,7 +9,7 @@
.Nd change file access and modification times
.Sh SYNOPSIS
.Nm
-.Op Fl achm
+.Op Fl acfhm
.Op Fl d Ar isotime | Fl t Ar datetime | Fl r Ar ref_file
.Ar file...
.Sh DESCRIPTION
@@ -25,8 +25,20 @@ is also given.
.It Fl c
Do not create
.Ar file .
+.It Fl f
+Ignored.
+coreutils and BusyBox never supported it,
+.Ox
+removed it in 2005,
+.Nx
+in 2011,
+.Fx
+in 2012.
+.\" Let's not publicly document too much that illumos still supports it
.It Fl d Ar isotime
include(lib/iso_parse.mdoc)
+.It Fl c
+Ignored.
.It Fl h
Do not follow symlinks.
.It Fl m
@@ -73,6 +85,8 @@ IEEE Std 1003.1-2024 (“POSIX.1”)
specification.
.Pp
.Fl h
-is an extension.
+and
+.Fl f
+are extensions.
.Sh AUTHORS
.An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me
diff --git a/cmd/touch.c b/cmd/touch.c
@@ -125,7 +125,7 @@ main(int argc, char *argv[])
int utimensat_flags = 0;
int c = 0;
- while((c = getopt(argc, argv, ":achmr:t:d:")) != -1)
+ while((c = getopt(argc, argv, ":acfhmr:t:d:")) != -1)
{
const char *errstr = NULL;
@@ -137,6 +137,19 @@ main(int argc, char *argv[])
case 'c':
FIELD_CLR(open_flags, O_CREAT);
break;
+ case 'f':
+ /* Legacy from BSD, ignored
+ *
+ * As of 2024-12-05:
+ *
+ * coreutils: Ignored since first commit in 1992
+ * OpenBSD: Ignored since OpenBSD 3.8 (commit in 2005)
+ * NetBSD: Ignored since NetBSD 6.0 (commit in 2011)
+ * FreeBSD: Ignored since FreeBSD 10 (commit in 2012)
+ * BusyBox: Ignored (and not documented)
+ * illumos: Ignored in SystemV emulation, supported otherwise
+ */
+ break;
case 'h':
FIELD_SET(open_flags, O_NOFOLLOW);
FIELD_SET(utimensat_flags, AT_SYMLINK_NOFOLLOW);