summaryrefslogtreecommitdiff
path: root/doc/it
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-02 19:32:13 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-07 13:18:13 +0200
commit2cf66de4236ca05024917c183c24f4dede4aa6d9 (patch)
tree204d66805a8e955a7ba8f2319d551db4e7c0b9c3 /doc/it
parent08bc6404eb0d7d6fb276c33d9f4cd6499c63d624 (diff)
downloadweechat-2cf66de4236ca05024917c183c24f4dede4aa6d9.zip
api: add function "asprintf"
Diffstat (limited to 'doc/it')
-rw-r--r--doc/it/weechat_plugin_api.it.adoc54
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc
index 7ee9cc055..a3fcab585 100644
--- a/doc/it/weechat_plugin_api.it.adoc
+++ b/doc/it/weechat_plugin_api.it.adoc
@@ -568,6 +568,60 @@ num_files = 2
str = weechat.ngettext("file", "files", num_files)
----
+==== asprintf
+
+_WeeChat ≥ 4.3.0._
+
+// TRANSLATION MISSING
+Format a message in a string allocated by the function.
+
+// TRANSLATION MISSING
+[NOTE]
+This function is defined for systems where the GNU function `asprintf()`
+is not available. +
+The behavior is almost the same except that `*result` is set to NULL on error.
+
+Prototipo:
+
+[source,c]
+----
+int weechat_asprintf (char **result, const char *fmt, ...);
+----
+
+Argomenti:
+
+// TRANSLATION MISSING
+* _result_: pointer to a string pointer
+// TRANSLATION MISSING
+* _fmt_: format string
+
+Valore restituito:
+
+// TRANSLATION MISSING
+* number of bytes written in `*result` (excluding the final null byte),
+ a negative value in case of error.
+
+Esempio in C:
+
+[source,c]
+----
+char *str;
+
+if (weechat_asprintf (&str, "%s, %d", "test", 42) >= 0)
+{
+ /* *str == "test, 42" */
+ /* ... */
+ free (str);
+}
+else
+{
+ /* error: *str == NULL */
+}
+----
+
+[NOTE]
+Questa funzione non è disponibile nelle API per lo scripting.
+
==== strndup
// TRANSLATION MISSING