diff options
| author | lukem <lukem@NetBSD.org> | 2003-12-05 13:37:48 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2003-12-05 13:37:48 +0000 |
| commit | a9beb0e4439ae031de723787f27a4eb4e6d7a4d7 (patch) | |
| tree | 46626ac02ffc2f7667626ddc1ebe644f9222bc30 /lib/libedit | |
| parent | 3b1892c380180d77479fa1aa2fce3d0f22ef17c5 (diff) | |
Tokenization function enhancements:
* Make tok_init(), tok_end(), tok_reset(), tok_line() and tok_str()
publically available in <histedit.h>
* Documented the public functions in editline(3)
* Renamed tok_line() -> tok_str()
* Added new tok_line() which takes a "const LineInfo *" instead of
"const char *" (the former has "cursor" information), and optionally
return the argv index ("int *cursorc") and offset within that index
("int *cursorv"). This means that completion routines can use the
tokenization code to crack the line and easily find which word the
cursor is at. (mmm, context sensitive completion :)
* Fixed TEST/test.c when using "continuation" lines (unmatched quote
or \ at EOL), and added some more DEBUG messages including highlighting
where the cursor is (with a `_').
Diffstat (limited to 'lib/libedit')
| -rw-r--r-- | lib/libedit/Makefile | 7 | ||||
| -rw-r--r-- | lib/libedit/TEST/Makefile | 6 | ||||
| -rw-r--r-- | lib/libedit/TEST/test.c | 47 | ||||
| -rw-r--r-- | lib/libedit/editline.3 | 107 | ||||
| -rw-r--r-- | lib/libedit/histedit.h | 29 | ||||
| -rw-r--r-- | lib/libedit/parse.c | 7 | ||||
| -rw-r--r-- | lib/libedit/readline.c | 7 | ||||
| -rw-r--r-- | lib/libedit/shlib_version | 4 | ||||
| -rw-r--r-- | lib/libedit/tokenizer.c | 84 | ||||
| -rw-r--r-- | lib/libedit/tokenizer.h | 50 |
10 files changed, 240 insertions, 108 deletions
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 36835256fb7..ad69a1c277b 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2003/08/01 17:03:58 lukem Exp $ +# $NetBSD: Makefile,v 1.29 2003/12/05 13:37:48 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -16,7 +16,10 @@ MLINKS= editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \ editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_get.3 \ editline.3 el_source.3 editline.3 el_resize.3 editline.3 el_line.3 \ editline.3 el_insertstr.3 editline.3 el_deletestr.3 \ - editline.3 history_init.3 editline.3 history_end.3 editline.3 history.3 + editline.3 history_init.3 editline.3 history_end.3 \ + editline.3 history.3 \ + editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \ + editline.3 tok_line.3 editline.3 tok_str.3 # For speed and debugging #SRCS= ${OSRCS} tokenizer.c history.c readline.c diff --git a/lib/libedit/TEST/Makefile b/lib/libedit/TEST/Makefile index e3d2bac2098..0118710e7f7 100644 --- a/lib/libedit/TEST/Makefile +++ b/lib/libedit/TEST/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2003/10/16 21:41:46 christos Exp $ +# $NetBSD: Makefile,v 1.2 2003/12/05 13:37:48 lukem Exp $ NOMAN=1 PROG=test @@ -6,4 +6,8 @@ CPPFLAGS=-I${.CURDIR}/.. LDADD+=-ledit -ltermcap DPADD+=${LIBEDIT} ${LIBTERMCAP} +.ifdef DEBUG +CPPFLAGS+=-DDEBUG +.endif + .include <bsd.prog.mk> diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/test.c index 510e5dc581d..d7768fe8fa9 100644 --- a/lib/libedit/TEST/test.c +++ b/lib/libedit/TEST/test.c @@ -1,4 +1,4 @@ -/* $NetBSD: test.c,v 1.13 2003/08/07 16:44:35 agc Exp $ */ +/* $NetBSD: test.c,v 1.14 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: test.c,v 1.13 2003/08/07 16:44:35 agc Exp $"); +__RCSID("$NetBSD: test.c,v 1.14 2003/12/05 13:37:48 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -59,7 +59,6 @@ __RCSID("$NetBSD: test.c,v 1.13 2003/08/07 16:44:35 agc Exp $"); #include <dirent.h> #include "histedit.h" -#include "tokenizer.h" static int continuation = 0; static EditLine *el = NULL; @@ -72,8 +71,8 @@ static void sig(int); static char * prompt(EditLine *el) { - static char a[] = "Edit$"; - static char b[] = "Edit>"; + static char a[] = "Edit$ "; + static char b[] = "Edit> "; return (continuation ? b : a); } @@ -171,15 +170,35 @@ main(int argc, char *argv[]) el_source(el, NULL); while ((buf = el_gets(el, &num)) != NULL && num != 0) { - int ac; + int ac, cc, co; +#ifdef DEBUG + int i; +#endif const char **av; + const LineInfo *li; + li = el_line(el); #ifdef DEBUG - (void) fprintf(stderr, "got %d %s", num, buf); + (void) fprintf(stderr, "==> got %d %s", num, buf); + (void) fprintf(stderr, " > li `%.*s_%.*s'\n", + (li->cursor - li->buffer), li->buffer, + (li->lastchar - 1 - li->cursor), + (li->cursor >= li->lastchar) ? "" : li->cursor); + #endif if (!continuation && num == 1) continue; - ncontinuation = tok_line(tok, buf, &ac, &av) > 0; + ac = cc = co = 0; + ncontinuation = tok_LineInfo(tok, li, &ac, &av, &cc, &co); + if (ncontinuation < 0) { + (void) fprintf(stderr, "Internal error\n"); + continuation = 0; + continue; + } +#ifdef DEBUG + (void) fprintf(stderr, " > nc %d ac %d cc %d co %d\n", + ncontinuation, ac, cc, co); +#endif #if 0 if (continuation) { /* @@ -200,6 +219,18 @@ main(int argc, char *argv[]) continuation = ncontinuation; ncontinuation = 0; + if (continuation) + continue; +#ifdef DEBUG + for (i = 0; i < ac; i++) { + (void) fprintf(stderr, " > arg# %2d ", i); + if (i != cc) + (void) fprintf(stderr, "`%s'\n", av[i]); + else + (void) fprintf(stderr, "`%.*s_%s'\n", + co, av[i], av[i] + co); + } +#endif if (strcmp(av[0], "history") == 0) { int rv; diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3 index 429f2f93d96..e76a78ae703 100644 --- a/lib/libedit/editline.3 +++ b/lib/libedit/editline.3 @@ -1,6 +1,6 @@ -.\" $NetBSD: editline.3,v 1.42 2003/11/04 13:22:19 christos Exp $ +.\" $NetBSD: editline.3,v 1.43 2003/12/05 13:37:48 lukem Exp $ .\" -.\" Copyright (c) 1997-1999 The NetBSD Foundation, Inc. +.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This file was contributed to The NetBSD Foundation by Luke Mewburn. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 17, 2003 +.Dd December 5, 2003 .Os .Dt EDITLINE 3 .Sh NAME @@ -53,8 +53,13 @@ .Nm el_deletestr , .Nm history_init , .Nm history_end , -.Nm history -.Nd line editor and history functions +.Nm history , +.Nm tok_init , +.Nm tok_end , +.Nm tok_reset , +.Nm tok_line , +.Nm tok_str +.Nd line editor, history and tokenization functions .Sh LIBRARY .Lb libedit .Sh SYNOPSIS @@ -93,10 +98,20 @@ .Fn history_end "History *h" .Ft int .Fn history "History *h" "HistEvent *ev" "int op" "..." +.Ft Tokenizer * +.Fn tok_init "const char *IFS" +.Ft void +.Fn tok_end "Tokenizer *t" +.Ft void +.Fn tok_reset "Tokenizer *t" +.Ft int +.Fn tok_line "Tokenizer *t" "const LineInfo *li" "int *argc" "const char *argv[]" "int *cursorc" "int *cursoro" +.Ft int +.Fn tok_str "Tokenizer *t" "const char *str" "int *argc" "const char *argv[]" .Sh DESCRIPTION The .Nm -library provides generic line editing and history functions, +library provides generic line editing, history and tokenization functions, similar to those found in .Xr sh 1 . .Pp @@ -476,6 +491,16 @@ typedef struct lineinfo { const char *lastchar; /* address of last character */ } LineInfo; .Ed +.Pp +.Fa buffer +is not NUL terminated. +This function may be called after +.Fn el_gets +to obtain the +.Fa LineInfo +structure pertaining to line returned by that function, +and from within user defined functions added with +.Dv EL_ADDFN . .It Fn el_insertstr Insert .Fa str @@ -619,6 +644,73 @@ Otherwise, \-1 is returned and .Fa ev is updated to contain more details about the error. .El +.Sh TOKENIZATION FUNCTIONS +The tokenization functions use a common data structure, +.Fa Tokenizer , +which is created by +.Fn tok_init +and freed by +.Fn tok_end . +.Pp +The following functions are available: +.Bl -tag -width 4n +.It Fn tok_init +Initialise the tokenizer, and return a data structure +to be used by all other tokenizer functions. +.Fa IFS +contains the Input Field Separators, which defaults to +<space>, <tab>, and <newline> if +.Dv NULL . +.It Fn tok_end +Clean up and finish with +.Fa t , +assumed to have been created with +.Fn tok_init . +.It Fn tok_reset +Reset the tokenizer state. +Use after a line has been successfully tokenized +by +.Fn tok_line +or +.Fn tok_str +and before a new line is to be tokenized. +.It Fn tok_line +Tokenize +.Fa li , +If successful, modify: +.Fa argv +to contain the words, +.Fa argc +to contain the number of words, +.Fa cursorc +(if not +.Dv NULL ) +to contain the index of the word containing the cursor, +and +.Fa cursoro +(if not +.Dv NULL ) +to contain the offset within +.Fa argv[cursorc] +of the cursor. +.Pp +Returns +0 if successful, +-1 for an internal error, +1 for an unmatched single quote, +2 for an unmatched double quote, +and +3 for a backslash quoted <newline>. +A positive exit code indicates that another line should be read +and tokenization attempted again. +. +.It Fn tok_str +A simpler form of +.Fn tok_line ; +.Fa str +is a NUL terminated string to tokenize. +.El +. .\"XXX.Sh EXAMPLES .\"XXX: provide some examples .Sh SEE ALSO @@ -653,9 +745,6 @@ and .Dv EL_RPROMPT . Jaromir Dolecek implemented the readline emulation. .Sh BUGS -The tokenization functions are not publicly defined in -.Aq Pa histedit.h . -.Pp At this time, it is the responsibility of the caller to check the result of the .Dv EL_EDITMODE diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h index 5e6fd01b290..c58eb62dcfa 100644 --- a/lib/libedit/histedit.h +++ b/lib/libedit/histedit.h @@ -1,4 +1,4 @@ -/* $NetBSD: histedit.h,v 1.24 2003/10/16 22:26:32 christos Exp $ */ +/* $NetBSD: histedit.h,v 1.25 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ #define _HISTEDIT_H_ #define LIBEDIT_MAJOR 2 -#define LIBEDIT_MINOR 8 +#define LIBEDIT_MINOR 9 #include <sys/types.h> #include <stdio.h> @@ -49,6 +49,7 @@ /* * ==== Editing ==== */ + typedef struct editline EditLine; /* @@ -60,7 +61,6 @@ typedef struct lineinfo { const char *lastchar; } LineInfo; - /* * EditLine editor function return codes. * For user-defined function interface @@ -80,9 +80,8 @@ typedef struct lineinfo { * Initialization, cleanup, and resetting */ EditLine *el_init(const char *, FILE *, FILE *, FILE *); -void el_reset(EditLine *); void el_end(EditLine *); - +void el_reset(EditLine *); /* * Get a line, a character or push a string back in the input queue @@ -144,7 +143,6 @@ int el_source(EditLine *, const char *); */ void el_resize(EditLine *); - /* * User-defined function interface. */ @@ -152,6 +150,7 @@ const LineInfo *el_line(EditLine *); int el_insertstr(EditLine *, const char *); void el_deletestr(EditLine *, int); + /* * ==== History ==== */ @@ -194,4 +193,22 @@ int history(History *, HistEvent *, int, ...); #define H_SETUNIQUE 20 /* , int); */ #define H_GETUNIQUE 21 /* , void); */ + +/* + * ==== Tokenization ==== + */ + +typedef struct tokenizer Tokenizer; + +/* + * String tokenization functions, using simplified sh(1) quoting rules + */ +Tokenizer *tok_init(const char *); +void tok_end(Tokenizer *); +void tok_reset(Tokenizer *); +int tok_line(Tokenizer *, const LineInfo *, + int *, const char ***, int *, int *); +int tok_str(Tokenizer *, const char *, + int *, const char ***); + #endif /* _HISTEDIT_H_ */ diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index e7a36b300bf..de02fc611b6 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.19 2003/11/02 20:06:57 christos Exp $ */ +/* $NetBSD: parse.c,v 1.20 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: parse.c,v 1.19 2003/11/02 20:06:57 christos Exp $"); +__RCSID("$NetBSD: parse.c,v 1.20 2003/12/05 13:37:48 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -55,7 +55,6 @@ __RCSID("$NetBSD: parse.c,v 1.19 2003/11/02 20:06:57 christos Exp $"); * setty */ #include "el.h" -#include "tokenizer.h" #include <stdlib.h> private const struct { @@ -84,7 +83,7 @@ parse_line(EditLine *el, const char *line) Tokenizer *tok; tok = tok_init(NULL); - tok_line(tok, line, &argc, &argv); + tok_str(tok, line, &argc, &argv); argc = el_parse(el, argc, argv); tok_end(tok); return (argc); diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 20b4556d0a8..aa0397496de 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.43 2003/11/03 03:22:55 christos Exp $ */ +/* $NetBSD: readline.c,v 1.44 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.43 2003/11/03 03:22:55 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.44 2003/12/05 13:37:48 lukem Exp $"); #endif /* not lint && not SCCSID */ #include <sys/types.h> @@ -64,7 +64,6 @@ __RCSID("$NetBSD: readline.c,v 1.43 2003/11/03 03:22:55 christos Exp $"); #include "histedit.h" #include "readline/readline.h" #include "el.h" -#include "tokenizer.h" #include "fcns.h" /* for EL_NUM_FCNS */ /* for rl_complete() */ @@ -2061,7 +2060,7 @@ rl_parse_and_bind(const char *line) Tokenizer *tok; tok = tok_init(NULL); - tok_line(tok, line, &argc, &argv); + tok_str(tok, line, &argc, &argv); argc = el_parse(e, argc, argv); tok_end(tok); return (argc ? 1 : 0); diff --git a/lib/libedit/shlib_version b/lib/libedit/shlib_version index 5b7a33c1f72..d79ab7d1f01 100644 --- a/lib/libedit/shlib_version +++ b/lib/libedit/shlib_version @@ -1,5 +1,5 @@ -# $NetBSD: shlib_version,v 1.14 2003/09/26 17:44:51 christos Exp $ +# $NetBSD: shlib_version,v 1.15 2003/12/05 13:37:48 lukem Exp $ # Remember to update distrib/sets/lists/base/shl.* when changing # major=2 -minor=8 +minor=9 diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c index 22bb19be236..b8a263332f8 100644 --- a/lib/libedit/tokenizer.c +++ b/lib/libedit/tokenizer.c @@ -1,4 +1,4 @@ -/* $NetBSD: tokenizer.c,v 1.13 2003/10/18 23:48:42 christos Exp $ */ +/* $NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tokenizer.c,v 1.13 2003/10/18 23:48:42 christos Exp $"); +__RCSID("$NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -46,7 +46,7 @@ __RCSID("$NetBSD: tokenizer.c,v 1.13 2003/10/18 23:48:42 christos Exp $"); */ #include <string.h> #include <stdlib.h> -#include "tokenizer.h" +#include "histedit.h" typedef enum { Q_none, Q_single, Q_double, Q_one, Q_doubleone @@ -170,21 +170,39 @@ tok_end(Tokenizer *tok) /* tok_line(): - * Bourne shell like tokenizing - * Return: - * -1: Internal error - * 3: Quoted return - * 2: Unmatched double quote - * 1: Unmatched single quote - * 0: Ok + * Bourne shell (sh(1)) like tokenizing + * Arguments: + * tok current tokenizer state (setup with tok_init()) + * line line to parse + * Returns: + * -1 Internal error + * 3 Quoted return + * 2 Unmatched double quote + * 1 Unmatched single quote + * 0 Ok + * Modifies (if return value is 0): + * argc number of arguments + * argv argument array + * cursorc if !NULL, argv element containing cursor + * cursorv if !NULL, offset in argv[cursorc] of cursor */ public int -tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv) +tok_line(Tokenizer *tok, const LineInfo *line, + int *argc, const char ***argv, int *cursorc, int *cursoro) { const char *ptr; - - for (;;) { - switch (*(ptr = line++)) { + int cc, co; + + cc = co = -1; + ptr = line->buffer; + for (ptr = line->buffer; ;ptr++) { + if (ptr >= line->lastchar) + ptr = ""; + if (ptr == line->cursor) { + cc = tok->argc; + co = tok->wptr - tok->wstart; + } + switch (*ptr) { case '\'': tok->flags |= TOK_KEEP; tok->flags &= ~TOK_EAT; @@ -283,10 +301,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv) tok->flags &= ~TOK_EAT; switch (tok->quote) { case Q_none: - tok_finish(tok); - *argv = (const char **)tok->argv; - *argc = tok->argc; - return (0); + goto tok_line_outok; case Q_single: case Q_double: @@ -316,10 +331,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv) tok->flags &= ~TOK_EAT; return (3); } - tok_finish(tok); - *argv = (const char **)tok->argv; - *argc = tok->argc; - return (0); + goto tok_line_outok; case Q_single: return (1); @@ -404,4 +416,32 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv) tok->argv = p; } } + tok_line_outok: + if (cc == -1 && co == -1) { + cc = tok->argc; + co = tok->wptr - tok->wstart; + } + if (cursorc != NULL) + *cursorc = cc; + if (cursoro != NULL) + *cursoro = co; + tok_finish(tok); + *argv = (const char **)tok->argv; + *argc = tok->argc; + return (0); +} + +/* tok_str(): + * Simpler version of tok_line, taking a NUL terminated line + * and splitting into words, ignoring cursor state. + */ +public int +tok_str(Tokenizer *tok, const char *line, int *argc, const char ***argv) +{ + LineInfo li; + + memset(&li, 0, sizeof(li)); + li.buffer = line; + li.cursor = li.lastchar = strchr(line, '\0'); + return (tok_line(tok, &li, argc, argv, NULL, NULL)); } diff --git a/lib/libedit/tokenizer.h b/lib/libedit/tokenizer.h deleted file mode 100644 index 3d2010b0426..00000000000 --- a/lib/libedit/tokenizer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: tokenizer.h,v 1.6 2003/08/07 16:44:34 agc Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tokenizer.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * tokenizer.h: Header file for tokenizer routines - */ -#ifndef _h_tokenizer -#define _h_tokenizer - -typedef struct tokenizer Tokenizer; - -Tokenizer *tok_init(const char *); -void tok_reset(Tokenizer *); -void tok_end(Tokenizer *); -int tok_line(Tokenizer *, const char *, int *, const char ***); - -#endif /* _h_tokenizer */ |
