1N/A/* -*- buffer-read-only: t -*- vi: set ro: */
1N/A/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
1N/A/* A replacement function, for systems that lack strndup.
1N/A
1N/A Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007, 2009,
1N/A 2010 Free Software Foundation, Inc.
1N/A
1N/A This program is free software; you can redistribute it and/or modify it
1N/A under the terms of the GNU General Public License as published by the
1N/A Free Software Foundation; either version 3, or (at your option) any
1N/A later version.
1N/A
1N/A This program is distributed in the hope that it will be useful,
1N/A but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A GNU General Public License for more details.
1N/A
1N/A You should have received a copy of the GNU General Public License
1N/A along with this program; if not, write to the Free Software Foundation,
1N/A Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
1N/A
1N/A#include <config.h>
1N/A
1N/A#include <string.h>
1N/A
1N/A#include <stdlib.h>
1N/A
1N/Achar *
1N/Astrndup (char const *s, size_t n)
1N/A{
1N/A size_t len = strnlen (s, n);
1N/A char *new = malloc (len + 1);
1N/A
1N/A if (new == NULL)
1N/A return NULL;
1N/A
1N/A new[len] = '\0';
1N/A return memcpy (new, s, len);
1N/A}