156160Sru/* substring.c -- extract substring.
2146515Sru   $Id: substring.c,v 1.2 2004/04/11 17:56:46 karl Exp $
356160Sru
4146515Sru   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
556160Sru
656160Sru   This program is free software; you can redistribute it and/or modify
756160Sru   it under the terms of the GNU General Public License as published by
856160Sru   the Free Software Foundation; either version 2, or (at your option)
956160Sru   any later version.
1056160Sru
1156160Sru   This program is distributed in the hope that it will be useful,
1256160Sru   but WITHOUT ANY WARRANTY; without even the implied warranty of
1356160Sru   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1456160Sru   GNU General Public License for more details.
1556160Sru
1656160Sru   You should have received a copy of the GNU General Public License along
1756160Sru   with this program; if not, write to the Free Software Foundation, Inc.,
1856160Sru   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1956160Sru
2056160Sru#include "system.h"
2156160Sru
2256160Sruchar *
23146515Srusubstring (const char *start, const char *end)
2456160Sru{
2556160Sru  char *result = xmalloc (end - start + 1);
2656160Sru  char *scan_result = result;
27146515Sru  const char *scan = start;
2856160Sru
2956160Sru  while (scan < end)
3056160Sru    *scan_result++ = *scan++;
3156160Sru
3256160Sru  *scan_result = 0;
3356160Sru  return result;
3456160Sru}
3556160Sru
36