delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/04/03:16:28

X-Spam-Check-By: sourceware.org
Message-ID: <463ADDA8.8030209@marco.de>
Date: Fri, 04 May 2007 09:15:52 +0200
From: Daniel Spannbauer <ds AT marco DOT de>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.8.0.8) Gecko/20061105 SeaMonkey/1.0.6
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Some Batch-Scripting-Problems under Windows
References: <4639D32B DOT 40607 AT marco DOT de> <Pine DOT GSO DOT 4 DOT 63 DOT 0705031024140 DOT 12789 AT access1 DOT cims DOT nyu DOT edu> <4639FAA4 DOT 10800 AT marco DOT de> <Pine DOT GSO DOT 4 DOT 63 DOT 0705031155090 DOT 12789 AT access1 DOT cims DOT nyu DOT edu> <463AD32B DOT 5080504 AT marco DOT de>
In-Reply-To: <463AD32B.5080504@marco.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com


Daniel Spannbauer wrote:
> Igor Peshansky wrote:
>   
>> On Thu, 3 May 2007, Daniel Spannbauer wrote:
>>
>>   
>>     
>>> Hello Igor,
>>> first of all Thanks for the answer.
>>>
>>> Igor Peshansky wrote:
>>>     
>>>       
>>>> On Thu, 3 May 2007, Daniel Spannbauer wrote:
>>>>
>>>>       
>>>>         
>>>>> Hello,
>>>>>
>>>>> we've build a Program for Cygwin to load some Firmware in some Hardware
>>>>> which is produced by us.
>>>>> The Firmwware is called file.tld. At the moment the USer has to open
>>>>> Cygwin, jumpd to the Path of the file.tld (for example: C:\Dokumente und
>>>>> Einstellungen\test\Eigene Dateien\tload) an run the program by "tload -l
>>>>> /dev/ttyS0 file.tld".
>>>>>
>>>>> This is very uncomfortable.
>>>>> Now I try to write a simple Batch-Script to do this automaticly, so you
>>>>> have just to douible-klick  on file.tld an the  Firmware is loaded over
>>>>> a predefined serial Line.
>>>>>
>>>>> The batch-Script looks as follows:
>>>>>
>>>>> LINE=/dev/ttyS0
>>>>> c:\Programme\cygwin\bin\bash -c "/bin/tload.exe -l %LINE% %1%"
>>>>>
>>>>> But this won't work couse "%1%" is still "C:\Dokumente und
>>>>> Einstellungen\test\Eigene Dateien\tload\file.tld" which isn't a cygwin-Path.
>>>>>         
>>>>>           
>>>> That's not even valid batch syntax.  You want
>>>>
>>>> set LINE=/dev/ttyS0
>>>> c:\Programme\cygwin\bin\bash -c "/bin/tload.exe -l %LINE% %1"
>>>>       
>>>>         
>>> Thats clear, I simply don't wrote it.
>>>
>>>     
>>>       
>>>>> So I cahnged the script as follows:
>>>>>
>>>>> LINE=/dev/ttyS0
>>>>> c:\Programme\cygwin\bin\bash -c "/bin/tload.exe -l %LINE% '/bin/cygpath -a -i %1%' "
>>>>>
>>>>> But this also don't work. couse "%1% has Double-Quots (") at first and
>>>>> last place.
>>>>>
>>>>> I think it is just a quoting-Problem.
>>>>> Any Ideas out there?
>>>>>         
>>>>>           
>>>> Yes.  Use single quotes.  For example, the below should work:
>>>>
>>>> set LINE=/dev/ttyS0
>>>> c:\cygwin\bin\bash -c '/bin/tload.exe -l %LINE% "`/bin/cygpath -a -i %1`"'
>>>>
>>>> (you need to quote the output of cygpath as well, as that may contain
>>>> spaces).
>>>>       
>>>>         
>>> Ok, that works. But the Output of cygpath is "/cygdrive/c/Dokumente und
>>> Einstellungen/test/Eigene Dateien/tload/file.tld".
>>> Seems that our Program, tload.exe, has a Problemwith Blanks in the
>>> File-Name :(
>>>     
>>>       
>> Well, the above code runs /bin/tload, not your tload.  FWIW, /bin/tload is
>> a machine load visualizer from the procps package.
>>
>> If you didn't forget to put double quotes around the invocation of
>> cygpath, your program should get the whole filename as one argument in
>> argv.  If even in that case your tload does not not like spaces in
>> filenames, that's probably a bug in your code.
>> 	Igor
>>   
>>     
>
> Its not a bug, its a Feature :)
> Linux also don't like Blanks in File-Names. So I think I have to put a
> Backslash bevor the Blanks.
> But how? With awk?
>
> Regards
>
> Daniel
>
>
>   

Ok, now the Batch looks as follows:

set PATH=C:\Programme\marco\cygwin\bin %PATH%
set LINE=/dev/ttyS0
c:\Programme\marco\cygwin\bin\bash -c '/bin/tload.exe -l %LINE% -I
/cygdrive/c:/Programme/marco/cygwin/usr/uti/include/tload -v SLOW=1
"`/bin/cygpath -a -i %1`"'
pause

With the Option -I set path to the Include-Files for Tload is set, but
it cat find the Includefiles. The tload needs also zcat, but this can't
also be found by tload.
Don't know whats broken here.

Regards

Daniel

-- 
Daniel Spannbauer                         Systembetreuung
marco Systemanalyse und Entwicklung GmbH  Tel   +49 8333 9233-27 Fax -11
Auf der Wies 8, D 87727 Babenhausen       Mobil +49 171 4033220
http://www.marco.de/                      Email ds AT marco DOT de
Geschäftsführer Martin Reuter             HRB 68255 Amtsgericht München


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019