From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 22-AUG-1990 13:17:21.74
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Converting UN*X filesnames to VMS --responses

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA03387; Wed, 22 Aug 90 13:09:52 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Wed, 22 AUG 90 08:35:04 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA29664; Wed, 22 Aug 90 08:25:26 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 22 Aug 90 15:09:56 GMT
From: zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!cathedral!pac@tut.cis.ohio-state.edu  (Michael A. Packer)
Subject: Converting UN*X filesnames to VMS --responses
Message-Id: <697@babcock.cerc.wvu.wvnet.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


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

