logo

utils-std

Collection of commonly available Unix tools
commit: 73076a09363d6471825b2740179aae55e6c0d414
parent cd9123c51ba5e7092229c9c44d16577dae0ef775
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 19 Sep 2023 13:20:18 +0200

cmd/touch: Use lib/bitmasks.h macros

Diffstat:

Mcmd/touch.c7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cmd/touch.c b/cmd/touch.c @@ -6,6 +6,7 @@ #define _XOPEN_SOURCE 700 // strptime (NetBSD) #define _POSIX_C_SOURCE 200809L // O_NOFOLLOW, st_atim/st_mtim +#include "../lib/bitmasks.h" /* FIELD_* */ #include "../lib/iso_parse.h" /* iso_parse */ #include <errno.h> /* errno */ @@ -37,11 +38,11 @@ main(int argc, char *argv[]) ch_atime = true; break; case 'c': - open_flags ^= O_CREAT; + FIELD_CLR(open_flags, O_CREAT); break; case 'h': - open_flags |= O_NOFOLLOW; - utimensat_flags |= AT_SYMLINK_NOFOLLOW; + FIELD_SET(open_flags, O_NOFOLLOW); + FIELD_SET(utimensat_flags, AT_SYMLINK_NOFOLLOW); break; case 'm': ch_mtime = true;