*BSD News Article 57583


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!swrinde!newsfeed.internetmci.com!in2.uu.net!news.eden.com!arlut.utexas.edu!khan!jerry
From: jerry@arlut.utexas.edu (Jerry Heyman)
Newsgroups: alt.unix.wizards,comp.unix.admin,comp.unix.advocacy,comp.unix.aix,comp.unix.bsd.misc,comp.unix.solaris,comp.unix.ultrix
Subject: Re: A challenge
Followup-To: alt.unix.wizards,comp.unix.admin,comp.unix.advocacy,comp.unix.aix,comp.unix.bsd.misc,comp.unix.solaris,comp.unix.ultrix
Date: 20 Dec 1995 23:49:46 GMT
Organization: UT Applied Research Laboratories
Lines: 49
Distribution: inet
Message-ID: <4ba7eq$lrs@ns1.arlut.utexas.edu>
References: <4b4q0l$pc3@news.inc.net> <4b5e2r$nma@shocker.mid.net> <4b9kvv$ria@hecate.umd.edu>
NNTP-Posting-Host: khan.arlut.utexas.edu
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au alt.unix.wizards:2487 comp.unix.admin:36328 comp.unix.advocacy:12482 comp.unix.aix:67057 comp.unix.bsd.misc:395 comp.unix.solaris:55199 comp.unix.ultrix:26573

Ed Schmahl (ed@astro.umd.edu) wrote:


: Here's a question (possibly useful, possibly stupid) that none of the
: Unix wizards I know have been able to answer.  Let's see if anyone on
: the Net has any suggestions.

Okay, I don't claim to be a wizard - but I'll give it a try...

: Say we've got a (gasp) Fortran program that outputs data to a file called
: R:foobar.  The program compiles fine on VMS and DOS operating systems, but not
: on Unix systems, which complains about the ":" as a directory tree separator.
: The obvious (non wizardly) way to solve this is to modify the source code to 
: sense the OS that it's being compiled under and change the ":" to a "/"
: when it's compiled under Unix.  But is there a (wizardly) way
: to force Unix, during run time, to accept R:foobar as if it was R/foobar?

I assume you mean forcing your program (not Unix) to map R:foobar to R/foobar.

You could define an environment variable (say FILE_SEPARATOR) which is set
to either ":" or "/" depending on the system you're running on, and then add
an if test in the code that says (roughly)

   separator = getenv(FILE_SEPARATOR)
   IF (separator .NE. ":") THEN
      spot = INDEX(filename,":")
      filename = substr (filename,1,spot-1) || "/" || substr(filename,spot+1)
   ENDIF

While not eligant, it handles the simple case.  Because VMS uses : as a
directory separator, you could put the above in a loop to handle possible
sub directories.

I'm sure that someone else will come up with a better/slicker solution...

: Ed Schmahl

: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
:     Department of Astronomy                  http://www.astro.umd.edu/~ed
:     University of Maryland                               ed@astro.umd.edu
:     College Park, MD 20742                                 (301) 405-1506
: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

jerry
--
Jerry Heyman                   | jerry@arlut.utexas.edu
Tactical Simulation Division   | http://www.arlut.utexas.edu/~jerry/main.html
Applied Research Laboratories of UT Austin | "Software is the difference
P.O. Box 8029, Austin, TX 78713-8029       |     between hardware and reality"