aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/touch.c
AgeCommit message (Collapse)Author
2019-03-26Make touch use xparsedate() (result: -t and -d the same, autodetects format),Rob Landley
and fix tests to pass on host too.
2018-12-04Add FLAG(x) macro, expanding to (toys.optflags & FLAG_##x)Rob Landley
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-11-13touch: ignore -f like everyone else.Elliott Hughes
I assume it's actually meaningful on BSD/macOS and makes them behave like us, but I don't have access to a Mac to test that theory.
2018-08-25Convert more argument variables in GLOBALS() to new style.Rob Landley
2017-04-11Fix touch -a/-m (and add the missing tests).Elliott Hughes
utimensat takes atime in [0] and mtime in [1], but since we're overwriting with UTIME_OMIT, we actually want to flip the comparison so -a blats 1 and -m blats 0.
2016-10-20Add special "touch -" behavior and require an argument.Rob Landley
2016-10-19More touch tests, and a fix found by one. (The three -t formats can onlyRob Landley
reliably be distinguished by checking length, because %H amd %m and such can match different numbers of digits.)
2016-10-18Unify touch -t and -d handling, allow posix's underspecified "time designator"Rob Landley
T to be a space instead (because the posix says so, no idea why), initialize default values reliably including zeroing daylight savings time field (which is handled inconsistently by libc and just screws stuff up).
2016-08-01Fix touch(1) date parsing on tzcode-derived systems.Elliott Hughes
The IANA tzcode implementation of mktime (used on Android and BSDs) sets errno in some cases where it doesn't return -1 to indicate failure, so the existing test always failed on those systems. I don't think glibc ever sets errno (which is fine by ISO C, but not POSIX). Other uses of mktime in toybox are already fine. This one would have been caught by the existing tests if I was running them on the device :-(
2016-04-21Fix touch -t seconds parsingDavis Mosenkovs
2015-07-04Actually set time with touch -d and -t when you don't specify nanonseconds.Rob Landley
There's a nanoseconds field value that says use current time, which I set but forgot to clear in the right places. (Oops.)
2015-05-31Move the magic list of commands needing cleanup from toys/pending/READMERob Landley
to greppable TODO annotations in the individual files. (grep -riw TODO)
2015-02-08Rewrite of a patch from Elliott Hughes to implement touch -h and switch API ↵Rob Landley
to utimensat() which offers nanosecond granularity and UTIME_OMIT/UTIME_NOW.
2015-01-14Make touch -d miliseconds work. (Still only 6 digits precision instead of 9, ↵Rob Landley
but it's a start.)
2014-10-01Bugfix from Ashwini Sharma: Z timezone required by posix for touch but not ↵Rob Landley
for libc, so we have to implement it here.
2014-09-17Minor cleanup pass on touch.Rob Landley
2013-09-09Minor cleanups.Rob Landley
2013-09-09Don't write a zero past end of toybuf with large -d value.Rob Landley
2013-08-18Fix usage: lines for a couple commands.Rob Landley
2013-01-02Have error_msg() and friends set TT.exitval to 1 if it's still 0, clean out ↵Rob Landley
other places that were setting it that no longer need to.
2012-11-25Update touch: add remaining posix arguments, make existing ones work.Rob Landley
2012-11-16More touch cleanup to use generic infrastructure: use getdate() from libc, ↵Rob Landley
use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros.
2012-11-16Fix touch warnings (unused variables, failure to reserve space for null ↵Rob Landley
terminator).
2012-11-16Refactor touch (cleanup whitespace, brackets, function order), code ↵Rob Landley
otherwise same.
2012-11-16Add touch from Choubey Ji.Rob Landley