FreeBSD Bugzilla – Attachment 230614 Details for
Bug 260871
[patch] touch(1) enhancement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to add "-R" to touch(1)
patch-usr.bin_touch.patch (text/plain), 2.14 KB, created by
Jamie Landeg-Jones
on 2022-01-02 02:15:40 UTC
(
hide
)
Description:
patch to add "-R" to touch(1)
Filename:
MIME Type:
Creator:
Jamie Landeg-Jones
Created:
2022-01-02 02:15:40 UTC
Size:
2.14 KB
patch
obsolete
>--- usr.bin/touch/touch.c.orig 2017-11-20 19:49:47.091844000 +0000 >+++ usr.bin/touch/touch.c 2021-12-20 01:23:24.746087000 +0000 >@@ -62,6 +62,7 @@ > static void stime_arg2(const char *, int, struct timespec *); > static void stime_darg(const char *, struct timespec *); > static void stime_file(const char *, struct timespec *); >+static void lstime_file(const char *, struct timespec *); > static int timeoffset(const char *); > static void usage(const char *); > >@@ -81,7 +82,7 @@ > ts[0].tv_sec = ts[1].tv_sec = 0; > ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW; > >- while ((ch = getopt(argc, argv, "A:acd:fhmr:t:")) != -1) >+ while ((ch = getopt(argc, argv, "A:acd:fhmr:R:t:")) != -1) > switch(ch) { > case 'A': > Aflag = timeoffset(optarg); >@@ -110,6 +111,10 @@ > timeset = 1; > stime_file(optarg, ts); > break; >+ case 'R': >+ timeset = 1; >+ lstime_file(optarg, ts); >+ break; > case 't': > timeset = 1; > stime_arg1(optarg, ts); >@@ -396,10 +401,22 @@ > } > > static void >+lstime_file(const char *fname, struct timespec *tsp) >+{ >+ struct stat sb; >+ >+ if (lstat(fname, &sb)) >+ err(1, "%s", fname); >+ tsp[0] = sb.st_atim; >+ tsp[1] = sb.st_mtim; >+} >+ >+static void > usage(const char *myname) > { > fprintf(stderr, "usage: %s [-A [-][[hh]mm]SS] [-achm] [-r file] " >- "[-t [[CC]YY]MMDDhhmm[.SS]]\n" >+ "[-R file]\n" >+ " [-t [[CC]YY]MMDDhhmm[.SS]]\n" > " [-d YYYY-MM-DDThh:mm:SS[.frac][tz]] " > "file ...\n", myname); > exit(1); > >--- usr.bin/touch/touch.1.orig 2018-06-01 23:34:59.554963000 +0100 >+++ usr.bin/touch/touch.1 2021-12-20 00:57:34.568892000 +0000 >@@ -42,6 +42,7 @@ > .Op Fl A Ar [-][[hh]mm]SS > .Op Fl achm > .Op Fl r Ar file >+.Op Fl R Ar file > .Op Fl t Ar [[CC]YY]MMDDhhmm[.SS] > .Op Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][tz] > .Ar >@@ -161,6 +162,12 @@ > .It Fl r > Use the access and modifications times from the specified file > instead of the current time of day. >+.It Fl R >+As >+.Fl r >+, but if the file is a symbolic link, return the times of the link >+itself rather than the file that the link points to. >+(NB: This is a FreeBSD 13+ only extension) > .It Fl t > Change the access and modification times to the specified time instead > of the current time of day.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 260871
: 230614