Merge from coreutils.
[gnulib.git] / lib / readtokens.h
1 /* readtokens.h -- Functions for reading tokens from an input stream.
2
3    Copyright (C) 1990, 1991, 1999, 2001-2004 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19    Written by Jim Meyering. */
20
21 #ifndef READTOKENS_H
22 # define READTOKENS_H
23
24 # include <stdio.h>
25
26 struct tokenbuffer
27 {
28   size_t size;
29   char *buffer;
30 };
31 typedef struct tokenbuffer token_buffer;
32
33 void init_tokenbuffer (token_buffer *tokenbuffer);
34
35 size_t
36   readtoken (FILE *stream, const char *delim, size_t n_delim,
37              token_buffer *tokenbuffer);
38 size_t
39   readtokens (FILE *stream, size_t projected_n_tokens,
40               const char *delim, size_t n_delim,
41               char ***tokens_out, size_t **token_lengths);
42
43 #endif /* not READTOKENS_H */