Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/Access.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 2.8 KB
Line 
1'\"
2'\" Copyright (c) 1998-1999 Scriptics Corporation
3'\"
4'\" See the file "license.terms" for information on usage and redistribution
5'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6'\"
7'\" RCS: @(#) $Id: Access.3,v 1.9 2004/10/07 14:44:31 dkf Exp $
8'\"
9.so man.macros
10.TH Tcl_Access 3 8.1 Tcl "Tcl Library Procedures"
11.BS
12.SH NAME
13Tcl_Access, Tcl_Stat \- check file permissions and other attributes
14.SH SYNOPSIS
15.nf
16\fB#include <tcl.h>\fR
17.sp
18int
19\fBTcl_Access\fR(\fIpath\fR, \fImode\fR)
20.sp
21int
22\fBTcl_Stat\fR(\fIpath\fR, \fIstatPtr\fR)
23.SH ARGUMENTS
24.AS "struct stat" *statPtr out
25.AP char *path in
26Native name of the file to check the attributes of.
27.AP int mode in
28Mask consisting of one or more of R_OK, W_OK, X_OK and F_OK.  R_OK,
29W_OK and X_OK request checking whether the file exists and  has  read,
30write and  execute  permissions, respectively.  F_OK just requests
31checking for the existence of the file.
32.AP "struct stat" *statPtr out
33The structure that contains the result.
34.BE
35
36.SH DESCRIPTION
37.PP
38As of Tcl 8.4, the object-based APIs \fBTcl_FSAccess\fR and
39\fBTcl_FSStat\fR should be used in preference to \fBTcl_Access\fR and
40\fBTcl_Stat\fR, wherever possible.
41.PP
42There are two reasons for calling \fBTcl_Access\fR and \fBTcl_Stat\fR
43rather than calling system level functions \fBaccess\fR and \fBstat\fR
44directly.  First, the Windows implementation of both functions fixes
45some bugs in the system level calls.  Second, both \fBTcl_Access\fR
46and \fBTcl_Stat\fR (as well as \fBTcl_OpenFileChannelProc\fR) hook
47into a linked list of functions.  This allows the possibility to reroute
48file access to alternative media or access methods.
49.PP
50\fBTcl_Access\fR checks whether the process would be allowed to read,
51write or test for existence of the file (or other file system object)
52whose name is pathname.   If pathname is a symbolic link on Unix,
53then permissions of the file referred by this symbolic link are
54tested.
55.PP
56On success (all requested permissions granted), zero is returned.  On
57error (at least one bit in mode asked for a permission that is denied,
58or some other  error occurred), -1 is returned.
59.PP
60\fBTcl_Stat\fR fills the stat structure \fIstatPtr\fR with information
61about the specified file.  You do not need any access rights to the
62file to get this information but you need search rights to all
63directories named in the path leading to the file.  The stat structure
64includes info regarding device, inode (always 0 on Windows),
65privilege mode, nlink (always 1 on Windows), user id (always 0 on
66Windows), group id (always 0 on Windows), rdev (same as device on
67Windows), size, last access time, last modification time, and creation
68time.
69.PP
70If \fIpath\fR exists, \fBTcl_Stat\fR returns 0 and the stat structure
71is filled with data.  Otherwise, -1 is returned, and no stat info is
72given.
73
74.SH KEYWORDS
75stat, access
76
Note: See TracBrowser for help on using the repository browser.