On 2025-10-24 04:25, Manuela Friedrich wrote:
zic.c(104): error C2061: syntax error: identifier 'creat_perms'
Thanks again. I see that your platform has sys/stat.h but it does not
define mode_t as per POSIX. Let's try the attached proposed patch, which
I installed in the development repo. This simplifies the code a bit.
The idea is that we know how gid_t, mode_t and uid_t work on
MS-Windows-like platforms that have <direct.h>: the types are unsigned
short so let's just use that as a convenience (though it puzzles me why
Microsoft doesn't do that for us). On other non-POSIX platforms we can
continue to ask the builder to use something like -Dmode_t=int. (This
would be needed if a mad scientist built tzcode on UNIX System III or
earlier!)From df08e6a1333bce837240757d48fa63eb6ccf26bf Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 24 Oct 2025 08:46:44 -0700
Subject: [PROPOSED] Port mode_t (and gid_t, uid_t) to MS-Windows
Problem reported by Manuela Friedrich in:
* zic.c (gid_t, mode_t, uid_t) [HAVE_DIRECT_H]: New typedefs.
(gid_t, mode_t, uid_t): Remove these macros.
---
Makefile | 4 ++--
zic.c | 11 +----------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index b3ceb997..f57042df 100644
--- a/Makefile
+++ b/Makefile
@@ -269,7 +269,7 @@ LDLIBS=
# variables like 'tzname' required by POSIX
# -DHAVE_PWD_H=0 if your system lacks pwd.h, grp.h and corresponding functions
# The following additional options may be needed:
-# -Dgid_t=T, -Duid_t=T to define gid_t, uid_t to be type T (default int)
+# -Dgid_t=T, -Duid_t=T to define gid_t, uid_t to be type T
# -DHAVE_SETENV=0 if your system lacks the setenv function
# -DHAVE_SETMODE=[01] if your system lacks or has the setmode and getmode
# functions (default is guessed)
@@ -286,7 +286,7 @@ LDLIBS=
# -DHAVE_SYMLINK=0 if your system lacks the symlink function
# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
# The following additional option may be needed:
-# -Dmode_t=T to define mode_t to be type T (default int)
+# -Dmode_t=T to define mode_t to be type T
# -DHAVE_TZSET=0 if your system lacks a tzset function
# -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
diff --git a/zic.c b/zic.c
index d6bf8b60..81a1c5a8 100644
--- a/zic.c
+++ b/zic.c
@@ -49,6 +49,7 @@ enum { FORMAT_LEN_GROWTH_BOUND = 5 };
# include <direct.h>
# include <io.h>
# define mkdir(name, mode) _mkdir(name)
+typedef unsigned short gid_t, mode_t, uid_t;
#endif
#ifndef HAVE_GETRANDOM
@@ -67,10 +68,6 @@ enum { FORMAT_LEN_GROWTH_BOUND = 5 };
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
-#else
-# ifndef mode_t
-# define mode_t int
-# endif
#endif
#ifndef S_IRWXU
@@ -119,12 +116,6 @@ static mode_t creat_perms = CREAT_PERMS;
# include <grp.h>
# include <pwd.h>
#else
-# ifndef gid_t
-# define gid_t int
-# endif
-# ifndef uid_t
-# define uid_t int
-# endif
struct group { gid_t gr_gid; };
struct passwd { uid_t pw_uid; };
# define getgrnam(arg) NULL
--
2.48.1