2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)breakline.c 1.10 04/09/25 Copyright 1985, 1995-2003 J. Schilling */
15 * break a line pointed to by *buf into fields
16 * returns the number of tokens, the line was broken into (>= 1)
18 * delim is the delimiter to break at
19 * array[0 .. found-1] point to strings from broken line
20 * array[found ... len] point to '\0'
21 * len is the size of the array
23 * Copyright (c) 1985, 1995-2003 J. Schilling
26 * This program is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License version 2
28 * as published by the Free Software Foundation.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License along with
36 * this program; see the file COPYING. If not, write to the Free Software
37 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 register char *array[],
52 breakline(buf, delim, array, len)
55 register char *array[];
59 register char *bp = buf;
64 for (i = 0, found = 1; i < len; i++) {
65 for (dp = bp; *dp != '\0' && *dp != delim; dp++)