[PATCH] getdomainname should be usable on SunOS with -lnsl
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>
This commit is contained in:
parent
aa894d8887
commit
5a90d4ac1a
7
Makefile
7
Makefile
@ -151,7 +151,8 @@ ifeq ($(shell uname -s),Darwin)
|
|||||||
endif
|
endif
|
||||||
ifeq ($(shell uname -s),SunOS)
|
ifeq ($(shell uname -s),SunOS)
|
||||||
NEEDS_SOCKET = YesPlease
|
NEEDS_SOCKET = YesPlease
|
||||||
PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
|
NEEDS_NSL = YesPlease
|
||||||
|
PLATFORM_DEFINES += -D__EXTENSIONS__
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef SHELL_PATH
|
ifndef SHELL_PATH
|
||||||
@ -198,6 +199,10 @@ ifdef NEEDS_SOCKET
|
|||||||
LIBS += -lsocket
|
LIBS += -lsocket
|
||||||
SIMPLE_LIB += -lsocket
|
SIMPLE_LIB += -lsocket
|
||||||
endif
|
endif
|
||||||
|
ifdef NEEDS_NSL
|
||||||
|
LIBS += -lnsl
|
||||||
|
SIMPLE_LIB += -lnsl
|
||||||
|
endif
|
||||||
|
|
||||||
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
|
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#define _XOPEN_SOURCE /* glibc2 needs this */
|
#define _XOPEN_SOURCE /* glibc2 needs this */
|
||||||
#define __EXTENSIONS__ /* solaris needs this */
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
2
ident.c
2
ident.c
@ -36,13 +36,11 @@ int setup_ident(void)
|
|||||||
memcpy(real_email, pw->pw_name, len);
|
memcpy(real_email, pw->pw_name, len);
|
||||||
real_email[len++] = '@';
|
real_email[len++] = '@';
|
||||||
gethostname(real_email + len, sizeof(real_email) - len);
|
gethostname(real_email + len, sizeof(real_email) - len);
|
||||||
#ifndef NO_GETDOMAINNAME
|
|
||||||
if (!strchr(real_email+len, '.')) {
|
if (!strchr(real_email+len, '.')) {
|
||||||
len = strlen(real_email);
|
len = strlen(real_email);
|
||||||
real_email[len++] = '.';
|
real_email[len++] = '.';
|
||||||
getdomainname(real_email+len, sizeof(real_email)-len);
|
getdomainname(real_email+len, sizeof(real_email)-len);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* And set the default date */
|
/* And set the default date */
|
||||||
datestamp(real_date, sizeof(real_date));
|
datestamp(real_date, sizeof(real_date));
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user