3 ms·
Here is touch.c [1] from macOS. The only change since Lion is the addition of the __used attribute on a couple of consts at the beginning. It's very similar t
by ken 7y ago
Here is touch.c [1] from macOS. The only change since Lion is the addition of the __used attribute on a couple of consts at the beginning. It's very similar to the FreeBSD one, though they've diverged slightly in the past 2 decades.
It supports 8 different flags (plus an undocumented -? flag), with support for using absolute or relative times, setting various timestamps on a file, and options for dealing with symlinks and permissions and such. More features than I'll ever need, but not outrageously so.
On Mojave, this file is only 23392 bytes, so it's no longer bigger than Turbo Pascal. Plus, automatic filesystem compression shrinks this down to only 7340 bytes on disk. Since blocks are 4096 bytes, this is actually the second-smallest (non-empty) file!
[1]: https://opensource.apple.com/source/file_cmds/file_cmds-287.40.2/touch/touch.c.auto.html https://opensource.apple.com/source/file_cmds/file_cmds-287....
- ksherlock 7y ago'?' isn't an undocumented flag; that's the getopt() return value to indicate a bad option or a missing argument.