pusateri@romeo.cs.duke.edu (Thomas J. Pusateri) (07/18/89)
I am in need of getting the full pathname of the current working directory. In SUN OS (BSD) there is a call getwd() that when passed a buffer, returns that buffer with the current directory. Is there a work around for SYSTEM V? Is the PWD environment variable standard on all SYSTEM V machines under bourne shell and korn shell? Could I just do a getenv() on PWD? Thanks for any info. Tom Pusateri National Biomedical Simulation Resource Duke University Medical Center pusateri@nbsr.mc.duke.edu
tanya@adds.newyork.NCR.COM (Tanya Katz) (07/19/89)
In-reply-to: your article <15005@duke.cs.duke.edu> > I am in need of getting the full pathname of the current working directory. > In SUN OS (BSD) there is a call getwd() that when passed a buffer, returns > that buffer with the current directory. Is there a work around for > SYSTEM V? Is the PWD environment variable standard on all SYSTEM V machines > under bourne shell and korn shell? Could I just do a getenv() on PWD? > I think $PWD is just korn shell... In system V there is getcwd(3c) from my manual char * getcwd(buf, size) char *buf; int size; > Thanks for any info. Hope this is on your machine... Tanya ------------------------------------------------------------------------------ ### ###### ###### ##### Tanya Katz (516) 231-5400 x430 # # # # # # # # # # # # # ##### ncrlnk!adds!tanya ####### # # # # # tanya.katz@adds.newyork.ncr.com # # ###### ###### ##### Applied Digital Data Systems, Inc. 100 Marcus Blvd., Hauppauge, NY 11788 ------------------------------------------------------------------------------
lenny@icus.islp.ny.us (Lenny Tropiano) (07/22/89)
In article <1124@adds.newyork.NCR.COM> tanya@adds.newyork.NCR.COM (Tanya Katz) writes: |> |>In-reply-to: your article <15005@duke.cs.duke.edu> |> |>> I am in need of getting the full pathname of the current working directory. ... |>In system V there is getcwd(3c) |> |>from my manual |> |>char * getcwd(buf, size) |>char *buf; |>int size; |> |>> Thanks for any info. |>Hope this is on your machine... The underlying code for getcwd(3C) is pretty simple... If you notice the "SEE ALSO" section, you'll figure it out too. getcwd(3C) basically malloc's a piece of memory, open's a pipe to pwd(1) using popen(2), and then reads in the contents of the pwd command. So if you don't have this on your machine you should be able to easily make one. -Lenny -- Lenny Tropiano ICUS Software Systems [w] +1 (516) 589-7930 lenny@icus.islp.ny.us Telex; 154232428 ICUS [h] +1 (516) 968-8576 {ames,talcott,decuac,hombre,pacbell,sbcs}!icus!lenny attmail!icus!lenny ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752