STRSTR(3POSIX)
π STRSTR(3POSIX) π
okay bestie, welcome to the POSIX Programmer's Manual page for strstr, from the 3POSIX section. grab a boba, we're finding substrings π§β¨
πΈ PROLOG πΈ
heads up, this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, consult the corresponding Linux manual page for details of Linux behavior), or honestly the interface may not be implemented on Linux at all. no cap. π
β¨ NAME β¨
strstr β find a substring. that's it. that's the whole job. π
π SYNOPSIS π
#include <string.h>
char *strstr(const char *s1, const char *s2);
π¦ DESCRIPTION π¦
okay so the functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional β nobody's trying to start drama. This volume of POSIX.1β2017 defers to the ISO C standard. periodt.
The strstr() function shall locate the first occurrence in the string pointed to by s1 of the sequence of bytes (excluding the terminating NUL character, bestie, we do NOT count that) in the string pointed to by s2.
so like. s1 is the haystack. s2 is the needle. and strstr is the girl who finds the needle first, every time. π₯
π RETURN VALUE π
Upon successful completion, strstr() shall return a pointer to the located string, or a null pointer if the string is not found. π
But wait β if s2 points to a string with zero length, the function shall return s1. yes literally just hands you back the whole haystack, iconic behavior honestly. π
π ERRORS π
No errors are defined. it simply does not have an errors section moment. and also, the following sections are informative:
π EXAMPLES π
None. (i know. we're all a little disappointed. π)
π§ APPLICATION USAGE π§
None. (same energy as above. moving on.)
β RATIONALE β
None. (the committee said "we have no thoughts, head empty" and honestly? respect.) π
π FUTURE DIRECTIONS π
None. the future is bright and it contains exactly zero plans for strstr. β¨
π SEE ALSO π
strchr()- The Base Definitions volume of
POSIX.1β2017,<string.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. (translation: if they disagree, the original wins, no arguing. π
) The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole thing bestie, you ate it up π«Ά ok bye, this page was brought to you by IEEE/The Open Group, dated 2017 β STRSTR(3POSIX), signin' off π
β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms