Why use pwd(1) for getpwd(3C)? (Re: Why use find?)

joseph.a.brownlee jbr0 at cbnews.att.com
Tue Oct 9 22:28:13 AEST 1990


In article <1990Oct7.001518.14216 at diku.dk>, kimcm at diku.dk (Kim Christian Madsen)
writes:
>                   [...] on my system (a SYSV) system, find perfoms
> a getpwd(3C) each time it enters a directory, and getpwd(3) is by
> standard implemented by forking a shell to do a pwd(1) in oorder [sic]
> to get the result [...]

While this is somewhat off the subject, I have to admit that I have always
wondered why getpwd(3C) is implemented this way.  It seems exactly backward
from one what normally expects (and sees) in UNIX, where UNIX programs are
based on underlying system or subroutine calls.  Of course, this reversal
causes the poor performance mentioned above.

I guess I always assumed that this is the way it is for historical reasons
rather than due to some sound technical concern, but I admit that I am in the
dark on this one.  I would appreciate any enlightenment the net can provide.

Followups to c.u.programmer since this is more a programming issue than a
shell issue.

-- 
   -      _   Joe Brownlee, Analysts International Corp. @ AT&T Network Systems
  /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
 /   \ | \_,  E-mail: jbr at cblph.att.com     Who pays attention to what _I_ say?
 "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk



More information about the Comp.unix.programmer mailing list