home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!rutgers!cmcl2!prism.poly.edu!kapela
- From: kapela@prism.poly.edu (Theodore S. Kapela)
- Newsgroups: comp.unix.programmer
- Subject: Re: expanding ~'s in a directory name.
- Message-ID: <1992Jul31.151135.25775@prism.poly.edu>
- Date: 31 Jul 92 15:11:35 GMT
- References: <1992Jul29.012629.14000@gucis.cit.gu.edu.au> <MJN.92Jul31043705@pseudo.uucp>
- Organization: Polytechnic University, New York
- Lines: 27
-
- In article <MJN.92Jul31043705@pseudo.uucp> mjn@pseudo.uucp (Murray Nesbitt) writes:
- >
- >In article <1992Jul29.012629.14000@gucis.cit.gu.edu.au> aroll@gucis.cit.gu.edu.au (Ashley Roll) writes:
- >
- >>My problem is how do I expand ~'s. I want to expand then the way that csh does
- >
- >
- >I don't care^H^H^H^Hknow about the csh, but the following should work
- >with sh and ksh:
- >
- >#include <stdlib.h>
- >
- >char *expanded_tilde;
- >
- > expanded_tilde = getenv("HOME");
- >
-
- What about ~user instead of just ~? With csh, I can do something
- like cd ~joeuser/tmp to cd to joeuser's $HOME/tmp. What your function
- needs to do is check what follows the ~ and act appropriately. You still
- need to check /etc/passwd for other users.
-
- --
- ..............................................................................
- Theodore S. Kapela kapela@poly.edu
- Center for Applied Large-Scale Computing
- Polytechnic University
-