Need help with subdirectories names

Tony Denault denault at hale.ifa.hawaii.edu
Wed May 1 08:25:20 AEST 1991


I would like to ask for help on the following programming problems concerning
subdirectories.

I have an application where the user can type in a directory. I would like them to 
use short cuts names like ~username/whatever or $HOME/whatever. I suppose the program
will need to read these and expand them somehow. How they get expanded is where I get
confused. 
 
For the ~username, I was thinking of reading the /etc/passwd file, search for the user
name and determine their home directory.  
 
For the $HOME, I need to search the enviroment variables for the variables value. 

Is my thinking correct or am I missing something? Can anyone provide some example code
or routine that expands a relative or shortcut name into a full pathname.

Thanks.

Tony Denault
--
/------------------------------------------------------------------------\
| Tony Denault, Institute for Astronomy,  | denault at uhifa.ifa.hawaii.edu |
| 2680 Woodlawn Drive, Honolulu, HI 96789 |               (808) 956-8101 |
\------------------------------------------------------------------------/



More information about the Comp.unix.questions mailing list