155682Smarkm/* substring.c -- extract substring.
255682Smarkm   $Id: substring.c,v 1.1.1.2 2006/07/17 16:03:41 espie Exp $
355682Smarkm
455682Smarkm   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
555682Smarkm
655682Smarkm   This program is free software; you can redistribute it and/or modify
755682Smarkm   it under the terms of the GNU General Public License as published by
855682Smarkm   the Free Software Foundation; either version 2, or (at your option)
955682Smarkm   any later version.
1055682Smarkm
1155682Smarkm   This program is distributed in the hope that it will be useful,
1255682Smarkm   but WITHOUT ANY WARRANTY; without even the implied warranty of
1355682Smarkm   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1455682Smarkm   GNU General Public License for more details.
1555682Smarkm
1655682Smarkm   You should have received a copy of the GNU General Public License along
1755682Smarkm   with this program; if not, write to the Free Software Foundation, Inc.,
1855682Smarkm   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1955682Smarkm
2055682Smarkm#include "system.h"
2155682Smarkm
2255682Smarkmchar *
2355682Smarkmsubstring (const char *start, const char *end)
2455682Smarkm{
2555682Smarkm  char *result = xmalloc (end - start + 1);
2655682Smarkm  char *scan_result = result;
2755682Smarkm  const char *scan = start;
2855682Smarkm
2955682Smarkm  while (scan < end)
3055682Smarkm    *scan_result++ = *scan++;
3155682Smarkm
3255682Smarkm  *scan_result = 0;
3355682Smarkm  return result;
3455682Smarkm}
3555682Smarkm
3655682Smarkm