From: Andrej Bauer (Andrej.Bauer@ijs.si)
Date: 08/25/93


From: Andrej.Bauer@ijs.si (Andrej Bauer)
Subject: Re: /bin/pwd missing in SLS 1.02
Date: 26 Aug 1993 02:54:15 +0200

Here is a quick partial solution.

=======================pwd.c==============================
#include <stdlib.h>
#include <unistd.h>

#define PATH_MAX 256

main() { char buf[PATH_MAX]; puts(getwd(buf)); }
==========================================================

To compile & install do the following (as root):
cc -o pwd pwd.c
cp pwd /etc/pwd
chmod ugo=rx /bin/pwd
chown root /bin/pwd
chgrp roo /bin/pwd

Does anyone know where to find PATH_MAX? Shouldn't it be in unistd.h?

WARNING:
This program will fail if you do something like this:

mkdir foo
cd foo
rmdir ../foo
/bin/pwd

Since I don't know what pwd is supposed to do in such cases,
someone else might kindly tell us (I guess it should return
a non-zero exit status).

Andrej (Andrej.Bauer@IJS.si)