This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Probably stupid make question (cmd a=b)


Thanks, that saves me some tinkering!

Yeah, the documentation I'm writing for using CMake with the cross-compiler already recommends against using directories with blanks; I was hoping to avoid that restriction, but it seems like it may be more trouble than it's worth!

...phsiii

-----Original Message-----
From: Stephan Mueller [mailto:Stephan.Mueller@microsoft.com]
Sent: Saturday, August 30, 2008 1:35 PM
To: Phil Smith; Jay; cygwin@cygwin.com
Subject: RE: Probably stupid make question (cmd a=b)

Creating a test batch file that echos %1 etc and %* is pretty trivial to create.  In mine, I tend to do
        @echo echoing percent-n
        @echo .%1. .%2. .%3. .%4. .%5. .%6. .%7. .%8. .%9.
and similarly for %* -- the dots won't be confused with content when doing experiments.

>From this, you can test theories like the one below and see that batch will parse
        -Dsomething=c:\Documents and Settings\whatever
as four tokens.  If you want the path to be a single token you will need to use quotes.  A perl equivalent will show that perl treats that as three tokens.  So, neither cmd nor perl will avoid your need to quote filenames with spaces in them.  cmd just adds to the problem with the equals-treated-as-space thing.

If your CMake-created-Makefile doesn't quote filenames, then that's a bug in the Makefile generation or maybe it's just out-of-spec usage -- you could also consider the bug to be the use of any file or directory components containing spaces.  So, another approach might be to set 'something' to a location other than somewhere under c:\Documents and Settings; insist that your build be in a sane, no-space-in-name location.

stephan();


-----Original Message-----
From: Phil Smith [mailto:phil@voltage.com]
Sent: Saturday, August 30, 2008 8:57 AM
To: Jay; cygwin@cygwin.com; Stephan Mueller
Subject: RE: Probably stupid make question (cmd a=b)

Thanks for the good ideas.

The Makefile is generated by CMake, and I don't have (or know that I have) a way to force the quotes in there. Wish I did.

Yeah, I'm probably going to wind up using Perl. A quick question (obviously I can figure this out, but if I knew offhand it would save me some hassle): does Perl handle arguments such as long filenames as single arguments, as .bat does? That's the *only* good thing about .bat AFAICT:

 -Dsomething=c:\Documents and Settings\whatever

comes in as %1 or whatever (or would, if the equals sign didn't get eaten!).  If Perl is going to get the above as 3 arguments, then it's going to be a LOT more work to make it handle things correctly.  After fighting with this for more time than I care to think about, I guess I'm hoping to get an idea of how big the remaining hill is!

...phsiii
-----Original Message-----
From: jayk123@hotmail.com [mailto:jayk123@hotmail.com] On Behalf Of Jay
Sent: Saturday, August 30, 2008 10:48 AM
To: cygwin@cygwin.com; Phil Smith; stephan.mueller@microsoft.com
Subject: RE: Probably stupid make question (cmd a=b)


  continuing somewhat off topic:

  > Probably stupid make question
  > 144097 by: Phil
  > 144106 by: Stephan


>>>>>  But really, just about anything is better than cmd.   <<<<


 Have you tried quotes?

  D:\>type 2.cmd
  @echo 1 is %1
  @echo 2 is %2


  D:\>.\2.cmd a=b
  1 is a
  2 is b

  D:\>.\2.cmd "a=b"
  1 is "a=b"
  2 is


  I think tilde is how to strip quotes:
    echo 1 is %~1
    echo 2 is %~2
  to echo without quotes

  echo 1 is "%~1"
  echo 2 is "%~2"

  to echo with one set of quotes, no matter if the input was quoted.
  Though this might go badly if the last character is a blackslash, it might
   escape the quote. I find anything involving "quoting" to be broken.
   It is difficult/impossible to know how many rounds of unquoting will occur,
    and how/by whom. It seems that a large percentage of cmd and bash
    code is merely fighting to get quoting right. A lot of this stems from the
    bogus construct of representing an array of strings as one string with
    spaces delimiting elements.


  But really, just about anything is better than cmd.
  I have used cmd a lot and I heartily recommend Perl or Python instead,
   no matter the application.


 I do like cmd for interactive use, it is fast, has decent command line editing,
   history, quickedit (I wish I could triple click for lines), and my favorite feature
   F8 does completion against command line history.


  But as a programming language, it is terrible. It is too string based.


  People complain about the need to install Perl/Python on Windows, that they aren't "built in".
  Yes, but the alternative, using cmd, is much worse than having to install them.
  Perl can just be copied around, no need to "install" it.
  Python I haven't tried that yet.


 - Jay


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]