\hypertarget{group__Evil__Unistd__Group}{\section{Unistd.\-h functions}
\label{group__Evil__Unistd__Group}\index{Unistd.\-h functions@{Unistd.\-h functions}}
}


This header provides functions ported from Unix in unistd.\-h.  


\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Evil__Unistd__Group_gac3dd34bf8535ef31b67981c7b2d6b285}{\#define \hyperlink{group__Evil__Unistd__Group_gac3dd34bf8535ef31b67981c7b2d6b285}{getcwd}(b, s)~\hyperlink{group__Evil__Unistd__Group_ga3a7e8de0f694e3f44d1760a2680b41ad}{evil\-\_\-getcwd}((b),(s))}\label{group__Evil__Unistd__Group_gac3dd34bf8535ef31b67981c7b2d6b285}

\begin{DoxyCompactList}\small\item\em Wrapper around \hyperlink{group__Evil__Unistd__Group_ga3a7e8de0f694e3f44d1760a2680b41ad}{evil\-\_\-getcwd()}. \end{DoxyCompactList}\item 
\hypertarget{group__Evil__Unistd__Group_ga5ecdf33dcbe17677f251c99743b545ce}{\#define \hyperlink{group__Evil__Unistd__Group_ga5ecdf33dcbe17677f251c99743b545ce}{pipe}(fds)~\hyperlink{group__Evil__Unistd__Group_gadbb68c1c2c5e30137d5a92a08bfdbf6d}{evil\-\_\-pipe}(fds)}\label{group__Evil__Unistd__Group_ga5ecdf33dcbe17677f251c99743b545ce}

\begin{DoxyCompactList}\small\item\em Wrapper around \hyperlink{group__Evil__Unistd__Group_gadbb68c1c2c5e30137d5a92a08bfdbf6d}{evil\-\_\-pipe()}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
double \hyperlink{group__Evil__Unistd__Group_ga618a57ccf0e29811e85de383ddb086cb}{evil\-\_\-time\-\_\-get} (void)
\begin{DoxyCompactList}\small\item\em Return the time spent since the Evil library has been initialized. \end{DoxyCompactList}\item 
int \hyperlink{group__Evil__Unistd__Group_ga5308edbce19b9f58c614de3184afee2a}{symlink} (const char $\ast$oldpath, const char $\ast$newpath)
\begin{DoxyCompactList}\small\item\em Create a shell link. \end{DoxyCompactList}\item 
ssize\-\_\-t \hyperlink{group__Evil__Unistd__Group_ga55b2cac4867b5c23c0cfa391ba95c215}{readlink} (const char $\ast$path, char $\ast$buf, size\-\_\-t bufsiz)
\begin{DoxyCompactList}\small\item\em Read value of a shell link. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{group__Evil__Unistd__Group_ga3a7e8de0f694e3f44d1760a2680b41ad}{evil\-\_\-getcwd} (char $\ast$buffer, size\-\_\-t size)
\begin{DoxyCompactList}\small\item\em Get the current directory. \end{DoxyCompactList}\item 
int \hyperlink{group__Evil__Unistd__Group_gaade6baa64ddc1f9f190ccdb73358541e}{evil\-\_\-sockets\-\_\-init} (void)
\begin{DoxyCompactList}\small\item\em Initiates the use of Windows sockets. \end{DoxyCompactList}\item 
void \hyperlink{group__Evil__Unistd__Group_ga64c9a315ea785ca30679c479a349d433}{evil\-\_\-sockets\-\_\-shutdown} (void)
\begin{DoxyCompactList}\small\item\em Shutdown the Windows socket system. \end{DoxyCompactList}\item 
int \hyperlink{group__Evil__Unistd__Group_gadbb68c1c2c5e30137d5a92a08bfdbf6d}{evil\-\_\-pipe} (int $\ast$fds)
\begin{DoxyCompactList}\small\item\em Create a pair of sockets. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This header provides functions ported from Unix in unistd.\-h. 

\subsection{Function Documentation}
\hypertarget{group__Evil__Unistd__Group_ga618a57ccf0e29811e85de383ddb086cb}{\index{Unistd.\-h functions@{Unistd.\-h functions}!evil\-\_\-time\-\_\-get@{evil\-\_\-time\-\_\-get}}
\index{evil\-\_\-time\-\_\-get@{evil\-\_\-time\-\_\-get}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{evil\-\_\-time\-\_\-get}]{\setlength{\rightskip}{0pt plus 5cm}double evil\-\_\-time\-\_\-get (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_ga618a57ccf0e29811e85de383ddb086cb}


Return the time spent since the Evil library has been initialized. 

\begin{DoxyReturn}{Returns}
The time spent since the Evil library has been initialized.
\end{DoxyReturn}
This function returns the time spent since the Evil library has been initialized. It uses a high-\/resolution timer and then can have a precision up to the nano-\/second. The precision is processor dependant. This function can be used to benchmark parts of code in with high precision.

Conformity\-: Not appliclable.

Supported O\-S\-: Windows X\-P, Windows C\-E. 

Referenced by ecore\-\_\-time\-\_\-get().

\hypertarget{group__Evil__Unistd__Group_ga5308edbce19b9f58c614de3184afee2a}{\index{Unistd.\-h functions@{Unistd.\-h functions}!symlink@{symlink}}
\index{symlink@{symlink}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{symlink}]{\setlength{\rightskip}{0pt plus 5cm}int symlink (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{oldpath, }
\item[{const char $\ast$}]{newpath}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_ga5308edbce19b9f58c614de3184afee2a}


Create a shell link. 


\begin{DoxyParams}{Parameters}
{\em oldpath} & The file name to be linked. \\
\hline
{\em newpath} & The file name to create. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 otherwise.
\end{DoxyReturn}
Create a shell link {\ttfamily newpath} to {\ttfamily oldpath} ({\ttfamily newpath} is the name of the file created, {\ttfamily oldpath} is the string used in creating the shell link).

On success, this function returns 0. Otherwise, it returns -\/1 and errno may be set to the following value\-:
\begin{DoxyItemize}
\item E\-N\-O\-M\-E\-M\-: Not enough memory.
\end{DoxyItemize}

On Windows, the symbolic links do not exist. Nevertheless shell links can be created. This function is named like the Unix function for portability reasons.

Conformity\-: None.

Supported O\-S\-: Windows X\-P, Windows C\-E. 

References evil\-\_\-char\-\_\-to\-\_\-wchar().

\hypertarget{group__Evil__Unistd__Group_ga55b2cac4867b5c23c0cfa391ba95c215}{\index{Unistd.\-h functions@{Unistd.\-h functions}!readlink@{readlink}}
\index{readlink@{readlink}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{readlink}]{\setlength{\rightskip}{0pt plus 5cm}ssize\-\_\-t readlink (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{char $\ast$}]{buf, }
\item[{size\-\_\-t}]{bufsiz}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_ga55b2cac4867b5c23c0cfa391ba95c215}


Read value of a shell link. 


\begin{DoxyParams}{Parameters}
{\em path} & The file name to be linked. \\
\hline
{\em buf} & The file name to create. \\
\hline
{\em bufsiz} & The size of the buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 otherwise.
\end{DoxyReturn}
Place the content of the shell link {\ttfamily path} in the buffer {\ttfamily buf}, which has size {\ttfamily bufzsiz}.

On success, this function returns 0. Otherwise, it returns -\/1 and errno may be set to the following value\-:
\begin{DoxyItemize}
\item E\-N\-O\-M\-E\-M\-: Not enough memory.
\end{DoxyItemize}

On Windows, the symbolic links do not exist. Nevertheless shell links can be managed. This function is named like the Unix function for portability reasons.

Conformity\-: None.

Supported O\-S\-: Windows X\-P, Windows C\-E. 

References evil\-\_\-char\-\_\-to\-\_\-wchar(), and evil\-\_\-wchar\-\_\-to\-\_\-char().

\hypertarget{group__Evil__Unistd__Group_ga3a7e8de0f694e3f44d1760a2680b41ad}{\index{Unistd.\-h functions@{Unistd.\-h functions}!evil\-\_\-getcwd@{evil\-\_\-getcwd}}
\index{evil\-\_\-getcwd@{evil\-\_\-getcwd}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{evil\-\_\-getcwd}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ evil\-\_\-getcwd (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{buffer, }
\item[{size\-\_\-t}]{size}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_ga3a7e8de0f694e3f44d1760a2680b41ad}


Get the current directory. 


\begin{DoxyParams}{Parameters}
{\em buffer} & Buffer to store the current directory. \\
\hline
{\em size} & Size of the buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The current directory.
\end{DoxyReturn}
On Windows desktop, use the \-\_\-getcwd function in M\-S\-V\-C\-R\-T.

On Windows C\-E, get the current directory by extracting the path from the executable that is running and put the result in {\ttfamily buffer} of length {\ttfamily size}. If {\ttfamily size} is less or equal than 0, return N\-U\-L\-L. If the current absolute path would require a buffer longer than {\ttfamily size} elements, N\-U\-L\-L is returned. If {\ttfamily buffer} is N\-U\-L\-L, a buffer of length {\ttfamily size} is allocated and is returned. If the allocation fails, N\-U\-L\-L is returned. On success, {\ttfamily buffer} is returned and contains the current directory. The last '\textbackslash{}' is not included. If {\ttfamily buffer} is N\-U\-L\-L, the returned value must be freed if not N\-U\-L\-L.

Specially usefull on Win\-C\-E where the current directory functionality is not supported.

Conformity\-: Almost P\-O\-S\-I\-X.\-1 (no errno set)

Supported O\-S\-: Windows X\-P, Windows C\-E. 

References evil\-\_\-wchar\-\_\-to\-\_\-char().

\hypertarget{group__Evil__Unistd__Group_gaade6baa64ddc1f9f190ccdb73358541e}{\index{Unistd.\-h functions@{Unistd.\-h functions}!evil\-\_\-sockets\-\_\-init@{evil\-\_\-sockets\-\_\-init}}
\index{evil\-\_\-sockets\-\_\-init@{evil\-\_\-sockets\-\_\-init}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{evil\-\_\-sockets\-\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}int evil\-\_\-sockets\-\_\-init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_gaade6baa64ddc1f9f190ccdb73358541e}


Initiates the use of Windows sockets. 

\begin{DoxyReturn}{Returns}
1 on success, 0 otherwise.
\end{DoxyReturn}
Initiates the use of Windows sockets. If the function succeeds, it returns 1, otherwise it returns 0.

Conformity\-: Non applicable.

Supported O\-S\-: Windows X\-P, Windows C\-E. 

Referenced by evil\-\_\-init().

\hypertarget{group__Evil__Unistd__Group_ga64c9a315ea785ca30679c479a349d433}{\index{Unistd.\-h functions@{Unistd.\-h functions}!evil\-\_\-sockets\-\_\-shutdown@{evil\-\_\-sockets\-\_\-shutdown}}
\index{evil\-\_\-sockets\-\_\-shutdown@{evil\-\_\-sockets\-\_\-shutdown}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{evil\-\_\-sockets\-\_\-shutdown}]{\setlength{\rightskip}{0pt plus 5cm}void evil\-\_\-sockets\-\_\-shutdown (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_ga64c9a315ea785ca30679c479a349d433}


Shutdown the Windows socket system. 

Shutdown the Windows socket system.

Conformity\-: Non applicable.

Supported O\-S\-: Windows X\-P, Windows C\-E. 

Referenced by evil\-\_\-shutdown().

\hypertarget{group__Evil__Unistd__Group_gadbb68c1c2c5e30137d5a92a08bfdbf6d}{\index{Unistd.\-h functions@{Unistd.\-h functions}!evil\-\_\-pipe@{evil\-\_\-pipe}}
\index{evil\-\_\-pipe@{evil\-\_\-pipe}!Unistd.h functions@{Unistd.\-h functions}}
\subsubsection[{evil\-\_\-pipe}]{\setlength{\rightskip}{0pt plus 5cm}int evil\-\_\-pipe (
\begin{DoxyParamCaption}
\item[{int $\ast$}]{fds}
\end{DoxyParamCaption}
)}}\label{group__Evil__Unistd__Group_gadbb68c1c2c5e30137d5a92a08bfdbf6d}


Create a pair of sockets. 


\begin{DoxyParams}{Parameters}
{\em fds} & A pointer that contains two sockets.\\
\hline
\end{DoxyParams}
Create a pair of sockets that can be use with select(). Hence, \hyperlink{group__Evil__Unistd__Group_gaade6baa64ddc1f9f190ccdb73358541e}{evil\-\_\-sockets\-\_\-init()} must have been caled at least once before. Contrary to Unix, that functions does not create a pair of file descriptors.

Conformity\-: Not applicable.

Supported O\-S\-: Windows X\-P, Windows C\-E. 