9Dh FL$NCAT file list with wildcards
Input
A register  - 1 to start catalogue and 0 to continue. Top bit set if sizes required.
B register  - Device: 0=A:,1=B:,2=C:,3=D:
X register  - Where to put the filename (leading byte count) .
UTW_S0+1  - Length of string at UTW_S1 (if top bit is set, filetype is in UTW_S0).
UTW_S0(msb)  - File type if top bit of S0+1 is set.
UTW_S1  - Points to match string.
UTW_S2  - n'th match required.
Output
A register  - file type found.
B register  - 1 if OPO, 2 if OPT or 0 otherwise.
UTW_S0  - contains no of bytes in the block file or number of records in the ODB file found (only if top bit of A was set).
Description

Gets the S2'th match of a wildcard file name in the list of the files on a device.

The match string can contain the wild card characters:

   *    match any number of any characters.
   +    match any 1 character.

It can also contain any of the following file extensions:

  • .ODB - text (database) files
  • .OPL - OPL procedures (text or object)
  • .DIA - CM/XP diary save files
  • .COM - Comms Link setup files
  • .PLN - Spreadsheet files
  • .PAG - Pager setup files
  • .NTS - Notepad files
  • .TY8-TYF - file types (88-8F)
  • .OPT - OPL procedures (text only)
  • .OPO - OPL procedures (object only)

Wild cards cannot be used in file extensions except * on its own so that "MAIN.*" will give all types of file called "MAIN".

"*.*" will give all files of all types.

If no file extension is supplied, .* will be assumed, so that "M*" will give all files of all types starting with "M".

Note that the file extension .OPL will match and file which has Text or object and .OPO and .OPT work in exactly the same way as .OPL.

If the top bit of UTW_S0+1 is set, it means that there is no extension in the filespec, but the file type to use is in UTW_S0.

Returns error 238 when there are no directory entries which match the string supplied.

If the top bit of A is set, returns sizes in UTW_S0.

See also FL$NCAT.

This call is not available on CM/XP machines.

Example The following procedure will provide a catalog of all saved CM/XP diary files that begin with "D".
        LDAA    #1              ;A=1 first time
        LDX     #MATCH
        LDAB    0,X
        STAB    UTW_S0+1:       ;length of match string
        INX
        STX     UTW_S1:         ;Point to match string
        LDAB    #MY_DEVICE      ;which device : 0 - 3 for A: to D:
        BRA     FIRST

LOOP:   LDX     #TEMP           ;print byte string in TEMP
        PSHX                    ;pass address to UT$DISP
        OS      UT$DISP
        ASCII   "%s"            ;leading byte count string
        DB      13,10           ; CR LF
        DB      0               ;terminator for format string

        CLRA                    ;A=0 on subsequent calls to FL$WCAT
FIRST:
        LDX     #TEMP           ;filenames placed in TEMP by FL$WCAT
        OS      FL$WCAT
        BCC     LOOP            ;repeat until error returned
        CMPB    #238            ;eof err means normal 
        BEQ     DONE
ERROR:  ...                     ;otherwise report error

DONE:   ...

MATCH:  ASCIC   "D*.DIA"
Errors 238 - No more entries (normal completion)

246 - no pack in slot
245 - bad or damaged pak in slot
243 - selected an invalid pak.
236 - Bad file name.