Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!uhccux!hale.ifa.hawaii.edu From: denault@hale.ifa.hawaii.edu (Tony Denault) Newsgroups: comp.unix.questions Subject: Need help with subdirectories names Message-ID: <12746@uhccux.uhcc.Hawaii.Edu> Date: 30 Apr 91 22:25:20 GMT Sender: news@uhccux.uhcc.Hawaii.Edu Organization: Institute For Astronomy, Hawaii Lines: 24 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@uhifa.ifa.hawaii.edu | | 2680 Woodlawn Drive, Honolulu, HI 96789 | (808) 956-8101 | \------------------------------------------------------------------------/