public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: How to use g++ when paths contain spaces?
@ 1999-06-15  1:01 Schaible, Joerg
  1999-06-30 22:10 ` Schaible, Joerg
  0 siblings, 1 reply; 8+ messages in thread
From: Schaible, Joerg @ 1999-06-15  1:01 UTC (permalink / raw)
  To: 'cygwin-list'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

> > > I can't seem to get my command lines or makefiles right when the path
to
> > > my include directories contain spaces.

> I totally agree about spaces in path names, but for a variety of reasons I
> need to access files from another application that the user might
> have installed under "Program Files".

Hello,

to avoid paths with blanks I convert them normally to old 8.3 syntax using
followinf functions:

function dospath
{
    local cr=$(echo -e "\r")
    pushd "$1" > /dev/null 2>&1
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(command.com /c cd) | sed -e s#$cr##g
    popd > /dev/null 2>&1
}
function dosname
{
    local p=$(dirname "$1")
    local dos=$(dospath "$p")
    local cr=$(echo -e "\r")
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(dospath "$p")/$(cmd.exe /c dir /x /b $dos\\$(basename "$1")) |
sed -e s#$cr##g
}


Usage:

> dosname "/Program files/winamp/readme.txt"
C:\PROGRA~1\WINAMP\README.TXT


If you want to have back the cygwin path, you may have to do some additional
processing :)

Greetings
Jörg


> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: How to use g++ when paths contain spaces?
  1999-06-15  1:01 How to use g++ when paths contain spaces? Schaible, Joerg
@ 1999-06-30 22:10 ` Schaible, Joerg
  0 siblings, 0 replies; 8+ messages in thread
From: Schaible, Joerg @ 1999-06-30 22:10 UTC (permalink / raw)
  To: 'cygwin-list'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

> > > I can't seem to get my command lines or makefiles right when the path
to
> > > my include directories contain spaces.

> I totally agree about spaces in path names, but for a variety of reasons I
> need to access files from another application that the user might
> have installed under "Program Files".

Hello,

to avoid paths with blanks I convert them normally to old 8.3 syntax using
followinf functions:

function dospath
{
    local cr=$(echo -e "\r")
    pushd "$1" > /dev/null 2>&1
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(command.com /c cd) | sed -e s#$cr##g
    popd > /dev/null 2>&1
}
function dosname
{
    local p=$(dirname "$1")
    local dos=$(dospath "$p")
    local cr=$(echo -e "\r")
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(dospath "$p")/$(cmd.exe /c dir /x /b $dos\\$(basename "$1")) |
sed -e s#$cr##g
}


Usage:

> dosname "/Program files/winamp/readme.txt"
C:\PROGRA~1\WINAMP\README.TXT


If you want to have back the cygwin path, you may have to do some additional
processing :)

Greetings
Jörg


> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to use g++ when paths contain spaces?
  1999-06-14 23:54 ` Pontus Lidman
@ 1999-06-30 22:10   ` Pontus Lidman
  0 siblings, 0 replies; 8+ messages in thread
From: Pontus Lidman @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Earnie Boyd; +Cc: cygwin

On Mon, 14 Jun 1999, Earnie Boyd wrote:

> --- Pontus Lidman <pontus@mathcore.com> wrote:
> > Hello,
> > 
> > I can't seem to get my command lines or makefiles right when the path to
> > my include directories contain spaces.
[snip]
> 
> Character quoting using the DOS shell uses the ^ character.  If you execute
> your commands in the bash shell the you can use the \ character.
> 
> I as a manager wouldn't ever allow a space in a directory or file name.  It
> causes too many headaches.  The FAQ also warns of the dangers of the space in
> file names.  I suggest that you modify the spaces to _ or -.  Or in the case of
> "include dir" change it to "include".

I totally agree about spaces in path names, but for a variety of reasons I
need to access files from another application that the user might
have installed under "Program Files".

I tried using ^ to escape spaces but it doesn't seem to work the way I
hoped it would:

