Code: Select all
Structure stat64
st_dev.w ; /* ID of device containing file */
st_mode.i ; /* Mode of file */
st_nlink.i ; /* Number of hard links */
st_ino.w ; /* File serial number */
st_uid.i ; /* User ID of the file */
st_gid.i ; /* Group ID of the file */
st_rdev.i ; /* Device ID */
st_atimespec.q ; /* time of last access */
st_mtimespec.q ; /* time of last data modification */
st_ctimespec.q ; /* time of last status change */
st_birthtimespec.q ; /* time of file creation(birth) */
st_size.i ; /* file size, in bytes */
st_blocks.i ; /* blocks allocated for file */
st_blksize.i ; /* optimal blocksize for I/O */
st_flags.i ; /* user defined flags for file */
st_gen.i ; /* file generation number */
st_lspare.i ; /* RESERVED: DO NOT USE! */
st_qspare.q[2] ; /* RESERVED: DO NOT USE! */
EndStructure
Structure passwd
pw_name.s ; /* user name */
pw_passwd.s ; /* encrypted password */
pw_uid.i ; /* user uid */
pw_gid.i ; /* user gid */
pw_change.i ; /* password change time */
pw_class.s ; /* user access class */
pw_gecos.s ; /* Honeywell login info */
pw_dir.s ; /* home directory */
pw_shell.s ; /* default shell */
pw_expire.i ; /* account expiration */
pw_fields.i ; /* internal: fields filled in */
EndStructure
;ImportC "/usr/lib/libc.dylib"
; stat.l(s.s, *buf)
; getpwuid(*uid)
;EndImport
buf.stat64
*pwd.passwd
; place your own path to file/folder here
err.l=stat_("/Users/riveraa/Library",@buf)
Debug buf\st_uid ; USER ID of file's owner
Debug buf\st_gid ; GROUP ID with rights to file
*pwd=getpwuid_(buf\st_uid) ; pass uid to function
Debug *pwd\pw_name ; user's shortname
Debug *pwd\pw_uid ; confirms correct uid
AIR.
Edit: Realized that the ImportC block wasn't needed because the api functions are accessible without them. Calls have been modified accordingly...