annotate lib/strchrnul.c @ 7944:a1d177cd9523

* doc/gnulib-tool.texi (Initial import): Update to match current behavior with strdup module. * lib/.cppi-disable: Remove strcase.h, strdup.h, strndup.h, strnlen.h. * lib/memmem.h: Remove; all uses removed. This is now done by <string.h>. * lib/mempcpy.h: Likewise. * lib/memrchr.h: Likewise. * lib/stpcpy.h: Likewise. * lib/stpncpy.h: Likewise. * lib/strcase.h: Likewise. * lib/strchrnul.h: Likewise. * lib/strdup.h: Likewise. * lib/strndup.h: Likewise. * lib/strnlen.h: Likewise. * lib/strpbrk.h: Likewise. * lib/strsep.h: Likewise. * lib/strstr.h: Likewise. * lib/strtok_r.h: Likewise. * lib/string_.h: New file. * lib/argp-namefrob.h: Don't include no-longer-existent include files. Rely on <string.h> instead. * lib/canon-host.c: Likewise. * lib/chdir-long.c: Likewise. * lib/concatpath.c: Likewise. * lib/exclude.c: Likewise. * lib/fchdir.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getcwd.c: Likewise. * lib/getsubopt.c: Likewise. * lib/glob.c: Likewise. * lib/hard-locale.c: Likewise. * lib/iconvme.c: Likewise. * lib/javacomp.c: Likewise. * lib/mempcpy.c: Likewise. * lib/memrchr.c: Likewise. * lib/regex_internal.h: Likewise. * lib/stpncpy.c: Likewise. * lib/strcasecmp.c: Likewise. * lib/strchrnul.c: Likewise. * lib/strdup.c: Likewise. * lib/striconv.c: Likewise. * lib/striconveh.c: Likewise. * lib/striconveha.c: Likewise. * lib/strncasecmp.c: Likewise. * lib/strndup.c: Likewise. * lib/strnlen.c: Likewise. * lib/strsep.c: Likewise. * lib/strstr.c: Likewise. * lib/strtok_r.c: Likewise. * lib/userspec.c: Likewise. * lib/w32spawn.h: Likewise. * lib/xstrndup.c: Likewise. * lib/mountlist.c (strstr): Remove decl. * m4/string_h.m4: New file. * m4/memmem.m4 (gl_FUNC_MEMMEM): Set HAVE_DECL_MEMMEM if necessary. * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Set HAVE_MEMPCPY if necessary. * m4/memrchr.m4 (gl_FUNC_MEMRCHR): Set HAVE_MEMRCHR * m4/stpcpy.m4 (gl_FUNC_STPCPY): Set HAVE_STPCPY if necessary. * m4/stpncpy.m4 (gl_PREREQ_STPNCPY): Set HAVE_STPNCPY if necessary. * m4/strcase.m4 (gl_FUNC_STRCASECMP): Set REPLACE_STRCASECMP if necessary. (gl_FUNC_STRNCASECMP): Set HAVE_DECL_STRNCASECMP if necessary. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Set HAVE_STRCHRNUL if necessary. * m4/strdup.m4 (gl_FUNC_STRDUP): Set HAVE_DECL_STRDUP if necessary. * m4/strndup.m4 (gl_FUNC_STRNDUP): Set HAVE_DECL_STRNLEN and HAVE_DECL_STRDUP if necessary. (gl_PREREQ_STRNLEN): Don't bother to check for strnlen decl, since gl_FUNC_STRNDUP does that now. * m4/strnlen.m4 (gl_FUNC_STRNLEN): Set HAVE_DECL_STRNLEN if necessary. Check for decl here... (gl_PREREQ_STRNLEN): ... not here. * m4/strpbrk.m4 (gl_FUNC_STRPBRK): Set HAVE_STRPBRK if necessary. * m4/strsep.m4 (gl_FUNC_STRSEP): Set HAVE_STRSEP if necessary. * m4/strstr.m4 (gl_FUNC_STRSTR): Set REPLACE_STRSTR if necessary. * m4/strtok_r.m4 (gl_FUNC_STRTOK_R): Set HAVE_DECL_STRTOK_R if necessary. * modules/string: New file. * modules/memmem (Files): Remove special-purpose include file. (Depends-on): Add string. (Include): Include <string.h>, not the removed file. * modules/mempcpy: Likewise. * modules/memrchr: Likewise. * modules/stpcpy: Likewise. * modules/stpncpy: Likewise. * modules/strcase: Likewise. * modules/strchrnul: Likewise. * modules/strdup: Likewise. * modules/strndup: Likewise. * modules/strnlen: Likewise. * modules/strpbrk: Likewise. * modules/strsep: Likewise. * modules/strstr: Likewise. * modules/strtok_r: Likewise. * tests/test-dirname.c: Don't include "stdup.h", since <string.h> now suffices. * tests/test-memmem.c: Don't include "memmem.h", since <string.h> now suffices.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 26 Jan 2007 22:16:55 +0000
parents a48fb0e98c8c
children b0198d1bb409
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Searching in a string.
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 5848
diff changeset
2 Copyright (C) 2003, 2007 Free Software Foundation, Inc.
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 4679
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 /* Specification. */
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 5848
diff changeset
19 #include <string.h>
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 /* Find the first occurrence of C in S or the final NUL byte. */
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 char *
4676
7779e842b2e1 Remove K&R cruft.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4387
diff changeset
23 strchrnul (const char *s, int c_in)
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 {
4679
b3ad36bab412 (strchrnul): Convert arg to char, not to unsigned char.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4676
diff changeset
25 char c = c_in;
4676
7779e842b2e1 Remove K&R cruft.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4387
diff changeset
26 while (*s && (*s != c))
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 s++;
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
4676
7779e842b2e1 Remove K&R cruft.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4387
diff changeset
29 return (char *) s;
4387
3d8c93096962 New module strchrnul.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 }