/* This file is part of limb https://lila.oss/limb
* Copyright (C) 2023 Olivier Brunel jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <limb/output.h>
void
list_matches_full(obuffer *obuf, u8 level, const char *intro,
const char *prefix, const char *sep, const char *outro,
const char *str, size_t slen, int first,
const void *list_, size_t offset, size_t llen)
{
const char *list = (const char *) list_ + first * llen;
const char *el = * (const char **) (list + offset);
obuffer_putmsg(obuf, level, outarray(intro, prefix, el), 3);
for (list += llen; (el = * (const char **) (list + offset)); list += llen)
if (!strncmp(str, el, slen))
obuffer_putmsg(obuf, level, outarray(sep, prefix, el), 3);
obuffer_putmsg(obuf, level, outarray(outro, "\n", PUTMSG_FLUSH), 3);
}