1.0.44.21: expand ~ in pathnames
[sbcl.git] / src / runtime / wrap.c
index 8493bf6..c17b0f1 100644 (file)
@@ -317,10 +317,9 @@ uid_username(int uid)
 }
 
 char *
-uid_homedir(uid_t uid)
+passwd_homedir(struct passwd *p)
 {
-    struct passwd *p = getpwuid(uid);
-    if(p) {
+    if (p) {
         /* Let's be careful about this, shall we? */
         size_t len = strlen(p->pw_dir);
         if (p->pw_dir[len-1] == '/') {
@@ -342,6 +341,18 @@ uid_homedir(uid_t uid)
         return 0;
     }
 }
+
+char *
+user_homedir(char *name)
+{
+    return passwd_homedir(getpwnam(name));
+}
+
+char *
+uid_homedir(uid_t uid)
+{
+    return passwd_homedir(getpwuid(uid));
+}
 #endif /* !LISP_FEATURE_WIN32 */
 \f
 /*