diff options
author | Andy Wingo <wingo@pobox.com> | 2010-11-18 11:15:16 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-11-18 11:15:16 +0100 |
commit | cd28785f799d76fc242224b032b67a31346cf539 (patch) | |
tree | 283475743fcbd5c3534b52adcfc541e0d9f9dd1f /libguile/deprecated.c | |
parent | e75184d5d2cddfc6feea40989e23c609b17a6053 (diff) | |
download | guile-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.
Diffstat (limited to 'libguile/deprecated.c')
-rw-r--r-- | libguile/deprecated.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 () { |