Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!swrinde!ucsd!rutgers!att!cbnews!jbr0 From: jbr0@cbnews.att.com (joseph.a.brownlee) Newsgroups: comp.unix.programmer Subject: Why use pwd(1) for getpwd(3C)? (Re: Why use find?) Summary: Why use pwd(1) for getpwd(3C)? Message-ID: <1990Oct9.122813.1329@cbnews.att.com> Date: 9 Oct 90 12:28:13 GMT References: <28790001@col.hp.com> <1977@sixhub.UUCP> <1990Oct7.001518.14216@diku.dk> Organization: AT&T Bell Laboratories Lines: 25 In article <1990Oct7.001518.14216@diku.dk>, kimcm@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@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