158f0484fSRodney W. Grimes.\" Copyright (c) 1990, 1991, 1993 258f0484fSRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 358f0484fSRodney W. Grimes.\" 458f0484fSRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 558f0484fSRodney W. Grimes.\" Chris Torek and the American National Standards Committee X3, 658f0484fSRodney W. Grimes.\" on Information Processing Systems. 758f0484fSRodney W. Grimes.\" 858f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 958f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions 1058f0484fSRodney W. Grimes.\" are met: 1158f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 1258f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 1358f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 1458f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 1558f0484fSRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 163fb3b97cSEd Maste.\" 3. Neither the name of the University nor the names of its contributors 1758f0484fSRodney W. Grimes.\" may be used to endorse or promote products derived from this software 1858f0484fSRodney W. Grimes.\" without specific prior written permission. 1958f0484fSRodney W. Grimes.\" 2058f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2158f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2258f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2358f0484fSRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2458f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2558f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2658f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2758f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2858f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2958f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3058f0484fSRodney W. Grimes.\" SUCH DAMAGE. 3158f0484fSRodney W. Grimes.\" 32d902844bSNiclas Zeising.Dd February 13, 2013 3358f0484fSRodney W. Grimes.Dt STRCHR 3 3458f0484fSRodney W. Grimes.Os 3558f0484fSRodney W. Grimes.Sh NAME 36d902844bSNiclas Zeising.Nm strchr , strrchr , strchrnul 3758f0484fSRodney W. Grimes.Nd locate character in string 3825bb73e0SAlexey Zelkin.Sh LIBRARY 3925bb73e0SAlexey Zelkin.Lb libc 4058f0484fSRodney W. Grimes.Sh SYNOPSIS 4132eef9aeSRuslan Ermilov.In string.h 42c9ae54eeSSimon L. B. Nielsen.Ft "char *" 4358f0484fSRodney W. Grimes.Fn strchr "const char *s" "int c" 44c9ae54eeSSimon L. B. Nielsen.Ft "char *" 45c9ae54eeSSimon L. B. Nielsen.Fn strrchr "const char *s" "int c" 46d902844bSNiclas Zeising.Ft "char *" 47d902844bSNiclas Zeising.Fn strchrnul "const char *s" "int c" 4858f0484fSRodney W. Grimes.Sh DESCRIPTION 4958f0484fSRodney W. GrimesThe 5058f0484fSRodney W. Grimes.Fn strchr 5158f0484fSRodney W. Grimesfunction locates the first occurrence of 525c564baeSRuslan Ermilov.Fa c 53c9ae54eeSSimon L. B. Nielsen(converted to a 54c9ae54eeSSimon L. B. Nielsen.Vt char ) 5558f0484fSRodney W. Grimesin the string pointed to by 565c564baeSRuslan Ermilov.Fa s . 574bbf46d6SSimon L. B. NielsenThe terminating null character is considered part of the string; 584bbf46d6SSimon L. B. Nielsentherefore if 594bbf46d6SSimon L. B. Nielsen.Fa c 604bbf46d6SSimon L. B. Nielsenis 614bbf46d6SSimon L. B. Nielsen.Ql \e0 , 624bbf46d6SSimon L. B. Nielsenthe functions locate the terminating 634bbf46d6SSimon L. B. Nielsen.Ql \e0 . 64c9ae54eeSSimon L. B. Nielsen.Pp 65c9ae54eeSSimon L. B. NielsenThe 66c9ae54eeSSimon L. B. Nielsen.Fn strrchr 67c9ae54eeSSimon L. B. Nielsenfunction is identical to 68c9ae54eeSSimon L. B. Nielsen.Fn strchr 69c9ae54eeSSimon L. B. Nielsenexcept it locates the last occurrence of 70c9ae54eeSSimon L. B. Nielsen.Fa c . 71d902844bSNiclas Zeising.Pp 72d902844bSNiclas ZeisingThe 73d902844bSNiclas Zeising.Fn strchrnul 74d902844bSNiclas Zeisingfunction is identical to 75d902844bSNiclas Zeising.Fn strchr 76d902844bSNiclas Zeisingexcept that if 77d902844bSNiclas Zeising.Fa c 78d902844bSNiclas Zeisingis not found in 79d902844bSNiclas Zeising.Fa s 80d902844bSNiclas Zeisinga pointer to the terminating 81d902844bSNiclas Zeising.Ql \e0 82d902844bSNiclas Zeisingis returned. 83c9ae54eeSSimon L. B. Nielsen.Sh RETURN VALUES 84c9ae54eeSSimon L. B. NielsenThe functions 85c9ae54eeSSimon L. B. Nielsen.Fn strchr 86c9ae54eeSSimon L. B. Nielsenand 87c9ae54eeSSimon L. B. Nielsen.Fn strrchr 88c9ae54eeSSimon L. B. Nielsenreturn a pointer to the located character, or 89c9ae54eeSSimon L. B. Nielsen.Dv NULL 90c9ae54eeSSimon L. B. Nielsenif the character does not appear in the string. 91d902844bSNiclas Zeising.Pp 92d902844bSNiclas Zeising.Fn strchrnul 93d902844bSNiclas Zeisingreturns a pointer to the terminating 94d902844bSNiclas Zeising.Ql \e0 95d902844bSNiclas Zeisingif the character does not appear in the string. 9658f0484fSRodney W. Grimes.Sh SEE ALSO 9758f0484fSRodney W. Grimes.Xr memchr 3 , 986050c8feSAndre Oppermann.Xr memmem 3 , 9958f0484fSRodney W. Grimes.Xr strcspn 3 , 10058f0484fSRodney W. Grimes.Xr strpbrk 3 , 10158f0484fSRodney W. Grimes.Xr strsep 3 , 10258f0484fSRodney W. Grimes.Xr strspn 3 , 10358f0484fSRodney W. Grimes.Xr strstr 3 , 1045174a6a2SEdward Tomasz Napierala.Xr strtok 3 , 1055174a6a2SEdward Tomasz Napierala.Xr wcschr 3 10658f0484fSRodney W. Grimes.Sh STANDARDS 107c9ae54eeSSimon L. B. NielsenThe functions 10858f0484fSRodney W. Grimes.Fn strchr 109c9ae54eeSSimon L. B. Nielsenand 110c9ae54eeSSimon L. B. Nielsen.Fn strrchr 111c9ae54eeSSimon L. B. Nielsenconform to 112588a200cSRuslan Ermilov.St -isoC . 113*c0806cdcSJilles TjoelkerThe function 114d902844bSNiclas Zeising.Fn strchrnul 115*c0806cdcSJilles Tjoelkeris a 116*c0806cdcSJilles Tjoelker.Tn GNU 117*c0806cdcSJilles Tjoelkerextension. 118*c0806cdcSJilles Tjoelker.Sh HISTORY 119d902844bSNiclas ZeisingThe 120d902844bSNiclas Zeising.Fn strchrnul 121d902844bSNiclas Zeisingfunction first appeared in glibc 2.1.1 and was added in 122d902844bSNiclas Zeising.Fx 10.0 . 123