#include "EXTERN.h"
#include "perl.h"
+#ifdef HAS_GETSPENT
+/* Shadow password support for solaris - pdo@cs.umd.edu*/
+#include <shadow.h>
+#endif
+
/* XXX If this causes problems, set i_unistd=undef in the hint file. */
#ifdef I_UNISTD
# include <unistd.h>
register SV *sv;
struct passwd *pwent;
STRLEN n_a;
+#ifdef HAS_GETSPENT
+ struct spwd *spwent;
+#endif
if (which == OP_GPWNAM)
pwent = getpwnam(POPpx);
else
pwent = (struct passwd *)getpwent();
+#ifdef HAS_GETSPENT
+ if (which == OP_GPWNAM)
+ spwent = getspnam(pwent->pw_name);
+ else if (which == OP_GPWUID)
+ spwent = getspnam(pwent->pw_name);
+ else
+ spwent = (struct spwd *)getspent();
+#endif
+
EXTEND(SP, 10);
if (GIMME != G_ARRAY) {
PUSHs(sv = sv_newmortal());
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef PWPASSWD
+#ifdef HAS_GETSPENT
+ if (spwent)
+ sv_setpv(sv, spwent->sp_pwdp);
+ else
+ sv_setpv(sv, pwent->pw_passwd);
+#else
sv_setpv(sv, pwent->pw_passwd);
#endif
+#endif
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)pwent->pw_uid);
djSP;
#if defined(HAS_PASSWD) && defined(HAS_SETPWENT) && !defined(CYGWIN32)
setpwent();
+#ifdef HAS_GETSPENT
+ setspent();
+#endif
RETPUSHYES;
#else
DIE(PL_no_func, "setpwent");
djSP;
#if defined(HAS_PASSWD) && defined(HAS_ENDPWENT)
endpwent();
+#ifdef HAS_GETSPENT
+ endspent();
+#endif
RETPUSHYES;
#else
DIE(PL_no_func, "endpwent");