debug.c.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. debug.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='dataspec.c.html' title=' dataspec.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='decdecode.c.html' title=' decdecode.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * signed debug (signed status, char const * string, char const * format, ...);
  24. *
  25. * error.h
  26. *
  27. * variation of the GNU error() function that accepts a message in
  28. * place of an error code and always returns -1;
  29. *
  30. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  31. * Copyright (c) 2001-2006 by Charles Maier Associates;
  32. * Licensed under the Internet Software Consortium License;
  33. *
  34. *--------------------------------------------------------------------*/
  35. #ifndef DEBUG_SOURCE
  36. #define DEBUG_SOURCE
  37. #include &lt;stdio.h&gt;
  38. #include &lt;stdlib.h&gt;
  39. #include &lt;stdarg.h&gt;
  40. #include &lt;string.h&gt;
  41. #include &quot;../tools/types.h&quot;
  42. #include &quot;../tools/error.h&quot;
  43. #ifdef __GNUC__
  44. __attribute__ ((format (printf, 3, 4)))
  45. #endif
  46. signed debug (signed status, char const * string, char const * format, ...)
  47. {
  48. extern char const * program_name;
  49. if ((program_name) &amp;&amp; (* program_name))
  50. {
  51. fprintf (stderr, &quot;%s: &quot;, program_name);
  52. }
  53. if ((string) &amp;&amp; (* string))
  54. {
  55. fprintf (stderr, &quot;%s: &quot;, string);
  56. }
  57. if ((format) &amp;&amp; (*format))
  58. {
  59. va_list arglist;
  60. va_start (arglist, format);
  61. vfprintf (stderr, format, arglist);
  62. va_end (arglist);
  63. }
  64. fprintf (stderr, &quot;\n&quot;);
  65. fflush (stderr);
  66. if (status)
  67. {
  68. exit (status);
  69. }
  70. return (-1);
  71. }
  72. #endif
  73. </pre>
  74. <div class='footerlink'>
  75. [<a href='dataspec.c.html' title=' dataspec.c '>PREV</a>]
  76. [<a href='toolkit.html' title=' Index '>HOME</a>]
  77. [<a href='decdecode.c.html' title=' decdecode.c '>NEXT</a>]
  78. </div>
  79. </body>
  80. </html>