/usr/share/doc/discover/api-reference/core_8c-source.html is in libdiscover-dev 2.1.2-5.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>discover: /home/pere/src/debiancvs/pkg-discover/discover/trunk/lib/core.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<div class="nav">
<a class="el" href="dir_000002.html">lib</a></div>
<h1>core.c</h1><a href="core_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001
00011 <span class="comment">/* $Progeny$</span>
00012 <span class="comment"> *</span>
00013 <span class="comment"> * Copyright 2002 Progeny Linux Systems, Inc.</span>
00014 <span class="comment"> * Copyright 2002 Hewlett-Packard Company</span>
00015 <span class="comment"> *</span>
00016 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span>
00017 <span class="comment"> * copy of this software and associated documentation files (the "Software"),</span>
00018 <span class="comment"> * to deal in the Software without restriction, including without limitation</span>
00019 <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span>
00020 <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span>
00021 <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span>
00022 <span class="comment"> *</span>
00023 <span class="comment"> * The above copyright notice and this permission notice shall be included in</span>
00024 <span class="comment"> * all copies or substantial portions of the Software.</span>
00025 <span class="comment"> *</span>
00026 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
00027 <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
00028 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span>
00029 <span class="comment"> * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
00030 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
00031 <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
00032 <span class="comment"> * DEALINGS IN THE SOFTWARE.</span>
00033 <span class="comment"> */</span>
00034
00035 <span class="preprocessor">#include "config.h"</span>
00036
00037 <span class="preprocessor">#include <assert.h></span>
00038
00039 <span class="preprocessor">#include <<a class="code" href="discover_8h.html">discover/discover.h</a>></span>
00040 <span class="preprocessor">#include <<a class="code" href="discover-xml_8h.html">discover/discover-xml.h</a>></span>
00041
00042 <span class="preprocessor">#include <discover/utils.h></span>
00043
00044 <span class="keyword">static</span> <span class="keywordtype">char</span> *discover_errlist[] = {
00045 N_(<span class="stringliteral">"Success."</span>),
00046 N_(<span class="stringliteral">"Input/output error."</span>),
00047 N_(<span class="stringliteral">"XML parsing error."</span>),
00048 N_(<span class="stringliteral">"System error."</span>),
00049 N_(<span class="stringliteral">"Disabled bus."</span>),
00050 N_(<span class="stringliteral">"Bus not found."</span>),
00051 N_(<span class="stringliteral">"Data source not found."</span>),
00052 N_(<span class="stringliteral">"Device not found."</span>),
00053 N_(<span class="stringliteral">"Invalid version range."</span>),
00054 N_(<span class="stringliteral">"Not implemented."</span>)
00055 };
00056 <span class="keyword">static</span> <span class="keywordtype">int</span>
00057 discover_nerr = <span class="keyword">sizeof</span>(discover_errlist) / <span class="keyword">sizeof</span>(discover_errlist[0]);
00058
00067 <a class="code" href="structdiscover__error.html">discover_error_t</a> *
<a name="l00068"></a><a class="code" href="group__core.html#ga0">00068</a> <a class="code" href="group__core.html#ga0">discover_error_new</a>(<span class="keywordtype">void</span>)
00069 {
00070 <a class="code" href="structdiscover__error.html">discover_error_t</a> *status = _discover_xmalloc(<span class="keyword">sizeof</span>(<a class="code" href="structdiscover__error.html">discover_error_t</a>));
00071 status-><a class="code" href="structdiscover__error.html#o0">code</a> = 0;
00072 status-><a class="code" href="structdiscover__error.html#o1">message</a> = NULL;
00073 status-><a class="code" href="structdiscover__error.html#o2">create_message</a> = <a class="code" href="group__core.html#ga1">_discover_create_message</a>;
00074 <span class="keywordflow">return</span> status;
00075 }
00076
00081 <span class="keywordtype">void</span> *
<a name="l00082"></a><a class="code" href="group__core.html#ga1">00082</a> <a class="code" href="group__core.html#ga1">_discover_create_message</a>(<a class="code" href="structdiscover__error.html">discover_error_t</a> **status, <span class="keywordtype">char</span> *message)
00083 {
00084 <span class="keywordflow">if</span>((*status)->message) {
00085 free((*status)->message);
00086 }
00087 (*status)->message = _discover_xmalloc(strlen(message) + 1);
00088 strcpy((*status)->message, message);
00089 }
00090
00094 <span class="keywordtype">void</span>
<a name="l00095"></a><a class="code" href="group__core.html#ga2">00095</a> <a class="code" href="group__core.html#ga2">discover_error_free</a>(<a class="code" href="structdiscover__error.html">discover_error_t</a> *status)
00096 {
00097 assert(status != NULL);
00098 <span class="keywordflow">if</span> (status-><a class="code" href="structdiscover__error.html#o1">message</a> != NULL) {
00099 free(status-><a class="code" href="structdiscover__error.html#o1">message</a>);
00100 }
00101 free(status);
00102 }
00103
00110 <span class="keywordtype">char</span> *
<a name="l00111"></a><a class="code" href="group__core.html#ga3">00111</a> <a class="code" href="group__core.html#ga3">discover_strerror</a>(<a class="code" href="structdiscover__error.html">discover_error_t</a> *err)
00112 {
00113 assert(err != NULL);
00114 assert(err-><a class="code" href="structdiscover__error.html#o0">code</a> >= 0);
00115 assert(err-><a class="code" href="structdiscover__error.html#o0">code</a> < discover_nerr);
00116
00117 <span class="keywordflow">return</span> _(discover_errlist[err-><a class="code" href="structdiscover__error.html#o0">code</a>]);
00118 }
00119
00123 <span class="keywordtype">int</span>
<a name="l00124"></a><a class="code" href="group__core.html#ga4">00124</a> <a class="code" href="group__core.html#ga4">discover_major_version</a>(<span class="keywordtype">void</span>)
00125 {
00126 <span class="keywordflow">return</span> PACKAGE_MAJOR;
00127 }
00128
00132 <span class="keywordtype">int</span>
<a name="l00133"></a><a class="code" href="group__core.html#ga5">00133</a> <a class="code" href="group__core.html#ga5">discover_minor_version</a>(<span class="keywordtype">void</span>)
00134 {
00135 <span class="keywordflow">return</span> PACKAGE_MINOR;
00136 }
00137
00141 <span class="keywordtype">int</span>
<a name="l00142"></a><a class="code" href="group__core.html#ga6">00142</a> <a class="code" href="group__core.html#ga6">discover_micro_version</a>(<span class="keywordtype">void</span>)
00143 {
00144 <span class="keywordflow">return</span> PACKAGE_MICRO;
00145 }
00146
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Jul 28 03:38:00 2005 for discover by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|