1 /* Copyright (C) 2004 Free Software Foundation, Inc.
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software Foundation,
15 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 #if !defined (HAVE_STRNLEN)
23 #include <sys/types.h>
25 #if defined (HAVE_UNISTD_H)
31 /* Find the length of S, but scan at most MAXLEN characters. If no '\0'
32 terminator is found within the first MAXLEN characters, return MAXLEN. */
35 register const char *s;
38 register const char *e;
41 for (e = s, n = 0; *e && n < maxlen; e++, n++)