\doxysection{src/libsphinxbase/util/err.c File Reference}
\label{err_8c}\index{src/libsphinxbase/util/err.c@{src/libsphinxbase/util/err.c}}


Somewhat antiquated logging and error interface.  


{\ttfamily \#include "{}config.\+h"{}}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$stdarg.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include "{}sphinxbase/err.\+h"{}}\newline
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ err\+\_\+set\+\_\+debug\+\_\+level} (int level)
\begin{DoxyCompactList}\small\item\em Set debugging verbosity level. \end{DoxyCompactList}\item 
int \textbf{ err\+\_\+get\+\_\+debug\+\_\+level} (void)
\begin{DoxyCompactList}\small\item\em Get debugging verbosity level. \end{DoxyCompactList}\item 
FILE $\ast$ \textbf{ err\+\_\+get\+\_\+logfp} (void)
\begin{DoxyCompactList}\small\item\em Get the current logging filehandle. \end{DoxyCompactList}\item 
FILE $\ast$ \textbf{ err\+\_\+set\+\_\+logfp} (FILE $\ast$newfp)
\begin{DoxyCompactList}\small\item\em Direct all logging to a given filehandle. \end{DoxyCompactList}\item 
int \textbf{ err\+\_\+set\+\_\+logfile} (char const $\ast$file)
\begin{DoxyCompactList}\small\item\em Append all log messages to a given file. \end{DoxyCompactList}\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header\+\_\+wofn} (char const $\ast$msg)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+pr\+\_\+header} (char const $\ast$f, long ln, char const $\ast$msg)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header} (char const $\ast$f, long ln, char const $\ast$msg)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+pr\+\_\+warn} (char const $\ast$fmt,...)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info} (char const $\ast$fmt,...)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+die\+\_\+error} (char const $\ast$fmt,...)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+fatal\+\_\+sys\+\_\+error} (char const $\ast$fmt,...)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+sys\+\_\+error} (char const $\ast$fmt,...)
\item 
void \textbf{ \+\_\+\+E\+\_\+\+\_\+abort\+\_\+error} (char const $\ast$fmt,...)
\end{DoxyCompactItemize}
\doxysubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
FILE $\ast$ \textbf{ logfp} = NULL
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Somewhat antiquated logging and error interface. 



Definition in file \textbf{ err.\+c}.



