\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_g0c5c30c9931a29d7958312e75a23d2ca}{ibuf\_\-fn} (int, void $\ast$, unsigned long)
\item 
typedef \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_g0c5c30c9931a29d7958312e75a23d2ca}{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[ibuf\_\-close]{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-close(in)~iobuf\_\-close(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}


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


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


Test if the {\tt 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[ibuf\_\-rewind]{\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[ibuf\_\-seekfwd]{\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[ibuf\_\-timedout]{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-timedout(in)~iobuf\_\-timedout(\&((in) $\rightarrow$ io))}}
\label{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}


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

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


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


{\tt 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[ibuf\_\-eof]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-eof (\hyperlink{structibuf}{ibuf} $\ast$ {\em in})}}
\label{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}


Test if the {\tt 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[ibuf\_\-getc]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getc (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, char $\ast$ {\em ch})}}
\label{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}


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


Read a netstring from the given {\tt 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[ibuf\_\-gets]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-gets (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen}, char {\em boundary})}}
\label{group__ibuf_g858fcf15103325cc8e9659f72625a891}


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


Read a line from the {\tt 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[ibuf\_\-getstr\_\-crlf]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getstr\_\-crlf (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, struct \hyperlink{structstr}{str} $\ast$ {\em s})}}
\label{group__ibuf_g288d0416864dc0874f95561df885be29}


Read a line from the {\tt 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[ibuf\_\-getu]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getu (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, unsigned long $\ast$ {\em data})}}
\label{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}


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


Initialize an {\tt 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[ibuf\_\-open]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-open (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, const char $\ast$ {\em filename}, unsigned {\em bufsize})}}
\label{group__ibuf_g0310201d000ed4435933d33d1679ce70}


Initialize an {\tt 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[ibuf\_\-openreadclose]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-openreadclose (const char $\ast$ {\em filename}, struct \hyperlink{structstr}{str} $\ast$ {\em out})}}
\label{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}


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


Retrieve the next character in the {\tt 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[ibuf\_\-read]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}}
\label{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}


Read a block of data from the {\tt 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[ibuf\_\-read\_\-large]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read\_\-large (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}}
\label{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}


Read a block of data from the {\tt 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 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 iobuf} buffer size. \hypertarget{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}{
\index{ibuf@{ibuf}!ibuf_readall@{ibuf\_\-readall}}
\index{ibuf_readall@{ibuf\_\-readall}!ibuf@{ibuf}}
\subsubsection[ibuf\_\-readall]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-readall (\hyperlink{structibuf}{ibuf} $\ast$ {\em in}, struct \hyperlink{structstr}{str} $\ast$ {\em out})}}
\label{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}


Read the remainder of the {\tt ibuf} into the {\tt str}. \hypertarget{group__ibuf_g15b46604ef239c3115eae097fc53f188}{
\index{ibuf@{ibuf}!ibuf_refill@{ibuf\_\-refill}}
\index{ibuf_refill@{ibuf\_\-refill}!ibuf@{ibuf}}
\subsubsection[ibuf\_\-refill]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-refill (\hyperlink{structibuf}{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[ibuf\_\-seek]{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-seek (\hyperlink{structibuf}{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[ibuf\_\-tell]{\setlength{\rightskip}{0pt plus 5cm}unsigned ibuf\_\-tell (\hyperlink{structibuf}{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[inbuf]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structibuf}{ibuf} \hyperlink{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}{inbuf}}}
\label{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}


Input buffer for {\tt stdin} 