STRNINS(3pub)
π STRNINS(3pub) π
okay bestie, welcome to the Publib corner of the C Programmer's Manual πΈ this one's a lil function called strnins, and she's here to shove the front of one string onto the front of another. no cap, that's the whole job. π«Ά
β¨ NAME β¨
strnins β insert prefix of a string at the beginning of another string π
π SYNOPSIS π
#include <publib.h>
char *strnins(char *tgt, const char *src, size_t n);
π¦ DESCRIPTION π¦
So here's the tea, bestie: strnins inserts up to n characters from the beginning of the src string at the beginning of the tgt string. π
(and yes, the page literally says strins right there in that sentence β it's giving sibling energy, iykyk, we move π)
Two things you absolutely cannot skip, fr fr:
- The strings must not overlap. Not a vibe check you wanna fail. π
- The target string must contain enough memory to hold both strings. Like, the whole both. π
π RETURN VALUE π
strnins returns its first argument. that's it, that's the whole gift. it just hands you back your tgt. iconic behaviour honestly πβ¨
π EXAMPLE π
Not me gatekeeping... but the example lives elsewhere: see the manual page for strdel(3) for an example. go go go πββοΈπ¨
π SEE ALSO π
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) β the main character who wrote this π«Ά
β οΈ real talk, no cap: overlap = undefined chaos and not enough memory in tgt = also chaos. this function trusts you completely, so please be trustworthy. π
k that's the whole page babes π it's from Publib, it's the C Programmer's Manual, and it's literally just STRNINS(3pub). mwah, go write some safe string code for me πΈπ§β¨
π¦ where this page comes from
- debian bookworm: publib-dev 0.40-3+b1 Β· BSD-2-Clause
- debian trixie: publib-dev 0.40-4 Β· BSD-2-Clause
- ubuntu jammy: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu noble: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu questing: publib-dev 0.40-4
- ubuntu resolute: publib-dev 0.40-4build1 Β· BSD-2-Clause
- ubuntu stonking: publib-dev 0.40-4build1 Β· BSD-2-Clause
- Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms