\hypertarget{group__ibuf}{
\section{ibuf: Input Buffer Managemenet}
\label{group__ibuf}\index{ibuf: Input Buffer Managemenet@{ibuf: Input Buffer Managemenet}}
}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structibuf}{ibuf}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}{ibuf\_\-close}(in)~iobuf\_\-close(\&((in) $\rightarrow$ io))
\item 
\#define \hyperlink{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03}{ibuf\_\-closed}(in)~iobuf\_\-closed(\&((in) $\rightarrow$ io))
\item 
\#define \hyperlink{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a}{ibuf\_\-error}(in)~iobuf\_\-error(\&((in) $\rightarrow$ io))
\item 
\#define \hyperlink{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}{ibuf\_\-timedout}(in)~iobuf\_\-timedout(\&((in) $\rightarrow$ io))
\item 
\#define \hyperlink{group__ibuf_g43682921fe9e0b50d36871af333991b2}{ibuf\_\-rewind}(in)~ibuf\_\-seek(in,0)
\item 
\#define \hyperlink{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526}{ibuf\_\-seekfwd}(in, off)~ibuf\_\-seek(ibuf\_\-tell(in)+(offset))
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef int($\ast$ \hyperlink{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ibuf\_\-fn} )(int, void $\ast$, unsigned long)
\item 
typedef struct \hyperlink{structibuf}{ibuf} \hyperlink{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb}{ibuf}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{group__ibuf_gde09b49be139f74da5cb5ec62147e681}{ibuf\_\-init} (\hyperlink{structibuf}{ibuf} $\ast$in, int fd, \hyperlink{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ibuf\_\-fn} fn, unsigned flags, unsigned bufsize)
\item 
int \hyperlink{group__ibuf_g0310201d000ed4435933d33d1679ce70}{ibuf\_\-open} (\hyperlink{structibuf}{ibuf} $\ast$in, const char $\ast$filename, unsigned bufsize)
\item 
int \hyperlink{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}{ibuf\_\-eof} (\hyperlink{structibuf}{ibuf} $\ast$in)
\item 
int \hyperlink{group__ibuf_g15b46604ef239c3115eae097fc53f188}{ibuf\_\-refill} (\hyperlink{structibuf}{ibuf} $\ast$in)
\item 
int \hyperlink{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}{ibuf\_\-read\_\-large} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen)
\item 
int \hyperlink{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}{ibuf\_\-read} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen)
\item 
unsigned \hyperlink{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22}{ibuf\_\-tell} (\hyperlink{structibuf}{ibuf} $\ast$in)
\item 
int \hyperlink{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9}{ibuf\_\-seek} (\hyperlink{structibuf}{ibuf} $\ast$in, unsigned offset)
\item 
int \hyperlink{group__ibuf_gb6877639711be2c0936763ba8ca54871}{ibuf\_\-peek} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$ch)
\item 
int \hyperlink{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}{ibuf\_\-getc} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$ch)
\item 
int \hyperlink{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}{ibuf\_\-getu} (\hyperlink{structibuf}{ibuf} $\ast$in, unsigned long $\ast$data)
\item 
int \hyperlink{group__ibuf_g858fcf15103325cc8e9659f72625a891}{ibuf\_\-gets} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen, char boundary)
\item 
int \hyperlink{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4}{ibuf\_\-getstr} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s, char boundary)
\item 
int \hyperlink{group__ibuf_g288d0416864dc0874f95561df885be29}{ibuf\_\-getstr\_\-crlf} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s)
\item 
int \hyperlink{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e}{ibuf\_\-getnetstring} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s)
\item 
int \hyperlink{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}{ibuf\_\-readall} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s)
\item 
int \hyperlink{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}{ibuf\_\-openreadclose} (const char $\ast$filename, struct \hyperlink{structstr}{str} $\ast$s)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hyperlink{structibuf}{ibuf} \hyperlink{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}{inbuf}
\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[Calling Convention]\end{Desc}
Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and {\tt 0} (false) otherwise. 

