No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / texinfo / lib / substring.c
blobbc9cb391a5aafaca02b8cfa7e0b7e4e23db77601
1 /* $NetBSD$ */
3 /* substring.c -- extract substring.
4 Id: substring.c,v 1.2 2004/04/11 17:56:46 karl Exp
6 Copyright (C) 1999, 2004 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #include "system.h"
24 char *
25 substring (const char *start, const char *end)
27 char *result = xmalloc (end - start + 1);
28 char *scan_result = result;
29 const char *scan = start;
31 while (scan < end)
32 *scan_result++ = *scan++;
34 *scan_result = 0;
35 return result;