mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
upgrade to libedit-2.6.7
(fixed Bug #4462 libedit compile failure) BitKeeper/etc/ignore: change config.h -> config.h to commit cmd-line-utils/libedit/config.h cmd-line-utils/libedit/Makefile.am: upgrade to libedit-2.6.7 cmd-line-utils/libedit/chared.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/chared.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/common.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/el.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/el.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/emacs.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/hist.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/hist.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/histedit.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/history.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/key.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/key.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/makelist.sh: upgrade to libedit-2.6.7 cmd-line-utils/libedit/map.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/map.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/parse.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/prompt.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/read.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/readline.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/readline/readline.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/refresh.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/search.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/search.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sig.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sig.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sys.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/term.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tokenizer.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tokenizer.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tty.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tty.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/vi.c: upgrade to libedit-2.6.7 configure.in: change liblibedit.a to correct libedit.a
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tokenizer.c,v 1.7 2001/01/04 15:56:32 christos Exp $ */
|
||||
/* $NetBSD: tokenizer.c,v 1.11 2002/10/27 20:24:29 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tokenizer.c,v 1.11 2002/10/27 20:24:29 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* tokenize.c: Bourne shell like tokenizer
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "tokenizer.h"
|
||||
@@ -66,7 +72,7 @@ typedef enum {
|
||||
struct tokenizer {
|
||||
char *ifs; /* In field separator */
|
||||
int argc, amax; /* Current and maximum number of args */
|
||||
const char **argv; /* Argument list */
|
||||
char **argv; /* Argument list */
|
||||
char *wptr, *wmax; /* Space and limit on the word buffer */
|
||||
char *wstart; /* Beginning of next word */
|
||||
char *wspace; /* Space of word buffer */
|
||||
@@ -103,16 +109,29 @@ tok_init(const char *ifs)
|
||||
{
|
||||
Tokenizer *tok = (Tokenizer *) tok_malloc(sizeof(Tokenizer));
|
||||
|
||||
if (tok == NULL)
|
||||
return NULL;
|
||||
tok->ifs = strdup(ifs ? ifs : IFS);
|
||||
if (tok->ifs == NULL) {
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->argc = 0;
|
||||
tok->amax = AINCR;
|
||||
tok->argv = (const char **) tok_malloc(sizeof(char *) * tok->amax);
|
||||
if (tok->argv == NULL)
|
||||
return (NULL);
|
||||
tok->argv = (char **) tok_malloc(sizeof(char *) * tok->amax);
|
||||
if (tok->argv == NULL) {
|
||||
tok_free((ptr_t)tok->ifs);
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->argv[0] = NULL;
|
||||
tok->wspace = (char *) tok_malloc(WINCR);
|
||||
if (tok->wspace == NULL)
|
||||
return (NULL);
|
||||
if (tok->wspace == NULL) {
|
||||
tok_free((ptr_t)tok->argv);
|
||||
tok_free((ptr_t)tok->ifs);
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->wmax = tok->wspace + WINCR;
|
||||
tok->wstart = tok->wspace;
|
||||
tok->wptr = tok->wspace;
|
||||
@@ -268,7 +287,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
switch (tok->quote) {
|
||||
case Q_none:
|
||||
tok_finish(tok);
|
||||
*argv = tok->argv;
|
||||
*argv = (const char **)tok->argv;
|
||||
*argc = tok->argc;
|
||||
return (0);
|
||||
|
||||
@@ -301,7 +320,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
return (3);
|
||||
}
|
||||
tok_finish(tok);
|
||||
*argv = tok->argv;
|
||||
*argv = (const char **)tok->argv;
|
||||
*argc = tok->argc;
|
||||
return (0);
|
||||
|
||||
@@ -363,25 +382,25 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
if (tok->wptr >= tok->wmax - 4) {
|
||||
size_t size = tok->wmax - tok->wspace + WINCR;
|
||||
char *s = (char *) tok_realloc(tok->wspace, size);
|
||||
/* SUPPRESS 22 */
|
||||
int offs = s - tok->wspace;
|
||||
if (s == NULL)
|
||||
return (-1);
|
||||
|
||||
if (offs != 0) {
|
||||
if (s != tok->wspace) {
|
||||
int i;
|
||||
for (i = 0; i < tok->argc; i++)
|
||||
tok->argv[i] = tok->argv[i] + offs;
|
||||
tok->wptr = tok->wptr + offs;
|
||||
tok->wstart = tok->wstart + offs;
|
||||
tok->wmax = s + size;
|
||||
for (i = 0; i < tok->argc; i++) {
|
||||
tok->argv[i] =
|
||||
(tok->argv[i] - tok->wspace) + s;
|
||||
}
|
||||
tok->wptr = (tok->wptr - tok->wspace) + s;
|
||||
tok->wstart = (tok->wstart - tok->wspace) + s;
|
||||
tok->wspace = s;
|
||||
}
|
||||
tok->wmax = s + size;
|
||||
}
|
||||
if (tok->argc >= tok->amax - 4) {
|
||||
const char **p;
|
||||
char **p;
|
||||
tok->amax += AINCR;
|
||||
p = (const char **) tok_realloc(tok->argv,
|
||||
p = (char **) tok_realloc(tok->argv,
|
||||
tok->amax * sizeof(char *));
|
||||
if (p == NULL)
|
||||
return (-1);
|
||||
|
||||
Reference in New Issue
Block a user