\subsection{Define Documentation}
\hypertarget{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}{
\index{ibuf@{ibuf}!ibuf\_\-close@{ibuf\_\-close}}
\index{ibuf\_\-close@{ibuf\_\-close}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-close(in)~iobuf\_\-close(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}


Close the {\tt \hyperlink{structibuf}{ibuf}}. \hypertarget{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03}{
\index{ibuf@{ibuf}!ibuf\_\-closed@{ibuf\_\-closed}}
\index{ibuf\_\-closed@{ibuf\_\-closed}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-closed(in)~iobuf\_\-closed(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03}


Test if the {\tt \hyperlink{structibuf}{ibuf}} has been closed. \hypertarget{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a}{
\index{ibuf@{ibuf}!ibuf\_\-error@{ibuf\_\-error}}
\index{ibuf\_\-error@{ibuf\_\-error}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-error(in)~iobuf\_\-error(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a}


Test if the {\tt \hyperlink{structibuf}{ibuf}} is in an error state. \hypertarget{group__ibuf_g43682921fe9e0b50d36871af333991b2}{
\index{ibuf@{ibuf}!ibuf\_\-rewind@{ibuf\_\-rewind}}
\index{ibuf\_\-rewind@{ibuf\_\-rewind}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-rewind(in)~ibuf\_\-seek(in,0)}}
\label{group__ibuf_g43682921fe9e0b50d36871af333991b2}


Set the effective read position to the start of the file. \hypertarget{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526}{
\index{ibuf@{ibuf}!ibuf\_\-seekfwd@{ibuf\_\-seekfwd}}
\index{ibuf\_\-seekfwd@{ibuf\_\-seekfwd}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-seekfwd(in, off)~ibuf\_\-seek(ibuf\_\-tell(in)+(offset))}}
\label{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526}


Set the effective read position {\tt off} bytes forward. \hypertarget{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}{
\index{ibuf@{ibuf}!ibuf\_\-timedout@{ibuf\_\-timedout}}
\index{ibuf\_\-timedout@{ibuf\_\-timedout}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-timedout(in)~iobuf\_\-timedout(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}


Test if the last {\tt \hyperlink{structibuf}{ibuf}} read timed out. 

\subsection{Typedef Documentation}
\hypertarget{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb}{
\index{ibuf@{ibuf}!ibuf@{ibuf}}
\index{ibuf@{ibuf}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf ibuf} {\bf ibuf}}}
\label{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb}


Input specific buffer typedef. \hypertarget{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{
\index{ibuf@{ibuf}!ibuf\_\-fn@{ibuf\_\-fn}}
\index{ibuf\_\-fn@{ibuf\_\-fn}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ {\bf ibuf\_\-fn})(int, void $\ast$, unsigned long)}}
\label{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}


{\tt \hyperlink{structibuf}{ibuf}} read function pointer prototype. 

\subsection{Function Documentation}
\hypertarget{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}{
\index{ibuf@{ibuf}!ibuf\_\-eof@{ibuf\_\-eof}}
\index{ibuf\_\-eof@{ibuf\_\-eof}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-eof ({\bf ibuf} $\ast$ {\em in})}}
\label{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}


Test if the {\tt \hyperlink{structibuf}{ibuf}} has reaced end of file. \hypertarget{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}{
\index{ibuf@{ibuf}!ibuf\_\-getc@{ibuf\_\-getc}}
\index{ibuf\_\-getc@{ibuf\_\-getc}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getc ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em ch})}}
\label{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}


Retrieve a single character from the {\tt \hyperlink{structibuf}{ibuf}}. \hypertarget{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e}{
\index{ibuf@{ibuf}!ibuf\_\-getnetstring@{ibuf\_\-getnetstring}}
\index{ibuf\_\-getnetstring@{ibuf\_\-getnetstring}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getnetstring ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s})}}
\label{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e}


Read a netstring from the given {\tt \hyperlink{structibuf}{ibuf}} .

If the input is not a netstring, {\tt errno} (and {\tt in-$>$io.errnum} ) will be set to {\tt EPROTOTYPE} and the state of {\tt in} will be undefined. \hypertarget{group__ibuf_g858fcf15103325cc8e9659f72625a891}{
\index{ibuf@{ibuf}!ibuf\_\-gets@{ibuf\_\-gets}}
\index{ibuf\_\-gets@{ibuf\_\-gets}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-gets ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen}, char {\em boundary})}}
\label{group__ibuf_g858fcf15103325cc8e9659f72625a891}


Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a C string. \hypertarget{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4}{
\index{ibuf@{ibuf}!ibuf\_\-getstr@{ibuf\_\-getstr}}
\index{ibuf\_\-getstr@{ibuf\_\-getstr}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getstr ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s}, char {\em boundary})}}
\label{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4}


Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a dynamic string. \hypertarget{group__ibuf_g288d0416864dc0874f95561df885be29}{
\index{ibuf@{ibuf}!ibuf\_\-getstr\_\-crlf@{ibuf\_\-getstr\_\-crlf}}
\index{ibuf\_\-getstr\_\-crlf@{ibuf\_\-getstr\_\-crlf}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getstr\_\-crlf ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s})}}
\label{group__ibuf_g288d0416864dc0874f95561df885be29}


Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a dynamic string, terminated by a CR+LF pair. \hypertarget{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}{
\index{ibuf@{ibuf}!ibuf\_\-getu@{ibuf\_\-getu}}
\index{ibuf\_\-getu@{ibuf\_\-getu}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getu ({\bf ibuf} $\ast$ {\em in}, unsigned long $\ast$ {\em data})}}
\label{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}


