This should be something that somebody has already done....

Does any body have a perl script that does "lsflags" -- the inverse of
cflags?  [I want to be able to display the values for both mode and flags
for any given file. Preferrably in symbolic form rather than strickly 
numeric chmod form.]

Stat apparently only returns 13 elements even though the stat structure
contains 4 additional ones:
#         u_int32_t st_flags;             /* user defined flags for file */
#         u_int32_t st_gen;               /* file generation number */
#         int32_t   st_lspare;
#         int64_t   st_qspare[2];

>From what I can tell "st_flags" is where the HFS+ file system stores the 
"immutable" flags and the like (the lock box which only shows up under
get-info). 

Also from /usr/include/sys/stat.h:
/*
 * Definitions of flags stored in file flags word.
 *
 * Super-user and owner changeable flags.
 */
#define UF_SETTABLE     0x0000ffff      /* mask of owner changeable flags
*/
#define UF_NODUMP       0x00000001      /* do not dump file */
#define UF_IMMUTABLE    0x00000002      /* file may not be changed */
#define UF_APPEND       0x00000004      /* writes to file may only append
*/
#define UF_OPAQUE       0x00000008      /* directory is opaque wrt. union
*/
/*
 * Super-user changeable flags.
 */
#define SF_SETTABLE     0xffff0000      /* mask of superuser changeable
flags */
#define SF_ARCHIVED     0x00010000      /* file is archived */
#define SF_IMMUTABLE    0x00020000      /* file may not be changed */
#define SF_APPEND       0x00040000      /* writes to file may only append
*/

-- 
T.T.F.N.
William H. Magill                          Senior Systems Administrator
Information Services and Computing (ISC)   Networking & Telecommunications
University of Pennsylvania                 
[EMAIL PROTECTED]                       [EMAIL PROTECTED]
http://www.isc-net.upenn.edu/~magill/      [EMAIL PROTECTED]

Reply via email to