home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.eng.gtefsd.com!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!agate!doc.ic.ac.uk!uknet!miclon!nreadwin
- From: nreadwin@micrognosis.co.uk (Neil Readwin)
- Newsgroups: comp.os.vms
- Subject: Re: Need C program to get default directory
- Message-ID: <C1J5CC.9zw@micrognosis.co.uk>
- Date: 27 Jan 93 20:38:35 GMT
- References: <1993Jan26.073901.1636@galaxy.gov.bc.ca>
- Sender: news@micrognosis.co.uk
- Organization: Micrognosis, a division of CSK(UK) Ltd
- Lines: 23
-
- rforster@galaxy.gov.bc.ca (Russ Forster) writes:
- |> I am looking for a very small VAXC routine to find the default
- |> directory given a username. All the GETUAI examples I've seen
- |> have been ~100 lines.
-
- One HUNDRED lines? Sheesh! Five lines to do it, one line to test it...
-
- #include <descrip.h>
- #include <string.h>
- #include <uaidef.h>
-
- char*g(char*u){char q[64];int retlen,st;struct dsc$descriptor_s u_d =
- {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0}; struct {short i,bl;int ba,ra,z;}it={64,
- UAI$_DEFDIR,q,&retlen,0};u_d.dsc$w_length=strlen(u); u_d.dsc$a_pointer=u;
- st=sys$getuai(0,0,&u_d,&it,0,0,0);if(!(st&1))return 0;u=malloc(q[0]);
- return u?(u[q[0]]=0,strncpy(u,&q[1],q[0])):u;}
-
- main(int ac,char*av[]){if(ac>1){char*d=g(av[1]);printf("%s\n",d?d:"Unknown");}}
-
- Run it using "MC SYS$DISK:[]foo.EXE username". Neil
- --
- Phone: +44 71 815 5283 E-mail: nreadwin@micrognosis.co.uk
- Anything is a cause for sorrow that my mind or body has made
-