[comp.sys.mac.programmer] MPW & spaces in pathnames

pascal@CAM.ORG (Pascal Gosselin) (12/28/90)

   I am sure that someone may have already replied to the message that I
posted on the 24th, but HD space limitations may have caused a reply
to be nuked before I could see it.

Basically, I was having problems with a script that couldn't seem
to recognize existing pathnames.

Turns out that the script was built in a way that didn't allow SPACES
in path.  I happened to still have my HD named to the default "Macintosh HD"
(yes, A little pathetic, oh well!) and this causing all of the problems.

Is this a limitation of MPW ?  Was the script built improperly?  I don't
know, I didin't write the script....   I was simply using it to compile
Faircom's Ctree v4.3C ...

E-mail me if know what causes the problem.  Thanks!


-- 
+----------------------------------------------------------------------------+
| Pascal Gosselin          | Internet: P.Gosselin@CAM.ORG Applelink: CDA0585 |
| Gest-Mac Inc. Apple VAR  |   Voice (514) 767-4444   Fax (514) 767-7337     |
+----------------------------------------------------------------------------+

laird@chinet.chi.il.us (Laird J. Heal) (12/30/90)

In article <1990Dec27.173958.18413@CAM.ORG> pascal@CAM.ORG (Pascal Gosselin) writes:
>Turns out that the script was built in a way that didn't allow SPACES
>in path.  I happened to still have my HD named to the default "Macintosh HD"
>(yes, A little pathetic, oh well!) and this causing all of the problems.

Wherever there is a file name, put double-quotes around anything that is
not wild-carded (? or option-x) and almost all of your troubles will be
solved.

My internal drive is named "/" partially just to catch errors of this
type.  If I really wanted to cause myself some trouble, I would name it
'"' or '"/' or something similar, so I could have fun escaping quotes in
the proper places.

-- 
Laird J. Heal                           The Usenet is dead!
Here:  laird@chinet.chi.il.us		Long Live the Usenet!

Laird.J..Heal@f20.n226.z1.FIDONET.ORG (Laird J. Heal) (12/30/90)

Reply-To: laird@chinet.chi.il.us

In article <1990Dec27.173958.18413@CAM.ORG> pascal@CAM.ORG (Pascal Gosselin)
writes:
>Turns out that the script was built in a way that didn't allow SPACES
>in path.  I happened to still have my HD named to the default "Macintosh HD"
>(yes, A little pathetic, oh well!) and this causing all of the problems.

Wherever there is a file name, put double-quotes around anything that is
not wild-carded (? or option-x) and almost all of your troubles will be
solved.

My internal drive is named "/" partially just to catch errors of this
type.  If I really wanted to cause myself some trouble, I would name it
'"' or '"/' or something similar, so I could have fun escaping quotes in
the proper places.

-- 
Laird J. Heal                           The Usenet is dead!
Here:  laird@chinet.chi.il.us           Long Live the Usenet!

 + Organization: Chinet - Public Access UNIX

--  
Laird J. Heal - via FidoNet node 1:105/14
    UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Laird.J..Heal
INTERNET: Laird.J..Heal@f20.n226.z1.FIDONET.ORG

tim@hoptoad.uucp (Tim Maroney) (12/30/90)

In article <1990Dec27.173958.18413@CAM.ORG> pascal@CAM.ORG (Pascal Gosselin)
writes:
>>Turns out that the script was built in a way that didn't allow SPACES
>>in path.  I happened to still have my HD named to the default "Macintosh HD"
>>(yes, A little pathetic, oh well!) and this causing all of the problems.

In article <1990Dec29.221358.18317@chinet.chi.il.us> laird@chinet.chi.il.us
(Laird J. Heal) writes:
>Wherever there is a file name, put double-quotes around anything that is
>not wild-carded (? or option-x) and almost all of your troubles will be
>solved.

Fine if all you're doing is typing, or writing scripts intended to work
on a single system configuration.  Building file names out of arguments
and variable expansions, and storing them in variables or aliases,
makes the problem much more complicated.  I know how to solve this in
csh on UNIX; I've been using MPW Shell since before it was released and
I still don't know a consistent solution for it.  As a result, I am
making all my development hard drives and all program source files
single words.

I wish that MPW Shell would simply get smarter about multi-word file
names, perfomrinag an internal parse-check-and-combine operation when
the current simplistic approach gives a file system error on a partial
name.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Religion flourishes in greater purity without than with the aid
 of government." -- James Madison

Tim.Maroney@f20.n226.z1.FIDONET.ORG (Tim Maroney) (12/31/90)

From: tim@hoptoad.uucp
Reply-To: tim@hoptoad.UUCP

In article <1990Dec27.173958.18413@CAM.ORG> pascal@CAM.ORG (Pascal Gosselin)
writes:
>>Turns out that the script was built in a way that didn't allow SPACES
>>in path.  I happened to still have my HD named to the default "Macintosh HD"
>>(yes, A little pathetic, oh well!) and this causing all of the problems.

In article <1990Dec29.221358.18317@chinet.chi.il.us> laird@chinet.chi.il.us
(Laird J. Heal) writes:
>Wherever there is a file name, put double-quotes around anything that is
>not wild-carded (? or option-x) and almost all of your troubles will be
>solved.

Fine if all you're doing is typing, or writing scripts intended to work
on a single system configuration.  Building file names out of arguments
and variable expansions, and storing them in variables or aliases,
makes the problem much more complicated.  I know how to solve this in
csh on UNIX; I've been using MPW Shell since before it was released and
I still don't know a consistent solution for it.  As a result, I am
making all my development hard drives and all program source files
single words.

I wish that MPW Shell would simply get smarter about multi-word file
names, perfomrinag an internal parse-check-and-combine operation when
the current simplistic approach gives a file system error on a partial
name.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Religion flourishes in greater purity without than with the aid
 of government." -- James Madison

 + Organization: Electronics for Imaging, San Bruno CA

--  
Tim Maroney - via FidoNet node 1:105/14
    UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Tim.Maroney
INTERNET: Tim.Maroney@f20.n226.z1.FIDONET.ORG

Reid Ellis <rae@gpu.utcs.toronto.edu> (01/06/91)

Laird J. Heal <laird@chinet.chi.il.us> writes:
>Wherever there is a file name, put double-quotes around anything that
>is not wild-carded (? or option-x) and almost all of your troubles
>will be solved.

Tim Maroney <tim@hoptoad.uucp> writes:
>Building file names out of arguments and variable expansions, and
>storing them in variables or aliases, makes the problem much more
>complicated.

One problem along these lines is storing filenames in a file,
separated by newlines.  Given such a file, it is difficult to assign
the file names to a variable, properly quoted.  That is to say, given
a file such as:

	File Number 1
	Second File

I want to set a variable as follows:

	set foo '"File Number 1" "Second File"'

The obvious doesn't work:

	set foo "`cat filename`"

since files have spaces in them.  Later in the script, I want to be
able to say:

	for file in {foo} ...

Recently, I have started using StreamEdit as a solution to the
problem, be having it quote each line in the file.  Thus my assignment
is now:

	set foo `streamedit -s script.sed file`

Not quite good enough, in my view.

					Reid
--
Reid Ellis  176 Brookbanks Drive, Toronto ON, M3A 2T5 Canada
rae@gpu.utcs.toronto.edu      ||  rae%alias@csri.toronto.edu
CDA0610@applelink.apple.com   ||             +1 416 446 1644