🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec
Article #1607

Re: Shell functions in VAX C

#1607
From: Aaron Leonard
Date: Thu, 07 Jun 1990 20:34
52 lines
2207 bytes
>Could someone please describe the syntax for the SHELL$TO_VMS function?

Yeah, I actually tried using this beast once and it's a weird 'un.  It's
pretty complex, because it allows successive calls to explode wildcarded
filespecs into a series of VMS-ized specific filenames.  And you have to
pass it the address of a routine to deal with the filename returned.

I wrote up a little jacket routine to handle the simple (only one filename
returned) case; you can link it into your program.

Have fun,

Aaron

/* unix-filespec-to-vms.c
 */

static char ux_emul_vms_filespec[255];  /* a place to stash the VMS-y filespec
                                         * that SHELL$TO_VMS returns
                                         */

/* unix_filespec_to_vms
 *   Use SHELL$TO_VMS to translate a U*x-y filespec to a VMS-y one.
 *   
 * Returns: 0 if no filenames matched the input filespec, else 1.
 * Returns the first matching VMS-y filespec in first arg.
 *
 */

int unix_filespec_to_vms(vmsspec, unixspec)
char *vmsspec;
char *unixspec;                         /* possibly wild */
{
    int ux_emul_act_routine(), SHELL$TO_VMS();
    int num_files_found;

    num_files_found = SHELL$TO_VMS(unixspec, ux_emul_act_routine, 1);
    if (num_files_found != 1)
       return (0);
    strcpy(vmsspec, ux_emul_vms_filespec);
    return (1);
        
}   /* unix_filespec_to_vms */

int ux_emul_act_routine(fspec)
char *fspec;
{
    /* this routine is fired off by SHELL$TO_VMS if it finds any files. */

    strcpy(ux_emul_vms_filespec, fspec);        /* stash the filename */
    return (0);                                 /* don't get called again */
}
Technical Details
Message-ID: <21920@megaron.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!asuvax!noao!arizona!dragoon.telcom.arizona.edu!aaron
References: <27786@eerie.acsu.Buffalo.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!asuvax!noao!arizona!dragoon.telcom.arizona.edu!aaron
From: leonard@telcom.arizona.edu (Aaron Leonard)
Newsgroups: comp.sys.dec
Subject: Re: Shell functions in VAX C
Message-ID: <21920@megaron.cs.arizona.edu>
Date: 7 Jun 90 20:34:37 GMT
References: <27786@eerie.acsu.Buffalo.EDU>
Sender: news@cs.arizona.edu
Reply-To: Leonard@Arizona.EDU
Distribution: na
Organization: Univ of Ariz Telecom
Lines: 52