Skip to content

Commit

Permalink
[PATCH] getdomainname should be usable on SunOS with -lnsl
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 17, 2005
1 parent aa894d8 commit 5a90d4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ ifeq ($(shell uname -s),Darwin)
endif
ifeq ($(shell uname -s),SunOS)
NEEDS_SOCKET = YesPlease
PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
NEEDS_NSL = YesPlease
PLATFORM_DEFINES += -D__EXTENSIONS__
endif

ifndef SHELL_PATH
Expand Down Expand Up @@ -198,6 +199,10 @@ ifdef NEEDS_SOCKET
LIBS += -lsocket
SIMPLE_LIB += -lsocket
endif
ifdef NEEDS_NSL
LIBS += -lnsl
SIMPLE_LIB += -lnsl
endif

DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'

Expand Down
1 change: 0 additions & 1 deletion convert-objects.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define _XOPEN_SOURCE /* glibc2 needs this */
#define __EXTENSIONS__ /* solaris needs this */
#include <time.h>
#include <ctype.h>
#include "cache.h"
Expand Down
2 changes: 0 additions & 2 deletions ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5a90d4a

Please sign in to comment.