Let winbind depend directly on libnet rather than through the ejs bindings.
[samba.git] / source4 / lib / appweb / ejs-2.0 / mpr / UNIX / mprFile.c
1 /**
2  *      @file   mprFile.c
3  *      @brief  File services for Unix
4  *      @overview 
5  *      @remarks 
6  *              See mprGenFile.c for other file services.
7  */
8
9 /******************************************************************************/
10 /*
11  *      @copy   default
12  *      
13  *      Copyright (c) Mbedthis Software LLC, 2003-2006. All Rights Reserved.
14  *      
15  *      This software is distributed under commercial and open source licenses.
16  *      You may use the GPL open source license described below or you may acquire 
17  *      a commercial license from Mbedthis Software. You agree to be fully bound 
18  *      by the terms of either license. Consult the LICENSE.TXT distributed with 
19  *      this software for full details.
20  *      
21  *      This software is open source; you can redistribute it and/or modify it 
22  *      under the terms of the GNU General Public License as published by the 
23  *      Free Software Foundation; either version 2 of the License, or (at your 
24  *      option) any later version. See the GNU General Public License for more 
25  *      details at: http://www.mbedthis.com/downloads/gplLicense.html
26  *      
27  *      This program is distributed WITHOUT ANY WARRANTY; without even the 
28  *      implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
29  *      
30  *      This GPL license does NOT permit incorporating this software into 
31  *      proprietary programs. If you are unable to comply with the GPL, you must
32  *      acquire a commercial license to use this software. Commercial licenses 
33  *      for this software and support services are available from Mbedthis 
34  *      Software at http://www.mbedthis.com 
35  *      
36  *      @end
37  */
38
39 /********************************** Includes **********************************/
40
41 #include        "mpr.h"
42
43 /************************************ Code ************************************/
44
45 int mprGetFileInfo(MprCtx ctx, const char *path, MprFileInfo *info)
46 {
47         struct stat     s;
48
49         mprAssert(path);
50         mprAssert(info);
51
52         if (stat(path, &s) < 0) {
53                 return -1;
54         }
55
56         info->size = s.st_size;
57         info->ctime = s.st_ctime;
58         info->mtime = s.st_mtime;
59         info->inode = s.st_ino;
60         info->isDir = (s.st_mode & S_IFDIR) != 0;
61         info->isReg = (s.st_mode & S_IFREG) != 0;
62
63         if (strcmp(path, "/dev/null") == 0) {
64                 info->isReg = 0;
65         }
66
67         return 0;
68 }
69  
70 /******************************************************************************/
71
72 int mprMakeDir(MprCtx ctx, const char *path, int perms)
73 {
74         return mkdir(path, perms);
75 }
76  
77 /******************************************************************************/
78 /*
79  * Local variables:
80  * tab-width: 4
81  * c-basic-offset: 4
82  * End:
83  * vim:tw=78
84  * vim600: sw=4 ts=4 fdm=marker
85  * vim<600: sw=4 ts=4
86  */