[mod.computers.vax] DCL function F$SEARCH

LEICHTER-JERRY@YALE.ARPA (05/13/86)

    [The following code works fine when P1 contains a wildcard, loops forever
    otherwise:]
    $LOOP:
    $   FILE = F$SEARCH(P1)
    $   IF FILE .EQS. "" THEN EXIT
    $   WRITE SYS$OUTPUT FILE
    $ GOTO LOOP
    
    Tim Pearson, Astronomy Dept, Caltech, Pasadena 91125, USA
Misfeature?  That's just the way it works - when there are no wildcards in the
argument, F$SEARCH resets itself immediately; you never get the null that
signals "no more arguments".  A workaround - ugly, but what can you do - is:

    $ PREVIOUS_FILE = ""
    $LOOP:
    $   FILE = F$SEARCH(P1)
    $   IF FILE .EQS. "" THEN EXIT
    $   WRITE SYS$OUTPUT FILE
    $   IF FILE .EQS. PREVIOUS_FILE THEN EXIT
    $   PREVIOUS_FILE = FILE
    $ GOTO LOOP
							-- Jerry
-------