aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/touch.c')
-rw-r--r--toys/posix/touch.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/toys/posix/touch.c b/toys/posix/touch.c
index 214d6cf9..5e5588b1 100644
--- a/toys/posix/touch.c
+++ b/toys/posix/touch.c
@@ -27,9 +27,7 @@ config TOUCH
#include "toys.h"
GLOBALS(
- char *time;
- char *file;
- char *date;
+ char *t, *r, *d;
)
void touch_main(void)
@@ -52,10 +50,10 @@ void touch_main(void)
// List of search types
if (toys.optflags & FLAG_d) {
format = (char *[]){"%Y-%m-%dT%T", "%Y-%m-%d %T", 0};
- date = TT.date;
+ date = TT.d;
} else {
format = (char *[]){"%m%d%H%M", "%y%m%d%H%M", "%C%y%m%d%H%M", 0};
- date = TT.time;
+ date = TT.t;
}
// Trailing Z means UTC timezone, don't expect libc to know this.
@@ -101,10 +99,10 @@ void touch_main(void)
// Set time from -r?
- if (TT.file) {
+ if (TT.r) {
struct stat st;
- xstat(TT.file, &st);
+ xstat(TT.r, &st);
ts[0] = st.st_atim;
ts[1] = st.st_mtim;
}