libut(3)
Okay bestie, this is libut(3) from the Library Functions Manual, and it's giving pure URI-template utility energy β¨. It's a whole little lifecycle: init a handle, register key-values, generate a URI, destroy the handle. Iconic.
π NAME π
ut_init(), ut_destroy(), ut_keyvalue(), ut_generate() β URI template facility π
πΈ SYNOPSIS πΈ
#include <ut.h>
URITEMP * ut_init (void);
void ut_destroy (URITEMP *ut);
int ut_keyvalue (URITEMP *ut, int type, const char *name, void *value);
size_t ut_generate (URITEMP *ut, const char *template, char *buf, size_t buflen);
π DESCRIPTION π
These functions are the mechanism for generating Universal Resource Identifiers (URIs) based on a template you provide. No cap.
First, an application initializes a template using ut_init(), which returns a handle. Then, through multiple calls to ut_keyvalue(), values get assigned to symbolic names and registered with that handle. A name may reference a string, a list of strings, or a set of key-value pairs. Once registration is complete, ut_generate() is used to generate a URI based on the provided template. When the handle is no longer needed, ut_destroy() deallocates the resources associated with it. Periodt.
The type parameter to ut_keyvalue() must be one of UT_KEYTYPE_STRING, UT_KEYTYPE_LIST or UT_KEYTYPE_KEYVALUE. If it is UT_KEYTYPE_LIST, the value parameter should be a NULL-terminated array of terminated strings that comprise the list; if it is UT_KEYTYPE_KEYVALUE, the value parameter should be a NULL-terminated array of terminated strings where the even-numbered entries are keys and the odd-numbered entries are their corresponding values. It returns 0 on success or non-zero on error. If the name was already in use, its value(s) are replaced. Slay.
The template parameter to ut_generate() is expected to conform to the URI templates draft (see below). The buf parameter points to a buffer where the result will be written, up to buflen bytes. The buffer will always remain properly terminated β yes, always. The function returns the number of bytes that would be needed to expand the template completely, or a negative number on error. So if the return value exceeds buflen, the string produced was truncated. That's the truncation vibe check π
.
π COPYRIGHT π
Copyright (c) 2011, 2012, The Trusted Domain Project. All rights reserved.
π¦ SEE ALSO π¦
draft-gregorio-uritemplateβ the URI templates draft β¨
That's the whole libut(3) situation, bestie π. Sign-off time π: the source/version footer is literally just libut(3), and there is no date listed on this page, so this is your cute little end-of-manual moment. Mwah, go generate some iconic URIs ππ
π¦ where this page comes from
- opensuse-leap 16.0: opendkim-devel 2.11.0-bp160.1.4 Β· BSD-3-Clause AND Sendmail
- opensuse-leap 16.0: opendkim-devel 2.11.0-bp160.1.4 Β· BSD-3-Clause AND Sendmail
- opensuse-leap 16.0: opendkim-devel 2.11.0-bp160.1.4 Β· BSD-3-Clause AND Sendmail
- opensuse-leap 16.0: opendkim-devel 2.11.0-bp160.1.4 Β· BSD-3-Clause AND Sendmail
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms