lrb@rrivax.rri.uwo.ca (Lance R. Bailey) (08/20/90)
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
pac@cathedral.cerc.wvu.wvnet.edu (Michael A. Packer) (08/20/90)
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? thanks in advance... I will post any information i get... thanks pac@cerc.wvu.wvnet.edu -- USMAIL: Drawer 2000, Concurrent Eng. Res. Center, WVU, Morgantown, WV 26506 PHONE: 304 293-7226 INTERNET : pac@cerc.wvu.wvnet.edu
sean@dsl.pitt.edu.UUCP (08/27/90)
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? Plenty. First, the Vax C compiler supports this (to a certain degree). Also, you might look at the GNU C compiler which has code for parsing Unix file conventions into VMS. I am sure that there are other places as well, such as code from the DECUS tape. Sean McLinden Decision Systems Laboratory University of Pittsburgh P.S. The GNU C compiler can be ftp'd from a number of sites including prep.ai.mit.edu.