Read an unsigned long from the {\tt \hyperlink{structibuf}{ibuf}} \hypertarget{group__ibuf_gde09b49be139f74da5cb5ec62147e681}{
\index{ibuf@{ibuf}!ibuf\_\-init@{ibuf\_\-init}}
\index{ibuf\_\-init@{ibuf\_\-init}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-init ({\bf ibuf} $\ast$ {\em in}, int {\em fd}, {\bf ibuf\_\-fn} {\em fn}, unsigned {\em flags}, unsigned {\em bufsize})}}
\label{group__ibuf_gde09b49be139f74da5cb5ec62147e681}


Initialize an {\tt \hyperlink{structibuf}{ibuf}} from an already-opened file descriptor. \hypertarget{group__ibuf_g0310201d000ed4435933d33d1679ce70}{
\index{ibuf@{ibuf}!ibuf\_\-open@{ibuf\_\-open}}
\index{ibuf\_\-open@{ibuf\_\-open}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-open ({\bf ibuf} $\ast$ {\em in}, const char $\ast$ {\em filename}, unsigned {\em bufsize})}}
\label{group__ibuf_g0310201d000ed4435933d33d1679ce70}


Initialize an {\tt \hyperlink{structibuf}{ibuf}} by opening a file for reading. \hypertarget{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}{
\index{ibuf@{ibuf}!ibuf\_\-openreadclose@{ibuf\_\-openreadclose}}
\index{ibuf\_\-openreadclose@{ibuf\_\-openreadclose}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-openreadclose (const char $\ast$ {\em filename}, struct {\bf str} $\ast$ {\em out})}}
\label{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}


Open and read the entire file into the {\tt \hyperlink{structstr}{str}} . \hypertarget{group__ibuf_gb6877639711be2c0936763ba8ca54871}{
\index{ibuf@{ibuf}!ibuf\_\-peek@{ibuf\_\-peek}}
\index{ibuf\_\-peek@{ibuf\_\-peek}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-peek ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em ch})}}
\label{group__ibuf_gb6877639711be2c0936763ba8ca54871}


Retrieve the next character in the {\tt \hyperlink{structibuf}{ibuf}} without advancing the current read position. \hypertarget{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}{
\index{ibuf@{ibuf}!ibuf\_\-read@{ibuf\_\-read}}
\index{ibuf\_\-read@{ibuf\_\-read}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}}
\label{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}


Read a block of data from the {\tt \hyperlink{structibuf}{ibuf}} 

Returns true only if the entire block was read. If the return value is false, the caller will need to check if a partial block was read. \hypertarget{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}{
\index{ibuf@{ibuf}!ibuf\_\-read\_\-large@{ibuf\_\-read\_\-large}}
\index{ibuf\_\-read\_\-large@{ibuf\_\-read\_\-large}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read\_\-large ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}}
\label{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}


Read a block of data from the {\tt \hyperlink{structibuf}{ibuf}}.

This routine differs from {\tt ibuf\_\-read} in that the data is, as much as is possible, read directly into the given buffer, rather than first being read into the {\tt \hyperlink{structiobuf}{iobuf}} buffer and then into the given buffer. {\tt ibuf\_\-read} automatically calls this routine if the requested {\tt datalen} is larger than or equal to the {\tt \hyperlink{structiobuf}{iobuf}} buffer size. \hypertarget{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}{
\index{ibuf@{ibuf}!ibuf\_\-readall@{ibuf\_\-readall}}
\index{ibuf\_\-readall@{ibuf\_\-readall}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-readall ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em out})}}
\label{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}


Read the remainder of the {\tt \hyperlink{structibuf}{ibuf}} into the {\tt \hyperlink{structstr}{str}}. \hypertarget{group__ibuf_g15b46604ef239c3115eae097fc53f188}{
\index{ibuf@{ibuf}!ibuf\_\-refill@{ibuf\_\-refill}}
\index{ibuf\_\-refill@{ibuf\_\-refill}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-refill ({\bf ibuf} $\ast$ {\em in})}}
\label{group__ibuf_g15b46604ef239c3115eae097fc53f188}


(Re)fill the buffer from the file descriptor.

\begin{Desc}
\item[Note:]This function may only be called when the buffer is completely empty. \end{Desc}
\hypertarget{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9}{
\index{ibuf@{ibuf}!ibuf\_\-seek@{ibuf\_\-seek}}
\index{ibuf\_\-seek@{ibuf\_\-seek}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-seek ({\bf ibuf} $\ast$ {\em in}, unsigned {\em offset})}}
\label{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9}


Set the effective read position. \hypertarget{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22}{
\index{ibuf@{ibuf}!ibuf\_\-tell@{ibuf\_\-tell}}
\index{ibuf\_\-tell@{ibuf\_\-tell}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned ibuf\_\-tell ({\bf ibuf} $\ast$ {\em in})}}
\label{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22}


Look up the current effective read position. 

\subsection{Variable Documentation}
\hypertarget{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}{
\index{ibuf@{ibuf}!inbuf@{inbuf}}
\index{inbuf@{inbuf}!ibuf@{ibuf}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf ibuf} {\bf inbuf}}}
\label{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}


Input buffer for {\tt stdin} 