English Amiga Board


Go Back   English Amiga Board > Support > support.AmigaOS

 
 
Thread Tools
Old 05 December 2023, 18:16   #1
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 370
VERSION test for EXACT version only?

Hi,
I currently have some issues with the VERSION command and its capability to test for a specific version.

As far as I understand it, it is not possible to test for an exact version only. Since it will return 0 when the version is equal or greater, or it will return 5 otherwise.

Lets use the IPrefs.pch from MMULib as example, which bumps the version number of an WB 3.1 IPrefs from 40.7 to 40.8.

Normal something like this would work:
Code:
VERSION >NIL: C:IPrefs 40 REVISION 7
IF NOT WARN
  "Correct Version. Patch it."
ELSE
  "Wrong Version. Do nothing" 
ENDIF
My problem is, that this would work after the file was patched because the number is greater. And I can't use this code on a higher WB version because the IPrefs version already would be higher.
It becomes even more annoying when I want to test for a version and the update uses a lower version number. For example the RAR client in XAD, the included one is v2.5, the updated/better one is v1.7.

So, I'm basically looking for a way to test for a specific version only and then do something. And I don't want to nest up multiple checks to accomplish that.

My only idea would be to redirect the output of VERSION to a file and then use something like SEARCH to test for the exact version.
Or use some third party commands to get the version into a variable and then test that.
EctoOne is offline  
Old 05 December 2023, 18:34   #2
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
What about something like :
Code:
if "`version c:iprefs`" eq "iprefs 40.7"
  "Correct Version. Patch it."
else
  "Wrong Version. Do nothing" 
endif
meynaf is offline  
Old 05 December 2023, 19:24   #3
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 370
I was looking at DoVer which has something similar to LFORMAT and can be set to just the version number. But that only works for DoVer's function to write the output as filenote. The STDOUT still contains the filename, but I thought of using that like you did.
Good to see that I don't need an extra tool for that. It's still a bit annoying that I have to input the filename, but I guess it's the best I can get. Thanks.
EctoOne is offline  
Old 05 December 2023, 22:23   #4
CebollinO
Registered User
 
CebollinO's Avatar
 
Join Date: Oct 2023
Location: Castel Goffredo / Mantova / Italy
Posts: 34
If it can help you, I use this in my theme:

Version exec.library version 47 >NIL:
If Warn
echo "*e[>1m*e[32;41m*e[0;20H*e[J"
echo "-------------------------------------------------------------"
echo "Kickstart 3.2 and AmigaOS 3.2x are required for this to work."
echo "-------------------------------------------------------------"
CebollinO is offline  
Old 06 December 2023, 00:11   #5
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 370
I appreciate it but it is not good enough for my current project to detect the Kickstart version.
The solution from menynaf seems to work fine for now.
EctoOne is offline  
Old 06 December 2023, 11:12   #6
CebollinO
Registered User
 
CebollinO's Avatar
 
Join Date: Oct 2023
Location: Castel Goffredo / Mantova / Italy
Posts: 34
Quote:
Originally Posted by EctoOne View Post
I appreciate it but it is not good enough for my current project to detect the Kickstart version.
The solution from menynaf seems to work fine for now.

Is only an example how to use "Version".
CebollinO is offline  
Old 06 December 2023, 14:10   #7
DisasterIncarna
Registered User
 
DisasterIncarna's Avatar
 
Join Date: Oct 2021
Location: England
Posts: 1,180
i tried this

Code:
.KEY FILE
IF Exists <FILE>
  SET VERSION `VERSION <FILE>`
  Failat 21
  SKIP >NIL: "$VERSION"
  Failat 20
Else
  Echo "Need a Valid File To Check..."
Endif

; Do Something When Specific Version Found
LAB "IPrefs 40.7"
  Echo "Found 40.7"
  SKIP END
LAB "IPrefs 47.29"
  Echo "Found 47.29"
  SKIP END
LAB "UNKNOWN"
; Do Something When No Matching Version Found
Echo "Unexpected Version Found..."

LAB END
Echo ""
Saved this as C:VERTEST, so i can call something like

VERTEST C:IPREFS

when it finds 1 specific version, it will do what you want, if it finds another specific version you can again do whatever, i have a LAB for an unexpected/unspecified result but i am not sure how to skip to it, the method i used is to SKIP to the version number, if that version has no corresponding LAB then a failcode 10 occurs, i assumed adding a SKIP "UNKNOWN" directly under SKIP >NIL: "$VERSION" that would have the script move to LAB "UNKNOWN" however it doesnt seem to do that and just runs to the end of the script doing nothing, so i have messed up something simple most likely.
DisasterIncarna is online now  
Old 06 December 2023, 18:40   #8
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 370
Looks interesting. I probably would use something similar if we could create functions in shell scripts like in a bash script. I mean I could create a temporary script file somewhere in PATH to simulate that, but I think it would be overkill.
I have already scrapped the project where I needed this, but I still think I might use in an older project. And if I remember correctly, I never had the need to detect more than two different versions of the same file. Which is why menynafs solution would also be more compact.
But yeah, thanks for the input.
EctoOne is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Necronom - Amiga - Test Version? miga support.Games 10 20 March 2024 14:12
Test Drive II: Whdload version including the Germany scenery disk? emuola project.WHDLoad 3 14 March 2020 18:38
-Test Drive III Amiga version Drummerboy support.Games 6 01 May 2011 02:44
CDTV CD drive version test request Toni Wilen request.Other 2 04 November 2007 14:57
Old version number? [GameBase version vs. GBA version + misc. questions] wanderer project.GameBase Amiga 5 23 August 2007 00:51

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07578 seconds with 13 queries