filemode.bmx 392 B

12345678910111213141516171819
  1. ' filemode.bmx
  2. ' the following function converts the file mode to
  3. ' the standard unix permission bits string
  4. Function Permissions$(mode)
  5. local testbit,pos
  6. local p$="rwxrwxrwx"
  7. testbit=%100000000
  8. pos=1
  9. while (testbit)
  10. if mode & testbit res$:+mid$(p$,pos,1) else res$:+"-"
  11. testbit=testbit shr 1
  12. pos:+1
  13. wend
  14. return res
  15. End Function
  16. print Permissions$(filemode("filemode.bmx"))