Welcome, Guest. Please login or register.

Author Topic: Old school script gurus... where are you??  (Read 1800 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thomas

Re: Old school script gurus... where are you??
« on: December 26, 2013, 03:25:04 PM »
version >nil: version 36
if warn

else

endif


Edit: sorry, version version does not work with kick 1.3. Use version exec.library or version dos.library instead. Any library which is located in ROM and not on disk.

Edit2: now I remember the right solution: you just say version 36, but you have to use the 1.3 version of the version command.

So this is correct:

wb13:c/version >nil: 36
if warn

else

endif
« Last Edit: December 26, 2013, 03:57:06 PM by Thomas »
 

Offline Thomas

Re: Old school script gurus... where are you??
« Reply #1 on: December 26, 2013, 10:43:02 PM »
Version 36 is 2.0.

33 -> 1.2
34 -> 1.3
36 -> 2.0
37 -> 2.1
39 -> 3.0
40 -> 3.1
44 -> 3.5
45 -> 3.9
50 -> 4.0 (or MorphOS)

The command checks for version 36. If the version found is 36 or above, it returns 0 (OK), if the version is below 36, it returns 5 (WARN).

The return code can be checked by the if command:

5 = WARN
10 = ERROR
20 = FAIL
« Last Edit: December 26, 2013, 10:45:32 PM by Thomas »
 

Offline Thomas

Re: Old school script gurus... where are you??
« Reply #2 on: December 27, 2013, 10:23:39 PM »
The template for the version command is always the same:

VERSION filename version revision

All arguments are optional. If filename is given, the file is loaded and its version is determined. If version is given, the version found is checked against the given one and the return code is set accordingly. Revision likewise if you need more accurate checking than just the version number.

In 2.0 the command line handling has changed. All commands in 2.0 use the same new function of dos.library to handle arguments while in 1.3 each command has its own code to handle command lines.

The 1.3 version of the version command accepts a number as only argument and uses this as version.

The 2.0 version of the version command treats a single argument always as the file name. If you want to omit the file name and only check for a version, then you have to specify keywords. OTOH the 1.3 version does not accept keywords. That's why there is no common solution.

The command line to check the system's version in 2.0 is what I wrote in my first post:

version version 36

This does not check the version of the version command because 'version' in this case is used as a keyword. If you want to check the version of a file called version you have to enclose the file name in quotation marks so that it is not recognised as key word:

version "version" 36