Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.tools > #20

Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor)

From "A.D. Fundum" <what.ever@neverm.ind>
Message-ID <o8uYFJ3iqTdG-pn2-9dlCE1rTjZYh@localhost> (permalink)
Newsgroups comp.os.os2.programmer.misc, comp.os.os2.apps, comp.os.os2.programmer.tools
Subject Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor)
References (1 earlier) <o8uYFJ3iqTdG-pn2-lddw7WF8YUTz@localhost> <o8uYFJ3iqTdG-pn2-dKTjwP0UB8sB@localhost> <97c9mpF42tU1@mid.uni-berlin.de> <o8uYFJ3iqTdG-pn2-l1zCrydyidcP@localhost> <cSWxyCWhUBcp-pn2-ukwFVnsMMr19@localhost>
Organization News-Service.com
Date 2011-07-24 12:23 +0200

Cross-posted to 3 groups.

Show all headers | View raw


 >> (DosFindNext returns the correct case, so SysFileTree may
 >> work as well for REXX.)

Rexx version, if needed also with more than a single underlying 
DosFind*-call:

--

/* PrintDir.CMD */

CALL RxFuncAdd 'SysDriveMap','RexxUtil','SysDriveMap'
CALL RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'

ARG argv

IF Left(argv,1)='"' THEN PARSE VAR argv '"' argv '"' .

here=Directory()
drive=Left(Directory(),2)

IF Arg()>1 THEN DO
   SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
   EXIT 1
END

IF Arg()=1 THEN DO
   IF Length(argv)<>2 THEN DO
      SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
      EXIT 1
   END

   IF argv<'A:' | argv>'Z:' | Right(argv,1)<>':' THEN DO
      SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
      EXIT 1
   END
   drive=argv
END

IF Pos(drive,SysDriveMap('A:'),1)=0 THEN DO
   SAY 'SYS0021: The drive is not ready.' 
   RETURN 1
   EXIT
END

fullpath=Directory(drive)
CALL Directory here
IF Length(fullpath)>3 THEN DO
   count=0
   DO i=1 TO CountStr('\',fullpath)+1
      PARSE VAR fullpath part.i '\' fullpath
      count=count+1
   END i
   fullpath=part.1
   DO i=2 TO count
      rc=SysFileTree(fullpath||'\'||part.i,'DIRS.','DO')      
      IF rc=2 THEN DO
         SAY 'SysFileTree() error: rc='||rc
         EXIT 1
      END
      IF dirs.0<>1 THEN DO
         SAY 'Error: directory' part.i 'not found'
         EXIT 1
      END
      fullpath=fullpath||'\'||FileSpec('N',dirs.1)
   END i
END

IF Length(fullpath)<3 THEN DO
   SAY "Error: unexpected number of characters ("||Length(fullpath),
       ||") in" fullpath
   EXIT 1
END

SAY fullpath

EXIT

Back to comp.os.os2.programmer.tools | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Force gnu assembler to invoke the preprocessor Marcel Müller <news.5.maazl@spamgourmet.org> - 2011-06-19 12:28 +0200
  Re: Force gnu assembler to invoke the preprocessor "A.D. Fundum" <what.ever@neverm.ind> - 2011-06-19 15:42 +0200
    Re: Force gnu assembler to invoke the preprocessor "A.D. Fundum" <what.ever@neverm.ind> - 2011-07-03 16:46 +0200
      DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor) Andreas Schnellbacher <aschn@despammed.com> - 2011-07-04 00:44 +0200
        Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor) "A.D. Fundum" <what.ever@neverm.ind> - 2011-07-04 11:09 +0200
          Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor) "A.D. Fundum" <what.ever@neverm.ind> - 2011-07-21 22:54 +0200
            Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor) "A.D. Fundum" <what.ever@neverm.ind> - 2011-07-24 12:23 +0200
            Re: DosQueryPathInfo with correct case (was: Force gnu assembler to invoke the preprocessor) "A.D. Fundum" <what.ever@neverm.ind> - 2011-07-24 12:32 +0200
  Re: Force gnu assembler to invoke the preprocessor Dave Yeo <dave.r.yeo@gmail.com> - 2011-06-19 11:24 -0700

csiph-web