Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #6244 > unrolled thread
| Started by | Kevin Wells <kev@kevsoft.co.uk> |
|---|---|
| First post | 2021-01-20 20:58 +0000 |
| Last post | 2021-02-01 12:21 +1300 |
| Articles | 9 — 7 participants |
Back to article view | Back to comp.sys.acorn.programmer
Better way to check for wget Kevin Wells <kev@kevsoft.co.uk> - 2021-01-20 20:58 +0000
Re: Better way to check for wget Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> - 2021-01-22 12:15 +0000
Re: Better way to check for wget Kevin Wells <kev@kevsoft.co.uk> - 2021-01-25 14:23 +0000
Re: Better way to check for wget Jonathan Harston <jgh@mdfs.net> - 2021-01-31 04:23 -0800
Re: Better way to check for wget Theo <theom+news@chiark.greenend.org.uk> - 2021-01-22 13:49 +0000
Re: Better way to check for wget Sprow <news@sprow.co.uk> - 2021-01-22 10:20 -0800
Re: Better way to check for wget Kevin Wells <kev@kevsoft.co.uk> - 2021-01-25 14:24 +0000
Re: Better way to check for wget "John Williams (News)" <UCEbin@tiscali.co.uk> - 2021-01-25 17:12 +0000
Re: Better way to check for wget Ronald <gettingchoppy@gmail.com> - 2021-02-01 12:21 +1300
| From | Kevin Wells <kev@kevsoft.co.uk> |
|---|---|
| Date | 2021-01-20 20:58 +0000 |
| Subject | Better way to check for wget |
| Message-ID | <d253f5f158.Kevin@Kevsoft> |
Hi I use wget in a few of my applications and the check I use to see if wget is present is in the !Run file: If "<Wget$Dir>"= "" THEN Error error message. One of my users has wget in their Libary directory inside !Boot so my check fails to spot wget and they get that error. Is their a better way to check for wget, either in the !Run obey file or in the main application file in BASIC to check for wget? Thanks. -- Kev Wells http://kevsoft.co.uk/ https://ko-fi.com/kevsoft carpe cervisium Useless Fact 02 In the artic the sun sometimes appears to be square.
[toc] | [next] | [standalone]
| From | Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> |
|---|---|
| Date | 2021-01-22 12:15 +0000 |
| Message-ID | <TrydnZhlbaR8XJf9nZ2dnUU7-XvNnZ2d@giganews.com> |
| In reply to | #6244 |
On 20/01/2021 20:58, Kevin Wells wrote:
[...]
> Is their a better way to check for wget, either in the !Run obey file or
> in the main application file in BASIC to check for wget?
[As well as the current method of checking for a system variable]
Off the top of my head, something along the lines of:
IfThere "<Boot$Dir>.Library.wget" then Set <MyApp$WGet>
If "<Wget$Dir>" <> "" THEN Set <MyApp$WGet>
If "<MyApp$Wget>" = "" THEN Error message
Not sure how sensible that is, TBH, having never needed to do something
similar. (And not having a RISC OS machine switched on to check. e.g. is
there a specific variable used for the library directory? Any other
locations it could potentially be squirrelled away in? etc.)
--
Vince M Hudd - Soft Rock Software - www.softrock.co.uk
RISCOSitory - www.riscository.com
[toc] | [prev] | [next] | [standalone]
| From | Kevin Wells <kev@kevsoft.co.uk> |
|---|---|
| Date | 2021-01-25 14:23 +0000 |
| Message-ID | <ac5664f458.Kevin@Kevsoft> |
| In reply to | #6249 |
In message <TrydnZhlbaR8XJf9nZ2dnUU7-XvNnZ2d@giganews.com>
Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> wrote:
>On 20/01/2021 20:58, Kevin Wells wrote:
>
>[...]
>
>> Is their a better way to check for wget, either in the !Run obey file or
>> in the main application file in BASIC to check for wget?
>
>[As well as the current method of checking for a system variable]
>
>Off the top of my head, something along the lines of:
>
>IfThere "<Boot$Dir>.Library.wget" then Set <MyApp$WGet>
>If "<Wget$Dir>" <> "" THEN Set <MyApp$WGet>
>If "<MyApp$Wget>" = "" THEN Error message
Thanks for this, but Ronald May sent me an idea off list, that got me an
idea which I'm implementing in the application BASIC file rather than
the !Run file, in which I use X wget and send the log into the
applications scrap file and if the scrap file exist or not do what is
required.
>
>Not sure how sensible that is, TBH, having never needed to do something
>similar. (And not having a RISC OS machine switched on to check. e.g. is
>there a specific variable used for the library directory? Any other
>locations it could potentially be squirrelled away in? etc.)
>
--
Kev Wells
http://kevsoft.co.uk/ https://ko-fi.com/kevsoft
carpe cervisium
Useless Fact 03 You burn 3.5 calories each time you laugh.
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Harston <jgh@mdfs.net> |
|---|---|
| Date | 2021-01-31 04:23 -0800 |
| Message-ID | <8f7c89a2-6b23-4ff6-bd36-25d91a525c6dn@googlegroups.com> |
| In reply to | #6249 |
On Friday, 22 January 2021 at 12:15:36 UTC, Vince M Hudd wrote:
> Off the top of my head, something along the lines of:
> IfThere "<Boot$Dir>.Library.wget" then Set <MyApp$WGet>
> If "<Wget$Dir>" <> "" THEN Set <MyApp$WGet>
> If "<MyApp$Wget>" = "" THEN Error message
UnSet Wget$Ok
IfThere Run:wget Then Set Wget$Ok "Ok"
If "<Wget$Dir>" <> "" Then Set Wget$Ok "Ok"
If "<Wget$Ok>" = "" THEN Error message
would check for the presence of a runnable wget, but not a local wget
(eg in a module).
The better method would be for your application to just simply issue
a wget command and collect the error if it isn't found.
SYS "XOS_CLI","Wimp_Task wget "+parameters$ TO r0%;f%
IF (f% AND 1) THEN PROCreport("wget not available")
Don't pre-assume. Attempt the action and deal with the response.
"This is a BBC therefore there is no RealTimeClock" -> Wrong
"There is no RTC, therefore there is no RTC" -> Correct
jgh
[toc] | [prev] | [next] | [standalone]
| From | Theo <theom+news@chiark.greenend.org.uk> |
|---|---|
| Date | 2021-01-22 13:49 +0000 |
| Message-ID | <xoo*5xRay@news.chiark.greenend.org.uk> |
| In reply to | #6244 |
Kevin Wells <kev@kevsoft.co.uk> wrote: > Is their a better way to check for wget, either in the !Run obey file or > in the main application file in BASIC to check for wget? Perhaps something like: SYS "XWimp_StartTask", "wget -V" TO ;flags% IF (flags% AND 2) THEN ... I think you have to use Wimp_StartTask because if you use OS_CLI there's a risk of replacing your BASIC program with the wget application and being unable to return when it finishes. This is a check that wget is either somewhere on your Run$Path or an alias and can successfully execute - if you can run 'wget -V' you know you have a functioning program, whereas not being in an expected place is only one of the things that could go wrong. Theo
[toc] | [prev] | [next] | [standalone]
| From | Sprow <news@sprow.co.uk> |
|---|---|
| Date | 2021-01-22 10:20 -0800 |
| Message-ID | <a0838f64-717f-44bf-b505-a53dcefa4ee1n@googlegroups.com> |
| In reply to | #6250 |
On Friday, January 22, 2021 at 1:49:30 PM UTC, Theo wrote: > Kevin Wells <k...@kevsoft.co.uk> wrote: > > Is their a better way to check for wget, either in the !Run obey file or > > in the main application file in BASIC to check for wget? > Perhaps something like: > > SYS "XWimp_StartTask", "wget -V" TO ;flags% > IF (flags% AND 2) THEN ... There's a pecking order for how commands are searched for, if you were to use *wget then * Is it an alias? * Is it in a module? * Is it on Run$Path (which includes the library directory %)? If you only ever *Run wget that makes things easier because you don't need to worry about aliases or modules, and only Run$Path. Canonicalise (OS_FSControl 37) the name "wget" for "Run$Path,<Wget$Dir>." and see what you get back. Sprow.
[toc] | [prev] | [next] | [standalone]
| From | Kevin Wells <kev@kevsoft.co.uk> |
|---|---|
| Date | 2021-01-25 14:24 +0000 |
| Message-ID | <356d64f458.Kevin@Kevsoft> |
| In reply to | #6250 |
In message <xoo*5xRay@news.chiark.greenend.org.uk>
Theo <theom+news@chiark.greenend.org.uk> wrote:
>Kevin Wells <kev@kevsoft.co.uk> wrote:
>> Is their a better way to check for wget, either in the !Run obey file or
>> in the main application file in BASIC to check for wget?
>
>Perhaps something like:
>
>SYS "XWimp_StartTask", "wget -V" TO ;flags%
>IF (flags% AND 2) THEN ...
The trouble with that is it brings up the contents of wget -V in a
window that has to be closed.
Thanks for this, but Ronald May sent me an idea off list, that got me an
idea which I'm implementing in the application BASIC file rather than
the !Run file, in which I use X wget and send the log into the
applications scrap file and if the scrap file exist or not do what is
required.
>
>I think you have to use Wimp_StartTask because if you use OS_CLI there's a
>risk of replacing your BASIC program with the wget application and being
>unable to return when it finishes.
>
>This is a check that wget is either somewhere on your Run$Path or an alias
>and can successfully execute - if you can run 'wget -V' you know you have a
>functioning program, whereas not being in an expected place is only one of
>the things that could go wrong.
>
>Theo
--
Kev Wells
http://kevsoft.co.uk/ https://ko-fi.com/kevsoft
carpe cervisium
I am not an Alcoholic I am a Drunk. Alcoholics go to meetings.
[toc] | [prev] | [next] | [standalone]
| From | "John Williams (News)" <UCEbin@tiscali.co.uk> |
|---|---|
| Date | 2021-01-25 17:12 +0000 |
| Message-ID | <58f473d9b3UCEbin@tiscali.co.uk> |
| In reply to | #6252 |
In article <356d64f458.Kevin@Kevsoft>, Kevin Wells <kev@kevsoft.co.uk> wrote: > I'm implementing in the application BASIC file rather than > the !Run file, in which I use X wget and send the log into the > applications scrap file You could always send it to null by redirection. John
[toc] | [prev] | [next] | [standalone]
| From | Ronald <gettingchoppy@gmail.com> |
|---|---|
| Date | 2021-02-01 12:21 +1300 |
| Message-ID | <79acacf758.beeb@-.-> |
| In reply to | #6254 |
In message <58f473d9b3UCEbin@tiscali.co.uk>
"John Williams (News)" <UCEbin@tiscali.co.uk> wrote:
> In article <356d64f458.Kevin@Kevsoft>,
> Kevin Wells <kev@kevsoft.co.uk> wrote:
>
> > I'm implementing in the application BASIC file rather than
> > the !Run file, in which I use X wget and send the log into the
> > applications scrap file
>
> You could always send it to null by redirection.
>
> John
>
Yes
wget { > null: }
would quit with 'File 'wget not found'
It does run the binary to find out though.
OTH it will find an alias also.
Ifthere Run:wget Then Else Error wget not found
only works for something in the Runpath, but also gives the
option for alternative Error msg or alternative Else ...
IfThere Run:wget Then Else If "<Wget$Dir>" = "" Then wget { > null: }
only trys to run wget in the case of someone not using the
standard issue wget app, but fits in the RunPath check first.
Bordering on too many conditions for an Obey line, wasn't there
an IfNThere available once?
I think it is multiple Elses that lose their way.
Possibly the 'which' utility would be best, includes modules.
but we cant assume that it is installed.
Maybe it should be mandatory.
On a system with alias's possibly hidden away, the 'which' utility
can reduce confusion.
Only been looking at obey file options here
Ronald May
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.acorn.programmer
csiph-web