Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
26 #include <sys/errno.h>
29 #define MAXPATHLEN 260 /* E32STD.H: KMaxFullName + 4 to avoid data loss */
35 EXPORT_C DIR* opendir(const char* _path)
37 wchar_t _wpath[MAXPATHLEN+1];
39 if (mbstowcs(_wpath, _path, MAXPATHLEN) == (size_t)-1)
44 return _opendir_r(&errno, _wpath);
48 A wide-character version of opendir()
50 EXPORT_C WDIR* wopendir(const wchar_t* _wpath)
57 return (WDIR*)_opendir_r(&errno, _wpath);
60 EXPORT_C struct dirent* readdir(DIR* dp)
62 return _readdir_r(&errno, dp);
65 EXPORT_C struct wdirent* wreaddir(WDIR* wdp)
72 return _wreaddir_r(wdp);
76 Sets the position (associated with the directory stream that dirp points to)
77 to the beginning of the directory.
78 Additionally, it causes the directory stream to refer to the current state of
79 the corresponding directory.
81 EXPORT_C void wrewinddir(WDIR* wdp)
86 EXPORT_C void rewinddir(DIR* dp)
88 WDIR* wdp = (__EPOC32_DIR*)dp;
93 closes the directory stream that dirp refers to.
94 The memory associated with the directory stream is released.
95 When this function returns, the value of dirp no longer point to
96 an accessible object of type DIR
99 EXPORT_C int wclosedir(WDIR* wdp)
101 return _wclosedir_r(&errno,wdp);
104 EXPORT_C int closedir(DIR* dp)
112 WDIR* wdp = (__EPOC32_DIR*)dp;
113 return wclosedir(wdp);
117 sets the position of the next readdir() operation on the directory
118 stream specified by dp to the position specified by index.
121 EXPORT_C void wseekdir(WDIR* wdp, off_t index)
131 EXPORT_C void seekdir(DIR* dp, long index)
133 WDIR* wdp = (__EPOC32_DIR*)dp;
134 wseekdir(wdp, index);
138 EXPORT_C off_t wtelldir(const WDIR* wdp)
153 Returns the current location associated with the directory stream dir.
155 EXPORT_C long telldir(DIR* dp)
157 WDIR* wdp = (__EPOC32_DIR*)dp;
158 return (long)wtelldir(wdp);