git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Work around missing strtoumax on Solaris.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 19, 2007, 07:36 UTC
Message-ID
<20070219073613.GA30144@spearce.org>

Solaris 9 apparently lacks the strtoumax function in its C library. But it does have strtoull and uintmax_t appears to be defined to be unsigned long long.

We now set NO_STRTOUMAX in the Makefile for SunOS systems, and if this is set define strtoumax to be strtoull.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Too bad I missed 1.5.0.1!  Time for 1.5.0.2 ?  ;-)
 Makefile          |    6 ++++++
 git-compat-util.h |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index ebecbbd..e8a827d 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,8 @@ all::
 #
 # Define NO_STRLCPY if you don't have strlcpy.
 #
+# Define NO_STRTOUMAX if you don't have strtoumax.
+#
 # Define NO_SETENV if you don't have setenv in the C library.
 #
 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
@@ -348,6 +350,7 @@ ifeq ($(uname_S),SunOS)
 	NEEDS_NSL = YesPlease
 	SHELL_PATH = /bin/bash
 	NO_STRCASESTR = YesPlease
+	NO_STRTOUMAX = YesPlease
 	ifeq ($(uname_R),5.8)
 		NEEDS_LIBICONV = YesPlease
 		NO_UNSETENV = YesPlease
@@ -517,6 +520,9 @@ ifdef NO_STRLCPY
 	COMPAT_CFLAGS += -DNO_STRLCPY
 	COMPAT_OBJS += compat/strlcpy.o
 endif
+ifdef NO_STRTOUMAX
+	COMPAT_CFLAGS += -DNO_STRTOUMAX
+endif
 ifdef NO_SETENV
 	COMPAT_CFLAGS += -DNO_SETENV
 	COMPAT_OBJS += compat/setenv.o
diff --git a/git-compat-util.h b/git-compat-util.h
index 105ac28..f812f8e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -139,6 +139,10 @@ extern char *gitstrcasestr(const char *haystack, const char *needle);
 extern size_t gitstrlcpy(char *, const char *, size_t);
 #endif
 
+#ifdef NO_STRTOUMAX
+#define strtoumax strtoull
+#endif
+
 extern void release_pack_memory(size_t);
 
 static inline char* xstrdup(const char *str)
-- 
1.5.0.552.ge1b1c
Message 1 of 1 in “Work around missing strtoumax on Solaris.”
  1. Work around missing strtoumax on Solaris.Shawn O. Pearce, Feb 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.