diff options
author | Damien Miller <djm@mindrot.org> | 2017-06-10 23:41:25 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-06-10 23:41:25 +1000 |
commit | bcd1485075aa72ba9418003f5cc27af2b049c51b (patch) | |
tree | 122b7024821c2c47b6df71639fe578bf5f571183 /defines.h | |
parent | 072e172f1d302d2a2c6043ecbfb4004406717b96 (diff) |
portability for sftp globbed ls sort by mtime
Include replacement timespeccmp() for systems that lack it.
Support time_t struct stat->st_mtime in addition to
timespec stat->st_mtim, as well as unsorted fallback.
Diffstat (limited to 'defines.h')
-rw-r--r-- | defines.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -519,6 +519,13 @@ struct winsize { | |||
519 | } | 519 | } |
520 | #endif | 520 | #endif |
521 | 521 | ||
522 | #ifndef timespeccmp | ||
523 | #define timespeccmp(tsp, usp, cmp) \ | ||
524 | (((tsp)->tv_sec == (usp)->tv_sec) ? \ | ||
525 | ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ | ||
526 | ((tsp)->tv_sec cmp (usp)->tv_sec)) | ||
527 | #endif | ||
528 | |||
522 | #ifndef __P | 529 | #ifndef __P |
523 | # define __P(x) x | 530 | # define __P(x) x |
524 | #endif | 531 | #endif |