Easy. Check out your /usr/include/sys/stat.h file (usually in that location). The information you return and convert to octal contains information other than permissions. Within the stat.h file, are defined a number of S_IFxxx macros, one of which is S_IFREG. The value of this is 0100000 (octal #), so when you see 100775 what you should actually read that as is: "This is a regular file whose permissions are 775". If for instance your value was 120775, then you would have "A link whose permissions are 775". The value that universe returns in status<5> is the raw value so you have to pick off the parts you want.

If you simply want the permissions (lowest 3 bits) from this value, use

PERMS = BITAND(status<5>, 511)

which will return you simply 775 (in your instance). Using the #define values in stat.h you could create BITAND code to determine if you are looking at a link, a directory, a file, a character block device, etc.

Hope this helps!!
Glenn


At 12:30 PM 8/5/2004, you wrote:
When doing a status on a file in a program, attribute 5 gives the
permission's in decimal format so 33277 in decimal returns 100775 in octal.
Why doesn't it just return the 775 value and or what is the significance of
the 100?

thanks
paul



Paul Boroditsch
Computer Sciences Corporation
[EMAIL PROTECTED]


----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

"In the end, it all boils down to a big mess of 1's and 0's..." - unknown

Glenn M. Herbert - Development Engineer, DSEngine / Connectivity Group
[EMAIL PROTECTED], Westboro, Ma. 01581 (508) 599-7281
Ascential Software - Profit from Intelligent Information -------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to