diff liboctave/oct-env.cc @ 2934:dddc1b5c324e

[project @ 1997-05-05 22:56:37 by jwe]
author jwe
date Mon, 05 May 1997 22:59:00 +0000
parents 66ef74ee5d9f
children 9d26524e2869
line wrap: on
line diff
--- a/liboctave/oct-env.cc	Mon May 05 22:52:47 1997 +0000
+++ b/liboctave/oct-env.cc	Mon May 05 22:59:00 1997 +0000
@@ -50,14 +50,11 @@
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
 #include "lo-error.h"
 #include "lo-sysdep.h"
 #include "lo-utils.h"
 #include "oct-env.h"
+#include "oct-passwd.h"
 
 octave_env::octave_env (void)
   : follow_symbolic_links (true), verbatim_pwd (true),
@@ -374,9 +371,9 @@
 
   if (user_name.empty ())
     {
-      struct passwd *entry = getpwuid (getuid ());
+      octave_passwd pw = octave_passwd::getpwuid (getuid ());
 
-      user_name = entry ? entry->pw_name : "I have no name!";
+      user_name = pw.empty () ? string ("I have no name!") : pw.name ();
     }
 
   return user_name;