pac@cathedral.cerc.wvu.wvnet.edu (Michael A. Packer) (08/22/90)
here are some of the responses i got: You apparently only get documentation with DEC/Shell but there are routines in the C RTL that comes with VMS that do what you want. SHELL$FROM_VMS (vms-filespec, action-routine, wild-flag) SHELL$TO_VMS (unix-filespec, action-routine, wild-flag) The filespec parameters are null terminated strings. The second parameter is a function called with each matching name. Wild-flag is 0 or 1. If 0, wild cards in the name are not expanded. For SHELL$FROM_VMS, the action routine takes a single argument, the translated name. With SHELL$TO_VMS, there are two arguments: the VMS file name and a type which indicates whether the name is a directory, a file, or specifies a DECnet link that is unavailable. In both cases translation continues until the action routine fails to return a success status. There is one other rotutine: unix-filespec = SHELL$TRANSLATE_VMS (vms-filespec) Hope this helps. -- ---- Bruce A. Hudson | HUDSON@AC.DAL.CA UCIS, Facilities and Operations | HUDSON@DALAC (Bitnet) Dalhousie University | HUDSON@DALCS (UUCP) Halifax, Nova Scotia, Canada | ============================================================================== Path: cerc.wvu.wvnet.edu!cs.wvu.wvnet.edu!haven!udel!wuarchive!uunet!cs.utexas.edu!news-server.csri.toronto.edu!utgpu!watadm1!ria!rrivax.rri.uwo.ca!lrb From: lrb@rrivax.rri.uwo.ca (Lance R. Bailey) Newsgroups: alt.sources.wanted Subject: Re: converting UN*X filenames to VMS ? Message-ID: <896@ria.ccs.uwo.ca> Date: 20 Aug 90 11:29:36 GMT References: <693@babcock.cerc.wvu.wvnet.edu> Sender: news@ria.ccs.uwo.ca Reply-To: lrb@rrivax.rri.uwo.ca Followup-To: alt.sources.wanted Organization: Robarts Research Institute -- London Canada Earth Lines: 126 News-Software: VAX/VMS VNEWS 1.3-4 In article <693@babcock.cerc.wvu.wvnet.edu>, pac@cathedral.cerc.wvu.wvnet.edu (Michael A. Packer) writes... >Does anyone have a routine or know of a place where I can find >a routine that will convert a unix file specification to >a VMS specification? here: #include <stdio.h> #include <string.h> /* * uucp work files are written in terms of unix file specifications. * FTP uses the actual machine's file specification. This means that * files referenced in the workfiles that are to be transmitted with FTP * should be re-worked from unix style to the machines style. * * most c compilers are nice enough to allow fopen() etcetera to use * unix specifications in the code and thus calls to fopen() etcetera * do not need to be reworked. * */ char * filefix(str,FILECODE) char *str; { char device[100]; char filename[100]; char directory[100]; static char result[300]; static char temp[300]; char *ptr1, *ptr2, *ptr3; if (!*str) return NULL; strcpy(temp,str); switch (FILECODE) { case 0: strcpy(result,str); return result; case 1: /* unix 2 VMS */ ptr1 = strchr(temp,'/'); if (!ptr1) { strcpy(result,temp); return result; } ptr2 = strchr(ptr1+1,'/'); if (!ptr2) { if (!*(ptr1+1)) strcpy(result,"dua0:[000000]"); /* / ---> dua0:[000000] */ else sprintf(result,"%s:[000000]",ptr1+1); /* /foo ---> foo:[000000] */ return result; } ptr3 = strchr(ptr2+1,'/'); if (!ptr3) { *ptr2=0; sprintf(result,"%s:[%s]",ptr1+1,ptr2+1); /* /foo/bar ---> foo:[bar] */ return result; } /* /foo/bar/fubar ---> foo:[bar]fubar */ *ptr2=0; sprintf(result,"%s:",ptr1+1); *ptr2='['; ptr1=strrchr(temp,'/'); /* find last */ *ptr1=']'; ptr1=strrchr(ptr2,'/'); while (ptr1) { *ptr1='.'; ptr1=strrchr(ptr2,'/'); } strcat(result,ptr2); return result; /* * foo:[bar] ---> /foo/bar * foo:[bar.fubar] ---> /foo/bar/fubar */ case 2: /* vms 2 unix */ ptr3=strrchr(temp,']'); if (!ptr3) return NULL; *ptr3=0; ptr1=strchr(temp,':'); if (!ptr1) return NULL; *(ptr1++)=0; ptr2=strchr(ptr1,'['); if (!ptr2) return NULL; *(ptr2++)=0; for (ptr3=strchr(ptr2,'.');ptr3;ptr3=strchr(ptr3,'.')) *ptr3='/'; sprintf(result,"/%s/%s",temp,ptr2); return result; } /* * shouldn't _really_ get here */ fprintf(stderr,"unknown filecode translation %d\n",FILECODE); return NULL; } /* * EOF */ >thanks in advance... welcome _________________________________ Lance R. Bailey, Systems Manager | Robarts Research Institute email: lrb@rri.uwo.ca | Clinical Trials Resources Group vox: 519-663-3787 ext. 4108 | P.O. Box 5015, 100 Perth Dr. fax: 519-663-3789 | London, Canada N6A 5K8 ============================================================================== thanks again for all of the help pac -- USMAIL: Drawer 2000, Concurrent Eng. Res. Center, WVU, Morgantown, WV 26506 PHONE: 304 293-7226 INTERNET : pac@cerc.wvu.wvnet.edu