\doxysubsection{Function Documentation}
\label{err_8c_a28cf0aaaf44493d5a78dec076d227df4} 
\index{err.c@{err.c}!\_E\_\_abort\_error@{\_E\_\_abort\_error}}
\index{\_E\_\_abort\_error@{\_E\_\_abort\_error}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_abort\_error()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+abort\+\_\+error (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 349} of file \textbf{ err.\+c}.

\label{err_8c_ad6271835d1ac95bf7d04cf30a148fb79} 
\index{err.c@{err.c}!\_E\_\_die\_error@{\_E\_\_die\_error}}
\index{\_E\_\_die\_error@{\_E\_\_die\_error}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_die\_error()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+die\+\_\+error (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 283} of file \textbf{ err.\+c}.

\label{err_8c_add44119b26798320a43e2eaee0f71a15} 
\index{err.c@{err.c}!\_E\_\_fatal\_sys\_error@{\_E\_\_fatal\_sys\_error}}
\index{\_E\_\_fatal\_sys\_error@{\_E\_\_fatal\_sys\_error}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_fatal\_sys\_error()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+fatal\+\_\+sys\+\_\+error (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 304} of file \textbf{ err.\+c}.

\label{err_8c_a5ff468fc371d3fd651257df3819e412a} 
\index{err.c@{err.c}!\_E\_\_pr\_header@{\_E\_\_pr\_header}}
\index{\_E\_\_pr\_header@{\_E\_\_pr\_header}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_pr\_header()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+pr\+\_\+header (\begin{DoxyParamCaption}\item[{char const $\ast$}]{f,  }\item[{long}]{ln,  }\item[{char const $\ast$}]{msg }\end{DoxyParamCaption})}



Definition at line \textbf{ 218} of file \textbf{ err.\+c}.

\label{err_8c_ad90268a25147c7485c0b41b1b12783e4} 
\index{err.c@{err.c}!\_E\_\_pr\_info@{\_E\_\_pr\_info}}
\index{\_E\_\_pr\_info@{\_E\_\_pr\_info}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_pr\_info()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 267} of file \textbf{ err.\+c}.

\label{err_8c_af0a195f2b0f1f9fc2ef7d60593b66faa} 
\index{err.c@{err.c}!\_E\_\_pr\_info\_header@{\_E\_\_pr\_info\_header}}
\index{\_E\_\_pr\_info\_header@{\_E\_\_pr\_info\_header}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_pr\_info\_header()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header (\begin{DoxyParamCaption}\item[{char const $\ast$}]{f,  }\item[{long}]{ln,  }\item[{char const $\ast$}]{msg }\end{DoxyParamCaption})}



Definition at line \textbf{ 234} of file \textbf{ err.\+c}.

\label{err_8c_afd2e78db5fc2b29d87b434d0a2d0d07e} 
\index{err.c@{err.c}!\_E\_\_pr\_info\_header\_wofn@{\_E\_\_pr\_info\_header\_wofn}}
\index{\_E\_\_pr\_info\_header\_wofn@{\_E\_\_pr\_info\_header\_wofn}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_pr\_info\_header\_wofn()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+pr\+\_\+info\+\_\+header\+\_\+wofn (\begin{DoxyParamCaption}\item[{char const $\ast$}]{msg }\end{DoxyParamCaption})}



Definition at line \textbf{ 205} of file \textbf{ err.\+c}.

\label{err_8c_a8cdfd1775cf364e5705bb00a262c7865} 
\index{err.c@{err.c}!\_E\_\_pr\_warn@{\_E\_\_pr\_warn}}
\index{\_E\_\_pr\_warn@{\_E\_\_pr\_warn}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_pr\_warn()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+pr\+\_\+warn (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 251} of file \textbf{ err.\+c}.

\label{err_8c_a9b5c6b51090d5a2aaedf1ab8e43e8f5c} 
\index{err.c@{err.c}!\_E\_\_sys\_error@{\_E\_\_sys\_error}}
\index{\_E\_\_sys\_error@{\_E\_\_sys\_error}!err.c@{err.c}}
\doxysubsubsection{\_E\_\_sys\_error()}
{\footnotesize\ttfamily void \+\_\+\+E\+\_\+\+\_\+sys\+\_\+error (\begin{DoxyParamCaption}\item[{char const $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Definition at line \textbf{ 330} of file \textbf{ err.\+c}.

\label{err_8c_a393ad2383651d1fed0223c92208a6631} 
\index{err.c@{err.c}!err\_get\_debug\_level@{err\_get\_debug\_level}}
\index{err\_get\_debug\_level@{err\_get\_debug\_level}!err.c@{err.c}}
\doxysubsubsection{err\_get\_debug\_level()}
{\footnotesize\ttfamily int err\+\_\+get\+\_\+debug\+\_\+level (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get debugging verbosity level. 

Note that debugging messages are only enabled when compiled with -\/DDEBUG. 

Definition at line \textbf{ 74} of file \textbf{ err.\+c}.

\label{err_8c_a028dd9600012527333ffc4ed9961e8a6} 
\index{err.c@{err.c}!err\_get\_logfp@{err\_get\_logfp}}
\index{err\_get\_logfp@{err\_get\_logfp}!err.c@{err.c}}
\doxysubsubsection{err\_get\_logfp()}
{\footnotesize\ttfamily FILE $\ast$ err\+\_\+get\+\_\+logfp (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get the current logging filehandle. 

\begin{DoxyReturn}{Returns}
Current logging filehandle, NULL if disabled. 
\end{DoxyReturn}


Definition at line \textbf{ 157} of file \textbf{ err.\+c}.



Referenced by \textbf{ cmd\+\_\+ln\+\_\+parse\+\_\+r()}, \textbf{ err\+\_\+set\+\_\+logfile()}, and \textbf{ err\+\_\+set\+\_\+logfp()}.

\label{err_8c_ac7956e03cd685da5fe6e134c462f73e1} 
\index{err.c@{err.c}!err\_set\_debug\_level@{err\_set\_debug\_level}}
\index{err\_set\_debug\_level@{err\_set\_debug\_level}!err.c@{err.c}}
\doxysubsubsection{err\_set\_debug\_level()}
{\footnotesize\ttfamily int err\+\_\+set\+\_\+debug\+\_\+level (\begin{DoxyParamCaption}\item[{int}]{level }\end{DoxyParamCaption})}



Set debugging verbosity level. 

Note that debugging messages are only enabled when compiled with -\/DDEBUG.


\begin{DoxyParams}{Parameters}
{\em level} & Verbosity level to set, or 0 to disable debug messages. \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 68} of file \textbf{ err.\+c}.

\label{err_8c_aaa2d9e5fcb8d7b80d941ba6374762ebe} 
\index{err.c@{err.c}!err\_set\_logfile@{err\_set\_logfile}}
\index{err\_set\_logfile@{err\_set\_logfile}!err.c@{err.c}}
\doxysubsubsection{err\_set\_logfile()}
{\footnotesize\ttfamily int err\+\_\+set\+\_\+logfile (\begin{DoxyParamCaption}\item[{char const $\ast$}]{file }\end{DoxyParamCaption})}



Append all log messages to a given file. 

Previous logging filehandle is closed (unless it was stdout or stderr).


\begin{DoxyParams}{Parameters}
{\em file} & File to send log messages to, or NULL to disable logging. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success, $<$0 for failure (e.\+g. if file does not exist) 
\end{DoxyReturn}


Definition at line \textbf{ 190} of file \textbf{ err.\+c}.



References \textbf{ err\+\_\+get\+\_\+logfp()}.



Referenced by \textbf{ cmd\+\_\+ln\+\_\+parse\+\_\+r()}.

\label{err_8c_a3c07cb0a50daeac9ac07c9b537aa50e5} 
\index{err.c@{err.c}!err\_set\_logfp@{err\_set\_logfp}}
\index{err\_set\_logfp@{err\_set\_logfp}!err.c@{err.c}}
\doxysubsubsection{err\_set\_logfp()}
{\footnotesize\ttfamily FILE $\ast$ err\+\_\+set\+\_\+logfp (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{logfp }\end{DoxyParamCaption})}



Direct all logging to a given filehandle. 


\begin{DoxyParams}{Parameters}
{\em logfp} & Filehandle to send log messages to, or NULL to disable logging. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Previous logging filehandle, if any. 
\end{DoxyReturn}


Definition at line \textbf{ 179} of file \textbf{ err.\+c}.



References \textbf{ err\+\_\+get\+\_\+logfp()}.



\doxysubsection{Variable Documentation}
\label{err_8c_ac16dab5cefce6fed135c20d1bae372a5} 
\index{err.c@{err.c}!logfp@{logfp}}
\index{logfp@{logfp}!err.c@{err.c}}
\doxysubsubsection{logfp}
{\footnotesize\ttfamily FILE$\ast$ logfp = NULL}



Definition at line \textbf{ 154} of file \textbf{ err.\+c}.

