slac_debug.c.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. slac_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='slac_connect.c.html' title=' slac_connect.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='slac_session.c.html' title=' slac_session.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  24. * Copyright (c) 2013 I2SE GmbH
  25. *
  26. * All rights reserved.
  27. *
  28. * Redistribution and use in source and binary forms, with or
  29. * without modification, are permitted (subject to the limitations
  30. * in the disclaimer below) provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. *
  36. * * Redistributions in binary form must reproduce the above
  37. * copyright notice, this list of conditions and the following
  38. * disclaimer in the documentation and/or other materials
  39. * provided with the distribution.
  40. *
  41. * * Neither the name of Qualcomm Atheros nor the names of
  42. * its contributors may be used to endorse or promote products
  43. * derived from this software without specific prior written
  44. * permission.
  45. *
  46. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  47. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  48. * COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR
  49. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  50. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  51. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  52. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  54. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  55. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  56. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  57. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  58. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  59. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. *
  61. *--------------------------------------------------------------------*/
  62. /*====================================================================*
  63. *
  64. * signed slac_debug (struct session * session, signed status, char const * string, char const * format, ...);
  65. *
  66. * slac.h
  67. *
  68. * variation of the GNU error() function that accepts a message in
  69. * place of an error code and always returns -1;
  70. *
  71. *--------------------------------------------------------------------*/
  72. #ifndef SLAC_DEBUG_SOURCE
  73. #define SLAC_DEBUG_SOURCE
  74. #include &lt;stdio.h&gt;
  75. #include &lt;stdlib.h&gt;
  76. #include &lt;stdarg.h&gt;
  77. #include &lt;string.h&gt;
  78. #include &quot;../iso15118/slac.h&quot;
  79. #include &quot;../tools/types.h&quot;
  80. #include &quot;../tools/error.h&quot;
  81. #include &quot;../tools/flags.h&quot;
  82. #ifdef __GNUC__
  83. __attribute__ ((format (printf, 4, 5)))
  84. #endif
  85. signed slac_debug (struct session * session, signed status, char const * string, char const * format, ...)
  86. {
  87. extern char const * program_name;
  88. if (_allclr (session-&gt;flags, SLAC_SILENCE))
  89. {
  90. if ((program_name) &amp;&amp; (* program_name))
  91. {
  92. fprintf (stderr, &quot;%s: &quot;, program_name);
  93. }
  94. if ((string) &amp;&amp; (* string))
  95. {
  96. fprintf (stderr, &quot;%s: &quot;, string);
  97. }
  98. if ((format) &amp;&amp; (*format))
  99. {
  100. va_list arglist;
  101. va_start (arglist, format);
  102. vfprintf (stderr, format, arglist);
  103. va_end (arglist);
  104. }
  105. fprintf (stderr, &quot;\n&quot;);
  106. fflush (stderr);
  107. }
  108. if (status)
  109. {
  110. exit (status);
  111. }
  112. return (-1);
  113. }
  114. #endif
  115. </pre>
  116. <div class='footerlink'>
  117. [<a href='slac_connect.c.html' title=' slac_connect.c '>PREV</a>]
  118. [<a href='toolkit.html' title=' Index '>HOME</a>]
  119. [<a href='slac_session.c.html' title=' slac_session.c '>NEXT</a>]
  120. </div>
  121. </body>
  122. </html>