<!-- #include "header.html" #PAGETITLE#="Kerberos Errors API" #BASEHREF#="" --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Kerberos Errors API </TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#663399"> <CENTER> <TABLE BORDER=0 CELLSPACING=8> <TR> <TD><IMG SRC="http://web.mit.edu/macdev/www/is-logo.gif" ALT="MIT Information Systems"></TD> <TD><BR><H1>Macintosh Development</H1></TD> </TR> </TABLE> <P> [<A HREF="http://web.mit.edu/macdev/www/macdev.html">Home</A>] [<A HREF="http://web.mit.edu/macdev/www/about.html">About Us</A>] [<A HREF="http://web.mit.edu/macdev/www/people.html">People</A>] [<A HREF="http://web.mit.edu/macdev/www/support.html">MIT Support Library</A>] [<A HREF="http://web.mit.edu/macdev/www/kerberos.html">MIT Kerberos for Macintosh</A>] <BR> [<A HREF="http://web.mit.edu/macdev/www/applications.html">Applications</A>] [<A HREF="http://web.mit.edu/macdev/www/macosx.html">Mac OS X</A>] [<A HREF="http://web.mit.edu/macdev/www/documentation.html">Miscellaneous Documentation</A>] [<A HREF="http://web.mit.edu/is/">Information Systems</A>] </P> </CENTER> <HR> <!-- end include --> <TABLE BORDER=0 CELLSPACING=4> <TR> <TD><IMG SRC="../../../Common/Documentation/graphics/ThreeHeadsAndKey.gif"></TD> <TD><B><FONT SIZE="+3">Kerberos Errors API</FONT></B></TD> </TR> </TABLE> <BLOCKQUOTE> <B><FONT SIZE="+2">Types:</FONT></B> <BLOCKQUOTE> <PRE><CODE>typedef long errcode_t;</CODE></PRE> <P> The error code integer type. The value of each error code is determined by <CODE>compile_et</CODE> based on the four character name of the API the error codes belong to.</P> <HR> <PRE><CODE>struct error_table { const char * const * const messages; int32_t base; int32_t count; };</CODE></PRE> <P> The error table type. This is the fallback error tables used if the bundle strings are not available. You can add and remove these from Kerberos Error's search path using <CODE>add_error_table()</CODE> and <CODE>remove_error_table()</CODE></P> <HR> <PRE><CODE>typedef void (*com_err_handler_t) (const char *whoami, errcode_t code, const char *format, va_list args);</CODE></PRE> <P> The com_err display hook callback. Your application should define this if it wants to use <CODE>com_err()</CODE> or <CODE>com_err_va()</CODE> to display error messages and does not want them <CODE>printf</CODE>ed to <CODE>stderr</CODE>.</P> <HR> </BLOCKQUOTE> <B><FONT SIZE="+2">Functions:</FONT></B> <BLOCKQUOTE> <PRE><CODE>char const *error_message (errcode_t code);</CODE></PRE> <P><CODE>error_message()</CODE> converts an error code to a UTF8 string so it can be reported to the user.<P> <HR> <PRE><CODE>com_err_handler_t set_com_err_hook(com_err_handler_t handler); com_err_handler_t reset_com_err_hook(void);</CODE></PRE> <P> <CODE>set_com_err_hook()</CODE> sets the com_err display hook function to <CODE>handler</CODE>. <CODE>reset_com_err_hook()</CODE> sets it back to the default function, which <CODE>fprintf</CODE>'s to stderr.</P> <HR> <PRE><CODE>void com_err (const char *progname, errcode_t code, const char *format, ...); void com_err_va (const char *progname, errcode_t code, const char *format, va_list args);</CODE></PRE> <P> <CODE>com_err()</CODE> and <CODE>com_err_va()</CODE> print an error message using the com_err hook function. The default hook function prints a string of the form "<CODE>progname</CODE>: <CODE>error_message (code></CODE> <CODE>format</CODE>" to <CODE>stderr</CODE>. You can set your own hook function with <CODE>set_com_err_hook()</CODE>. </P> <HR> <PRE><CODE>errcode_t add_error_table (const struct error_table *et); errcode_t remove_error_table (const struct error_table *et);</CODE></PRE> <P><CODE>add_error_table()</CODE> and <CODE>remove_error_table()</CODE> add and remove com_err C string error tables to the list of fallback error tables. These tables are searched after Kerberos Errors has failed to find a bundle string for the error code. You will only need these functions if your code does not have a bundle or if you do not install the strings list generated by the Kerberos Errors <CODE>compile_et</CODE>. <P> </BLOCKQUOTE> </BLOCKQUOTE> <!-- #include "footer.html" --> <HR> <P> <FONT SIZE="+1"> <B> Questions or comments? Send mail to <A HREF="mailto:macdev@mit.edu">macdev@mit.edu</A> </B> </FONT> <BR> Last updated on $Date: 2003/10/02 20:08:14 $ <BR> Last modified by $Author: smcguire $<BR> </P> <!-- Begin MIT-use only web reporting counter --> <IMG SRC="//counter.mit.edu/tally" WIDTH=1 HEIGHT=1 ALT=""> <!-- End MIT-use only web reporting counter --> </BODY> </HTML> <!-- end include -->