int main(int argc,char **argv) {
  int i;
  for (i=0; i<argc; i++) printf("'%s'\n",argv[i]);
}

c:\temp>a.exe a^ b
a.exe a^ b
'a.exe'
'a'
'b'

c:\temp>a.exe "a b"
a.exe "a b"
'a.exe'
'a b'

I had hoped these examples would give the same output.

I also gathered that the mingw32 port of 'make' would call sh.exe (if
available) to execute its command lines, so I tried putting the cygwin
sh.exe in the mingw32 bin directory and used standard sh quoting, but I
still got the same behaviour as before.

I guess I lose?

Regards,

Pontus Lidman




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* How to use g++ when paths contain spaces?
  1999-06-14 12:44 Pontus Lidman
@ 1999-06-30 22:10 ` Pontus Lidman
  0 siblings, 0 replies; 8+ messages in thread
From: Pontus Lidman @ 1999-06-30 22:10 UTC (permalink / raw)
  To: cygwin

Hello,

I can't seem to get my command lines or makefiles right when the path to
my include directories contain spaces.

The two main cases are:

g++ file.cc -I"include dir"
[usage message for cpp]
cpp.exe: too many arguments

or

g++ file.cc -Iinclude\ dir
g++: dir: No such file or directory

I guess quotes are the only way to use spaces in arguments on the Windows
NT command line. Is there any workaround that will let me use the full
path names including spaces? I really don't want to use the short 8+3
names as that would mean rewriting big chunks of my application.

Thanks,

Pontus Lidman



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to use g++ when paths contain spaces?
  1999-06-14 13:53 Earnie Boyd
  1999-06-14 23:54 ` Pontus Lidman
@ 1999-06-30 22:10 ` Earnie Boyd
  1 sibling, 0 replies; 8+ messages in thread
From: Earnie Boyd @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Pontus Lidman, cygwin

--- Pontus Lidman <pontus@mathcore.com> wrote:
> Hello,
> 
> I can't seem to get my command lines or makefiles right when the path to
> my include directories contain spaces.
> 
> The two main cases are:
> 
> g++ file.cc -I"include dir"
> [usage message for cpp]
> cpp.exe: too many arguments
> 
> or
> 
> g++ file.cc -Iinclude\ dir
> g++: dir: No such file or directory
> 
> I guess quotes are the only way to use spaces in arguments on the Windows
> NT command line. Is there any workaround that will let me use the full
> path names including spaces? I really don't want to use the short 8+3
> names as that would mean rewriting big chunks of my application.

Character quoting using the DOS shell uses the ^ character.  If you execute
your commands in the bash shell the you can use the \ character.

I as a manager wouldn't ever allow a space in a directory or file name.  It
causes too many headaches.  The FAQ also warns of the dangers of the space in
file names.  I suggest that you modify the spaces to _ or -.  Or in the case of
"include dir" change it to "include".
===
YAWIA,
Earnie Boyd < mailto:earnie_boyd@yahoo.com >

Newbies, please visit
< http://www.freeyellow.com/members5/gw32/index.html >
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to use g++ when paths contain spaces?
  1999-06-14 13:53 Earnie Boyd
@ 1999-06-14 23:54 ` Pontus Lidman
  1999-06-30 22:10   ` Pontus Lidman
  1999-06-30 22:10 ` Earnie Boyd
  1 sibling, 1 reply; 8+ messages in thread
From: Pontus Lidman @ 1999-06-14 23:54 UTC (permalink / raw)
  To: Earnie Boyd; +Cc: cygwin

On Mon, 14 Jun 1999, Earnie Boyd wrote:

> --- Pontus Lidman <pontus@mathcore.com> wrote:
> > Hello,
> > 
> > I can't seem to get my command lines or makefiles right when the path to
> > my include directories contain spaces.
[snip]
> 
> Character quoting using the DOS shell uses the ^ character.  If you execute
> your commands in the bash shell the you can use the \ character.
> 
> I as a manager wouldn't ever allow a space in a directory or file name.  It
> causes too many headaches.  The FAQ also warns of the dangers of the space in
> file names.  I suggest that you modify the spaces to _ or -.  Or in the case of
> "include dir" change it to "include".

