logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 25d16de6f4c594c2a074fd2307144b68f8105209
parent 0c0a6d40e26ff63dbd1d3410e485d21bc2ec3a83
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  3 Jun 2023 05:21:09 +0200

cmd/touch: Fix tm_atim for NetBSD

In NetBSD tm_atim is guarded behind _XOPEN_SOURCE >= 700 (or POSIX)

Diffstat:

Mcmd/touch.c23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/cmd/touch.c b/cmd/touch.c @@ -2,17 +2,18 @@ // SPDX-FileCopyrightText: 2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only -#define _DEFAULT_SOURCE // tm_gmtoff/tm_zone -#define _XOPEN_SOURCE // strptime -#include <errno.h> /* errno */ -#include <fcntl.h> /* open */ -#include <stdbool.h> /* bool */ -#include <stdio.h> /* perror, sscanf */ -#include <stdlib.h> /* exit */ -#include <string.h> /* memset */ -#include <sys/stat.h> /* futimens, stat */ -#include <time.h> /* strptime, tm */ -#include <unistd.h> /* access */ +#define _DEFAULT_SOURCE // tm_gmtoff/tm_zone +#define _XOPEN_SOURCE 700 // strptime, tm_atim/tm_mtim + +#include <errno.h> /* errno */ +#include <fcntl.h> /* open */ +#include <stdbool.h> /* bool */ +#include <stdio.h> /* perror, sscanf */ +#include <stdlib.h> /* exit */ +#include <string.h> /* memset */ +#include <sys/stat.h> /* futimens, stat */ +#include <time.h> /* strptime, tm */ +#include <unistd.h> /* access */ // Calls exit() on failure struct timespec