commit: 2892fdc2ad1fec5a298a8d3719669a801e0bd535
parent 1f07ed293d92e6df6d43dc5ae7e08240373391c2
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 3 Jun 2023 06:24:18 +0200
cmd/touch: Add -d@123… for abuild compatibility
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/cmd/touch.c b/cmd/touch.c
@@ -22,6 +22,15 @@ iso_parse(char *arg)
// YYYY-MM-DD[T ]hh:mm:SS([,\.]frac)?Z?
// Dammit Unixes why no nanoseconds in `struct tm` nor `strptime`
struct timespec time = {.tv_sec = 0, .tv_nsec = 0};
+
+ // For Alpine's abuild compatibility
+ if(arg[0] == '@')
+ {
+ arg++;
+ if(sscanf(arg, "%ld", &time.tv_sec) < 1) exit(EXIT_FAILURE);
+ return time;
+ }
+
struct tm tm;
memset(&tm, 0, sizeof(tm));