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

Build fixes for Solaris 9

From
DSDennis Stosberg <dennis@stosberg.net>
Date
Apr 11, 2006, 16:37 UTC
Message-ID
<20060411163758.G1237b62a@leonov.stosberg.net>
Hello,

The attached patch allows git to be built on Solaris 9, which does not have setenv() and unsetenv().

Also, Solaris needs strings.h for index(). A few days ago there was a thread about this on the list and the result was that strchr() is more portable than index() and is used everywhere in git anyway. So instead of including strings.h, this patch replaces all remaining calls to index() by strchr().

Regards, Dennis

diff --git a/Makefile b/Makefile
index c0409f3..ff645d8 100644
--- a/Makefile
+++ b/Makefile
@@ -248,6 +248,10 @@ ifeq ($(uname_S),SunOS)
 		NO_UNSETENV = YesPlease
 		NO_SETENV = YesPlease
 	endif
+	ifeq ($(uname_R),5.9)
+		NO_UNSETENV = YesPlease
+		NO_SETENV = YesPlease
+	endif
 	INSTALL = ginstall
 	TAR = gtar
 	ALL_CFLAGS += -D__EXTENSIONS__
diff --git a/http-fetch.c b/http-fetch.c
index 71a7daf..861644b 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -597,7 +597,7 @@ static void process_alternates_response(
 				newalt->packs = NULL;
 				path = strstr(target, "//");
 				if (path) {
-					path = index(path+2, '/');
+					path = strchr(path+2, '/');
 					if (path)
 						newalt->path_len = strlen(path);
 				}
@@ -678,7 +678,7 @@ static void
 xml_start_tag(void *userData, const char *name, const char **atts)
 {
 	struct xml_ctx *ctx = (struct xml_ctx *)userData;
-	const char *c = index(name, ':');
+	const char *c = strchr(name, ':');
 	int new_len;
 
 	if (c == NULL)
@@ -707,7 +707,7 @@ static void
 xml_end_tag(void *userData, const char *name)
 {
 	struct xml_ctx *ctx = (struct xml_ctx *)userData;
-	const char *c = index(name, ':');
+	const char *c = strchr(name, ':');
 	char *ep;
 
 	ctx->userFunc(ctx, 1);
@@ -1261,7 +1261,7 @@ int main(int argc, char **argv)
 	alt->next = NULL;
 	path = strstr(url, "//");
 	if (path) {
-		path = index(path+2, '/');
+		path = strchr(path+2, '/');
 		if (path)
 			alt->path_len = strlen(path);
 	}
diff --git a/http-push.c b/http-push.c
index 57cefde..994ee90 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1211,7 +1211,7 @@ static void
 xml_start_tag(void *userData, const char *name, const char **atts)
 {
 	struct xml_ctx *ctx = (struct xml_ctx *)userData;
-	const char *c = index(name, ':');
+	const char *c = strchr(name, ':');
 	int new_len;
 
 	if (c == NULL)
@@ -1240,7 +1240,7 @@ static void
 xml_end_tag(void *userData, const char *name)
 {
 	struct xml_ctx *ctx = (struct xml_ctx *)userData;
-	const char *c = index(name, ':');
+	const char *c = strchr(name, ':');
 	char *ep;
 
 	ctx->userFunc(ctx, 1);
@@ -2350,7 +2350,7 @@ int main(int argc, char **argv)
 			char *path = strstr(arg, "//");
 			remote->url = arg;
 			if (path) {
-				path = index(path+2, '/');
+				path = strchr(path+2, '/');
 				if (path)
 					remote->path_len = strlen(path);
 			}
Message 1 of 1 in “Build fixes for Solaris 9”
  1. Dennis StosbergApr 11, 2006

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.