summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-11-18 11:15:16 +0100
committerAndy Wingo <wingo@pobox.com>2010-11-18 11:15:16 +0100
commitcd28785f799d76fc242224b032b67a31346cf539 (patch)
tree283475743fcbd5c3534b52adcfc541e0d9f9dd1f
parente75184d5d2cddfc6feea40989e23c609b17a6053 (diff)
downloadguile-cd28785f799d76fc242224b032b67a31346cf539.tar.gz
deprecate cuserid
* libguile/posix.c: * libguile/posix.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only returns 8 bytes of a user's login. * doc/ref/posix.texi: Remove cuserid from docs.
-rw-r--r--doc/ref/posix.texi13
-rw-r--r--libguile/deprecated.c29
-rw-r--r--libguile/deprecated.h5
-rw-r--r--libguile/posix.c24
-rw-r--r--libguile/posix.h1
5 files changed, 35 insertions, 37 deletions
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index b237002c7..3499404f1 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -1112,18 +1112,7 @@ or getgrent respectively.
@end deffn
In addition to the accessor procedures for the user database, the
-following shortcut procedures are also available.
-
-@deffn {Scheme Procedure} cuserid
-@deffnx {C Function} scm_cuserid ()
-Return a string containing a user name associated with the
-effective user id of the process. Return @code{#f} if this
-information cannot be obtained.
-
-This function has been removed from the latest POSIX specification,
-Guile provides it only if the system has it. Using @code{(getpwuid
-(geteuid))} may be a better idea.
-@end deffn
+following shortcut procedure is also available.
@deffn {Scheme Procedure} getlogin
@deffnx {C Function} scm_getlogin ()
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index 648efe9ac..e11d353ad 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -2361,6 +2361,35 @@ int scm_internal_select (int fds,
+#ifdef 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"
+ "effective user id of the process. Return @code{#f} if this\n"
+ "information cannot be obtained.")
+#define FUNC_NAME s_scm_cuserid
+{
+ char buf[L_cuserid];
+ char * p;
+
+ scm_c_issue_deprecation_warning
+ ("`cuserid' is deprecated. Use `(passwd:name (getpwuid (geteuid)))' instead.");
+
+ p = cuserid (buf);
+ if (!p || !*p)
+ return SCM_BOOL_F;
+ return scm_from_locale_string (p);
+}
+#undef FUNC_NAME
+#endif /* HAVE_CUSERID */
+
+
+
void
scm_i_init_deprecated ()
{
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 893523f20..84258fa9f 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -736,6 +736,11 @@ SCM_DEPRECATED int scm_internal_select (int fds,
SELECT_TYPE *efds,
struct timeval *timeout);
+/* Deprecated because the cuserid call is deprecated.
+ */
+SCM_API SCM scm_cuserid (void);
+
+
void scm_i_init_deprecated (void);
diff --git a/libguile/posix.c b/libguile/posix.c
index f371cb23e..8301a7e94 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1841,30 +1841,6 @@ SCM_DEFINE (scm_getlogin, "getlogin", 0, 0, 0,
#undef FUNC_NAME
#endif /* HAVE_GETLOGIN */
-#ifdef 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"
- "effective user id of the process. Return @code{#f} if this\n"
- "information cannot be obtained.")
-#define FUNC_NAME s_scm_cuserid
-{
- char buf[L_cuserid];
- char * p;
-
- p = cuserid (buf);
- if (!p || !*p)
- return SCM_BOOL_F;
- return scm_from_locale_string (p);
-}
-#undef FUNC_NAME
-#endif /* HAVE_CUSERID */
-
#if HAVE_GETPRIORITY
SCM_DEFINE (scm_getpriority, "getpriority", 2, 0, 0,
(SCM which, SCM who),
diff --git a/libguile/posix.h b/libguile/posix.h
index ac774d33d..da588352a 100644
--- a/libguile/posix.h
+++ b/libguile/posix.h
@@ -83,7 +83,6 @@ SCM_API SCM scm_sync (void);
SCM_API SCM scm_crypt (SCM key, SCM salt);
SCM_API SCM scm_chroot (SCM path);
SCM_API SCM scm_getlogin (void);
-SCM_API SCM scm_cuserid (void);
SCM_API SCM scm_getpriority (SCM which, SCM who);
SCM_API SCM scm_setpriority (SCM which, SCM who, SCM prio);
SCM_API SCM scm_getpass (SCM prompt);