I totally agree about spaces in path names, but for a variety of reasons I
need to access files from another application that the user might
have installed under "Program Files".

I tried using ^ to escape spaces but it doesn't seem to work the way I
hoped it would:

int main(int argc,char **argv) {
  int i;
  for (i=0; i<argc; i++) printf("'%s'\n",argv[i]);
}

c:\temp>a.exe a^ b
a.exe a^ b
'a.exe'
'a'
'b'

c:\temp>a.exe "a b"
a.exe "a b"
'a.exe'
'a b'

I had hoped these examples would give the same output.

I also gathered that the mingw32 port of 'make' would call sh.exe (if
available) to execute its command lines, so I tried putting the cygwin
sh.exe in the mingw32 bin directory and used standard sh quoting, but I
still got the same behaviour as before.

I guess I lose?

Regards,

Pontus Lidman




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to use g++ when paths contain spaces?
@ 1999-06-14 13:53 Earnie Boyd
  1999-06-14 23:54 ` Pontus Lidman
  1999-06-30 22:10 ` Earnie Boyd
  0 siblings, 2 replies; 8+ messages in thread
From: Earnie Boyd @ 1999-06-14 13:53 UTC (permalink / raw)
  To: Pontus Lidman, cygwin

--- Pontus Lidman <pontus@mathcore.com> wrote:
> Hello,
> 
> I can't seem to get my command lines or makefiles right when the path to
> my include directories contain spaces.
> 
> The two main cases are:
> 
> g++ file.cc -I"include dir"
> [usage message for cpp]
> cpp.exe: too many arguments
> 
> or
> 
> g++ file.cc -Iinclude\ dir
> g++: dir: No such file or directory
> 
> I guess quotes are the only way to use spaces in arguments on the Windows
> NT command line. Is there any workaround that will let me use the full
> path names including spaces? I really don't want to use the short 8+3
> names as that would mean rewriting big chunks of my application.

Character quoting using the DOS shell uses the ^ character.  If you execute
your commands in the bash shell the you can use the \ character.

I as a manager wouldn't ever allow a space in a directory or file name.  It
causes too many headaches.  The FAQ also warns of the dangers of the space in
file names.  I suggest that you modify the spaces to _ or -.  Or in the case of
"include dir" change it to "include".
===
YAWIA,
Earnie Boyd < mailto:earnie_boyd@yahoo.com >

Newbies, please visit
< http://www.freeyellow.com/members5/gw32/index.html >
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* How to use g++ when paths contain spaces?
@ 1999-06-14 12:44 Pontus Lidman
  1999-06-30 22:10 ` Pontus Lidman
  0 siblings, 1 reply; 8+ messages in thread
From: Pontus Lidman @ 1999-06-14 12:44 UTC (permalink / raw)
  To: cygwin

Hello,

I can't seem to get my command lines or makefiles right when the path to
my include directories contain spaces.

The two main cases are:

g++ file.cc -I"include dir"
[usage message for cpp]
cpp.exe: too many arguments

or

g++ file.cc -Iinclude\ dir
g++: dir: No such file or directory

I guess quotes are the only way to use spaces in arguments on the Windows
NT command line. Is there any workaround that will let me use the full
path names including spaces? I really don't want to use the short 8+3
names as that would mean rewriting big chunks of my application.

Thanks,

Pontus Lidman



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1999-06-30 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-15  1:01 How to use g++ when paths contain spaces? Schaible, Joerg
1999-06-30 22:10 ` Schaible, Joerg
  -- strict thread matches above, loose matches on Subject: below --
1999-06-14 13:53 Earnie Boyd
1999-06-14 23:54 ` Pontus Lidman
1999-06-30 22:10   ` Pontus Lidman
1999-06-30 22:10 ` Earnie Boyd
1999-06-14 12:44 Pontus Lidman
1999-06-30 22:10 ` Pontus Lidman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).