From fbcc27cfefa2834f2605e43e63d65f68a17c2807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 23 Apr 2009 22:24:32 +0200 Subject: [PATCH] Work around lack of cuserid(3) declaration on Tru64 5.1b. * configure.in: Check for a cuserid(3) declaration. * libguile/posix.c [HAVE_CUSERID][!HAVE_DECL_CUSERID]: Provide a declaration. --- configure.in | 4 +++- libguile/posix.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a875edcf9..27908041f 100644 --- a/configure.in +++ b/configure.in @@ -736,10 +736,12 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime # anyway. # hstrerror - on Tru64 5.1b the symbol is available in libc but the # declaration isn't anywhere. +# cuserid - on Tru64 5.1b the declaration is documented to be available +# only with `_XOPEN_SOURCE' or some such. # AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h) AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname) -AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv, hstrerror]) +AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv, hstrerror, cuserid]) # crypt() may or may not be available, for instance in some countries there # are restrictions on cryptography. diff --git a/libguile/posix.c b/libguile/posix.c index 25d37d244..f036f5776 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1675,6 +1675,11 @@ SCM_DEFINE (scm_getlogin, "getlogin", 0, 0, 0, #endif /* HAVE_GETLOGIN */ #if HAVE_CUSERID + +# if !HAVE_DECL_CUSERID +extern char *cuserid (char *); +# endif + SCM_DEFINE (scm_cuserid, "cuserid", 0, 0, 0, (void), "Return a string containing a user name associated with the\n"