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

[PATCH] getdomainname should be usable on SunOS with -lnsl

From
Junio C Hamano <junkio@cox.net>
Date
Sep 12, 2005, 05:39 UTC
Message-ID
<7vmzmilu9w.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<25968.1126304722@lotus.CS.Berkeley.EDU>

Jason Riedy suggests that we should be able to use getdomainname if we properly specify which libraries to link.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 I've tried this on an ancient Solaris machine I happened to
 have access at work and it seems to link OK.  Patrick, could
 you try this and see if it works OK for you?
 Makefile |    6 +++++-
 ident.c  |    2 --
 2 files changed, 5 insertions(+), 3 deletions(-)
2b6a27b6157c6ee472d654dbcaf380aec00d6444
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -148,7 +148,7 @@ ifeq ($(shell uname -s),Darwin)
 endif
 ifeq ($(shell uname -s),SunOS)
 	NEEDS_SOCKET = YesPlease
-	PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
+	NEEDS_NSL = YesPlease
 endif
 
 ifndef SHELL_PATH
@@ -195,6 +195,10 @@ ifdef NEEDS_SOCKET
 	LIBS += -lsocket
 	SIMPLE_LIB += -lsocket
 endif
+ifdef NEEDS_NSL
+	LIBS += -lnsl
+	SIMPLE_LIB += -lnsl
+endif
 
 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 
diff --git a/ident.c b/ident.c
--- a/ident.c
+++ b/ident.c
@@ -36,13 +36,11 @@ int setup_ident(void)
 	memcpy(real_email, pw->pw_name, len);
 	real_email[len++] = '@';
 	gethostname(real_email + len, sizeof(real_email) - len);
-#ifndef NO_GETDOMAINNAME
 	if (!strchr(real_email+len, '.')) {
 		len = strlen(real_email);
 		real_email[len++] = '.';
 		getdomainname(real_email+len, sizeof(real_email)-len);
 	}
-#endif
 	/* And set the default date */
 	datestamp(real_date, sizeof(real_date));
 	return 0;
Previous: Jason Riedy
Message 5 of 5 in “patches”
  1. Patrick MauritzSep 5, 2005
  2. Junio C HamanoSep 8, 2005
  3. Patrick MauritzSep 8, 2005
  4. Jason RiedySep 9, 2005
  5. getdomainname should be usable on SunOS with -lnslJunio C Hamano, Sep 12, 2005

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.