{"thread":{"id":"3849","subject":"Build fixes for Solaris 9","startedAt":"2006-04-11T16:37:58Z","lastAt":"2006-04-11T16:37:58Z","messageCount":1,"participants":["Dennis Stosberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18564","messageId":"20060411163758.G1237b62a@leonov.stosberg.net","threadId":"3849","inReplyTo":null,"subject":"Build fixes for Solaris 9","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-04-11T16:37:58Z","receivedAt":"2006-04-11T16:37:58Z","isPatch":false,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Hello,\n\nThe attached patch allows git to be built on Solaris 9, which does\nnot have setenv() and unsetenv().\n\nAlso, Solaris needs strings.h for index().  A few days ago there was\na thread about this on the list and the result was that strchr() is\nmore portable than index() and is used everywhere in git anyway.  So\ninstead of including strings.h, this patch replaces all remaining\ncalls to index() by strchr().\n\nRegards,\nDennis\n\n\ndiff --git a/Makefile b/Makefile\nindex c0409f3..ff645d8 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -248,6 +248,10 @@ ifeq ($(uname_S),SunOS)\n \t\tNO_UNSETENV = YesPlease\n \t\tNO_SETENV = YesPlease\n \tendif\n+\tifeq ($(uname_R),5.9)\n+\t\tNO_UNSETENV = YesPlease\n+\t\tNO_SETENV = YesPlease\n+\tendif\n \tINSTALL = ginstall\n \tTAR = gtar\n \tALL_CFLAGS += -D__EXTENSIONS__\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 71a7daf..861644b 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -597,7 +597,7 @@ static void process_alternates_response(\n \t\t\t\tnewalt->packs = NULL;\n \t\t\t\tpath = strstr(target, \"//\");\n \t\t\t\tif (path) {\n-\t\t\t\t\tpath = index(path+2, '/');\n+\t\t\t\t\tpath = strchr(path+2, '/');\n \t\t\t\t\tif (path)\n \t\t\t\t\t\tnewalt->path_len = strlen(path);\n \t\t\t\t}\n@@ -678,7 +678,7 @@ static void\n xml_start_tag(void *userData, const char *name, const char **atts)\n {\n \tstruct xml_ctx *ctx = (struct xml_ctx *)userData;\n-\tconst char *c = index(name, ':');\n+\tconst char *c = strchr(name, ':');\n \tint new_len;\n \n \tif (c == NULL)\n@@ -707,7 +707,7 @@ static void\n xml_end_tag(void *userData, const char *name)\n {\n \tstruct xml_ctx *ctx = (struct xml_ctx *)userData;\n-\tconst char *c = index(name, ':');\n+\tconst char *c = strchr(name, ':');\n \tchar *ep;\n \n \tctx->userFunc(ctx, 1);\n@@ -1261,7 +1261,7 @@ int main(int argc, char **argv)\n \talt->next = NULL;\n \tpath = strstr(url, \"//\");\n \tif (path) {\n-\t\tpath = index(path+2, '/');\n+\t\tpath = strchr(path+2, '/');\n \t\tif (path)\n \t\t\talt->path_len = strlen(path);\n \t}\ndiff --git a/http-push.c b/http-push.c\nindex 57cefde..994ee90 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1211,7 +1211,7 @@ static void\n xml_start_tag(void *userData, const char *name, const char **atts)\n {\n \tstruct xml_ctx *ctx = (struct xml_ctx *)userData;\n-\tconst char *c = index(name, ':');\n+\tconst char *c = strchr(name, ':');\n \tint new_len;\n \n \tif (c == NULL)\n@@ -1240,7 +1240,7 @@ static void\n xml_end_tag(void *userData, const char *name)\n {\n \tstruct xml_ctx *ctx = (struct xml_ctx *)userData;\n-\tconst char *c = index(name, ':');\n+\tconst char *c = strchr(name, ':');\n \tchar *ep;\n \n \tctx->userFunc(ctx, 1);\n@@ -2350,7 +2350,7 @@ int main(int argc, char **argv)\n \t\t\tchar *path = strstr(arg, \"//\");\n \t\t\tremote->url = arg;\n \t\t\tif (path) {\n-\t\t\t\tpath = index(path+2, '/');\n+\t\t\t\tpath = strchr(path+2, '/');\n \t\t\t\tif (path)\n \t\t\t\t\tremote->path_len = strlen(path);\n \t\t\t}\n"}]}