gem-graph-client/doc/docbook/d8/d01/strings__op_8c.xml

84 lines
4.3 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_strings__op_8c" xml:lang="en-US">
<title>src/util/strings_op.c File Reference</title>
<indexterm><primary>src/util/strings_op.c</primary></indexterm>
<para>
<para>Gem-graph-client. </para>
</para>
<programlisting linenumbering="unnumbered">#include &lt;stdlib.h&gt;<?linebreak?>#include &lt;stdarg.h&gt;<?linebreak?>#include &lt;string.h&gt;<?linebreak?></programlisting><simplesect>
<title>Functions </title>
<itemizedlist>
<listitem><para>char * <link linkend="_strings__op_8c_1a7a9bfe2d249e5da19a1117c7d5636b8a">util_concat</link> (const char *str,...)</para>
<para><link xlink:href="https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Variadic-Prototypes">https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Variadic-Prototypes</link> </para>
</listitem>
</itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>
<para>Gem-graph-client. </para>
<para>This file is part of Gem-graph.</para>
<para>Programmers using the strcat function can easily be recognized as lazy and reckless. from The GNU C Library (glibc) manual (5.5 Concatenating Strings)</para>
<para>Whenever a programmer feels the need to use strcat she or he should think twice and look through the program to see whether the code cannot be rewritten to take advantage of already calculated results. The related functions strlcat, strncat, wcscat and wcsncat are almost always unnecessary, too. Again: it is almost always unnecessary to use functions like strcat. 😄️</para>
<para>Before calling vprintf or the other functions listed in this section, you must call va_start (see Variadic Functions) to initialize a pointer to the variable arguments. Then you can call va_arg to fetch the arguments that you want to handle yourself. This advances the pointer past those arguments.</para>
<para>Once your va_list pointer is pointing at the argument of your choice, you are ready to call vprintf. That argument and all subsequent arguments that were passed to your function are used by vprintf along with the template that you specified separately.</para>
<para>A.2 Variadic Functions ISO C defines a syntax for declaring a function to take a variable number or type of arguments. (Such functions are referred to as varargs functions or variadic functions.) However, the language itself provides no mechanism for such functions to access their non-required arguments; instead, you use the variable arguments macros defined in stdarg.h.</para>
<para>This section describes how to declare variadic functions, how to write them, and how to call them properly. </para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_strings__op_8c_1a7a9bfe2d249e5da19a1117c7d5636b8a"/><section>
<title>util_concat()</title>
<indexterm><primary>util_concat</primary><secondary>strings_op.c</secondary></indexterm>
<indexterm><primary>strings_op.c</primary><secondary>util_concat</secondary></indexterm>
<para><computeroutput>char * util_concat (const char * str, ...)</computeroutput></para><para>
<para><link xlink:href="https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Variadic-Prototypes">https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Variadic-Prototypes</link> </para>
</para>
<para><formalpara><title>See also</title>
<para>(in glibc/manual) &gt; ellipsis (‘…’) A.2.2.2 Receiving the Argument Values</para>
</formalpara>
<formalpara>
<title>
Parameters</title>
<para>
<table frame="all">
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*"/>
<colspec colwidth="4*"/>
<tbody>
<row>
<entry>*str</entry><entry>
<para></para>
</entry>
</row>
<row>
<entry>...</entry><entry></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</formalpara>
<formalpara><title>Returns</title>
<para>* </para>
</formalpara>
</para>
</section>
</section>
</section>