Back to index

tetex-bin  3.0
substring.c
Go to the documentation of this file.
00001 /* substring.c -- extract substring.
00002    $Id: substring.c,v 1.2 2004/04/11 17:56:46 karl Exp $
00003 
00004    Copyright (C) 1999, 2004 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License along
00017    with this program; if not, write to the Free Software Foundation, Inc.,
00018    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00019 
00020 #include "system.h"
00021 
00022 char *
00023 substring (const char *start, const char *end)
00024 {
00025   char *result = xmalloc (end - start + 1);
00026   char *scan_result = result;
00027   const char *scan = start;
00028 
00029   while (scan < end)
00030     *scan_result++ = *scan++;
00031 
00032   *scan_result = 0;
00033   return result;
00034 }
00035