libcsplit(3)

πŸ“¦ in opensuse-leap 16.0

πŸ’– libcsplit(3) β€” the cross-platform C split-string library, bestie edition πŸ’–

okay so you're reading the libcsplit(3) page from the Library Functions Manual and honestly? iconic choice. this is libcsplit.h, a whole little library that does split string stuff for you, cross-platform, in C. let's get into it 🫢


✨ SYNOPSIS ✨

#include <libcsplit.h>

🌸 Support functions

const char *
libcsplit_get_version(void);

πŸŽ€ Error functions

void
libcsplit_error_free(libcsplit_error_t **error);

int
libcsplit_error_fprint(libcsplit_error_t *error, FILE *stream);

int
libcsplit_error_sprint(libcsplit_error_t *error, char *string,
    size_t size);

int
libcsplit_error_backtrace_fprint(libcsplit_error_t *error,
    FILE *stream);

int
libcsplit_error_backtrace_sprint(libcsplit_error_t *error, char *string,
    size_t size);

πŸ¦‹ Narrow string functions

int
libcsplit_narrow_string_split(const char *string, size_t string_size,
    char delimiter, libcsplit_narrow_split_string_t **split_string,
    libcsplit_error_t **error);

πŸ’… Narrow split string functions

int
libcsplit_narrow_split_string_free(libcsplit_narrow_split_string_t **split_string,
    libcsplit_error_t **error);

int
libcsplit_narrow_split_string_get_string(libcsplit_narrow_split_string_t *split_string,
    char **string, size_t *string_size, libcsplit_error_t **error);

int
libcsplit_narrow_split_string_get_number_of_segments(libcsplit_narrow_split_string_t *split_string,
    int *number_of_segments, libcsplit_error_t **error);

int
libcsplit_narrow_split_string_get_segment_by_index(libcsplit_narrow_split_string_t *split_string,
    int segment_index, char **string_segment,
    size_t *string_segment_size, libcsplit_error_t **error);

int
libcsplit_narrow_split_string_set_segment_by_index(libcsplit_narrow_split_string_t *split_string,
    int segment_index, char *string_segment, size_t string_segment_size,
    libcsplit_error_t **error);

🌈 Wide string functions

int
libcsplit_wide_string_split(const wchar_t *string, size_t string_size,
    wchar_t delimiter, libcsplit_wide_split_string_t **split_string,
    libcsplit_error_t **error);

⭐ Wide split string functions

int
libcsplit_wide_split_string_free(libcsplit_wide_split_string_t **split_string,
    libcsplit_error_t **error);

int
libcsplit_wide_split_string_get_string(libcsplit_wide_split_string_t *split_string,
    wchar_t **string, size_t *string_size, libcsplit_error_t **error);

int
libcsplit_wide_split_string_get_number_of_segments(libcsplit_wide_split_string_t *split_string,
    int *number_of_segments, libcsplit_error_t **error);

int
libcsplit_wide_split_string_get_segment_by_index(libcsplit_wide_split_string_t *split_string,
    int segment_index, wchar_t **string_segment,
    size_t *string_segment_size, libcsplit_error_t **error);

int
libcsplit_wide_split_string_set_segment_by_index(libcsplit_wide_split_string_t *split_string,
    int segment_index, wchar_t *string_segment,
    size_t *string_segment_size, libcsplit_error_t **error);

🧚 DESCRIPTION 🧚

so the one function that gets called out here is libcsplit_get_version() β€” that's your girl when you need to retrieve the library version. that's it, that's the description section. short and slay πŸ’…


πŸ’€ RETURN VALUES πŸ’€

okay so most of these functions return NULL or -1 on error β€” it depends on the return type, so like, don't quote me on which one, check the type. for the actual, real, no-cap return values, go look at "libcsplit.h". that's the source of truth, periodt.


πŸ™ˆ ENVIRONMENT πŸ™ˆ

None

like literally none. nothing here. ✨


πŸ“ FILES πŸ“

None

also nothing. we love a low-maintenance library.


πŸ”₯ NOTES πŸ”₯

libcsplit can be compiled with wide character support (wchar_t). fancy.

to compile libcsplit with wide character support, use:

./configure --enable-wide-character-type=yes

or define:

_UNICODE

or:

UNICODE

during compilation.

and LIBCSPLIT_WIDE_CHARACTER_TYPE in libcsplit/features.h can be used to determine if libcsplit was compiled with wide character support. iykyk πŸ‘‘


😭 BUGS 😭

please report bugs of any kind on the project issue tracker:

https://github.com/libyal/libcsplit/issues

fr fr, any kind. they want to hear it.


πŸ‘‘ AUTHOR πŸ‘‘

these man pages are generated from "libcsplit.h". yeah, generated. no handwritten prose here (well... until now πŸ’…).


Copyright (C) 2008-2024, Joachim Metz <joachim.metz@gmail.com>.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

like, none. zero. don't come for them if it breaks, bestie 🫢


πŸŽ€ SEE ALSO πŸŽ€

  • the libcsplit.h include file

and that's the whole page!! this one came from libcsplit, dated March 15, 2019 β€” mwah, go split some strings πŸ’–βœ¨πŸŽ€