home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxlb.zip / SAMPLES / EALIST.CMD < prev    next >
OS/2 REXX Batch file  |  1993-01-08  |  2KB  |  57 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* EALIST: Example of using REXXLIB's DOSEALIST function. Lists all          */
  4. /* extended attributes of a specified file.                                  */
  5. /*                                                                           */
  6. /* Requires REXXLIB (dosealist & doseasize functions)                        */
  7. /*                                                                           */
  8. /* Command format: EALIST <filename>                                         */
  9. /*                                                                           */
  10. /*****************************************************************************/
  11.  
  12. types. = ''
  13. types.FFFE      = "length-preceeded binary"
  14. types.FFFD      = "length-preceeded ASCII"
  15. types.FFFB      = "length-preceeded bitmap"
  16. types.FFFA      = "length-preceeded metafile"
  17. types.FFF9      = "length-preceeded icon"
  18. types.FFEE      = "length-preceeded ASCII"
  19. types.FFDF      = "multi-valued, multi-typed field"
  20. types.FFDE      = "multi-valued, single-typed field"
  21. types.FFDD      = "ASN.1 field"
  22.  
  23. say ''
  24. parse arg file
  25. if file = '' then do
  26.     say 'File name not specified.'
  27.     exit
  28.     end
  29.  
  30. file = strip(file)
  31.  
  32. say file 'has' doseasize(file) 'bytes of extended attributes.'
  33. i = dosealist(file, "name.", "value.", "flags.")
  34. if i > 0 then do
  35.     say 'There are' i "extended attributes of" file':'
  36.     say ''
  37.     do j = 1 to i
  38.         type = "Unspecified."
  39.         /* check for special types */
  40.         if length(value.j) >= 4 then do
  41.             btype = c2x(reverse(left(value.j, 2)))
  42.             if types.btype \= '' then do
  43.                 type = types.btype
  44.                 length.j = c2d(reverse(substr(value.j, 3, 2)))
  45.                 value.j = substr(value.j, 5, length.j)
  46.                 end
  47.             end
  48.         value = left(value.j, min(60, length(value.j)))
  49.         if verify(value, xrange('20'x, '7e'x)) \= 0 then
  50.             value = c2x(left(value, min(30, length(value.j))))
  51.         say "Name:" name.j '' "Flags:" c2x(flags.j) '' "Type:" type
  52.         say "  Value:" value
  53.         end
  54.     end
  55. else
  56.     say "Dosealist failed, rc =" i "on '"file"'"
  57.