home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!gatech!europa.asd.contel.com!darwin.sura.net!convex!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: stat.pl query
- Message-ID: <1992Jul28.173304.27422@news.eng.convex.com>
- Originator: tchrist@pixel.convex.com
- Keywords: PERL
- Sender: usenet@news.eng.convex.com (news access account)
- Nntp-Posting-Host: pixel.convex.com
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: CONVEX Realtime Development, Colorado Springs, CO
- References: <1992Jul28.171317.22804@rdg.dec.com>
- Date: Tue, 28 Jul 1992 17:33:04 GMT
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 38
-
- From the keyboard of stuart@ds3100.new.dec.com (Stuart Broderick):
- :Probably a stupid question, but....
- :
- :The following script is using stat.pl to determine the mode of a file
- :using stat.pl.
- :
- :#! /usr/local/bin/perl
- :require 'stat.pl';
- :do Stat('./test');
- :print $st_mode,"\t",$st_uid,"\t",$st_gid,"\n";
- :
- :When this runs, I get
- :
- :st_mode st_uid st_gid
- :33224 1103 100
- :
- :When I do a "ls -lag ./test", I get
- :
- :-rwx--x--- 1 stuart espo 286720 Jul 28 17:56 ./test
- :
- :The username and group are correct (st_uid, st_gid), but what does
- :st_mode relate to ?
- :I expected it to give 0710.
- :
- :Can anyone tell me what I've done wrong ? I'm looking for a numeric
- :representation of
- :the permissions field.
-
- You should check the stat(2) man page. mode contains both inode type and
- permissions. usually you &= 07777 to get just the permissions, which you
- then may want to print out with a %04o printf mask.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- echo $package has manual pages available in source form.
- echo "However, you don't have nroff, so they're probably useless to you."
- --Larry Wall in Configure from the perl distribution
-