[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gbs3 fails with ://


Did you add th code that convert : to lf ?

That's terrible

Why not just echo -e "line 1\nline 2" ?


So a colon cannot be used in any pipe text to GBS unless you want line
feeds?

On Thu, 25 Apr 2024, 03:07 Brian G, <brian@xxxxxxxxxxxxxxxx> wrote:

>
> On 4/23/24 04:04, Bruce Steers wrote:
>
>
>
> On Tue, 23 Apr 2024 at 00:45, Brian G <brian@xxxxxxxxxxxxxxxx> wrote:
>
>>
>> On 4/22/24 16:28, Brian G wrote:
>>
>>
>> On 4/21/24 21:05, Bruce Steers wrote:
>>
>>
>>
>> On Mon, 22 Apr 2024 at 04:58, Bruce Steers <bsteers4@xxxxxxxxx> wrote:
>>
>>> This has bugged me a few times.
>>> using file:// or http:// the : turns into a linefeed when gbs3 is piped
>>> Is it me doing something wrong or is it a bug?
>>>
>>> echo 'Print "http//www.there"'| gbs3
>>> http//www.there
>>>
>>> echo 'Print "http://www.there";'| gbs3
>>> # Gambas Project File 3.0
>>> Title=Gambas Script
>>> Startup=MMain
>>> Vendor=Ordinary
>>> Version=0.0.1
>>> License=General Public License 2.0
>>>
>>> # Gambas module file : MMain:4:2: Non terminated string
>>>
>>>     1 :' Gambas module file
>>>     2 :
>>>     3 :Public Sub main()
>>>     4*:Print "http
>>> //www.there"
>>>         ^ Non terminated string
>>>     5 :End
>>>     6 :
>>>     7 :
>>>
>>> Respects
>>> BruceS
>>>
>> Aah i discovered this...
>> echo 'Print "file://www.there"'| gbs3 -
>>
>> works okay if i add the dash -
>>
>> I'll use the dash if i need it :)
>>
>> Respects
>>
>>
>> try
>>
>> echo 'print "https"&chr(58)&"//www.endofworld"' | gbs3
>>
>> Yes it is a bug I guess!
>>
>> --
>> ~~~~ Brian
>>
>> Yes the - causes it to read the stdin as if it were as file until eof
>> and process it that way.
>> --
>> ~~~~ Brian
>>
>> I have a fix, not sure how valid it is...
>
> A slight change in the _call() method of ParseArgs.class
>  Ie.
> The loop now goes from 0 To aArgs.Max not 1 To aArgs.Max to still function
> if there are no args
> if no args it checks Lof(File.In) to see if there's data and add the - arg
> if yes.
>
> Public Function _Call(c As Context, aArgs As String[]) As String
>   Dim I As Integer
>   Dim sApp As String
>   Dim index As Variant
>   If File.Name(aArgs[0]) = "gbw" & System.version Then c.$bWebPage = True
>   For I = 0 To aArgs.Max
>   If I = 0 Then
>     If aArgs.Count = 1 And If Lof(File.In) Then ' if there are no args but
> there is data waiting in stdin
>       aArgs.Add("-")
>       Goto gStdIn
>       Break
>     Else
>       Continue
>     Endif
>   Endif
> Respects
> BruceS
>
>
>
> echo "for i as integer = 0 to 3 : print i : next"| gbs3
> 0
> 1
> 2
> 3
> $ echo "for i as integer = 0 to 3 : print i : next"| gbs3 -
> # Gambas Project File 3.0
> Title=Gambas Script
> Startup=MMain
> Vendor=Ordinary
> Version=0.0.1
> License=General Public License 2.0
>
> # Gambas module file : MMain:4:28:'
>
>     1 :' Gambas module file
>     2 :
>     3 :Public Sub main()
>     4*:for i as integer = 0 to 3 : print i : next
>                                   ^ Unexpected ':'
>     5 :End
>     6 :
>     7 :
>
> --
> ~~~~ Brian
>
>

Follow-Ups:
Re: gbs3 fails with ://Tim Dickson <dickson.tim@xxxxxxxxxxxxxx>
References:
gbs3 fails with ://Bruce Steers <bsteers4@xxxxxxxxx>
Re: gbs3 fails with ://Bruce Steers <bsteers4@xxxxxxxxx>
Re: gbs3 fails with ://Brian G <brian@xxxxxxxxxxxxxxxx>
Re: gbs3 fails with ://Brian G <brian@xxxxxxxxxxxxxxxx>
Re: gbs3 fails with ://Bruce Steers <bsteers4@xxxxxxxxx>
Re: gbs3 fails with ://Brian G <brian@xxxxxxxxxxxxxxxx>