Merge branch 'master' of github.com:heimdal/heimdal
Conflicts: lib/gssapi/gssapi/gssapi.h lib/gssapi/gssapi_mech.h lib/gssapi/mech/gss_mech_switch.c
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 1995 - 2009 Kungliga Tekniska Högskolan
|
||||
Copyright (c) 1995 - 2011 Kungliga Tekniska Högskolan
|
||||
(Royal Institute of Technology, Stockholm, Sweden).
|
||||
All rights reserved.
|
||||
|
||||
|
@@ -51,6 +51,33 @@ typedef struct krb5_kx_context krb5_kx_context;
|
||||
#define K5DATA(kc) ((krb5_kx_context*)kc->data)
|
||||
#define CONTEXT(kc) (K5DATA(kc)->context)
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
ksyslog(krb5_context context, krb5_error_code ret, const char *fmt, ...)
|
||||
__attribute__((__format__(__printf__, 3, 0)));
|
||||
|
||||
static void
|
||||
ksyslog(krb5_context context, krb5_error_code ret, const char *fmt, ...)
|
||||
{
|
||||
const char *msg;
|
||||
char *str = NULL;
|
||||
va_list va;
|
||||
|
||||
msg = krb5_get_error_message(context, ret);
|
||||
|
||||
va_start(va, fmt);
|
||||
vasprintf(&str, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
syslog(LOG_ERR, "%s: %s", str, msg);
|
||||
|
||||
krb5_free_error_message(context, msg);
|
||||
free(str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy the krb5 context in `c'.
|
||||
*/
|
||||
@@ -378,8 +405,7 @@ recv_v5_auth (kx_context *kc, int sock, u_char *buf)
|
||||
ret = krb5_sock_to_principal (CONTEXT(kc), sock, "host",
|
||||
KRB5_NT_SRV_HST, &server);
|
||||
if (ret) {
|
||||
syslog (LOG_ERR, "krb5_sock_to_principal: %s",
|
||||
krb5_get_err_text (CONTEXT(kc), ret));
|
||||
ksyslog (CONTEXT(kc), ret, "krb5_sock_to_principal");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -393,22 +419,19 @@ recv_v5_auth (kx_context *kc, int sock, u_char *buf)
|
||||
&ticket);
|
||||
krb5_free_principal (CONTEXT(kc), server);
|
||||
if (ret) {
|
||||
syslog (LOG_ERR, "krb5_sock_to_principal: %s",
|
||||
krb5_get_err_text (CONTEXT(kc), ret));
|
||||
ksyslog (CONTEXT(kc), ret, "krb5_recvauth");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
ret = krb5_auth_con_getkey (CONTEXT(kc), auth_context, &K5DATA(kc)->keyblock);
|
||||
if (ret) {
|
||||
syslog (LOG_ERR, "krb5_auth_con_getkey: %s",
|
||||
krb5_get_err_text (CONTEXT(kc), ret));
|
||||
ksyslog (CONTEXT(kc), ret, "krb5_auth_con_getkey");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
ret = krb5_crypto_init (CONTEXT(kc), K5DATA(kc)->keyblock, 0, &K5DATA(kc)->crypto);
|
||||
if (ret) {
|
||||
syslog (LOG_ERR, "krb5_crypto_init: %s",
|
||||
krb5_get_err_text (CONTEXT(kc), ret));
|
||||
ksyslog (CONTEXT(kc), ret, "krb5_crypto_init");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@@ -106,6 +106,9 @@ struct ContentInfo;
|
||||
struct AlgorithmIdentifier;
|
||||
struct _krb5_krb_auth_data;
|
||||
struct krb5_dh_moduli;
|
||||
struct _krb5_key_data;
|
||||
struct _krb5_encryption_type;
|
||||
struct _krb5_key_type;
|
||||
#include "crypto-headers.h"
|
||||
#include <krb5-private.h> /* for _krb5_{get,put}_int */
|
||||
#endif
|
||||
|
@@ -43,12 +43,14 @@ krb5_keytab keytab;
|
||||
char *service = SERVICE;
|
||||
char *mech = "krb5";
|
||||
int fork_flag;
|
||||
char *password = NULL;
|
||||
|
||||
static struct getargs args[] = {
|
||||
{ "port", 'p', arg_string, &port_str, "port to listen to", "port" },
|
||||
{ "service", 's', arg_string, &service, "service to use", "service" },
|
||||
{ "keytab", 'k', arg_string, &keytab_str, "keytab to use", "keytab" },
|
||||
{ "mech", 'm', arg_string, &mech, "gssapi mech to use", "mech" },
|
||||
{ "password", 'P', arg_string, &password, "password to use", "password" },
|
||||
{ "fork", 'f', arg_flag, &fork_flag, "do fork" },
|
||||
{ "help", 'h', arg_flag, &help_flag },
|
||||
{ "version", 0, arg_flag, &version_flag }
|
||||
|
@@ -30,6 +30,30 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Portions Copyright (C) 2010 by the Massachusetts Institute of Technology.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Export of this software from the United States of America may
|
||||
* require a specific license from the United States Government.
|
||||
* It is the responsibility of any person or organization contemplating
|
||||
* export to obtain such a license before exporting.
|
||||
*
|
||||
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
||||
* distribute this software and its documentation for any purpose and
|
||||
* without fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright notice and
|
||||
* this permission notice appear in supporting documentation, and that
|
||||
* the name of M.I.T. not be used in advertising or publicity pertaining
|
||||
* to distribution of the software without specific, written prior
|
||||
* permission. Furthermore if you modify this software you must label
|
||||
* your software as modified software and not distribute it in such a
|
||||
* fashion that it might be confused with the original M.I.T. software.
|
||||
* M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without express
|
||||
* or implied warranty.
|
||||
*/
|
||||
|
||||
|
||||
#include "test_locl.h"
|
||||
#include <gssapi/gssapi.h>
|
||||
@@ -119,6 +143,11 @@ gss_err(int exitval, int status, const char *fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static gss_OID_desc eapMechs[] = {
|
||||
{ 10, "\x2B\x06\x01\x04\x01\xA9\x4A\x16\x01\x11" },
|
||||
{ 10, "\x2B\x06\x01\x04\x01\xA9\x4A\x16\x01\x12" },
|
||||
};
|
||||
|
||||
gss_OID
|
||||
select_mech(const char *mech)
|
||||
{
|
||||
@@ -126,10 +155,86 @@ select_mech(const char *mech)
|
||||
return GSS_KRB5_MECHANISM;
|
||||
else if (strcasecmp(mech, "spnego") == 0)
|
||||
return GSS_SPNEGO_MECHANISM;
|
||||
else if (strcasecmp(mech, "eap-aes128") == 0)
|
||||
return &eapMechs[0];
|
||||
else if (strcasecmp(mech, "eap-aes256") == 0)
|
||||
return &eapMechs[1];
|
||||
else if (strcasecmp(mech, "no-oid") == 0)
|
||||
return GSS_C_NO_OID;
|
||||
else
|
||||
errx (1, "Unknown mechanism '%s' (spnego, krb5, no-oid)", mech);
|
||||
errx (1, "Unknown mechanism '%s' (spnego, krb5, eap-aes128, eap-aes256, no-oid)", mech);
|
||||
}
|
||||
|
||||
static void
|
||||
dumpAttribute(OM_uint32 *minor,
|
||||
gss_name_t name,
|
||||
gss_buffer_t attribute,
|
||||
int noisy)
|
||||
{
|
||||
OM_uint32 major, tmp;
|
||||
gss_buffer_desc value;
|
||||
gss_buffer_desc display_value;
|
||||
int authenticated = 0;
|
||||
int complete = 0;
|
||||
int more = -1;
|
||||
unsigned int i;
|
||||
|
||||
while (more != 0) {
|
||||
value.value = NULL;
|
||||
display_value.value = NULL;
|
||||
|
||||
major = gss_get_name_attribute(minor, name, attribute, &authenticated,
|
||||
&complete, &value, &display_value,
|
||||
&more);
|
||||
if (GSS_ERROR(major))
|
||||
break;
|
||||
|
||||
fprintf(stderr, "Attribute %.*s %s %s\n\n%.*s\n",
|
||||
(int)attribute->length, (char *)attribute->value,
|
||||
authenticated ? "Authenticated" : "",
|
||||
complete ? "Complete" : "",
|
||||
(int)display_value.length, (char *)display_value.value);
|
||||
|
||||
if (noisy) {
|
||||
for (i = 0; i < value.length; i++) {
|
||||
if ((i % 32) == 0)
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "%02x", ((char *)value.value)[i] & 0xFF);
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
}
|
||||
|
||||
gss_release_buffer(&tmp, &value);
|
||||
gss_release_buffer(&tmp, &display_value);
|
||||
}
|
||||
}
|
||||
|
||||
static OM_uint32
|
||||
enumerateAttributes(OM_uint32 *minor,
|
||||
gss_name_t name,
|
||||
int noisy)
|
||||
{
|
||||
OM_uint32 major, tmp;
|
||||
int name_is_MN;
|
||||
gss_OID mech = GSS_C_NO_OID;
|
||||
gss_buffer_set_t attrs = GSS_C_NO_BUFFER_SET;
|
||||
unsigned int i;
|
||||
|
||||
major = gss_inquire_name(minor, name, &name_is_MN, &mech, &attrs);
|
||||
if (GSS_ERROR(major))
|
||||
return major;
|
||||
|
||||
if (attrs != GSS_C_NO_BUFFER_SET) {
|
||||
for (i = 0; i < attrs->count; i++)
|
||||
dumpAttribute(minor, name, &attrs->elements[i], noisy);
|
||||
}
|
||||
|
||||
#if 0
|
||||
gss_release_oid(&tmp, &mech);
|
||||
#endif
|
||||
gss_release_buffer_set(&tmp, &attrs);
|
||||
|
||||
return major;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -149,6 +254,7 @@ print_gss_name(const char *prefix, gss_name_t name)
|
||||
(int)name_token.length,
|
||||
(char *)name_token.value);
|
||||
|
||||
gss_release_buffer (&min_stat, &name_token);
|
||||
enumerateAttributes(&min_stat, name, 1);
|
||||
|
||||
gss_release_buffer (&min_stat, &name_token);
|
||||
}
|
||||
|
@@ -94,6 +94,8 @@ do_trans (int sock, gss_ctx_id_t context_hdl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern char *password;
|
||||
|
||||
static int
|
||||
proto (int sock, const char *hostname, const char *service)
|
||||
{
|
||||
@@ -102,6 +104,7 @@ proto (int sock, const char *hostname, const char *service)
|
||||
|
||||
int context_established = 0;
|
||||
gss_ctx_id_t context_hdl = GSS_C_NO_CONTEXT;
|
||||
gss_cred_id_t cred = GSS_C_NO_CREDENTIAL;
|
||||
gss_buffer_desc real_input_token, real_output_token;
|
||||
gss_buffer_t input_token = &real_input_token,
|
||||
output_token = &real_output_token;
|
||||
@@ -130,6 +133,26 @@ proto (int sock, const char *hostname, const char *service)
|
||||
gss_err (1, min_stat,
|
||||
"Error importing name `%s@%s':\n", service, hostname);
|
||||
|
||||
if (password) {
|
||||
gss_buffer_desc pw;
|
||||
|
||||
pw.value = password;
|
||||
pw.length = strlen(password);
|
||||
|
||||
maj_stat = gss_acquire_cred_with_password(&min_stat,
|
||||
GSS_C_NO_NAME,
|
||||
&pw,
|
||||
GSS_C_INDEFINITE,
|
||||
GSS_C_NO_OID_SET,
|
||||
GSS_C_INITIATE,
|
||||
&cred,
|
||||
NULL,
|
||||
NULL);
|
||||
if (GSS_ERROR(maj_stat))
|
||||
gss_err (1, min_stat,
|
||||
"Error acquiring initiator credentials");
|
||||
}
|
||||
|
||||
addrlen = sizeof(local);
|
||||
if (getsockname (sock, (struct sockaddr *)&local, &addrlen) < 0
|
||||
|| addrlen != sizeof(local))
|
||||
@@ -172,7 +195,7 @@ proto (int sock, const char *hostname, const char *service)
|
||||
while(!context_established) {
|
||||
maj_stat =
|
||||
gss_init_sec_context(&min_stat,
|
||||
GSS_C_NO_CREDENTIAL,
|
||||
cred,
|
||||
&context_hdl,
|
||||
server,
|
||||
mech_oid,
|
||||
|
@@ -300,6 +300,7 @@ doit (int port, const char *service)
|
||||
int sock, sock2;
|
||||
struct sockaddr_in my_addr;
|
||||
int one = 1;
|
||||
int ret;
|
||||
|
||||
sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -317,14 +318,17 @@ doit (int port, const char *service)
|
||||
if (bind (sock, (struct sockaddr *)&my_addr, sizeof(my_addr)) < 0)
|
||||
err (1, "bind");
|
||||
|
||||
if (listen (sock, 1) < 0)
|
||||
err (1, "listen");
|
||||
while (1) {
|
||||
if (listen (sock, 1) < 0)
|
||||
err (1, "listen");
|
||||
|
||||
sock2 = accept (sock, NULL, NULL);
|
||||
if (sock2 < 0)
|
||||
err (1, "accept");
|
||||
sock2 = accept (sock, NULL, NULL);
|
||||
if (sock2 < 0)
|
||||
err (1, "accept");
|
||||
|
||||
return proto (sock2, service);
|
||||
ret = proto (sock2, service);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -334,3 +338,4 @@ main(int argc, char **argv)
|
||||
int port = server_setup(&context, argc, argv);
|
||||
return doit (port, service);
|
||||
}
|
||||
|
||||
|
@@ -62,8 +62,7 @@ proto (int sock, const char *service)
|
||||
|
||||
status = krb5_auth_con_init (context, &auth_context);
|
||||
if (status)
|
||||
errx (1, "krb5_auth_con_init: %s",
|
||||
krb5_get_err_text(context, status));
|
||||
krb5_err(context, 1, status, "krb5_auth_con_init");
|
||||
|
||||
local_addr.addr_type = AF_INET;
|
||||
local_addr.address.length = sizeof(local.sin_addr);
|
||||
@@ -78,8 +77,7 @@ proto (int sock, const char *service)
|
||||
&local_addr,
|
||||
&remote_addr);
|
||||
if (status)
|
||||
errx (1, "krb5_auth_con_setaddr: %s",
|
||||
krb5_get_err_text(context, status));
|
||||
krb5_err(context, 1, status, "krb5_auth_con_setaddr");
|
||||
|
||||
status = krb5_read_message(context, &sock, &client_name);
|
||||
if(status)
|
||||
@@ -150,8 +148,7 @@ proto (int sock, const char *service)
|
||||
&data,
|
||||
NULL);
|
||||
if (status)
|
||||
errx (1, "krb5_rd_safe: %s",
|
||||
krb5_get_err_text(context, status));
|
||||
krb5_err(context, 1, status, "krb5_rd_safe");
|
||||
|
||||
printf ("safe packet: %.*s\n", (int)data.length,
|
||||
(char *)data.data);
|
||||
@@ -166,8 +163,7 @@ proto (int sock, const char *service)
|
||||
&data,
|
||||
NULL);
|
||||
if (status)
|
||||
errx (1, "krb5_rd_priv: %s",
|
||||
krb5_get_err_text(context, status));
|
||||
krb5_err(context, 1, status, "krb5_rd_priv");
|
||||
|
||||
printf ("priv packet: %.*s\n", (int)data.length,
|
||||
(char *)data.data);
|
||||
|
@@ -2,4 +2,5 @@
|
||||
# to really generate all files you need to run "make distcheck" in a
|
||||
# object tree, but this will do if you have all parts of the required
|
||||
# tool-chain installed
|
||||
autoreconf -f -i || { echo "autoreconf failed: $?"; exit 1; }
|
||||
PATH=/usr/local/bin:$PATH
|
||||
/usr/local/bin/autoreconf -f -i || { echo "autoreconf failed: $?"; exit 1; }
|
||||
|
@@ -6,18 +6,6 @@ dnl
|
||||
dnl el_init
|
||||
|
||||
AC_DEFUN([KRB_READLINE],[
|
||||
AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
|
||||
if test "$ac_cv_func_el_init" = yes ; then
|
||||
AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
|
||||
#include <histedit.h>]],
|
||||
[[el_init("", NULL, NULL, NULL);]])],
|
||||
[ac_cv_func_el_init_four=yes],
|
||||
[ac_cv_func_el_init_four=no])])
|
||||
if test "$ac_cv_func_el_init_four" = yes; then
|
||||
AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl readline
|
||||
|
||||
@@ -25,18 +13,15 @@ ac_foo=no
|
||||
build_editline=no
|
||||
if test "$with_readline" = yes; then
|
||||
:
|
||||
elif test "$with_libedit" = yes; then
|
||||
LIB_readline="${LIB_libedit}"
|
||||
elif test "$ac_cv_func_readline" = yes; then
|
||||
:
|
||||
elif test "$ac_cv_func_el_init" = yes; then
|
||||
ac_foo=yes
|
||||
build_editline=yes
|
||||
LIB_readline="\$(top_builddir)/lib/editline/libel_compat.la \$(LIB_el_init) \$(LIB_tgetent)"
|
||||
else
|
||||
build_editline=yes
|
||||
LIB_readline="\$(top_builddir)/lib/editline/libeditline.la \$(LIB_tgetent)"
|
||||
build_libedit=yes
|
||||
LIB_readline="\$(top_builddir)/lib/libedit/src/libheimedit.la \$(LIB_tgetent)"
|
||||
fi
|
||||
AM_CONDITIONAL(EDITLINE, test "$build_editline" = yes)
|
||||
AM_CONDITIONAL(el_compat, test "$ac_foo" = yes)
|
||||
AM_CONDITIONAL(LIBEDIT, test "$build_libedit" = yes)
|
||||
AC_DEFINE(HAVE_READLINE, 1,
|
||||
[Define if you have a readline compatible library.])dnl
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl rk_TEST_PACKAGE(package,headers,libraries,extra libs,
|
||||
dnl default locations, conditional, config-program)
|
||||
dnl default locations, conditional, config-program, headers)
|
||||
|
||||
AC_DEFUN([rk_TEST_PACKAGE],[
|
||||
AC_ARG_WITH($1,
|
||||
@@ -91,6 +91,7 @@ if test "$with_$1" != no; then
|
||||
if test "$[]$1_cflags" -a "$[]$1_libs"; then
|
||||
CFLAGS="$[]$1_cflags $save_CFLAGS"
|
||||
LIBS="$[]$1_libs $save_LIBS"
|
||||
m4_ifval([$8],[AC_CHECK_HEADERS([[$8]])])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[]])],[
|
||||
INCLUDE_$1="$[]$1_cflags"
|
||||
LIB_$1="$[]$1_libs"
|
||||
@@ -101,6 +102,7 @@ if test "$with_$1" != no; then
|
||||
ires= lres=
|
||||
for i in $header_dirs; do
|
||||
CFLAGS="-I$i $save_CFLAGS"
|
||||
m4_ifval([$8],[AC_CHECK_HEADERS([[$8]])])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]],[[]])],[ires=$i;break])
|
||||
done
|
||||
for i in $lib_dirs; do
|
||||
|
28
configure.ac
28
configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION($Revision$)
|
||||
AC_PREREQ(2.62)
|
||||
test -z "$CFLAGS" && CFLAGS="-g"
|
||||
AC_INIT([Heimdal],[1.4.99],[heimdal-bugs@h5l.org])
|
||||
AC_INIT([Heimdal],[1.5pre1],[heimdal-bugs@h5l.org])
|
||||
AC_CONFIG_SRCDIR([kuser/kinit.c])
|
||||
AC_CONFIG_HEADERS(include/config.h)
|
||||
AC_CONFIG_MACRO_DIR([cf])
|
||||
@@ -139,13 +139,6 @@ if test "$enable_kx509" != no ;then
|
||||
AC_DEFINE([KX509], 1, [Define to enable kx509.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(krb4,
|
||||
AS_HELP_STRING([--disable-krb4],
|
||||
[if you want disable to krb4 support]))
|
||||
if test "$enable_krb4" != no ;then
|
||||
AC_DEFINE([KRB4], 1, [Define to enable Kerberos 4.])
|
||||
fi
|
||||
|
||||
dnl Need to test if pkg-config exists
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
@@ -284,7 +277,23 @@ rk_CHECK_MAN
|
||||
|
||||
rk_TEST_PACKAGE(readline,
|
||||
[#include <stdio.h>
|
||||
#include <readline.h>],-lreadline,,, READLINE)
|
||||
#if defined(HAVE_READLINE_READLINE_H)
|
||||
#include <readline/readline.h>
|
||||
#elif defined(HAVE_READLINE_H)
|
||||
#include <readline.h>
|
||||
#endif
|
||||
],-lreadline,,, READLINE,, [readline.h readline/readline.h])
|
||||
|
||||
rk_TEST_PACKAGE(libedit,
|
||||
[#include <stdio.h>
|
||||
#if defined(HAVE_READLINE_READLINE_H)
|
||||
#include <readline/readline.h>
|
||||
#elif defined(HAVE_READLINE_H)
|
||||
#include <readline.h>
|
||||
#endif
|
||||
],-ledit,,, READLINE,, [readline.h readline/readline.h])
|
||||
|
||||
AC_CONFIG_SUBDIRS([lib/libedit])
|
||||
|
||||
rk_TEST_PACKAGE(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
|
||||
|
||||
@@ -596,7 +605,6 @@ AC_CONFIG_FILES(Makefile \
|
||||
lib/asn1/Makefile \
|
||||
lib/com_err/Makefile \
|
||||
lib/hcrypto/Makefile \
|
||||
lib/editline/Makefile \
|
||||
lib/hx509/Makefile \
|
||||
lib/gssapi/Makefile \
|
||||
lib/ntlm/Makefile \
|
||||
|
@@ -19,7 +19,7 @@
|
||||
@copyrightstart
|
||||
@verbatim
|
||||
|
||||
Copyright (c) 1997-2008 Kungliga Tekniska Högskolan
|
||||
Copyright (c) 1997-2011 Kungliga Tekniska Högskolan
|
||||
(Royal Institute of Technology, Stockholm, Sweden).
|
||||
All rights reserved.
|
||||
|
||||
@@ -122,36 +122,41 @@ SUCH DAMAGE.
|
||||
@end verbatim
|
||||
@copynext
|
||||
|
||||
@heading Simmule Turner and Rich Salz
|
||||
@heading The Regents of the University of California.
|
||||
|
||||
libeditline
|
||||
|
||||
This is a modified version of libeditline and the bugs we introduced
|
||||
are our own.
|
||||
libedit
|
||||
|
||||
@verbatim
|
||||
|
||||
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
Copyright (c) 1992, 1993
|
||||
The Regents of the University of California. All rights reserved.
|
||||
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or of the Regents of the University of California.
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Christos Zoulas of Cornell University.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it freely, subject
|
||||
to the following restrictions:
|
||||
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.
|
||||
|
||||
1. The authors are not responsible for the consequences of use of this
|
||||
software, no matter how awful, even if they arise from flaws in it.
|
||||
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Since few users ever read sources,
|
||||
credits must appear in the documentation.
|
||||
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software. Since few users
|
||||
ever read sources, credits must appear in the documentation.
|
||||
|
||||
4. This notice may not be removed or altered.
|
||||
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.
|
||||
|
||||
@end verbatim
|
||||
@copynext
|
||||
|
@@ -21,6 +21,7 @@ kcm_SOURCES = \
|
||||
log.c \
|
||||
main.c \
|
||||
protocol.c \
|
||||
sessions.c \
|
||||
renew.c
|
||||
|
||||
$(srcdir)/kcm-protos.h:
|
||||
|
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
|
||||
* Copyright (c) 2009 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -31,34 +33,51 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
#include "kcm_locl.h"
|
||||
|
||||
#ifndef __roken_rename_h__
|
||||
#define __roken_rename_h__
|
||||
|
||||
#ifndef HAVE_STRDUP
|
||||
#define rk_strdup _editline_strdup
|
||||
#endif
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define rk_snprintf _editline_snprintf
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#define rk_vsnprintf _editline_vsnprintf
|
||||
#endif
|
||||
#ifndef HAVE_ASPRINTF
|
||||
#define rk_asprintf _editline_asprintf
|
||||
#endif
|
||||
#ifndef HAVE_ASNPRINTF
|
||||
#define rk_asnprintf _editline_asnprintf
|
||||
#endif
|
||||
#ifndef HAVE_VASPRINTF
|
||||
#define rk_vasprintf _editline_vasprintf
|
||||
#endif
|
||||
#ifndef HAVE_VASNPRINTF
|
||||
#define rk_vasnprintf _editline_vasnprintf
|
||||
#endif
|
||||
#ifndef HAVE_STRLCAT
|
||||
#define rk_strlcat _editline_strlcat
|
||||
#if 0
|
||||
#include <bsm/audit_session.h>
|
||||
#endif
|
||||
|
||||
#endif /* __roken_rename_h__ */
|
||||
void
|
||||
kcm_session_add(pid_t session_id)
|
||||
{
|
||||
kcm_log(1, "monitor session: %d\n", session_id);
|
||||
}
|
||||
|
||||
void
|
||||
kcm_session_setup_handler(void)
|
||||
{
|
||||
#if 0
|
||||
au_sdev_handle_t *h;
|
||||
dispatch_queue_t bgq;
|
||||
|
||||
h = au_sdev_open(AU_SDEVF_ALLSESSIONS);
|
||||
if (h == NULL)
|
||||
return;
|
||||
|
||||
bgq = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
|
||||
|
||||
dispatch_async(bgq, ^{
|
||||
for (;;) {
|
||||
auditinfo_addr_t aio;
|
||||
int event;
|
||||
|
||||
if (au_sdev_read_aia(h, &event, &aio) != 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Ignore everything but END. This should relly be
|
||||
* CLOSE but since that is delayed until the credential
|
||||
* is reused, we can't do that
|
||||
* */
|
||||
if (event != AUE_SESSION_END)
|
||||
continue;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
kcm_cache_remove_session(aio.ai_asid);
|
||||
});
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
@@ -1179,6 +1179,7 @@ tgs_parse_request(krb5_context context,
|
||||
kdc_log(context, config, 5, "Ticket-granting ticket account %s does not have secrets at this KDC, need to proxy", p);
|
||||
if (ret == 0)
|
||||
free(p);
|
||||
ret = HDB_ERR_NOT_FOUND_HERE;
|
||||
goto out;
|
||||
} else if(ret){
|
||||
const char *msg = krb5_get_error_message(context, ret);
|
||||
@@ -2239,6 +2240,10 @@ _kdc_tgs_rep(krb5_context context,
|
||||
&auth_data,
|
||||
&replykey,
|
||||
&rk_is_subkey);
|
||||
if (ret == HDB_ERR_NOT_FOUND_HERE) {
|
||||
/* kdc_log() is called in tgs_parse_request() */
|
||||
goto out;
|
||||
}
|
||||
if (ret) {
|
||||
kdc_log(context, config, 0,
|
||||
"Failed parsing TGS-REQ from %s", from);
|
||||
|
@@ -103,14 +103,19 @@ encode_ticket (krb5_context context,
|
||||
if (ret)
|
||||
krb5_err(context, 1, ret, "EncTicketPart");
|
||||
|
||||
krb5_crypto_init(context, skey, etype, &crypto);
|
||||
krb5_encrypt_EncryptedData (context,
|
||||
crypto,
|
||||
KRB5_KU_TICKET,
|
||||
buf,
|
||||
len,
|
||||
skvno,
|
||||
&ticket.enc_part);
|
||||
ret = krb5_crypto_init(context, skey, etype, &crypto);
|
||||
if (ret)
|
||||
krb5_err(context, 1, ret, "krb5_crypto_init");
|
||||
ret = krb5_encrypt_EncryptedData (context,
|
||||
crypto,
|
||||
KRB5_KU_TICKET,
|
||||
buf,
|
||||
len,
|
||||
skvno,
|
||||
&ticket.enc_part);
|
||||
if (ret)
|
||||
krb5_err(context, 1, ret, "krb5_encrypt_EncryptedData");
|
||||
|
||||
free(buf);
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
include $(top_srcdir)/Makefile.am.common
|
||||
|
||||
if EDITLINE
|
||||
dir_editline = editline
|
||||
if LIBEDIT
|
||||
dir_editline = libedit
|
||||
endif
|
||||
if OTP
|
||||
dir_otp = otp
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#define DPO(data,offset) ((void *)(((unsigned char *)data) + offset))
|
||||
|
||||
|
||||
struct asn1_type_func prim[] = {
|
||||
static struct asn1_type_func prim[] = {
|
||||
#define el(name, type) { \
|
||||
(asn1_type_encode)der_put_##name, \
|
||||
(asn1_type_decode)der_get_##name, \
|
||||
|
@@ -1,152 +0,0 @@
|
||||
2006-10-19 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* Makefile.am (libel_compat_la_SOURCES): add edit_compat.h
|
||||
|
||||
* Makefile.am (libeditline_la_SOURCES): add edit_locl.h
|
||||
|
||||
2005-07-07 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* editline.c (TTYinfo): only call tgetent if we found it using
|
||||
autoconf
|
||||
|
||||
2005-06-16 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* complete.c: move const to make it pass -Wcast-qual
|
||||
|
||||
* testit.c: rename optind to optidx
|
||||
|
||||
* editline.c: ansi'ify the code
|
||||
|
||||
2005-04-24 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* *.[ch]: unexpose undefined part of the API, included strlcat
|
||||
|
||||
2005-04-18 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* editline.c (TTYget): use unsigned char to make sure a positive
|
||||
number is returned when successful
|
||||
|
||||
2005-04-02 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* Makefile.am: "must set with '=' before using '+='"
|
||||
|
||||
2005-03-31 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* editline.c: avoid const string and strict aliasing warnings
|
||||
|
||||
2005-03-21 Love Hörnquist Åstrand <lha@it.su.se>
|
||||
|
||||
* Makefile.am: Make editline a non-static library and let libtool
|
||||
decide (same with libel_compat). This way libedit will build
|
||||
shared version is the library that is possible to link with other
|
||||
shared lib if its needed. Also make libed_compat a libtool
|
||||
convenience library.
|
||||
|
||||
2002-08-22 Assar Westerlund <assar@kth.se>
|
||||
|
||||
* testit.c: make it use getarg so that it can handle --help and
|
||||
--version (and thus make check can pass)
|
||||
|
||||
2001-09-13 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* editline.c: rename STATUS -> el_STATUS to avoid conflict with
|
||||
STATUS in arpa/nameser.h
|
||||
|
||||
2000-11-15 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.am: make libeditline and libel_compat into libtool
|
||||
libraries but always make them static
|
||||
|
||||
2000-03-01 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* edit_compat.c (readline): be more liberal in what we accept from
|
||||
el_gets. if count == 0 -> interpret it as EOF. also copy the
|
||||
string first and then cut of the newline, it's cleaner
|
||||
|
||||
1999-12-23 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* editline.c (TTYinfo): add fallback if we fail to find "le" in
|
||||
termcap.
|
||||
|
||||
1999-08-06 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* editline.c (TTYinfo): copy backspace string to avoid referencing
|
||||
into a local variable.
|
||||
|
||||
1999-08-04 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.am: don't run testit in `make check'
|
||||
|
||||
1999-04-11 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.am: don't run testit as a check
|
||||
|
||||
Sat Apr 10 23:01:18 1999 Johan Danielsson <joda@hella.pdc.kth.se>
|
||||
|
||||
* complete.c (rl_complete_filename): return if there were no
|
||||
matches
|
||||
|
||||
Thu Apr 8 15:08:25 1999 Johan Danielsson <joda@hella.pdc.kth.se>
|
||||
|
||||
* Makefile.in: snprintf
|
||||
|
||||
* roken_rename.h: add snprintf, asprintf
|
||||
|
||||
* Makefile.am: build testit
|
||||
|
||||
* complete.c: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros;
|
||||
(rl_complete): call rl_list_possib instead of doing the same
|
||||
|
||||
* editline.h: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros
|
||||
|
||||
* editline.c: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros
|
||||
|
||||
* sysunix.c: add some whitespace
|
||||
|
||||
Thu Mar 18 11:22:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
|
||||
|
||||
* Makefile.am: include Makefile.am.common
|
||||
|
||||
Tue Mar 16 17:10:34 1999 Johan Danielsson <joda@hella.pdc.kth.se>
|
||||
|
||||
* editline.c: remove protos for read/write
|
||||
|
||||
Sat Mar 13 22:23:22 1999 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* <roken.h>: add
|
||||
|
||||
Sun Nov 22 10:40:28 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in (WFLAGS): set
|
||||
|
||||
Tue Sep 29 02:09:15 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in (LIB_DEPS): add LIB_tgetent
|
||||
|
||||
Thu Jul 2 15:10:08 1998 Johan Danielsson <joda@blubb.pdc.kth.se>
|
||||
|
||||
* edit_compat.c: support for newer libedit
|
||||
|
||||
Tue Jun 30 17:18:09 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in (distclean): don't remove roken_rename.h
|
||||
|
||||
Fri May 29 19:03:38 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in (strdup.c): remove dependency
|
||||
|
||||
Mon May 25 05:25:16 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in (clean): try to remove shared library debris
|
||||
|
||||
Sun Apr 19 09:53:46 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* Makefile.in: add symlink magic for linux
|
||||
|
||||
Sat Feb 7 07:24:30 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* editline.h: add prototypes
|
||||
|
||||
Tue Feb 3 10:24:22 1998 Johan Danielsson <joda@emma.pdc.kth.se>
|
||||
|
||||
* editline.c: If read returns EINTR, try again.
|
@@ -1,51 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
include $(top_srcdir)/Makefile.am.common
|
||||
|
||||
if do_roken_rename
|
||||
ES = snprintf.c strdup.c strlcat.c
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS += $(ROKEN_RENAME)
|
||||
|
||||
man_MANS = editline.3
|
||||
|
||||
lib_LTLIBRARIES = libeditline.la
|
||||
if el_compat
|
||||
noinst_LTLIBRARIES = libel_compat.la
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = testit
|
||||
|
||||
CHECK_LOCAL =
|
||||
|
||||
testit_LDADD = \
|
||||
libeditline.la \
|
||||
$(LIB_roken)
|
||||
|
||||
include_HEADERS = editline.h
|
||||
|
||||
libeditline_la_LIBADD = $(LIB_tgetent)
|
||||
|
||||
libeditline_la_SOURCES = \
|
||||
edit_locl.h \
|
||||
complete.c \
|
||||
editline.c \
|
||||
sysunix.c \
|
||||
editline.h \
|
||||
roken_rename.h \
|
||||
unix.h \
|
||||
$(EXTRA_SOURCE)
|
||||
|
||||
EXTRA_SOURCE = $(ES)
|
||||
|
||||
libel_compat_la_SOURCES = edit_compat.c edit_compat.h
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
|
||||
snprintf.c:
|
||||
$(LN_S) $(srcdir)/../roken/snprintf.c .
|
||||
strdup.c:
|
||||
$(LN_S) $(srcdir)/../roken/strdup.c .
|
||||
strlcat.c:
|
||||
$(LN_S) $(srcdir)/../roken/strlcat.c .
|
@@ -1,60 +0,0 @@
|
||||
########################################################################
|
||||
#
|
||||
# Copyright (c) 2009, Secure Endpoints Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
|
||||
# COPYRIGHT HOLDER 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.
|
||||
#
|
||||
|
||||
RELDIR = lib\editline
|
||||
|
||||
!include ../../windows/NTMakefile.w32
|
||||
|
||||
INCFILES=$(INCDIR)\editline.h
|
||||
|
||||
libeditline_la_OBJS = \
|
||||
$(OBJ)\complete.obj \
|
||||
$(OBJ)\editline.obj \
|
||||
$(OBJ)\syswin.obj
|
||||
|
||||
$(LIBEDITLINE): $(libeditline_la_OBJS)
|
||||
$(LIBCON)
|
||||
|
||||
$(OBJ)\testit.exe: $(OBJ)\testit.obj $(LIBEDITLINE) $(LIBROKEN) $(LIBVERS)
|
||||
$(EXECONLINK)
|
||||
$(EXEPREP_NODIST)
|
||||
|
||||
all:: $(INCFILES) $(LIBEDITLINE)
|
||||
|
||||
clean::
|
||||
-$(RM) $(LIBEDITLINE)
|
||||
|
||||
test-binaries: $(OBJ)\testit.exe
|
||||
|
||||
run-test:
|
||||
echo Please run $(OBJ)\testit.exe interactively to test.
|
||||
|
||||
test:: test-binaries run-test
|
@@ -1,45 +0,0 @@
|
||||
$Revision$
|
||||
|
||||
This is a line-editing library. It can be linked into almost any
|
||||
program to provide command-line editing and recall.
|
||||
|
||||
It is call-compatible with the FSF readline library, but it is a
|
||||
fraction of the size (and offers fewer features). It does not use
|
||||
standard I/O. It is distributed under a "C News-like" copyright.
|
||||
|
||||
Configuration is done in the Makefile. Type "make testit" to get
|
||||
a small slow shell for testing.
|
||||
|
||||
An earlier version was distributed with Byron's rc. Principal
|
||||
changes over that version include:
|
||||
Faster.
|
||||
Is eight-bit clean (thanks to brendan@cs.widener.edu)
|
||||
Written in K&R C, but ANSI compliant (gcc all warnings)
|
||||
Propagates EOF properly; rc trip test now passes
|
||||
Doesn't need or use or provide memmove.
|
||||
More robust
|
||||
Calling sequence changed to be compatible with readline.
|
||||
Test program, new manpage, better configuration
|
||||
More system-independant; includes Unix and OS-9 support.
|
||||
|
||||
Enjoy,
|
||||
Rich $alz
|
||||
<rsalz@osf.org>
|
||||
|
||||
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or of the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it freely, subject
|
||||
to the following restrictions:
|
||||
1. The authors are not responsible for the consequences of use of this
|
||||
software, no matter how awful, even if they arise from flaws in it.
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Since few users ever read sources,
|
||||
credits must appear in the documentation.
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software. Since few users
|
||||
ever read sources, credits must appear in the documentation.
|
||||
4. This notice may not be removed or altered.
|
@@ -1,243 +0,0 @@
|
||||
/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
*
|
||||
* This software is not subject to any license of the American Telephone
|
||||
* and Telegraph Company or of the Regents of the University of California.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose on
|
||||
* any computer system, and to alter it and redistribute it freely, subject
|
||||
* to the following restrictions:
|
||||
* 1. The authors are not responsible for the consequences of use of this
|
||||
* software, no matter how awful, even if they arise from flaws in it.
|
||||
* 2. The origin of this software must not be misrepresented, either by
|
||||
* explicit claim or by omission. Since few users ever read sources,
|
||||
* credits must appear in the documentation.
|
||||
* 3. Altered versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software. Since few users
|
||||
* ever read sources, credits must appear in the documentation.
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
|
||||
/*
|
||||
** History and file completion functions for editline library.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "edit_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
** strcmp-like sorting predicate for qsort.
|
||||
*/
|
||||
static int
|
||||
compare(const void *p1, const void *p2)
|
||||
{
|
||||
char * const *v1;
|
||||
char * const *v2;
|
||||
|
||||
v1 = (char * const *)p1;
|
||||
v2 = (char * const *)p2;
|
||||
return strcmp(*v1, *v2);
|
||||
}
|
||||
|
||||
/*
|
||||
** Fill in *avp with an array of names that match file, up to its length.
|
||||
** Ignore . and .. .
|
||||
*/
|
||||
static int
|
||||
FindMatches(char *dir, char *file, char ***avp)
|
||||
{
|
||||
char **av;
|
||||
char **new;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
DIRENTRY *ep;
|
||||
size_t ac;
|
||||
size_t len;
|
||||
|
||||
if ((dp = opendir(dir)) == NULL)
|
||||
return 0;
|
||||
|
||||
av = NULL;
|
||||
ac = 0;
|
||||
len = strlen(file);
|
||||
while ((ep = readdir(dp)) != NULL) {
|
||||
p = ep->d_name;
|
||||
if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
|
||||
continue;
|
||||
if (len && strncmp(p, file, len) != 0)
|
||||
continue;
|
||||
|
||||
if ((ac % MEM_INC) == 0) {
|
||||
if ((new = malloc(sizeof(char*) * (ac + MEM_INC))) == NULL)
|
||||
break;
|
||||
if (ac) {
|
||||
memcpy(new, av, ac * sizeof (char **));
|
||||
free(av);
|
||||
}
|
||||
*avp = av = new;
|
||||
}
|
||||
|
||||
if ((av[ac] = strdup(p)) == NULL) {
|
||||
if (ac == 0)
|
||||
free(av);
|
||||
break;
|
||||
}
|
||||
ac++;
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
(void)closedir(dp);
|
||||
if (ac)
|
||||
qsort(av, ac, sizeof (char **), compare);
|
||||
return ac;
|
||||
}
|
||||
|
||||
/*
|
||||
** Split a pathname into allocated directory and trailing filename parts.
|
||||
*/
|
||||
static int SplitPath(char *path, char **dirpart, char **filepart)
|
||||
{
|
||||
static char DOT[] = ".";
|
||||
char *dpart;
|
||||
char *fpart;
|
||||
|
||||
if ((fpart = strrchr(path, '/')) == NULL) {
|
||||
if ((dpart = strdup(DOT)) == NULL)
|
||||
return -1;
|
||||
if ((fpart = strdup(path)) == NULL) {
|
||||
free(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((dpart = strdup(path)) == NULL)
|
||||
return -1;
|
||||
dpart[fpart - path] = '\0';
|
||||
if ((fpart = strdup(fpart + 1)) == NULL) {
|
||||
free(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*dirpart = dpart;
|
||||
*filepart = fpart;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Attempt to complete the pathname, returning an allocated copy.
|
||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
||||
*/
|
||||
|
||||
static char *
|
||||
rl_complete_filename(char *pathname, int *unique)
|
||||
{
|
||||
char **av;
|
||||
char *new;
|
||||
char *p;
|
||||
size_t ac;
|
||||
size_t end;
|
||||
size_t i;
|
||||
size_t j;
|
||||
size_t len;
|
||||
char *s;
|
||||
|
||||
ac = rl_list_possib(pathname, &av);
|
||||
if(ac == 0)
|
||||
return NULL;
|
||||
|
||||
s = strrchr(pathname, '/');
|
||||
if(s == NULL)
|
||||
len = strlen(pathname);
|
||||
else
|
||||
len = strlen(s + 1);
|
||||
|
||||
p = NULL;
|
||||
if (ac == 1) {
|
||||
/* Exactly one match -- finish it off. */
|
||||
*unique = 1;
|
||||
j = strlen(av[0]) - len + 2;
|
||||
if ((p = malloc(j + 1)) != NULL) {
|
||||
memcpy(p, av[0] + len, j);
|
||||
asprintf(&new, "%s%s", pathname, p);
|
||||
if(new != NULL) {
|
||||
rl_add_slash(new, p, j + 1);
|
||||
free(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*unique = 0;
|
||||
if (len) {
|
||||
/* Find largest matching substring. */
|
||||
for (i = len, end = strlen(av[0]); i < end; i++)
|
||||
for (j = 1; j < ac; j++)
|
||||
if (av[0][i] != av[j][i])
|
||||
goto breakout;
|
||||
breakout:
|
||||
if (i > len) {
|
||||
j = i - len + 1;
|
||||
if ((p = malloc(j)) != NULL) {
|
||||
memcpy(p, av[0] + len, j);
|
||||
p[j - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
for (i = 0; i < ac; i++)
|
||||
free(av[i]);
|
||||
free(av);
|
||||
return p;
|
||||
}
|
||||
|
||||
static rl_complete_func_t complete_func = rl_complete_filename;
|
||||
|
||||
char *
|
||||
rl_complete(char *pathname, int *unique)
|
||||
{
|
||||
return (*complete_func)(pathname, unique);
|
||||
}
|
||||
|
||||
rl_complete_func_t
|
||||
rl_set_complete_func(rl_complete_func_t func)
|
||||
{
|
||||
rl_complete_func_t old = complete_func;
|
||||
complete_func = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
static int
|
||||
rl_list_possib_filename(char *pathname, char ***avp)
|
||||
{
|
||||
char *dir;
|
||||
char *file;
|
||||
int ac;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return 0;
|
||||
ac = FindMatches(dir, file, avp);
|
||||
free(dir);
|
||||
free(file);
|
||||
return ac;
|
||||
}
|
||||
|
||||
static rl_list_possib_func_t list_possib_func = rl_list_possib_filename;
|
||||
|
||||
int
|
||||
rl_list_possib(char *pathname, char ***avp)
|
||||
{
|
||||
return (*list_possib_func)(pathname, avp);
|
||||
}
|
||||
|
||||
rl_list_possib_func_t
|
||||
rl_set_list_possib_func(rl_list_possib_func_t func)
|
||||
{
|
||||
rl_list_possib_func_t old = list_possib_func;
|
||||
list_possib_func = func;
|
||||
return old;
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/* $Revision$
|
||||
**
|
||||
** Internal header file for editline library.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CRLF "\r\n"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
typedef struct dirent DIRENTRY;
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
typedef struct direct DIRENTRY;
|
||||
#endif
|
||||
|
||||
#include <roken.h>
|
||||
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif /* !defined(S_ISDIR) */
|
||||
|
||||
#define MEM_INC 64
|
||||
#define SCREEN_INC 256
|
||||
|
||||
/*
|
||||
** Variables and routines internal to this package.
|
||||
*/
|
||||
extern int rl_eof;
|
||||
extern int rl_erase;
|
||||
extern int rl_intr;
|
||||
extern int rl_kill;
|
||||
extern int rl_quit;
|
||||
|
||||
typedef char* (*rl_complete_func_t)(char*, int*);
|
||||
|
||||
typedef int (*rl_list_possib_func_t)(char*, char***);
|
||||
|
||||
void rl_add_slash (char*, char*, size_t);
|
||||
int rl_list_possib (char*, char***);
|
||||
void rl_ttyset (int);
|
||||
rl_complete_func_t rl_set_complete_func (rl_complete_func_t);
|
||||
rl_list_possib_func_t rl_set_list_possib_func (rl_list_possib_func_t);
|
||||
|
||||
#include "editline.h"
|
||||
|
@@ -1,175 +0,0 @@
|
||||
.\" $Revision$
|
||||
.TH EDITLINE 3
|
||||
.SH NAME
|
||||
editline \- command-line editing library with history
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B "char *"
|
||||
.B "readline(prompt)"
|
||||
.B " char *prompt;"
|
||||
|
||||
.B "void"
|
||||
.B "add_history(line)"
|
||||
.B " char *line;"
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Editline
|
||||
is a library that provides an line-editing interface with text recall.
|
||||
It is intended to be compatible with the
|
||||
.I readline
|
||||
library provided by the Free Software Foundation, but much smaller.
|
||||
The bulk of this manual page describes the user interface.
|
||||
.PP
|
||||
The
|
||||
.I readline
|
||||
routine returns a line of text with the trailing newline removed.
|
||||
The data is returned in a buffer allocated with
|
||||
.IR malloc (3),
|
||||
so the space should be released with
|
||||
.IR free (3)
|
||||
when the calling program is done with it.
|
||||
Before accepting input from the user, the specified
|
||||
.I prompt
|
||||
is displayed on the terminal.
|
||||
.PP
|
||||
The
|
||||
.I add_history
|
||||
routine makes a copy of the specified
|
||||
.I line
|
||||
and adds it to the internal history list.
|
||||
.SS "User Interface"
|
||||
A program that uses this library provides a simple emacs-like editing
|
||||
interface to its users.
|
||||
A line may be edited before it is sent to the calling program by typing either
|
||||
control characters or escape sequences.
|
||||
A control character, shown as a caret followed by a letter, is typed by
|
||||
holding down the ``control'' key while the letter is typed.
|
||||
For example, ``^A'' is a control-A.
|
||||
An escape sequence is entered by typing the ``escape'' key followed by one or
|
||||
more characters.
|
||||
The escape key is abbreviated as ``ESC.''
|
||||
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
|
||||
is not the same as ``ESC\ f''.
|
||||
.PP
|
||||
An editing command may be typed anywhere on the line, not just at the
|
||||
beginning.
|
||||
In addition, a return may also be typed anywhere on the line, not just at
|
||||
the end.
|
||||
.PP
|
||||
Most editing commands may be given a repeat count,
|
||||
.IR n ,
|
||||
where
|
||||
.I n
|
||||
is a number.
|
||||
To enter a repeat count, type the escape key, the number, and then
|
||||
the command to execute.
|
||||
For example, ``ESC\ 4\ ^f'' moves forward four characters.
|
||||
If a command may be given a repeat count then the text ``[n]'' is given at the
|
||||
end of its description.
|
||||
.PP
|
||||
The following control characters are accepted:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
^A Move to the beginning of the line
|
||||
^B Move left (backwards) [n]
|
||||
^D Delete character [n]
|
||||
^E Move to end of line
|
||||
^F Move right (forwards) [n]
|
||||
^G Ring the bell
|
||||
^H Delete character before cursor (backspace key) [n]
|
||||
^I Complete filename (tab key); see below
|
||||
^J Done with line (return key)
|
||||
^K Kill to end of line (or column [n])
|
||||
^L Redisplay line
|
||||
^M Done with line (alternate return key)
|
||||
^N Get next line from history [n]
|
||||
^P Get previous line from history [n]
|
||||
^R Search backward (forward if [n]) through history for text;
|
||||
\& must start line if text begins with an uparrow
|
||||
^T Transpose characters
|
||||
^V Insert next character, even if it is an edit command
|
||||
^W Wipe to the mark
|
||||
^X^X Exchange current location and mark
|
||||
^Y Yank back last killed text
|
||||
^[ Start an escape sequence (escape key)
|
||||
^]c Move forward to next character ``c''
|
||||
^? Delete character before cursor (delete key) [n]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The following escape sequences are provided.
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
ESC\ ^H Delete previous word (backspace key) [n]
|
||||
ESC\ DEL Delete previous word (delete key) [n]
|
||||
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
|
||||
ESC\ \. Get the last (or [n]'th) word from previous line
|
||||
ESC\ ? Show possible completions; see below
|
||||
ESC\ < Move to start of history
|
||||
ESC\ > Move to end of history
|
||||
ESC\ b Move backward a word [n]
|
||||
ESC\ d Delete word under cursor [n]
|
||||
ESC\ f Move forward a word [n]
|
||||
ESC\ l Make word lowercase [n]
|
||||
ESC\ u Make word uppercase [n]
|
||||
ESC\ y Yank back last killed text
|
||||
ESC\ v Show library version
|
||||
ESC\ w Make area up to mark yankable
|
||||
ESC\ nn Set repeat count to the number nn
|
||||
ESC\ C Read from environment variable ``_C_'', where C is
|
||||
\& an uppercase letter
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library has a small macro facility.
|
||||
If you type the escape key followed by an uppercase letter,
|
||||
.IR C ,
|
||||
then the contents of the environment variable
|
||||
.I _C_
|
||||
are read in as if you had typed them at the keyboard.
|
||||
For example, if the variable
|
||||
.I _L_
|
||||
contains the following:
|
||||
.RS
|
||||
^A^Kecho '^V^[[H^V^[[2J'^M
|
||||
.RE
|
||||
Then typing ``ESC L'' will move to the beginning of the line, kill the
|
||||
entire line, enter the echo command needed to clear the terminal (if your
|
||||
terminal is like a VT-100), and send the line back to the shell.
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library also does filename completion.
|
||||
Suppose the root directory has the following files in it:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'core 'u
|
||||
bin vmunix
|
||||
core vmunix.old
|
||||
.fi
|
||||
.RE
|
||||
If you type ``rm\ /v'' and then the tab key.
|
||||
.I Editline
|
||||
will then finish off as much of the name as possible by adding ``munix''.
|
||||
Because the name is not unique, it will then beep.
|
||||
If you type the escape key and a question mark, it will display the
|
||||
two choices.
|
||||
If you then type a period and a tab, the library will finish off the filename
|
||||
for you:
|
||||
.RS
|
||||
.nf
|
||||
.RI "rm /v[TAB]" munix .TAB old
|
||||
.fi
|
||||
.RE
|
||||
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
||||
is shown in italics.
|
||||
.SH "BUGS AND LIMITATIONS"
|
||||
Cannot handle lines more than 80 columns.
|
||||
.SH AUTHORS
|
||||
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
|
||||
and Rich $alz <rsalz@osf.org>.
|
||||
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
|
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
||||
/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
*
|
||||
* This software is not subject to any license of the American Telephone
|
||||
* and Telegraph Company or of the Regents of the University of California.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose on
|
||||
* any computer system, and to alter it and redistribute it freely, subject
|
||||
* to the following restrictions:
|
||||
* 1. The authors are not responsible for the consequences of use of this
|
||||
* software, no matter how awful, even if they arise from flaws in it.
|
||||
* 2. The origin of this software must not be misrepresented, either by
|
||||
* explicit claim or by omission. Since few users ever read sources,
|
||||
* credits must appear in the documentation.
|
||||
* 3. Altered versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software. Since few users
|
||||
* ever read sources, credits must appear in the documentation.
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
/* This a modifed version of editline */
|
||||
|
||||
#ifndef __HEIM_EDITLINE
|
||||
#define __HEIM_EDITLINE 1
|
||||
|
||||
void rl_initialize (void);
|
||||
void add_history (char*);
|
||||
char* readline (const char* prompt);
|
||||
char* rl_complete (char*, int*); /* warning diffrent api the gnu readline */
|
||||
void rl_reset_terminal (char*);
|
||||
|
||||
#endif
|
||||
|
@@ -1,92 +0,0 @@
|
||||
/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
*
|
||||
* This software is not subject to any license of the American Telephone
|
||||
* and Telegraph Company or of the Regents of the University of California.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose on
|
||||
* any computer system, and to alter it and redistribute it freely, subject
|
||||
* to the following restrictions:
|
||||
* 1. The authors are not responsible for the consequences of use of this
|
||||
* software, no matter how awful, even if they arise from flaws in it.
|
||||
* 2. The origin of this software must not be misrepresented, either by
|
||||
* explicit claim or by omission. Since few users ever read sources,
|
||||
* credits must appear in the documentation.
|
||||
* 3. Altered versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software. Since few users
|
||||
* ever read sources, credits must appear in the documentation.
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Unix system-dependant routines for editline library.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "edit_locl.h"
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#else
|
||||
#include <sgtty.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
|
||||
void
|
||||
rl_ttyset(int Reset)
|
||||
{
|
||||
static struct termios old;
|
||||
struct termios new;
|
||||
|
||||
if (Reset == 0) {
|
||||
tcgetattr(0, &old);
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
|
||||
new = old;
|
||||
new.c_cc[VINTR] = -1;
|
||||
new.c_cc[VQUIT] = -1;
|
||||
new.c_lflag &= ~(ECHO | ICANON);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
tcsetattr(0, TCSANOW, &new);
|
||||
}
|
||||
else
|
||||
tcsetattr(0, TCSANOW, &old);
|
||||
}
|
||||
|
||||
#else /* !HAVE_TERMIOS_H */
|
||||
|
||||
void
|
||||
rl_ttyset(int Reset)
|
||||
{
|
||||
static struct sgttyb old;
|
||||
struct sgttyb new;
|
||||
|
||||
if (Reset == 0) {
|
||||
ioctl(0, TIOCGETP, &old);
|
||||
rl_erase = old.sg_erase;
|
||||
rl_kill = old.sg_kill;
|
||||
new = old;
|
||||
new.sg_flags &= ~(ECHO | ICANON);
|
||||
new.sg_flags &= ~(ISTRIP | INPCK);
|
||||
ioctl(0, TIOCSETP, &new);
|
||||
} else {
|
||||
ioctl(0, TIOCSETP, &old);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_TERMIOS_H */
|
||||
|
||||
void
|
||||
rl_add_slash(char *path, char *p, size_t len)
|
||||
{
|
||||
struct stat Sb;
|
||||
|
||||
if (stat(path, &Sb) >= 0)
|
||||
strlcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ", len);
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDER 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.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
#include "edit_locl.h"
|
||||
|
||||
void
|
||||
rl_ttyset(int Reset)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
rl_add_slash(char *path, char *p, size_t len)
|
||||
{
|
||||
struct stat Sb;
|
||||
|
||||
if (stat(path, &Sb) >= 0)
|
||||
strlcat(p, S_ISDIR(Sb.st_mode) ? "\\" : " ", len);
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
/* $Revision$
|
||||
**
|
||||
** A "micro-shell" to test editline library.
|
||||
** If given any arguments, commands aren't executed.
|
||||
*/
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <getarg.h>
|
||||
|
||||
#include "edit_locl.h"
|
||||
|
||||
static int n_flag = 0;
|
||||
static int version_flag = 0;
|
||||
static int help_flag = 0;
|
||||
|
||||
static struct getargs args[] = {
|
||||
{"dry-run", 'n', arg_flag, &n_flag,
|
||||
"do not run commands", NULL },
|
||||
{"version", 0, arg_flag, &version_flag,
|
||||
"print version", NULL },
|
||||
{"help", 0, arg_flag, &help_flag,
|
||||
NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
usage (int ret)
|
||||
{
|
||||
arg_printusage (args,
|
||||
sizeof(args)/sizeof(*args),
|
||||
NULL,
|
||||
"");
|
||||
exit (ret);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
int optidx = 0;
|
||||
|
||||
setprogname (argv[0]);
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optidx))
|
||||
usage(1);
|
||||
|
||||
if (help_flag)
|
||||
usage (0);
|
||||
|
||||
if(version_flag){
|
||||
print_version(NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
while ((p = readline("testit> ")) != NULL) {
|
||||
(void)printf("\t\t\t|%s|\n", p);
|
||||
if (!n_flag) {
|
||||
if (strncmp(p, "cd ", 3) == 0) {
|
||||
if (chdir(&p[3]) < 0)
|
||||
perror(&p[3]);
|
||||
} else if (system(p) != 0) {
|
||||
perror(p);
|
||||
}
|
||||
}
|
||||
add_history(p);
|
||||
free(p);
|
||||
}
|
||||
exit(0);
|
||||
/* NOTREACHED */
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
/* $Revision$
|
||||
**
|
||||
** Editline system header file for Unix.
|
||||
*/
|
||||
|
||||
#define CRLF "\r\n"
|
||||
#define FORWARD STATIC
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(USE_DIRENT)
|
||||
#include <dirent.h>
|
||||
typedef struct dirent DIRENTRY;
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
typedef struct direct DIRENTRY;
|
||||
#endif /* defined(USE_DIRENT) */
|
||||
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif /* !defined(S_ISDIR) */
|
@@ -170,6 +170,7 @@ ntlmsrc = \
|
||||
ntlm/canonicalize_name.c \
|
||||
ntlm/compare_name.c \
|
||||
ntlm/context_time.c \
|
||||
ntlm/creds.c \
|
||||
ntlm/crypto.c \
|
||||
ntlm/delete_sec_context.c \
|
||||
ntlm/display_name.c \
|
||||
@@ -185,10 +186,11 @@ ntlmsrc = \
|
||||
ntlm/indicate_mechs.c \
|
||||
ntlm/init_sec_context.c \
|
||||
ntlm/inquire_context.c \
|
||||
ntlm/inquire_cred.c \
|
||||
ntlm/inquire_cred_by_mech.c \
|
||||
ntlm/inquire_mechs_for_name.c \
|
||||
ntlm/inquire_names_for_mech.c \
|
||||
ntlm/inquire_sec_context_by_oid.c \
|
||||
ntlm/iter_cred.c \
|
||||
ntlm/process_context_token.c \
|
||||
ntlm/release_cred.c \
|
||||
ntlm/release_name.c \
|
||||
|
@@ -1025,9 +1025,23 @@ GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_add_cred_with_password (
|
||||
OM_uint32 * /*acceptor_time_rec*/
|
||||
);
|
||||
|
||||
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
|
||||
gss_pname_to_uid(
|
||||
OM_uint32 *minor,
|
||||
const gss_name_t name,
|
||||
const gss_OID mech_type,
|
||||
uid_t *uidOut);
|
||||
|
||||
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
|
||||
gss_userok(OM_uint32 *minor,
|
||||
const gss_name_t name,
|
||||
const char *user,
|
||||
int *user_ok);
|
||||
|
||||
/*
|
||||
* Naming extensions
|
||||
*/
|
||||
|
||||
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_display_name_ext (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
@@ -1074,23 +1088,6 @@ GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_export_name_composite (
|
||||
gss_buffer_t /* exp_composite_name */
|
||||
);
|
||||
|
||||
typedef struct gss_any *gss_any_t;
|
||||
|
||||
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_map_name_to_any (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
int, /* authenticated */
|
||||
gss_buffer_t, /* type_id */
|
||||
gss_any_t * /* output */
|
||||
);
|
||||
|
||||
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_any_name_mapping (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
gss_buffer_t, /* type_id */
|
||||
gss_any_t * /* input */
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* Copyright (c) 2006 - 2009 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -33,12 +33,18 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _EDIT_COMPAT_H
|
||||
#define _EDIT_COMPAT_H
|
||||
#ifndef GSSAPI_NETLOGON_H_
|
||||
#define GSSAPI_NETLOGON_H_
|
||||
|
||||
void rl_reset_terminal(char *p);
|
||||
void rl_initialize(void);
|
||||
char *readline(const char *prompt);
|
||||
void add_history(char *p);
|
||||
#include <gssapi.h>
|
||||
|
||||
#endif /* _EDIT_COMPAT_H */
|
||||
GSSAPI_CPP_START
|
||||
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID GSS_NETLOGON_MECHANISM;
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID GSS_NETLOGON_NT_NETBIOS_DNS_NAME;
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID GSS_NETLOGON_SET_SESSION_KEY_X;
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID GSS_NETLOGON_SET_SIGN_ALGORITHM_X;
|
||||
|
||||
GSSAPI_CPP_END
|
||||
|
||||
#endif /* GSSAPI_NETLOGON_H_ */
|
@@ -125,6 +125,13 @@ extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_set_sign_algorithm_x_oid_
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_netlogon_nt_netbios_dns_name_oid_desc;
|
||||
#define GSS_NETLOGON_NT_NETBIOS_DNS_NAME (&__gss_netlogon_nt_netbios_dns_name_oid_desc)
|
||||
|
||||
/* GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X.128 */
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_inq_win2k_pac_x_oid_desc;
|
||||
#define GSS_C_INQ_WIN2K_PAC_X (&__gss_c_inq_win2k_pac_x_oid_desc)
|
||||
|
||||
extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_inq_sspi_session_key_oid_desc;
|
||||
#define GSS_C_INQ_SSPI_SESSION_KEY (&__gss_c_inq_sspi_session_key_oid_desc)
|
||||
|
||||
/*
|
||||
* "Standard" mechs
|
||||
*/
|
||||
|
@@ -393,47 +393,6 @@ _gss_cred_label_get_t(OM_uint32 * /* minor_status */,
|
||||
const char * /* label */,
|
||||
gss_buffer_t /* value */);
|
||||
|
||||
typedef struct gss_mo_desc_struct gss_mo_desc;
|
||||
|
||||
struct gss_mo_desc_struct {
|
||||
gss_OID option;
|
||||
OM_uint32 flags;
|
||||
#define GSS_MO_MA 1
|
||||
#define GSS_MO_MA_CRITICAL 2
|
||||
const char *name;
|
||||
void *ctx;
|
||||
int (*get)(gss_const_OID, gss_mo_desc *, gss_buffer_t);
|
||||
int (*set)(gss_const_OID, gss_mo_desc *, int, gss_buffer_t);
|
||||
};
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_acquire_cred_with_password_t
|
||||
(OM_uint32 *, /* minor_status */
|
||||
const gss_name_t, /* desired_name */
|
||||
const gss_buffer_t, /* password */
|
||||
OM_uint32, /* time_req */
|
||||
const gss_OID_set, /* desired_mechs */
|
||||
gss_cred_usage_t, /* cred_usage */
|
||||
gss_cred_id_t *, /* output_cred_handle */
|
||||
gss_OID_set *, /* actual_mechs */
|
||||
OM_uint32 * /* time_rec */
|
||||
);
|
||||
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_add_cred_with_password_t (
|
||||
OM_uint32 *, /* minor_status */
|
||||
const gss_cred_id_t, /* input_cred_handle */
|
||||
const gss_name_t, /* desired_name */
|
||||
const gss_OID, /* desired_mech */
|
||||
const gss_buffer_t, /* password */
|
||||
gss_cred_usage_t, /* cred_usage */
|
||||
OM_uint32, /* initiator_time_req */
|
||||
OM_uint32, /* acceptor_time_req */
|
||||
gss_cred_id_t *, /* output_cred_handle */
|
||||
gss_OID_set *, /* actual_mechs */
|
||||
OM_uint32 *, /* initiator_time_rec */
|
||||
OM_uint32 * /* acceptor_time_rec */
|
||||
);
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_ext_t (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
@@ -480,20 +439,54 @@ typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_composite_t (
|
||||
gss_buffer_t /* exp_composite_name */
|
||||
);
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_map_name_to_any_t (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
int, /* authenticated */
|
||||
gss_buffer_t, /* type_id */
|
||||
gss_any_t * /* output */
|
||||
);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_release_any_name_mapping_t (
|
||||
OM_uint32 *, /* minor_status */
|
||||
gss_name_t, /* name */
|
||||
gss_buffer_t, /* type_id */
|
||||
gss_any_t * /* input */
|
||||
);
|
||||
typedef struct gss_mo_desc_struct gss_mo_desc;
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV
|
||||
_gss_mo_init (OM_uint32 *, gss_OID, gss_mo_desc **, size_t *);
|
||||
|
||||
|
||||
struct gss_mo_desc_struct {
|
||||
gss_OID option;
|
||||
OM_uint32 flags;
|
||||
#define GSS_MO_MA 1
|
||||
#define GSS_MO_MA_CRITICAL 2
|
||||
const char *name;
|
||||
void *ctx;
|
||||
int (*get)(gss_const_OID, gss_mo_desc *, gss_buffer_t);
|
||||
int (*set)(gss_const_OID, gss_mo_desc *, int, gss_buffer_t);
|
||||
};
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_acquire_cred_with_password_t
|
||||
(OM_uint32 *, /* minor_status */
|
||||
const gss_name_t, /* desired_name */
|
||||
const gss_buffer_t, /* password */
|
||||
OM_uint32, /* time_req */
|
||||
const gss_OID_set, /* desired_mechs */
|
||||
gss_cred_usage_t, /* cred_usage */
|
||||
gss_cred_id_t *, /* output_cred_handle */
|
||||
gss_OID_set *, /* actual_mechs */
|
||||
OM_uint32 * /* time_rec */
|
||||
);
|
||||
|
||||
|
||||
typedef OM_uint32 GSSAPI_CALLCONV _gss_add_cred_with_password_t (
|
||||
OM_uint32 *, /* minor_status */
|
||||
const gss_cred_id_t, /* input_cred_handle */
|
||||
const gss_name_t, /* desired_name */
|
||||
const gss_OID, /* desired_mech */
|
||||
const gss_buffer_t, /* password */
|
||||
gss_cred_usage_t, /* cred_usage */
|
||||
OM_uint32, /* initiator_time_req */
|
||||
OM_uint32, /* acceptor_time_req */
|
||||
gss_cred_id_t *, /* output_cred_handle */
|
||||
gss_OID_set *, /* actual_mechs */
|
||||
OM_uint32 *, /* initiator_time_rec */
|
||||
OM_uint32 * /* acceptor_time_rec */
|
||||
);
|
||||
|
||||
/* mechglue internal */
|
||||
struct gss_mech_compat_desc_struct;
|
||||
@@ -504,70 +497,68 @@ struct gss_mech_compat_desc_struct;
|
||||
#define GM_USE_MG_CRED 1 /* uses mech glue credentials */
|
||||
|
||||
typedef struct gssapi_mech_interface_desc {
|
||||
unsigned gm_version;
|
||||
const char *gm_name;
|
||||
gss_OID_desc gm_mech_oid;
|
||||
unsigned gm_flags;
|
||||
_gss_acquire_cred_t *gm_acquire_cred;
|
||||
_gss_release_cred_t *gm_release_cred;
|
||||
_gss_init_sec_context_t *gm_init_sec_context;
|
||||
_gss_accept_sec_context_t *gm_accept_sec_context;
|
||||
_gss_process_context_token_t *gm_process_context_token;
|
||||
_gss_delete_sec_context_t *gm_delete_sec_context;
|
||||
_gss_context_time_t *gm_context_time;
|
||||
_gss_get_mic_t *gm_get_mic;
|
||||
_gss_verify_mic_t *gm_verify_mic;
|
||||
_gss_wrap_t *gm_wrap;
|
||||
_gss_unwrap_t *gm_unwrap;
|
||||
_gss_display_status_t *gm_display_status;
|
||||
_gss_indicate_mechs_t *gm_indicate_mechs;
|
||||
_gss_compare_name_t *gm_compare_name;
|
||||
_gss_display_name_t *gm_display_name;
|
||||
_gss_import_name_t *gm_import_name;
|
||||
_gss_export_name_t *gm_export_name;
|
||||
_gss_release_name_t *gm_release_name;
|
||||
_gss_inquire_cred_t *gm_inquire_cred;
|
||||
_gss_inquire_context_t *gm_inquire_context;
|
||||
_gss_wrap_size_limit_t *gm_wrap_size_limit;
|
||||
_gss_add_cred_t *gm_add_cred;
|
||||
_gss_inquire_cred_by_mech_t *gm_inquire_cred_by_mech;
|
||||
_gss_export_sec_context_t *gm_export_sec_context;
|
||||
_gss_import_sec_context_t *gm_import_sec_context;
|
||||
_gss_inquire_names_for_mech_t *gm_inquire_names_for_mech;
|
||||
_gss_inquire_mechs_for_name_t *gm_inquire_mechs_for_name;
|
||||
_gss_canonicalize_name_t *gm_canonicalize_name;
|
||||
_gss_duplicate_name_t *gm_duplicate_name;
|
||||
_gss_inquire_sec_context_by_oid *gm_inquire_sec_context_by_oid;
|
||||
_gss_inquire_cred_by_oid *gm_inquire_cred_by_oid;
|
||||
_gss_set_sec_context_option *gm_set_sec_context_option;
|
||||
_gss_set_cred_option *gm_set_cred_option;
|
||||
_gss_pseudo_random *gm_pseudo_random;
|
||||
_gss_wrap_iov_t *gm_wrap_iov;
|
||||
_gss_unwrap_iov_t *gm_unwrap_iov;
|
||||
_gss_wrap_iov_length_t *gm_wrap_iov_length;
|
||||
_gss_store_cred_t *gm_store_cred;
|
||||
_gss_export_cred_t *gm_export_cred;
|
||||
_gss_import_cred_t *gm_import_cred;
|
||||
_gss_acquire_cred_ex_t *gm_acquire_cred_ex;
|
||||
_gss_iter_creds_t *gm_iter_creds;
|
||||
_gss_destroy_cred_t *gm_destroy_cred;
|
||||
_gss_cred_hold_t *gm_cred_hold;
|
||||
_gss_cred_unhold_t *gm_cred_unhold;
|
||||
_gss_cred_label_get_t *gm_cred_label_get;
|
||||
_gss_cred_label_set_t *gm_cred_label_set;
|
||||
gss_mo_desc *gm_mo;
|
||||
size_t gm_mo_num;
|
||||
struct gss_mech_compat_desc_struct *gm_compat;
|
||||
_gss_display_name_ext_t *gm_display_name_ext;
|
||||
_gss_inquire_name_t *gm_inquire_name;
|
||||
_gss_get_name_attribute_t *gm_get_name_attribute;
|
||||
_gss_set_name_attribute_t *gm_set_name_attribute;
|
||||
_gss_delete_name_attribute_t *gm_delete_name_attribute;
|
||||
_gss_export_name_composite_t *gm_export_name_composite;
|
||||
_gss_map_name_to_any_t *gm_map_name_to_any;
|
||||
_gss_release_any_name_mapping_t *gm_release_any_name_mapping;
|
||||
unsigned gm_version;
|
||||
const char *gm_name;
|
||||
gss_OID_desc gm_mech_oid;
|
||||
unsigned gm_flags;
|
||||
_gss_acquire_cred_t *gm_acquire_cred;
|
||||
_gss_release_cred_t *gm_release_cred;
|
||||
_gss_init_sec_context_t *gm_init_sec_context;
|
||||
_gss_accept_sec_context_t *gm_accept_sec_context;
|
||||
_gss_process_context_token_t *gm_process_context_token;
|
||||
_gss_delete_sec_context_t *gm_delete_sec_context;
|
||||
_gss_context_time_t *gm_context_time;
|
||||
_gss_get_mic_t *gm_get_mic;
|
||||
_gss_verify_mic_t *gm_verify_mic;
|
||||
_gss_wrap_t *gm_wrap;
|
||||
_gss_unwrap_t *gm_unwrap;
|
||||
_gss_display_status_t *gm_display_status;
|
||||
_gss_indicate_mechs_t *gm_indicate_mechs;
|
||||
_gss_compare_name_t *gm_compare_name;
|
||||
_gss_display_name_t *gm_display_name;
|
||||
_gss_import_name_t *gm_import_name;
|
||||
_gss_export_name_t *gm_export_name;
|
||||
_gss_release_name_t *gm_release_name;
|
||||
_gss_inquire_cred_t *gm_inquire_cred;
|
||||
_gss_inquire_context_t *gm_inquire_context;
|
||||
_gss_wrap_size_limit_t *gm_wrap_size_limit;
|
||||
_gss_add_cred_t *gm_add_cred;
|
||||
_gss_inquire_cred_by_mech_t *gm_inquire_cred_by_mech;
|
||||
_gss_export_sec_context_t *gm_export_sec_context;
|
||||
_gss_import_sec_context_t *gm_import_sec_context;
|
||||
_gss_inquire_names_for_mech_t *gm_inquire_names_for_mech;
|
||||
_gss_inquire_mechs_for_name_t *gm_inquire_mechs_for_name;
|
||||
_gss_canonicalize_name_t *gm_canonicalize_name;
|
||||
_gss_duplicate_name_t *gm_duplicate_name;
|
||||
_gss_inquire_sec_context_by_oid *gm_inquire_sec_context_by_oid;
|
||||
_gss_inquire_cred_by_oid *gm_inquire_cred_by_oid;
|
||||
_gss_set_sec_context_option *gm_set_sec_context_option;
|
||||
_gss_set_cred_option *gm_set_cred_option;
|
||||
_gss_pseudo_random *gm_pseudo_random;
|
||||
_gss_wrap_iov_t *gm_wrap_iov;
|
||||
_gss_unwrap_iov_t *gm_unwrap_iov;
|
||||
_gss_wrap_iov_length_t *gm_wrap_iov_length;
|
||||
_gss_store_cred_t *gm_store_cred;
|
||||
_gss_export_cred_t *gm_export_cred;
|
||||
_gss_import_cred_t *gm_import_cred;
|
||||
_gss_acquire_cred_ex_t *gm_acquire_cred_ex;
|
||||
_gss_iter_creds_t *gm_iter_creds;
|
||||
_gss_destroy_cred_t *gm_destroy_cred;
|
||||
_gss_cred_hold_t *gm_cred_hold;
|
||||
_gss_cred_unhold_t *gm_cred_unhold;
|
||||
_gss_cred_label_get_t *gm_cred_label_get;
|
||||
_gss_cred_label_set_t *gm_cred_label_set;
|
||||
gss_mo_desc *gm_mo;
|
||||
size_t gm_mo_num;
|
||||
_gss_display_name_ext_t *gm_display_name_ext;
|
||||
_gss_inquire_name_t *gm_inquire_name;
|
||||
_gss_get_name_attribute_t *gm_get_name_attribute;
|
||||
_gss_set_name_attribute_t *gm_set_name_attribute;
|
||||
_gss_delete_name_attribute_t *gm_delete_name_attribute;
|
||||
_gss_export_name_composite_t *gm_export_name_composite;
|
||||
_gss_acquire_cred_with_password_t *gm_acquire_cred_with_password;
|
||||
_gss_add_cred_with_password_t *gm_add_cred_with_password;
|
||||
_gss_add_cred_with_password_t *gm_add_cred_with_password;
|
||||
gss_mech_compat_desc_struct *gm_compat;
|
||||
} gssapi_mech_interface_desc, *gssapi_mech_interface;
|
||||
|
||||
gssapi_mech_interface
|
||||
|
59
lib/gssapi/mech/gss_destroy_cred.c
Normal file
59
lib/gssapi/mech/gss_destroy_cred.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 Doug Rabson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
#include "mech_locl.h"
|
||||
#include <heim_threads.h>
|
||||
|
||||
OM_uint32 GSSAPI_LIB_FUNCTION
|
||||
gss_destroy_cred(void *status,
|
||||
gss_cred_id_t *cred_handle)
|
||||
{
|
||||
struct _gss_cred *cred;
|
||||
struct _gss_mechanism_cred *mc;
|
||||
OM_uint32 junk;
|
||||
|
||||
if (cred_handle == NULL)
|
||||
return GSS_S_CALL_INACCESSIBLE_READ;
|
||||
if (*cred_handle == GSS_C_NO_CREDENTIAL)
|
||||
return GSS_S_COMPLETE;
|
||||
|
||||
cred = (struct _gss_cred *)*cred_handle;
|
||||
|
||||
while (HEIM_SLIST_FIRST(&cred->gc_mc)) {
|
||||
mc = HEIM_SLIST_FIRST(&cred->gc_mc);
|
||||
HEIM_SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link);
|
||||
if (mc->gmc_mech->gm_destroy_cred)
|
||||
mc->gmc_mech->gm_destroy_cred(&junk, &mc->gmc_cred);
|
||||
else
|
||||
mc->gmc_mech->gm_release_cred(&junk, &mc->gmc_cred);
|
||||
free(mc);
|
||||
}
|
||||
free(cred);
|
||||
|
||||
return GSS_S_COMPLETE;
|
||||
}
|
@@ -357,10 +357,10 @@ _gss_load_mech(void)
|
||||
OPTSYM(set_name_attribute);
|
||||
OPTSYM(delete_name_attribute);
|
||||
OPTSYM(export_name_composite);
|
||||
OPTSYM(map_name_to_any);
|
||||
OPTSYM(release_any_name_mapping);
|
||||
OPTSPISYM(acquire_cred_with_password);
|
||||
OPTSYM(add_cred_with_password);
|
||||
OPTSYM(pname_to_uid);
|
||||
OPTSYM(user_ok);
|
||||
|
||||
mi = dlsym(so, "gss_mo_init");
|
||||
if (mi != NULL) {
|
||||
|
@@ -118,6 +118,12 @@ gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_set_sign_algorithm_x_oid_desc =
|
||||
/* GSS_NETLOGON_NT_NETBIOS_DNS_NAME - 1.2.752.43.14.5 */
|
||||
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_netlogon_nt_netbios_dns_name_oid_desc = { 6, "\x2a\x85\x70\x2b\x0e\x05" };
|
||||
|
||||
/* GSS_C_INQ_WIN2K_PAC_X - 1.2.752.43.13.3.128 */
|
||||
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_inq_win2k_pac_x_oid_desc = { 8, "\x2a\x85\x70\x2b\x0d\x03\x81\x00" };
|
||||
|
||||
/* GSS_C_INQ_SSPI_SESSION_KEY - 1.2.840.113554.1.2.2.5.5 */
|
||||
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_inq_sspi_session_key_oid_desc = { 11, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x05\x05" };
|
||||
|
||||
/* GSS_KRB5_MECHANISM - 1.2.840.113554.1.2.2 */
|
||||
gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_mechanism_oid_desc = { 9, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
|
||||
|
||||
|
@@ -3,6 +3,8 @@
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -33,7 +35,7 @@
|
||||
|
||||
#include "ntlm.h"
|
||||
|
||||
OM_uint32 GSSAPI_CALLCONV _gss_ntlm_inquire_cred
|
||||
OM_uint32 _gss_ntlm_inquire_cred
|
||||
(OM_uint32 * minor_status,
|
||||
const gss_cred_id_t cred_handle,
|
||||
gss_name_t * name,
|
||||
@@ -46,8 +48,16 @@ OM_uint32 GSSAPI_CALLCONV _gss_ntlm_inquire_cred
|
||||
|
||||
*minor_status = 0;
|
||||
|
||||
if (name)
|
||||
*name = GSS_C_NO_NAME;
|
||||
if (cred_handle == NULL)
|
||||
return GSS_S_NO_CRED;
|
||||
|
||||
if (name) {
|
||||
ret = _gss_ntlm_duplicate_name(minor_status,
|
||||
(gss_name_t)cred_handle,
|
||||
name);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
if (lifetime)
|
||||
*lifetime = GSS_C_INDEFINITE;
|
||||
if (cred_usage)
|
||||
@@ -74,3 +84,54 @@ out:
|
||||
gss_release_oid_set(&junk, mechanisms);
|
||||
return ret;
|
||||
}
|
||||
|
||||
OM_uint32
|
||||
_gss_ntlm_destroy_cred(OM_uint32 *minor_status,
|
||||
gss_cred_id_t *cred_handle)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_storage *request, *response;
|
||||
krb5_data response_data;
|
||||
krb5_context context;
|
||||
ntlm_cred cred;
|
||||
|
||||
if (cred_handle == NULL || *cred_handle == GSS_C_NO_CREDENTIAL)
|
||||
return GSS_S_COMPLETE;
|
||||
|
||||
cred = (ntlm_cred)*cred_handle;
|
||||
|
||||
ret = krb5_init_context(&context);
|
||||
if (ret) {
|
||||
*minor_status = ret;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
ret = krb5_kcm_storage_request(context, KCM_OP_DEL_NTLM_CRED, &request);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = krb5_store_stringz(request, cred->username);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = krb5_store_stringz(request, cred->domain);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = krb5_kcm_call(context, request, &response, &response_data);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
krb5_storage_free(request);
|
||||
krb5_storage_free(response);
|
||||
krb5_data_free(&response_data);
|
||||
|
||||
out:
|
||||
krb5_free_context(context);
|
||||
if (ret) {
|
||||
*minor_status = ret;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
return _gss_ntlm_release_cred(minor_status, cred_handle);
|
||||
}
|
@@ -94,6 +94,7 @@ static gssapi_mech_interface_desc ntlm_mech = {
|
||||
_gss_ntlm_inquire_mechs_for_name,
|
||||
_gss_ntlm_canonicalize_name,
|
||||
_gss_ntlm_duplicate_name,
|
||||
_gss_ntlm_inquire_sec_context_by_oid,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -105,9 +106,8 @@ static gssapi_mech_interface_desc ntlm_mech = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_gss_ntlm_iter_creds_f,
|
||||
_gss_ntlm_destroy_cred,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -31,90 +33,58 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <histedit.h>
|
||||
#include "ntlm.h"
|
||||
|
||||
#include "edit_compat.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
void
|
||||
rl_reset_terminal(char *p)
|
||||
OM_uint32
|
||||
_gss_ntlm_inquire_sec_context_by_oid(OM_uint32 *minor_status,
|
||||
const gss_ctx_id_t context_handle,
|
||||
const gss_OID desired_object,
|
||||
gss_buffer_set_t *data_set)
|
||||
{
|
||||
}
|
||||
ntlm_ctx ctx = (ntlm_ctx)context_handle;
|
||||
|
||||
void
|
||||
rl_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
static const char *pr;
|
||||
static const char* ret_prompt(EditLine *e)
|
||||
{
|
||||
return pr;
|
||||
}
|
||||
|
||||
static History *h;
|
||||
|
||||
#ifdef H_SETSIZE
|
||||
#define EL_INIT_FOUR 1
|
||||
#else
|
||||
#ifdef H_SETMAXSIZE
|
||||
/* backwards compatibility */
|
||||
#define H_SETSIZE H_SETMAXSIZE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char *
|
||||
readline(const char* prompt)
|
||||
{
|
||||
static EditLine *e;
|
||||
#ifdef H_SETSIZE
|
||||
HistEvent ev;
|
||||
#endif
|
||||
int count;
|
||||
const char *str;
|
||||
|
||||
if(e == NULL){
|
||||
#ifdef EL_INIT_FOUR
|
||||
e = el_init("", stdin, stdout, stderr);
|
||||
#else
|
||||
e = el_init("", stdin, stdout);
|
||||
#endif
|
||||
el_set(e, EL_PROMPT, ret_prompt);
|
||||
h = history_init();
|
||||
#ifdef H_SETSIZE
|
||||
history(h, &ev, H_SETSIZE, 25);
|
||||
#else
|
||||
history(h, H_EVENT, 25);
|
||||
#endif
|
||||
el_set(e, EL_HIST, history, h);
|
||||
el_set(e, EL_EDITOR, "emacs"); /* XXX? */
|
||||
if (ctx == NULL) {
|
||||
*minor_status = 0;
|
||||
return GSS_S_NO_CONTEXT;
|
||||
}
|
||||
pr = prompt ? prompt : "";
|
||||
str = el_gets(e, &count);
|
||||
if (str && count > 0) {
|
||||
char *ret = strdup (str);
|
||||
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
if (gss_oid_equal(desired_object, GSS_NTLM_GET_SESSION_KEY_X) ||
|
||||
gss_oid_equal(desired_object, GSS_C_INQ_SSPI_SESSION_KEY)) {
|
||||
gss_buffer_desc value;
|
||||
|
||||
if (ret[strlen(ret) - 1] == '\n')
|
||||
ret[strlen(ret) - 1] = '\0';
|
||||
return ret;
|
||||
value.length = ctx->sessionkey.length;
|
||||
value.value = ctx->sessionkey.data;
|
||||
|
||||
return gss_add_buffer_set_member(minor_status,
|
||||
&value,
|
||||
data_set);
|
||||
} else if (gss_oid_equal(desired_object, GSS_C_INQ_WIN2K_PAC_X)) {
|
||||
if (ctx->pac.length == 0) {
|
||||
*minor_status = ENOENT;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
return gss_add_buffer_set_member(minor_status,
|
||||
&ctx->pac,
|
||||
data_set);
|
||||
|
||||
} else if (gss_oid_equal(desired_object, GSS_C_NTLM_AVGUEST)) {
|
||||
gss_buffer_desc value;
|
||||
uint32_t num;
|
||||
|
||||
if (ctx->kcmflags & KCM_NTLM_FLAG_AV_GUEST)
|
||||
num = 1;
|
||||
else
|
||||
num = 0;
|
||||
|
||||
value.length = sizeof(num);
|
||||
value.value = #
|
||||
|
||||
return gss_add_buffer_set_member(minor_status,
|
||||
&value,
|
||||
data_set);
|
||||
} else {
|
||||
*minor_status = 0;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
add_history(char *p)
|
||||
{
|
||||
#ifdef H_SETSIZE
|
||||
HistEvent ev;
|
||||
history(h, &ev, H_ENTER, p);
|
||||
#else
|
||||
history(h, H_ENTER, p);
|
||||
#endif
|
||||
}
|
97
lib/gssapi/ntlm/iter_cred.c
Normal file
97
lib/gssapi/ntlm/iter_cred.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ntlm.h"
|
||||
|
||||
void
|
||||
_gss_ntlm_iter_creds_f(OM_uint32 flags,
|
||||
void *userctx ,
|
||||
void (*cred_iter)(void *, gss_OID, gss_cred_id_t))
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_context context = NULL;
|
||||
krb5_storage *request, *response;
|
||||
krb5_data response_data;
|
||||
|
||||
ret = krb5_init_context(&context);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
ret = krb5_kcm_storage_request(context, KCM_OP_GET_NTLM_USER_LIST, &request);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
ret = krb5_kcm_call(context, request, &response, &response_data);
|
||||
krb5_storage_free(request);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
while (1) {
|
||||
uint32_t morep;
|
||||
char *user = NULL, *domain = NULL;
|
||||
ntlm_cred dn;
|
||||
|
||||
ret = krb5_ret_uint32(response, &morep);
|
||||
if (ret) goto out;
|
||||
|
||||
if (!morep) goto out;
|
||||
|
||||
ret = krb5_ret_stringz(response, &user);
|
||||
if (ret) goto out;
|
||||
ret = krb5_ret_stringz(response, &domain);
|
||||
if (ret) {
|
||||
free(user);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dn = calloc(1, sizeof(*dn));
|
||||
if (dn == NULL) {
|
||||
free(user);
|
||||
free(domain);
|
||||
goto out;
|
||||
}
|
||||
dn->username = user;
|
||||
dn->domain = domain;
|
||||
|
||||
cred_iter(userctx, GSS_NTLM_MECHANISM, (gss_cred_id_t)dn);
|
||||
}
|
||||
out:
|
||||
krb5_storage_free(response);
|
||||
krb5_data_free(&response_data);
|
||||
done:
|
||||
if (context)
|
||||
krb5_free_context(context);
|
||||
(*cred_iter)(userctx, NULL, NULL);
|
||||
}
|
@@ -49,8 +49,10 @@
|
||||
#include <gssapi.h>
|
||||
#include <gssapi_ntlm.h>
|
||||
#include <gssapi_mech.h>
|
||||
#include <gssapi_oid.h>
|
||||
|
||||
#include <krb5.h>
|
||||
#include <kcm.h>
|
||||
#include <heim_threads.h>
|
||||
|
||||
#include <heimntlm.h>
|
||||
@@ -109,6 +111,7 @@ typedef struct {
|
||||
void *ictx;
|
||||
ntlm_cred client;
|
||||
OM_uint32 gssflags;
|
||||
uint32_t kcmflags;
|
||||
uint32_t flags;
|
||||
uint32_t status;
|
||||
#define STATUS_OPEN 1
|
||||
@@ -116,6 +119,8 @@ typedef struct {
|
||||
#define STATUS_SESSIONKEY 4
|
||||
krb5_data sessionkey;
|
||||
|
||||
gss_buffer_desc pac;
|
||||
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
|
@@ -49,6 +49,10 @@ oid base GSS_NETLOGON_SET_SESSION_KEY_X 1.2.752.43.14.3
|
||||
oid base GSS_NETLOGON_SET_SIGN_ALGORITHM_X 1.2.752.43.14.4
|
||||
oid base GSS_NETLOGON_NT_NETBIOS_DNS_NAME 1.2.752.43.14.5
|
||||
|
||||
#/* GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X.128 */
|
||||
oid base GSS_C_INQ_WIN2K_PAC_X 1.2.752.43.13.3.128
|
||||
oid base GSS_C_INQ_SSPI_SESSION_KEY 1.2.840.113554.1.2.2.5.5
|
||||
|
||||
#/*
|
||||
# * "Standard" mechs
|
||||
# */
|
||||
|
@@ -390,6 +390,21 @@ certs_iter(hx509_context context, void *ctx, hx509_cert cert)
|
||||
return func(cert);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all certificates in a keystore and call an block
|
||||
* for each fo them.
|
||||
*
|
||||
* @param context a hx509 context.
|
||||
* @param certs certificate store to iterate over.
|
||||
* @param func block to call for each certificate. The function
|
||||
* should return non-zero to abort the iteration, that value is passed
|
||||
* back to the caller of hx509_certs_iter().
|
||||
*
|
||||
* @return Returns an hx509 error code.
|
||||
*
|
||||
* @ingroup hx509_keyset
|
||||
*/
|
||||
|
||||
int
|
||||
hx509_certs_iter(hx509_context context,
|
||||
hx509_certs certs,
|
||||
|
@@ -104,6 +104,9 @@ heim_ipc_semaphore_create(long value)
|
||||
{
|
||||
#ifdef HAVE_GCD
|
||||
return (heim_isemaphore)dispatch_semaphore_create(value);
|
||||
#elif !defined(ENABLE_PTHREAD_SUPPORT)
|
||||
heim_assert(0, "no semaphore support w/o pthreads");
|
||||
return NULL;
|
||||
#else
|
||||
heim_isemaphore s = malloc(sizeof(*s));
|
||||
if (s == NULL)
|
||||
@@ -126,6 +129,9 @@ heim_ipc_semaphore_wait(heim_isemaphore s, time_t t)
|
||||
timeout = (uint64_t)t * NSEC_PER_SEC;
|
||||
|
||||
return dispatch_semaphore_wait((dispatch_semaphore_t)s, timeout);
|
||||
#elif !defined(ENABLE_PTHREAD_SUPPORT)
|
||||
heim_assert(0, "no semaphore support w/o pthreads");
|
||||
return 0;
|
||||
#else
|
||||
HEIMDAL_MUTEX_lock(&s->mutex);
|
||||
/* if counter hits below zero, we get to wait */
|
||||
@@ -156,6 +162,9 @@ heim_ipc_semaphore_signal(heim_isemaphore s)
|
||||
{
|
||||
#ifdef HAVE_GCD
|
||||
return dispatch_semaphore_signal((dispatch_semaphore_t)s);
|
||||
#elif !defined(ENABLE_PTHREAD_SUPPORT)
|
||||
heim_assert(0, "no semaphore support w/o pthreads");
|
||||
return EINVAL;
|
||||
#else
|
||||
int wakeup;
|
||||
HEIMDAL_MUTEX_lock(&s->mutex);
|
||||
@@ -171,7 +180,9 @@ void
|
||||
heim_ipc_semaphore_release(heim_isemaphore s)
|
||||
{
|
||||
#ifdef HAVE_GCD
|
||||
return dispatch_release((dispatch_semaphore_t)s);
|
||||
dispatch_release((dispatch_semaphore_t)s);
|
||||
#elif !defined(ENABLE_PTHREAD_SUPPORT)
|
||||
heim_assert(0, "no semaphore support w/o pthreads");
|
||||
#else
|
||||
HEIMDAL_MUTEX_lock(&s->mutex);
|
||||
if (s->counter != 0)
|
||||
|
@@ -57,6 +57,7 @@
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include <heimbase.h>
|
||||
#include <base64.h>
|
||||
|
||||
#include <heim-ipc.h>
|
||||
|
@@ -104,7 +104,7 @@
|
||||
#define KADM5_HIST_PRINCIPAL "kadmin/history"
|
||||
#define KADM5_CHANGEPW_SERVICE "kadmin/changepw"
|
||||
|
||||
typedef struct _krb5_key_data {
|
||||
typedef struct {
|
||||
int16_t key_data_ver; /* Version */
|
||||
int16_t key_data_kvno; /* Key Version */
|
||||
int16_t key_data_type[2]; /* Array of types */
|
||||
|
@@ -37,12 +37,12 @@
|
||||
* AES
|
||||
*/
|
||||
|
||||
static struct key_type keytype_aes128 = {
|
||||
static struct _krb5_key_type keytype_aes128 = {
|
||||
KEYTYPE_AES128,
|
||||
"aes-128",
|
||||
128,
|
||||
16,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
NULL,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_AES_salt,
|
||||
@@ -51,12 +51,12 @@ static struct key_type keytype_aes128 = {
|
||||
EVP_aes_128_cbc
|
||||
};
|
||||
|
||||
static struct key_type keytype_aes256 = {
|
||||
static struct _krb5_key_type keytype_aes256 = {
|
||||
KEYTYPE_AES256,
|
||||
"aes-256",
|
||||
256,
|
||||
32,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
NULL,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_AES_salt,
|
||||
@@ -65,7 +65,7 @@ static struct key_type keytype_aes256 = {
|
||||
EVP_aes_256_cbc
|
||||
};
|
||||
|
||||
struct checksum_type _krb5_checksum_hmac_sha1_aes128 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_hmac_sha1_aes128 = {
|
||||
CKSUMTYPE_HMAC_SHA1_96_AES_128,
|
||||
"hmac-sha1-96-aes128",
|
||||
64,
|
||||
@@ -75,7 +75,7 @@ struct checksum_type _krb5_checksum_hmac_sha1_aes128 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct checksum_type _krb5_checksum_hmac_sha1_aes256 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_hmac_sha1_aes256 = {
|
||||
CKSUMTYPE_HMAC_SHA1_96_AES_256,
|
||||
"hmac-sha1-96-aes256",
|
||||
64,
|
||||
@@ -91,7 +91,7 @@ AES_PRF(krb5_context context,
|
||||
const krb5_data *in,
|
||||
krb5_data *out)
|
||||
{
|
||||
struct checksum_type *ct = crypto->et->checksum;
|
||||
struct _krb5_checksum_type *ct = crypto->et->checksum;
|
||||
krb5_error_code ret;
|
||||
Checksum result;
|
||||
krb5_keyblock *derived;
|
||||
@@ -139,7 +139,7 @@ AES_PRF(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct encryption_type _krb5_enctype_aes128_cts_hmac_sha1 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_aes128_cts_hmac_sha1 = {
|
||||
ETYPE_AES128_CTS_HMAC_SHA1_96,
|
||||
"aes128-cts-hmac-sha1-96",
|
||||
16,
|
||||
@@ -154,7 +154,7 @@ struct encryption_type _krb5_enctype_aes128_cts_hmac_sha1 = {
|
||||
AES_PRF
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_aes256_cts_hmac_sha1 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_aes256_cts_hmac_sha1 = {
|
||||
ETYPE_AES256_CTS_HMAC_SHA1_96,
|
||||
"aes256-cts-hmac-sha1-96",
|
||||
16,
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#define DES3_OLD_ENCTYPE 1
|
||||
#endif
|
||||
|
||||
struct checksum_type *_krb5_checksum_types[] = {
|
||||
struct _krb5_checksum_type *_krb5_checksum_types[] = {
|
||||
&_krb5_checksum_none,
|
||||
#ifdef HEIM_WEAK_CRYPTO
|
||||
&_krb5_checksum_crc32,
|
||||
@@ -63,7 +63,7 @@ int _krb5_num_checksums
|
||||
* these should currently be in reverse preference order.
|
||||
* (only relevant for !F_PSEUDO) */
|
||||
|
||||
struct encryption_type *_krb5_etypes[] = {
|
||||
struct _krb5_encryption_type *_krb5_etypes[] = {
|
||||
&_krb5_enctype_aes256_cts_hmac_sha1,
|
||||
&_krb5_enctype_aes128_cts_hmac_sha1,
|
||||
&_krb5_enctype_des3_cbc_sha1,
|
||||
|
@@ -37,12 +37,12 @@
|
||||
|
||||
#include "krb5_locl.h"
|
||||
|
||||
static struct key_type keytype_arcfour = {
|
||||
static struct _krb5_key_type keytype_arcfour = {
|
||||
KEYTYPE_ARCFOUR,
|
||||
"arcfour",
|
||||
128,
|
||||
16,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
NULL,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_arcfour_salt,
|
||||
@@ -57,17 +57,17 @@ static struct key_type keytype_arcfour = {
|
||||
|
||||
krb5_error_code
|
||||
_krb5_HMAC_MD5_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
Checksum *result)
|
||||
{
|
||||
EVP_MD_CTX *m;
|
||||
struct checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
const char signature[] = "signaturekey";
|
||||
Checksum ksign_c;
|
||||
struct key_data ksign;
|
||||
struct _krb5_key_data ksign;
|
||||
krb5_keyblock kb;
|
||||
unsigned char t[4];
|
||||
unsigned char tmp[16];
|
||||
@@ -105,7 +105,7 @@ _krb5_HMAC_MD5_checksum(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_hmac_md5 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_hmac_md5 = {
|
||||
CKSUMTYPE_HMAC_MD5,
|
||||
"hmac-md5",
|
||||
64,
|
||||
@@ -123,16 +123,16 @@ struct checksum_type _krb5_checksum_hmac_md5 = {
|
||||
|
||||
static krb5_error_code
|
||||
ARCFOUR_subencrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
void *ivec)
|
||||
{
|
||||
EVP_CIPHER_CTX ctx;
|
||||
struct checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
Checksum k1_c, k2_c, k3_c, cksum;
|
||||
struct key_data ke;
|
||||
struct _krb5_key_data ke;
|
||||
krb5_keyblock kb;
|
||||
unsigned char t[4];
|
||||
unsigned char *cdata = data;
|
||||
@@ -190,16 +190,16 @@ ARCFOUR_subencrypt(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
ARCFOUR_subdecrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
void *ivec)
|
||||
{
|
||||
EVP_CIPHER_CTX ctx;
|
||||
struct checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum (CKSUMTYPE_RSA_MD5);
|
||||
Checksum k1_c, k2_c, k3_c, cksum;
|
||||
struct key_data ke;
|
||||
struct _krb5_key_data ke;
|
||||
krb5_keyblock kb;
|
||||
unsigned char t[4];
|
||||
unsigned char *cdata = data;
|
||||
@@ -290,7 +290,7 @@ _krb5_usage2arcfour(krb5_context context, unsigned *usage)
|
||||
|
||||
static krb5_error_code
|
||||
ARCFOUR_encrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
@@ -309,7 +309,7 @@ ARCFOUR_encrypt(krb5_context context,
|
||||
return ARCFOUR_subdecrypt (context, key, data, len, keyusage, ivec);
|
||||
}
|
||||
|
||||
struct encryption_type _krb5_enctype_arcfour_hmac_md5 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_arcfour_hmac_md5 = {
|
||||
ETYPE_ARCFOUR_HMAC_MD5,
|
||||
"arcfour-hmac-md5",
|
||||
1,
|
||||
|
@@ -57,12 +57,12 @@ _krb5_xor (DES_cblock *key, const unsigned char *b)
|
||||
krb5_error_code
|
||||
_krb5_des_checksum(krb5_context context,
|
||||
const EVP_MD *evp_md,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
Checksum *cksum)
|
||||
{
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
EVP_MD_CTX *m;
|
||||
DES_cblock ivec;
|
||||
unsigned char *p = cksum->checksum.data;
|
||||
@@ -90,12 +90,12 @@ _krb5_des_checksum(krb5_context context,
|
||||
krb5_error_code
|
||||
_krb5_des_verify(krb5_context context,
|
||||
const EVP_MD *evp_md,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
Checksum *C)
|
||||
{
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
EVP_MD_CTX *m;
|
||||
unsigned char tmp[24];
|
||||
unsigned char res[16];
|
||||
@@ -130,7 +130,7 @@ _krb5_des_verify(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD5_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -141,7 +141,7 @@ RSA_MD5_checksum(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_rsa_md5 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_rsa_md5 = {
|
||||
CKSUMTYPE_RSA_MD5,
|
||||
"rsa-md5",
|
||||
64,
|
||||
|
@@ -49,8 +49,8 @@ krb5_DES_random_key(krb5_context context,
|
||||
|
||||
static void
|
||||
krb5_DES_schedule_old(krb5_context context,
|
||||
struct key_type *kt,
|
||||
struct key_data *key)
|
||||
struct _krb5_key_type *kt,
|
||||
struct _krb5_key_data *key)
|
||||
{
|
||||
DES_set_key_unchecked(key->key->keyvalue.data, key->schedule->data);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ krb5_DES_random_to_key(krb5_context context,
|
||||
_krb5_xor(k, (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
}
|
||||
|
||||
static struct key_type keytype_des_old = {
|
||||
static struct _krb5_key_type keytype_des_old = {
|
||||
KEYTYPE_DES,
|
||||
"des-old",
|
||||
56,
|
||||
@@ -80,12 +80,12 @@ static struct key_type keytype_des_old = {
|
||||
krb5_DES_random_to_key
|
||||
};
|
||||
|
||||
static struct key_type keytype_des = {
|
||||
static struct _krb5_key_type keytype_des = {
|
||||
KEYTYPE_DES,
|
||||
"des",
|
||||
56,
|
||||
8,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
krb5_DES_random_key,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_des_salt,
|
||||
@@ -96,7 +96,7 @@ static struct key_type keytype_des = {
|
||||
|
||||
static krb5_error_code
|
||||
CRC32_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -115,7 +115,7 @@ CRC32_checksum(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD4_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -128,7 +128,7 @@ RSA_MD4_checksum(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD4_DES_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -139,7 +139,7 @@ RSA_MD4_DES_checksum(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD4_DES_verify(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -150,7 +150,7 @@ RSA_MD4_DES_verify(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD5_DES_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -161,7 +161,7 @@ RSA_MD5_DES_checksum(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD5_DES_verify(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -170,7 +170,7 @@ RSA_MD5_DES_verify(krb5_context context,
|
||||
return _krb5_des_verify(context, EVP_md5(), key, data, len, C);
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_crc32 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_crc32 = {
|
||||
CKSUMTYPE_CRC32,
|
||||
"crc32",
|
||||
1,
|
||||
@@ -180,7 +180,7 @@ struct checksum_type _krb5_checksum_crc32 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct checksum_type _krb5_checksum_rsa_md4 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_rsa_md4 = {
|
||||
CKSUMTYPE_RSA_MD4,
|
||||
"rsa-md4",
|
||||
64,
|
||||
@@ -190,7 +190,7 @@ struct checksum_type _krb5_checksum_rsa_md4 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct checksum_type _krb5_checksum_rsa_md4_des = {
|
||||
struct _krb5_checksum_type _krb5_checksum_rsa_md4_des = {
|
||||
CKSUMTYPE_RSA_MD4_DES,
|
||||
"rsa-md4-des",
|
||||
64,
|
||||
@@ -200,7 +200,7 @@ struct checksum_type _krb5_checksum_rsa_md4_des = {
|
||||
RSA_MD4_DES_verify
|
||||
};
|
||||
|
||||
struct checksum_type _krb5_checksum_rsa_md5_des = {
|
||||
struct _krb5_checksum_type _krb5_checksum_rsa_md5_des = {
|
||||
CKSUMTYPE_RSA_MD5_DES,
|
||||
"rsa-md5-des",
|
||||
64,
|
||||
@@ -212,14 +212,14 @@ struct checksum_type _krb5_checksum_rsa_md5_des = {
|
||||
|
||||
static krb5_error_code
|
||||
evp_des_encrypt_null_ivec(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
int usage,
|
||||
void *ignore_ivec)
|
||||
{
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
EVP_CIPHER_CTX *c;
|
||||
DES_cblock ivec;
|
||||
memset(&ivec, 0, sizeof(ivec));
|
||||
@@ -231,14 +231,14 @@ evp_des_encrypt_null_ivec(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
evp_des_encrypt_key_ivec(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
int usage,
|
||||
void *ignore_ivec)
|
||||
{
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
EVP_CIPHER_CTX *c;
|
||||
DES_cblock ivec;
|
||||
memcpy(&ivec, key->key->keyvalue.data, sizeof(ivec));
|
||||
@@ -250,7 +250,7 @@ evp_des_encrypt_key_ivec(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
DES_CFB64_encrypt_null_ivec(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
@@ -268,7 +268,7 @@ DES_CFB64_encrypt_null_ivec(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
DES_PCBC_encrypt_key_ivec(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
@@ -283,7 +283,7 @@ DES_PCBC_encrypt_key_ivec(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct encryption_type _krb5_enctype_des_cbc_crc = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_cbc_crc = {
|
||||
ETYPE_DES_CBC_CRC,
|
||||
"des-cbc-crc",
|
||||
8,
|
||||
@@ -298,7 +298,7 @@ struct encryption_type _krb5_enctype_des_cbc_crc = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_des_cbc_md4 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_cbc_md4 = {
|
||||
ETYPE_DES_CBC_MD4,
|
||||
"des-cbc-md4",
|
||||
8,
|
||||
@@ -313,7 +313,7 @@ struct encryption_type _krb5_enctype_des_cbc_md4 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_des_cbc_md5 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_cbc_md5 = {
|
||||
ETYPE_DES_CBC_MD5,
|
||||
"des-cbc-md5",
|
||||
8,
|
||||
@@ -328,7 +328,7 @@ struct encryption_type _krb5_enctype_des_cbc_md5 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_des_cbc_none = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_cbc_none = {
|
||||
ETYPE_DES_CBC_NONE,
|
||||
"des-cbc-none",
|
||||
8,
|
||||
@@ -343,7 +343,7 @@ struct encryption_type _krb5_enctype_des_cbc_none = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_des_cfb64_none = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_cfb64_none = {
|
||||
ETYPE_DES_CFB64_NONE,
|
||||
"des-cfb64-none",
|
||||
1,
|
||||
@@ -358,7 +358,7 @@ struct encryption_type _krb5_enctype_des_cfb64_none = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct encryption_type _krb5_enctype_des_pcbc_none = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des_pcbc_none = {
|
||||
ETYPE_DES_PCBC_NONE,
|
||||
"des-pcbc-none",
|
||||
8,
|
||||
|
@@ -54,12 +54,12 @@ DES3_random_key(krb5_context context,
|
||||
|
||||
|
||||
#ifdef DES3_OLD_ENCTYPE
|
||||
static struct key_type keytype_des3 = {
|
||||
static struct _krb5_key_type keytype_des3 = {
|
||||
KEYTYPE_DES3,
|
||||
"des3",
|
||||
168,
|
||||
24,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
DES3_random_key,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_des3_salt,
|
||||
@@ -69,12 +69,12 @@ static struct key_type keytype_des3 = {
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct key_type keytype_des3_derived = {
|
||||
static struct _krb5_key_type keytype_des3_derived = {
|
||||
KEYTYPE_DES3,
|
||||
"des3",
|
||||
168,
|
||||
24,
|
||||
sizeof(struct evp_schedule),
|
||||
sizeof(struct _krb5_evp_schedule),
|
||||
DES3_random_key,
|
||||
_krb5_evp_schedule,
|
||||
_krb5_des3_salt_derived,
|
||||
@@ -86,7 +86,7 @@ static struct key_type keytype_des3_derived = {
|
||||
#ifdef DES3_OLD_ENCTYPE
|
||||
static krb5_error_code
|
||||
RSA_MD5_DES3_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -97,7 +97,7 @@ RSA_MD5_DES3_checksum(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
RSA_MD5_DES3_verify(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -106,7 +106,7 @@ RSA_MD5_DES3_verify(krb5_context context,
|
||||
return _krb5_des_verify(context, EVP_md5(), key, data, len, C);
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_rsa_md5_des3 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_rsa_md5_des3 = {
|
||||
CKSUMTYPE_RSA_MD5_DES3,
|
||||
"rsa-md5-des3",
|
||||
64,
|
||||
@@ -117,7 +117,7 @@ struct checksum_type _krb5_checksum_rsa_md5_des3 = {
|
||||
};
|
||||
#endif
|
||||
|
||||
struct checksum_type _krb5_checksum_hmac_sha1_des3 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_hmac_sha1_des3 = {
|
||||
CKSUMTYPE_HMAC_SHA1_DES3,
|
||||
"hmac-sha1-des3",
|
||||
64,
|
||||
@@ -128,7 +128,7 @@ struct checksum_type _krb5_checksum_hmac_sha1_des3 = {
|
||||
};
|
||||
|
||||
#ifdef DES3_OLD_ENCTYPE
|
||||
struct encryption_type _krb5_enctype_des3_cbc_md5 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des3_cbc_md5 = {
|
||||
ETYPE_DES3_CBC_MD5,
|
||||
"des3-cbc-md5",
|
||||
8,
|
||||
@@ -144,7 +144,7 @@ struct encryption_type _krb5_enctype_des3_cbc_md5 = {
|
||||
};
|
||||
#endif
|
||||
|
||||
struct encryption_type _krb5_enctype_des3_cbc_sha1 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des3_cbc_sha1 = {
|
||||
ETYPE_DES3_CBC_SHA1,
|
||||
"des3-cbc-sha1",
|
||||
8,
|
||||
@@ -160,7 +160,7 @@ struct encryption_type _krb5_enctype_des3_cbc_sha1 = {
|
||||
};
|
||||
|
||||
#ifdef DES3_OLD_ENCTYPE
|
||||
struct encryption_type _krb5_enctype_old_des3_cbc_sha1 = {
|
||||
struct _krb5_encryption_type _krb5_enctype_old_des3_cbc_sha1 = {
|
||||
ETYPE_OLD_DES3_CBC_SHA1,
|
||||
"old-des3-cbc-sha1",
|
||||
8,
|
||||
@@ -176,7 +176,7 @@ struct encryption_type _krb5_enctype_old_des3_cbc_sha1 = {
|
||||
};
|
||||
#endif
|
||||
|
||||
struct encryption_type _krb5_enctype_des3_cbc_none = {
|
||||
struct _krb5_encryption_type _krb5_enctype_des3_cbc_none = {
|
||||
ETYPE_DES3_CBC_NONE,
|
||||
"des3-cbc-none",
|
||||
8,
|
||||
|
@@ -35,10 +35,10 @@
|
||||
|
||||
void
|
||||
_krb5_evp_schedule(krb5_context context,
|
||||
struct key_type *kt,
|
||||
struct key_data *kd)
|
||||
struct _krb5_key_type *kt,
|
||||
struct _krb5_key_data *kd)
|
||||
{
|
||||
struct evp_schedule *key = kd->schedule->data;
|
||||
struct _krb5_evp_schedule *key = kd->schedule->data;
|
||||
const EVP_CIPHER *c = (*kt->evp)();
|
||||
|
||||
EVP_CIPHER_CTX_init(&key->ectx);
|
||||
@@ -49,23 +49,23 @@ _krb5_evp_schedule(krb5_context context,
|
||||
}
|
||||
|
||||
void
|
||||
_krb5_evp_cleanup(krb5_context context, struct key_data *kd)
|
||||
_krb5_evp_cleanup(krb5_context context, struct _krb5_key_data *kd)
|
||||
{
|
||||
struct evp_schedule *key = kd->schedule->data;
|
||||
struct _krb5_evp_schedule *key = kd->schedule->data;
|
||||
EVP_CIPHER_CTX_cleanup(&key->ectx);
|
||||
EVP_CIPHER_CTX_cleanup(&key->dctx);
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
_krb5_evp_encrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
int usage,
|
||||
void *ivec)
|
||||
{
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
EVP_CIPHER_CTX *c;
|
||||
c = encryptp ? &ctx->ectx : &ctx->dctx;
|
||||
if (ivec == NULL) {
|
||||
@@ -89,7 +89,7 @@ static const unsigned char zero_ivec[EVP_MAX_BLOCK_LENGTH] = { 0 };
|
||||
|
||||
krb5_error_code
|
||||
_krb5_evp_encrypt_cts(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
@@ -97,7 +97,7 @@ _krb5_evp_encrypt_cts(krb5_context context,
|
||||
void *ivec)
|
||||
{
|
||||
size_t i, blocksize;
|
||||
struct evp_schedule *ctx = key->schedule->data;
|
||||
struct _krb5_evp_schedule *ctx = key->schedule->data;
|
||||
char tmp[EVP_MAX_BLOCK_LENGTH], ivec2[EVP_MAX_BLOCK_LENGTH];
|
||||
EVP_CIPHER_CTX *c;
|
||||
unsigned char *p;
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#define DES3_OLD_ENCTYPE 1
|
||||
#endif
|
||||
|
||||
static struct key_type keytype_null = {
|
||||
static struct _krb5_key_type keytype_null = {
|
||||
KEYTYPE_NULL,
|
||||
"null",
|
||||
0,
|
||||
@@ -50,7 +50,7 @@ static struct key_type keytype_null = {
|
||||
|
||||
static krb5_error_code
|
||||
NONE_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -59,7 +59,7 @@ NONE_checksum(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_none = {
|
||||
struct _krb5_checksum_type _krb5_checksum_none = {
|
||||
CKSUMTYPE_NONE,
|
||||
"none",
|
||||
1,
|
||||
@@ -71,7 +71,7 @@ struct checksum_type _krb5_checksum_none = {
|
||||
|
||||
static krb5_error_code
|
||||
NULL_encrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data,
|
||||
size_t len,
|
||||
krb5_boolean encryptp,
|
||||
@@ -81,7 +81,7 @@ NULL_encrypt(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct encryption_type _krb5_enctype_null = {
|
||||
struct _krb5_encryption_type _krb5_enctype_null = {
|
||||
ETYPE_NULL,
|
||||
"null",
|
||||
1,
|
||||
|
@@ -44,7 +44,7 @@ _krb5_pk_octetstring2key(krb5_context context,
|
||||
const heim_octet_string *k_n,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
krb5_error_code ret;
|
||||
size_t keylen, offset;
|
||||
void *keydata;
|
||||
@@ -205,7 +205,7 @@ _krb5_pk_kdf(krb5_context context,
|
||||
const Ticket *ticket,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
struct encryption_type *et;
|
||||
struct _krb5_encryption_type *et;
|
||||
krb5_error_code ret;
|
||||
krb5_data other;
|
||||
size_t keylen, offset;
|
||||
|
@@ -35,17 +35,23 @@
|
||||
|
||||
#include "krb5_locl.h"
|
||||
|
||||
struct _krb5_key_usage {
|
||||
unsigned usage;
|
||||
struct _krb5_key_data key;
|
||||
};
|
||||
|
||||
|
||||
#ifndef HEIMDAL_SMALLER
|
||||
#define DES3_OLD_ENCTYPE 1
|
||||
#endif
|
||||
|
||||
static krb5_error_code _get_derived_key(krb5_context, krb5_crypto,
|
||||
unsigned, struct key_data**);
|
||||
static struct key_data *_new_derived_key(krb5_crypto crypto, unsigned usage);
|
||||
unsigned, struct _krb5_key_data**);
|
||||
static struct _krb5_key_data *_new_derived_key(krb5_crypto crypto, unsigned usage);
|
||||
|
||||
static void free_key_schedule(krb5_context,
|
||||
struct key_data *,
|
||||
struct encryption_type *);
|
||||
struct _krb5_key_data *,
|
||||
struct _krb5_encryption_type *);
|
||||
|
||||
/************************************************************
|
||||
* *
|
||||
@@ -56,7 +62,7 @@ krb5_enctype_keysize(krb5_context context,
|
||||
krb5_enctype type,
|
||||
size_t *keysize)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
if(et == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
N_("encryption type %d not supported", ""),
|
||||
@@ -72,7 +78,7 @@ krb5_enctype_keybits(krb5_context context,
|
||||
krb5_enctype type,
|
||||
size_t *keybits)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
if(et == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
"encryption type %d not supported",
|
||||
@@ -89,7 +95,7 @@ krb5_generate_random_keyblock(krb5_context context,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
if(et == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
N_("encryption type %d not supported", ""),
|
||||
@@ -110,11 +116,11 @@ krb5_generate_random_keyblock(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
_key_schedule(krb5_context context,
|
||||
struct key_data *key)
|
||||
struct _krb5_key_data *key)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct encryption_type *et = _krb5_find_enctype(key->key->keytype);
|
||||
struct key_type *kt;
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(key->key->keytype);
|
||||
struct _krb5_key_type *kt;
|
||||
|
||||
if (et == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -150,7 +156,7 @@ _key_schedule(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
SHA1_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
@@ -164,11 +170,11 @@ SHA1_checksum(krb5_context context,
|
||||
/* HMAC according to RFC2104 */
|
||||
krb5_error_code
|
||||
_krb5_internal_hmac(krb5_context context,
|
||||
struct checksum_type *cm,
|
||||
struct _krb5_checksum_type *cm,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
struct key_data *keyblock,
|
||||
struct _krb5_key_data *keyblock,
|
||||
Checksum *result)
|
||||
{
|
||||
unsigned char *ipad, *opad;
|
||||
@@ -228,8 +234,8 @@ krb5_hmac(krb5_context context,
|
||||
krb5_keyblock *key,
|
||||
Checksum *result)
|
||||
{
|
||||
struct checksum_type *c = _krb5_find_checksum(cktype);
|
||||
struct key_data kd;
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum(cktype);
|
||||
struct _krb5_key_data kd;
|
||||
krb5_error_code ret;
|
||||
|
||||
if (c == NULL) {
|
||||
@@ -252,13 +258,13 @@ krb5_hmac(krb5_context context,
|
||||
|
||||
krb5_error_code
|
||||
_krb5_SP_HMAC_SHA1_checksum(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
Checksum *result)
|
||||
{
|
||||
struct checksum_type *c = _krb5_find_checksum(CKSUMTYPE_SHA1);
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum(CKSUMTYPE_SHA1);
|
||||
Checksum res;
|
||||
char sha1_data[20];
|
||||
krb5_error_code ret;
|
||||
@@ -273,7 +279,7 @@ _krb5_SP_HMAC_SHA1_checksum(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct checksum_type _krb5_checksum_sha1 = {
|
||||
struct _krb5_checksum_type _krb5_checksum_sha1 = {
|
||||
CKSUMTYPE_SHA1,
|
||||
"sha1",
|
||||
64,
|
||||
@@ -283,7 +289,7 @@ struct checksum_type _krb5_checksum_sha1 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct checksum_type *
|
||||
struct _krb5_checksum_type *
|
||||
_krb5_find_checksum(krb5_cksumtype type)
|
||||
{
|
||||
int i;
|
||||
@@ -297,8 +303,8 @@ static krb5_error_code
|
||||
get_checksum_key(krb5_context context,
|
||||
krb5_crypto crypto,
|
||||
unsigned usage, /* not krb5_key_usage */
|
||||
struct checksum_type *ct,
|
||||
struct key_data **key)
|
||||
struct _krb5_checksum_type *ct,
|
||||
struct _krb5_key_data **key)
|
||||
{
|
||||
krb5_error_code ret = 0;
|
||||
|
||||
@@ -327,7 +333,7 @@ get_checksum_key(krb5_context context,
|
||||
|
||||
static krb5_error_code
|
||||
create_checksum (krb5_context context,
|
||||
struct checksum_type *ct,
|
||||
struct _krb5_checksum_type *ct,
|
||||
krb5_crypto crypto,
|
||||
unsigned usage,
|
||||
void *data,
|
||||
@@ -335,7 +341,7 @@ create_checksum (krb5_context context,
|
||||
Checksum *result)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
struct _krb5_key_data *dkey;
|
||||
int keyed_checksum;
|
||||
|
||||
if (ct->flags & F_DISABLED) {
|
||||
@@ -364,7 +370,7 @@ create_checksum (krb5_context context,
|
||||
}
|
||||
|
||||
static int
|
||||
arcfour_checksum_p(struct checksum_type *ct, krb5_crypto crypto)
|
||||
arcfour_checksum_p(struct _krb5_checksum_type *ct, krb5_crypto crypto)
|
||||
{
|
||||
return (ct->type == CKSUMTYPE_HMAC_MD5) &&
|
||||
(crypto->key.key->keytype == KEYTYPE_ARCFOUR);
|
||||
@@ -379,7 +385,7 @@ krb5_create_checksum(krb5_context context,
|
||||
size_t len,
|
||||
Checksum *result)
|
||||
{
|
||||
struct checksum_type *ct = NULL;
|
||||
struct _krb5_checksum_type *ct = NULL;
|
||||
unsigned keyusage;
|
||||
|
||||
/* type 0 -> pick from crypto */
|
||||
@@ -417,10 +423,10 @@ verify_checksum(krb5_context context,
|
||||
Checksum *cksum)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
struct _krb5_key_data *dkey;
|
||||
int keyed_checksum;
|
||||
Checksum c;
|
||||
struct checksum_type *ct;
|
||||
struct _krb5_checksum_type *ct;
|
||||
|
||||
ct = _krb5_find_checksum(cksum->cksumtype);
|
||||
if (ct == NULL || (ct->flags & F_DISABLED)) {
|
||||
@@ -441,7 +447,7 @@ verify_checksum(krb5_context context,
|
||||
}
|
||||
keyed_checksum = (ct->flags & F_KEYED) != 0;
|
||||
if(keyed_checksum) {
|
||||
struct checksum_type *kct;
|
||||
struct _krb5_checksum_type *kct;
|
||||
if (crypto == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
N_("Checksum type %s is keyed but no "
|
||||
@@ -511,7 +517,7 @@ krb5_verify_checksum(krb5_context context,
|
||||
size_t len,
|
||||
Checksum *cksum)
|
||||
{
|
||||
struct checksum_type *ct;
|
||||
struct _krb5_checksum_type *ct;
|
||||
unsigned keyusage;
|
||||
|
||||
ct = _krb5_find_checksum(cksum->cksumtype);
|
||||
@@ -537,7 +543,7 @@ krb5_crypto_get_checksum_type(krb5_context context,
|
||||
krb5_crypto crypto,
|
||||
krb5_cksumtype *type)
|
||||
{
|
||||
struct checksum_type *ct = NULL;
|
||||
struct _krb5_checksum_type *ct = NULL;
|
||||
|
||||
if (crypto != NULL) {
|
||||
ct = crypto->et->keyed_checksum;
|
||||
@@ -562,7 +568,7 @@ krb5_checksumsize(krb5_context context,
|
||||
krb5_cksumtype type,
|
||||
size_t *size)
|
||||
{
|
||||
struct checksum_type *ct = _krb5_find_checksum(type);
|
||||
struct _krb5_checksum_type *ct = _krb5_find_checksum(type);
|
||||
if(ct == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
N_("checksum type %d not supported", ""),
|
||||
@@ -577,7 +583,7 @@ KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
|
||||
krb5_checksum_is_keyed(krb5_context context,
|
||||
krb5_cksumtype type)
|
||||
{
|
||||
struct checksum_type *ct = _krb5_find_checksum(type);
|
||||
struct _krb5_checksum_type *ct = _krb5_find_checksum(type);
|
||||
if(ct == NULL) {
|
||||
if (context)
|
||||
krb5_set_error_message (context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
@@ -592,7 +598,7 @@ KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
|
||||
krb5_checksum_is_collision_proof(krb5_context context,
|
||||
krb5_cksumtype type)
|
||||
{
|
||||
struct checksum_type *ct = _krb5_find_checksum(type);
|
||||
struct _krb5_checksum_type *ct = _krb5_find_checksum(type);
|
||||
if(ct == NULL) {
|
||||
if (context)
|
||||
krb5_set_error_message (context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
@@ -607,7 +613,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_checksum_disable(krb5_context context,
|
||||
krb5_cksumtype type)
|
||||
{
|
||||
struct checksum_type *ct = _krb5_find_checksum(type);
|
||||
struct _krb5_checksum_type *ct = _krb5_find_checksum(type);
|
||||
if(ct == NULL) {
|
||||
if (context)
|
||||
krb5_set_error_message (context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
@@ -623,7 +629,7 @@ krb5_checksum_disable(krb5_context context,
|
||||
* *
|
||||
************************************************************/
|
||||
|
||||
struct encryption_type *
|
||||
struct _krb5_encryption_type *
|
||||
_krb5_find_enctype(krb5_enctype type)
|
||||
{
|
||||
int i;
|
||||
@@ -639,7 +645,7 @@ krb5_enctype_to_string(krb5_context context,
|
||||
krb5_enctype etype,
|
||||
char **string)
|
||||
{
|
||||
struct encryption_type *e;
|
||||
struct _krb5_encryption_type *e;
|
||||
e = _krb5_find_enctype(etype);
|
||||
if(e == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -678,7 +684,7 @@ krb5_enctype_to_keytype(krb5_context context,
|
||||
krb5_enctype etype,
|
||||
krb5_keytype *keytype)
|
||||
{
|
||||
struct encryption_type *e = _krb5_find_enctype(etype);
|
||||
struct _krb5_encryption_type *e = _krb5_find_enctype(etype);
|
||||
if(e == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
N_("encryption type %d not supported", ""),
|
||||
@@ -693,7 +699,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_enctype_valid(krb5_context context,
|
||||
krb5_enctype etype)
|
||||
{
|
||||
struct encryption_type *e = _krb5_find_enctype(etype);
|
||||
struct _krb5_encryption_type *e = _krb5_find_enctype(etype);
|
||||
if(e == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
N_("encryption type %d not supported", ""),
|
||||
@@ -751,7 +757,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_cksumtype_valid(krb5_context context,
|
||||
krb5_cksumtype ctype)
|
||||
{
|
||||
struct checksum_type *c = _krb5_find_checksum(ctype);
|
||||
struct _krb5_checksum_type *c = _krb5_find_checksum(ctype);
|
||||
if (c == NULL) {
|
||||
krb5_set_error_message (context, KRB5_PROG_SUMTYPE_NOSUPP,
|
||||
N_("checksum type %d not supported", ""),
|
||||
@@ -798,8 +804,8 @@ encrypt_internal_derived(krb5_context context,
|
||||
Checksum cksum;
|
||||
unsigned char *p, *q;
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
const struct encryption_type *et = crypto->et;
|
||||
struct _krb5_key_data *dkey;
|
||||
const struct _krb5_encryption_type *et = crypto->et;
|
||||
|
||||
checksum_sz = CHECKSUMSIZE(et->keyed_checksum);
|
||||
|
||||
@@ -864,7 +870,7 @@ encrypt_internal(krb5_context context,
|
||||
Checksum cksum;
|
||||
unsigned char *p, *q;
|
||||
krb5_error_code ret;
|
||||
const struct encryption_type *et = crypto->et;
|
||||
const struct _krb5_encryption_type *et = crypto->et;
|
||||
|
||||
checksum_sz = CHECKSUMSIZE(et->checksum);
|
||||
|
||||
@@ -926,7 +932,7 @@ encrypt_internal_special(krb5_context context,
|
||||
krb5_data *result,
|
||||
void *ivec)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t cksum_sz = CHECKSUMSIZE(et->checksum);
|
||||
size_t sz = len + cksum_sz + et->confoundersize;
|
||||
char *tmp, *p;
|
||||
@@ -967,8 +973,8 @@ decrypt_internal_derived(krb5_context context,
|
||||
Checksum cksum;
|
||||
unsigned char *p;
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_key_data *dkey;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
unsigned long l;
|
||||
|
||||
checksum_sz = CHECKSUMSIZE(et->keyed_checksum);
|
||||
@@ -1047,7 +1053,7 @@ decrypt_internal(krb5_context context,
|
||||
unsigned char *p;
|
||||
Checksum cksum;
|
||||
size_t checksum_sz, l;
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
|
||||
if ((len % et->padsize) != 0) {
|
||||
krb5_clear_error_message(context);
|
||||
@@ -1112,7 +1118,7 @@ decrypt_internal_special(krb5_context context,
|
||||
krb5_data *result,
|
||||
void *ivec)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t cksum_sz = CHECKSUMSIZE(et->checksum);
|
||||
size_t sz = len - cksum_sz - et->confoundersize;
|
||||
unsigned char *p;
|
||||
@@ -1201,8 +1207,8 @@ krb5_encrypt_iov_ivec(krb5_context context,
|
||||
Checksum cksum;
|
||||
unsigned char *p, *q;
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
const struct encryption_type *et = crypto->et;
|
||||
struct _krb5_key_data *dkey;
|
||||
const struct _krb5_encryption_type *et = crypto->et;
|
||||
krb5_crypto_iov *tiv, *piv, *hiv;
|
||||
|
||||
if (num_data < 0) {
|
||||
@@ -1393,8 +1399,8 @@ krb5_decrypt_iov_ivec(krb5_context context,
|
||||
Checksum cksum;
|
||||
unsigned char *p, *q;
|
||||
krb5_error_code ret;
|
||||
struct key_data *dkey;
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_key_data *dkey;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
krb5_crypto_iov *tiv, *hiv;
|
||||
|
||||
if (num_data < 0) {
|
||||
@@ -1619,7 +1625,7 @@ krb5_verify_checksum_iov(krb5_context context,
|
||||
unsigned int num_data,
|
||||
krb5_cksumtype *type)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
Checksum cksum;
|
||||
krb5_crypto_iov *civ;
|
||||
krb5_error_code ret;
|
||||
@@ -1833,15 +1839,15 @@ krb5_decrypt_EncryptedData(krb5_context context,
|
||||
|
||||
krb5_error_code
|
||||
_krb5_derive_key(krb5_context context,
|
||||
struct encryption_type *et,
|
||||
struct key_data *key,
|
||||
struct _krb5_encryption_type *et,
|
||||
struct _krb5_key_data *key,
|
||||
const void *constant,
|
||||
size_t len)
|
||||
{
|
||||
unsigned char *k = NULL;
|
||||
unsigned int nblocks = 0, i;
|
||||
krb5_error_code ret = 0;
|
||||
struct key_type *kt = et->keytype;
|
||||
struct _krb5_key_type *kt = et->keytype;
|
||||
|
||||
ret = _key_schedule(context, key);
|
||||
if(ret)
|
||||
@@ -1923,10 +1929,10 @@ _krb5_derive_key(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct key_data *
|
||||
static struct _krb5_key_data *
|
||||
_new_derived_key(krb5_crypto crypto, unsigned usage)
|
||||
{
|
||||
struct key_usage *d = crypto->key_usage;
|
||||
struct _krb5_key_usage *d = crypto->key_usage;
|
||||
d = realloc(d, (crypto->num_key_usage + 1) * sizeof(*d));
|
||||
if(d == NULL)
|
||||
return NULL;
|
||||
@@ -1946,8 +1952,8 @@ krb5_derive_key(krb5_context context,
|
||||
krb5_keyblock **derived_key)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct encryption_type *et;
|
||||
struct key_data d;
|
||||
struct _krb5_encryption_type *et;
|
||||
struct _krb5_key_data d;
|
||||
|
||||
*derived_key = NULL;
|
||||
|
||||
@@ -1975,10 +1981,10 @@ static krb5_error_code
|
||||
_get_derived_key(krb5_context context,
|
||||
krb5_crypto crypto,
|
||||
unsigned usage,
|
||||
struct key_data **key)
|
||||
struct _krb5_key_data **key)
|
||||
{
|
||||
int i;
|
||||
struct key_data *d;
|
||||
struct _krb5_key_data *d;
|
||||
unsigned char constant[5];
|
||||
|
||||
for(i = 0; i < crypto->num_key_usage; i++)
|
||||
@@ -2060,8 +2066,8 @@ krb5_crypto_init(krb5_context context,
|
||||
|
||||
static void
|
||||
free_key_schedule(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct encryption_type *et)
|
||||
struct _krb5_key_data *key,
|
||||
struct _krb5_encryption_type *et)
|
||||
{
|
||||
if (et->keytype->cleanup)
|
||||
(*et->keytype->cleanup)(context, key);
|
||||
@@ -2070,8 +2076,8 @@ free_key_schedule(krb5_context context,
|
||||
}
|
||||
|
||||
void
|
||||
_krb5_free_key_data(krb5_context context, struct key_data *key,
|
||||
struct encryption_type *et)
|
||||
_krb5_free_key_data(krb5_context context, struct _krb5_key_data *key,
|
||||
struct _krb5_encryption_type *et)
|
||||
{
|
||||
krb5_free_keyblock(context, key->key);
|
||||
if(key->schedule) {
|
||||
@@ -2081,8 +2087,8 @@ _krb5_free_key_data(krb5_context context, struct key_data *key,
|
||||
}
|
||||
|
||||
static void
|
||||
free_key_usage(krb5_context context, struct key_usage *ku,
|
||||
struct encryption_type *et)
|
||||
free_key_usage(krb5_context context, struct _krb5_key_usage *ku,
|
||||
struct _krb5_encryption_type *et)
|
||||
{
|
||||
_krb5_free_key_data(context, &ku->key, et);
|
||||
}
|
||||
@@ -2212,7 +2218,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_enctype_disable(krb5_context context,
|
||||
krb5_enctype enctype)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(enctype);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(enctype);
|
||||
if(et == NULL) {
|
||||
if (context)
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -2239,7 +2245,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_enctype_enable(krb5_context context,
|
||||
krb5_enctype enctype)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(enctype);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(enctype);
|
||||
if(et == NULL) {
|
||||
if (context)
|
||||
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -2283,7 +2289,7 @@ wrapped_length (krb5_context context,
|
||||
krb5_crypto crypto,
|
||||
size_t data_len)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t padsize = et->padsize;
|
||||
size_t checksumsize = CHECKSUMSIZE(et->checksum);
|
||||
size_t res;
|
||||
@@ -2298,7 +2304,7 @@ wrapped_length_dervied (krb5_context context,
|
||||
krb5_crypto crypto,
|
||||
size_t data_len)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t padsize = et->padsize;
|
||||
size_t res;
|
||||
|
||||
@@ -2334,7 +2340,7 @@ static size_t
|
||||
crypto_overhead (krb5_context context,
|
||||
krb5_crypto crypto)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t res;
|
||||
|
||||
res = CHECKSUMSIZE(et->checksum);
|
||||
@@ -2348,7 +2354,7 @@ static size_t
|
||||
crypto_overhead_dervied (krb5_context context,
|
||||
krb5_crypto crypto)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
size_t res;
|
||||
|
||||
if (et->keyed_checksum)
|
||||
@@ -2395,7 +2401,7 @@ krb5_random_to_key(krb5_context context,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
if(et == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
N_("encryption type %d not supported", ""),
|
||||
@@ -2429,7 +2435,7 @@ krb5_crypto_prf_length(krb5_context context,
|
||||
krb5_enctype type,
|
||||
size_t *length)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(type);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(type);
|
||||
|
||||
if(et == NULL || et->prf_length == 0) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -2448,7 +2454,7 @@ krb5_crypto_prf(krb5_context context,
|
||||
const krb5_data *input,
|
||||
krb5_data *output)
|
||||
{
|
||||
struct encryption_type *et = crypto->et;
|
||||
struct _krb5_encryption_type *et = crypto->et;
|
||||
|
||||
krb5_data_zero(output);
|
||||
|
||||
@@ -2640,8 +2646,8 @@ krb5_enctypes_compatible_keys(krb5_context context,
|
||||
krb5_enctype etype1,
|
||||
krb5_enctype etype2)
|
||||
{
|
||||
struct encryption_type *e1 = _krb5_find_enctype(etype1);
|
||||
struct encryption_type *e2 = _krb5_find_enctype(etype2);
|
||||
struct _krb5_encryption_type *e1 = _krb5_find_enctype(etype1);
|
||||
struct _krb5_encryption_type *e2 = _krb5_find_enctype(etype2);
|
||||
return e1 != NULL && e2 != NULL && e1->keytype == e2->keytype;
|
||||
}
|
||||
|
||||
|
@@ -35,21 +35,18 @@
|
||||
#define DES3_OLD_ENCTYPE 1
|
||||
#endif
|
||||
|
||||
struct key_data {
|
||||
struct _krb5_key_data {
|
||||
krb5_keyblock *key;
|
||||
krb5_data *schedule;
|
||||
};
|
||||
|
||||
struct key_usage {
|
||||
unsigned usage;
|
||||
struct key_data key;
|
||||
};
|
||||
struct _krb5_key_usage;
|
||||
|
||||
struct krb5_crypto_data {
|
||||
struct encryption_type *et;
|
||||
struct key_data key;
|
||||
struct _krb5_encryption_type *et;
|
||||
struct _krb5_key_data key;
|
||||
int num_key_usage;
|
||||
struct key_usage *key_usage;
|
||||
struct _krb5_key_usage *key_usage;
|
||||
};
|
||||
|
||||
#define CRYPTO_ETYPE(C) ((C)->et->type)
|
||||
@@ -71,50 +68,50 @@ struct salt_type {
|
||||
krb5_salt, krb5_data, krb5_keyblock*);
|
||||
};
|
||||
|
||||
struct key_type {
|
||||
struct _krb5_key_type {
|
||||
krb5_keytype type; /* XXX */
|
||||
const char *name;
|
||||
size_t bits;
|
||||
size_t size;
|
||||
size_t schedule_size;
|
||||
void (*random_key)(krb5_context, krb5_keyblock*);
|
||||
void (*schedule)(krb5_context, struct key_type *, struct key_data *);
|
||||
void (*schedule)(krb5_context, struct _krb5_key_type *, struct _krb5_key_data *);
|
||||
struct salt_type *string_to_key;
|
||||
void (*random_to_key)(krb5_context, krb5_keyblock*, const void*, size_t);
|
||||
void (*cleanup)(krb5_context, struct key_data *);
|
||||
void (*cleanup)(krb5_context, struct _krb5_key_data *);
|
||||
const EVP_CIPHER *(*evp)(void);
|
||||
};
|
||||
|
||||
struct checksum_type {
|
||||
struct _krb5_checksum_type {
|
||||
krb5_cksumtype type;
|
||||
const char *name;
|
||||
size_t blocksize;
|
||||
size_t checksumsize;
|
||||
unsigned flags;
|
||||
krb5_error_code (*checksum)(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *buf, size_t len,
|
||||
unsigned usage,
|
||||
Checksum *csum);
|
||||
krb5_error_code (*verify)(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
const void *buf, size_t len,
|
||||
unsigned usage,
|
||||
Checksum *csum);
|
||||
};
|
||||
|
||||
struct encryption_type {
|
||||
struct _krb5_encryption_type {
|
||||
krb5_enctype type;
|
||||
const char *name;
|
||||
size_t blocksize;
|
||||
size_t padsize;
|
||||
size_t confoundersize;
|
||||
struct key_type *keytype;
|
||||
struct checksum_type *checksum;
|
||||
struct checksum_type *keyed_checksum;
|
||||
struct _krb5_key_type *keytype;
|
||||
struct _krb5_checksum_type *checksum;
|
||||
struct _krb5_checksum_type *keyed_checksum;
|
||||
unsigned flags;
|
||||
krb5_error_code (*encrypt)(krb5_context context,
|
||||
struct key_data *key,
|
||||
struct _krb5_key_data *key,
|
||||
void *data, size_t len,
|
||||
krb5_boolean encryptp,
|
||||
int usage,
|
||||
@@ -130,20 +127,20 @@ struct encryption_type {
|
||||
|
||||
/* Checksums */
|
||||
|
||||
extern struct checksum_type _krb5_checksum_none;
|
||||
extern struct checksum_type _krb5_checksum_crc32;
|
||||
extern struct checksum_type _krb5_checksum_rsa_md4;
|
||||
extern struct checksum_type _krb5_checksum_rsa_md4_des;
|
||||
extern struct checksum_type _krb5_checksum_rsa_md5_des;
|
||||
extern struct checksum_type _krb5_checksum_rsa_md5_des3;
|
||||
extern struct checksum_type _krb5_checksum_rsa_md5;
|
||||
extern struct checksum_type _krb5_checksum_hmac_sha1_des3;
|
||||
extern struct checksum_type _krb5_checksum_hmac_sha1_aes128;
|
||||
extern struct checksum_type _krb5_checksum_hmac_sha1_aes256;
|
||||
extern struct checksum_type _krb5_checksum_hmac_md5;
|
||||
extern struct checksum_type _krb5_checksum_sha1;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_none;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_crc32;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_rsa_md4;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_rsa_md4_des;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_rsa_md5_des;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_rsa_md5_des3;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_rsa_md5;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_hmac_sha1_des3;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_hmac_sha1_aes128;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_hmac_sha1_aes256;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_hmac_md5;
|
||||
extern struct _krb5_checksum_type _krb5_checksum_sha1;
|
||||
|
||||
extern struct checksum_type *_krb5_checksum_types[];
|
||||
extern struct _krb5_checksum_type *_krb5_checksum_types[];
|
||||
extern int _krb5_num_checksums;
|
||||
|
||||
/* Salts */
|
||||
@@ -156,27 +153,27 @@ extern struct salt_type _krb5_des3_salt_derived[];
|
||||
|
||||
/* Encryption types */
|
||||
|
||||
extern struct encryption_type _krb5_enctype_aes256_cts_hmac_sha1;
|
||||
extern struct encryption_type _krb5_enctype_aes128_cts_hmac_sha1;
|
||||
extern struct encryption_type _krb5_enctype_des3_cbc_sha1;
|
||||
extern struct encryption_type _krb5_enctype_des3_cbc_md5;
|
||||
extern struct encryption_type _krb5_enctype_des3_cbc_none;
|
||||
extern struct encryption_type _krb5_enctype_arcfour_hmac_md5;
|
||||
extern struct encryption_type _krb5_enctype_des_cbc_md5;
|
||||
extern struct encryption_type _krb5_enctype_old_des3_cbc_sha1;
|
||||
extern struct encryption_type _krb5_enctype_des_cbc_crc;
|
||||
extern struct encryption_type _krb5_enctype_des_cbc_md4;
|
||||
extern struct encryption_type _krb5_enctype_des_cbc_md5;
|
||||
extern struct encryption_type _krb5_enctype_des_cbc_none;
|
||||
extern struct encryption_type _krb5_enctype_des_cfb64_none;
|
||||
extern struct encryption_type _krb5_enctype_des_pcbc_none;
|
||||
extern struct encryption_type _krb5_enctype_null;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_aes256_cts_hmac_sha1;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_aes128_cts_hmac_sha1;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des3_cbc_sha1;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des3_cbc_md5;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des3_cbc_none;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_arcfour_hmac_md5;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cbc_md5;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_old_des3_cbc_sha1;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cbc_crc;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cbc_md4;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cbc_md5;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cbc_none;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_cfb64_none;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_des_pcbc_none;
|
||||
extern struct _krb5_encryption_type _krb5_enctype_null;
|
||||
|
||||
extern struct encryption_type *_krb5_etypes[];
|
||||
extern struct _krb5_encryption_type *_krb5_etypes[];
|
||||
extern int _krb5_num_etypes;
|
||||
|
||||
/* Interface to the EVP crypto layer provided by hcrypto */
|
||||
struct evp_schedule {
|
||||
struct _krb5_evp_schedule {
|
||||
EVP_CIPHER_CTX ectx;
|
||||
EVP_CIPHER_CTX dctx;
|
||||
};
|
||||
|
@@ -81,5 +81,10 @@ typedef enum kcm_operation {
|
||||
#define _PATH_KCM_SOCKET "/var/run/.kcm_socket"
|
||||
#define _PATH_KCM_DOOR "/var/run/.kcm_door"
|
||||
|
||||
#define KCM_NTLM_FLAG_SESSIONKEY 1
|
||||
#define KCM_NTLM_FLAG_NTLM2_SESSION 2
|
||||
#define KCM_NTLM_FLAG_KEYEX 4
|
||||
#define KCM_NTLM_FLAG_AV_GUEST 8
|
||||
|
||||
#endif /* __KCM_H__ */
|
||||
|
||||
|
@@ -78,8 +78,9 @@
|
||||
* and/or temporary data not to be stored on disk. The type's name
|
||||
* is MEMORY. Each MEMORY keytab is referenced counted by and
|
||||
* opened by the residual name, so two handles can point to the
|
||||
* same memory area. When the last user closes the entry, it
|
||||
* disappears.
|
||||
* same memory area. When the last user closes using krb5_kt_close()
|
||||
* the keytab, the keys in they keytab is memset() to zero and freed
|
||||
* and can no longer be looked up by name.
|
||||
*
|
||||
*
|
||||
* @subsection krb5_keytab_example Keytab example
|
||||
|
@@ -87,7 +87,7 @@ HMAC_MD5_any_checksum(krb5_context context,
|
||||
unsigned usage,
|
||||
Checksum *result)
|
||||
{
|
||||
struct key_data local_key;
|
||||
struct _krb5_key_data local_key;
|
||||
krb5_error_code ret;
|
||||
|
||||
memset(&local_key, 0, sizeof(local_key));
|
||||
|
@@ -45,8 +45,8 @@ AES_string_to_key(krb5_context context,
|
||||
{
|
||||
krb5_error_code ret;
|
||||
uint32_t iter;
|
||||
struct encryption_type *et;
|
||||
struct key_data kd;
|
||||
struct _krb5_encryption_type *et;
|
||||
struct _krb5_key_data kd;
|
||||
|
||||
if (opaque.length == 0)
|
||||
iter = _krb5_AES_string_to_default_iterator;
|
||||
|
@@ -39,7 +39,7 @@ krb5_salttype_to_string (krb5_context context,
|
||||
krb5_salttype stype,
|
||||
char **string)
|
||||
{
|
||||
struct encryption_type *e;
|
||||
struct _krb5_encryption_type *e;
|
||||
struct salt_type *st;
|
||||
|
||||
e = _krb5_find_enctype (etype);
|
||||
@@ -71,7 +71,7 @@ krb5_string_to_salttype (krb5_context context,
|
||||
const char *string,
|
||||
krb5_salttype *salttype)
|
||||
{
|
||||
struct encryption_type *e;
|
||||
struct _krb5_encryption_type *e;
|
||||
struct salt_type *st;
|
||||
|
||||
e = _krb5_find_enctype (etype);
|
||||
@@ -187,7 +187,7 @@ krb5_string_to_key_data_salt_opaque (krb5_context context,
|
||||
krb5_data opaque,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
struct encryption_type *et =_krb5_find_enctype(enctype);
|
||||
struct _krb5_encryption_type *et =_krb5_find_enctype(enctype);
|
||||
struct salt_type *st;
|
||||
if(et == NULL) {
|
||||
krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
|
||||
@@ -247,9 +247,9 @@ krb5_string_to_key_derived(krb5_context context,
|
||||
krb5_enctype etype,
|
||||
krb5_keyblock *key)
|
||||
{
|
||||
struct encryption_type *et = _krb5_find_enctype(etype);
|
||||
struct _krb5_encryption_type *et = _krb5_find_enctype(etype);
|
||||
krb5_error_code ret;
|
||||
struct key_data kd;
|
||||
struct _krb5_key_data kd;
|
||||
size_t keylen;
|
||||
u_char *tmp;
|
||||
|
||||
|
30
lib/libedit/COPYING
Normal file
30
lib/libedit/COPYING
Normal file
@@ -0,0 +1,30 @@
|
||||
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.
|
||||
|
300
lib/libedit/ChangeLog
Normal file
300
lib/libedit/ChangeLog
Normal file
@@ -0,0 +1,300 @@
|
||||
* See also NetBSD changelog:
|
||||
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit
|
||||
|
||||
2011-02-27 Jess Thrysoee
|
||||
|
||||
* version-info: 0:36:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2010-04-24 Jess Thrysoee
|
||||
|
||||
* version-info: 0:35:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
Now with UTF-8 support. To enable this run 'configure --enable-widec'.
|
||||
For now an UTF-32 encoded wchar_t is required.
|
||||
This requirement is met on NetBSD, Solaris and OS X for any UTF-8 locale,
|
||||
and any system that define __STDC_ISO_10646__ (e.g. GNU libc on Linux).
|
||||
|
||||
2009-09-23 Jess Thrysoee
|
||||
* version-info: 0:34:0
|
||||
|
||||
* all: apply Apple patches from:
|
||||
http://opensource.apple.com/source/libedit/libedit-11/patches
|
||||
|
||||
2009-09-05 Jess Thrysoee
|
||||
|
||||
* version-info: 0:33:0
|
||||
|
||||
* all: Use predefined macro __sun to identify Solaris
|
||||
|
||||
* src/el.c: Ignore comment lines in .editrc
|
||||
|
||||
2009-07-23 Jess Thrysoee
|
||||
|
||||
* version-info: 0:32:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2009-06-10 Jess Thrysoee
|
||||
|
||||
* version-info: 0:31:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2009-05-03 Jess Thrysoee
|
||||
|
||||
* version-info: 0:30:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2009-04-05 Jess Thrysoee
|
||||
|
||||
* version-info: 0:29:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2009-01-11 Jess Thrysoee
|
||||
|
||||
* version-info: 0:28:0
|
||||
|
||||
* all: sync with upstream source. MAJOR.MINOR version is now 3.0.
|
||||
This is due to NetBSD changing time_t and dev_t to 64 bits. It does
|
||||
not really effect this package.
|
||||
|
||||
* configure.ac: Remove '--enable-debug' configure flag. The autoconf way
|
||||
to control flags is by specifying them when running configure,
|
||||
e.g. 'CFLAGS="-O0 -g" ./configure'
|
||||
|
||||
2008-07-12 Jess Thrysoee
|
||||
|
||||
* version-info: 0:27:0
|
||||
|
||||
* configure.ac: Added '--enable-debug' configure flag, to produce debugging
|
||||
information.
|
||||
|
||||
* examples/fileman.c: cast stat struct members, st_nlink and st_size,
|
||||
appropriately (see also 'man 2 stat'). Patch by Alex Elder.
|
||||
|
||||
* all: sync with upstream source. MINOR version is now 11.
|
||||
|
||||
2007-08-31 Jess Thrysoee
|
||||
|
||||
* version-info: 0:26:0
|
||||
|
||||
* libedit.pc.in,Makefile.am,configure.ac,patches/extra_dist_list.sh:
|
||||
Added pkg-config support for libedit. Patch by Masatake YAMATO.
|
||||
|
||||
2007-08-13 Jess Thrysoee
|
||||
|
||||
* version-info: 0:25:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2007-03-02 Jess Thrysoee
|
||||
|
||||
* version-info: 0:24:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2006-10-22 Jess Thrysoee
|
||||
|
||||
* version-info: 0:23:0
|
||||
|
||||
* src/shlib_version: Upstream bumped minor version from 9 to 10.
|
||||
|
||||
* all: sync with upstream source. More readline functions.
|
||||
|
||||
2006-10-22 Jess Thrysoee
|
||||
|
||||
* version-info: 0:22:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2006-08-29 Jess Thrysoee
|
||||
|
||||
* version-info: 0:21:0
|
||||
|
||||
* all: License cleanup. All 4-clause advertising BSD licenses has been
|
||||
changed to the 3-clause version by upstream.
|
||||
|
||||
* src/fgetln.c: use src/tools/compat/fgetln.c instead of
|
||||
othersrc/libexec/tnftpd/libnetbsd/fgetln.c
|
||||
|
||||
2006-08-16 Jess Thrysoee
|
||||
|
||||
* version-info: 0:20:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2006-06-03 Jess Thrysoee
|
||||
|
||||
* version-info: 0:19:0
|
||||
|
||||
* COPYING: added global license file
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2006-02-13 Jess Thrysoee
|
||||
|
||||
* version-info: 0:18:0
|
||||
|
||||
* src/readline.c: Partial rl_getc_function support, patch by Kjeld Borch
|
||||
Egevang.
|
||||
|
||||
* src/readline.c: Make write_history and read_history returncode readline
|
||||
compatible. Upstream patch.
|
||||
|
||||
2006-01-03 Jess Thrysoee
|
||||
|
||||
* version-info: 0:17:0
|
||||
|
||||
* patches/cvs_export.sh: strlcat.c and strlcpy.c was moved to
|
||||
src/common/lib/libc/string in the upstream cvs repository.
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-10-22 Jess Thrysoee
|
||||
|
||||
* version-info: 0:16:0
|
||||
|
||||
* patches/*.patch, configure.ac: define SCCSID, undef LIBC_SCCS. Remove
|
||||
fourteen cosmetic patches.
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-09-11 Jess Thrysoee
|
||||
|
||||
* version-info: 0:15:0
|
||||
|
||||
* src/Makefile.am: fix typo that meant generated files were distributes,
|
||||
and make generated file targets dependent on the the 'makelist' input
|
||||
files.
|
||||
|
||||
* all: sync with upstream source. This is just a manpage update
|
||||
|
||||
2005-08-28 Jess Thrysoee
|
||||
|
||||
* version-info: 0:14:0
|
||||
|
||||
* src/sys.h: include config.h to avoid "redefinition of
|
||||
`u_int32_t'". Patch by Norihiko Murase.
|
||||
|
||||
* src/search.c: explicitly include sys/types.h, because regex.h on
|
||||
FreeBSD needs it and does not include it itself. Patch by Norihiko Murase.
|
||||
|
||||
* acinclude.m4: added EL_GETPW_R_DRAFT test and use AC_TRY_LINK instead
|
||||
of AC_TRY_COMPILE. Suggested by Norihiko Murase.
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-08-16 Jess Thrysoee
|
||||
|
||||
* version-info: 0:13:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-08-05 Jess Thrysoee
|
||||
|
||||
* version-info: 0:12:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-07-24 Jess Thrysoee
|
||||
|
||||
* version-info: 0:11:0
|
||||
|
||||
* histedit.h, histedit.c, readline.c, editline/readline.h: From
|
||||
upstream; added remove_history().
|
||||
|
||||
2005-07-07 Jess Thrysoee
|
||||
|
||||
* version-info: 0:10:0
|
||||
|
||||
* history.c, key.c: From upstream source; Fix memory leaks found by
|
||||
valgrind.
|
||||
|
||||
2005-06-28 Jess Thrysoee
|
||||
|
||||
* version-info: 0:9:0
|
||||
|
||||
* src/readline.c: getpwent_r is not POSIX, always use getpwent.
|
||||
Reported by Gerrit P. Haase.
|
||||
|
||||
* src/Makefile.am: Added libtool -no-undefined. This is needed on Cygwin
|
||||
to get a shared editline library. Should not affect other platforms.
|
||||
Suggested by Gerrit P. Haase.
|
||||
|
||||
2005-06-15 Jess Thrysoee
|
||||
|
||||
* version-info: 0:8:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-06-01 Jess Thrysoee
|
||||
|
||||
* version-info: 0:7:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
* src/readline.c, src/filecomplete.c: Solaris use POSIX draft versions
|
||||
of getpwent_r, getpwnam_r and getpwuid_r which return 'struct passwd *'.
|
||||
Define HAVE_GETPW_R_POSIX if these functions are (non draft) POSIX
|
||||
compatible. Patch by Julien Torrès.
|
||||
|
||||
2005-05-28 Jess Thrysoee
|
||||
|
||||
* version-info: 0:6:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2005-03-11 Jess Thrysoee
|
||||
|
||||
* version-info: 0:5:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
2004-12-07 Jess Thrysoee
|
||||
|
||||
* version-info: 0:4:0
|
||||
|
||||
* src/readline.c: d_namlen (in struct dirent) is not portable, always
|
||||
use strlen. Patch by Scott Rankin.
|
||||
|
||||
2004-11-27 Jess Thrysoee
|
||||
|
||||
* version-info: 0:3:0
|
||||
|
||||
* src/history.c: bug #26785 fixed upstream, removed local patch.
|
||||
|
||||
2004-11-06 Jess Thrysoee
|
||||
|
||||
* version-info: 0:2:0
|
||||
|
||||
* all: sync with upstream source.
|
||||
|
||||
* doc/Makefile.am: If mdoc2man fails, remove empty file. Patch by
|
||||
Darren Tucker.
|
||||
|
||||
2004-10-14 Jess Thrysoee
|
||||
|
||||
* version-info: 0:1:0
|
||||
|
||||
* doc/Makefile.am: 'make install' twice fails. Remove old links before
|
||||
trying to link the man pages. Patch by Rick Richardson.
|
||||
|
||||
2004-09-28 Jess Thrysoee
|
||||
|
||||
* version-info: 0:0:0
|
||||
|
||||
* acinclude.m4 configure.ac src/Makefile.am: Adhere to
|
||||
LibTools library interface versions recommendation.
|
||||
http://www.gnu.org/software/libtool/manual.html#SEC32
|
||||
|
||||
* doc/Makefile.am: name all manpage links as el_* (e.g. el_history.3)
|
||||
to avoid conflicts.
|
||||
|
||||
2004-09-08 Jess Thrysoee
|
||||
|
||||
* all: Initial package.
|
229
lib/libedit/INSTALL
Normal file
229
lib/libedit/INSTALL
Normal file
@@ -0,0 +1,229 @@
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
9
lib/libedit/Makefile.am
Normal file
9
lib/libedit/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
#SUBDIRS = src examples doc
|
||||
SUBDIRS = src
|
||||
|
||||
#EXTRA_DIST = libedit.pc.in
|
||||
#pkgconfigdir = $(libdir)/pkgconfig
|
||||
#pkgconfig_DATA = libedit.pc
|
1
lib/libedit/THANKS
Normal file
1
lib/libedit/THANKS
Normal file
@@ -0,0 +1 @@
|
||||
Thanks to the NetBSD Project maintainers of libedit!
|
85
lib/libedit/acinclude.m4
Normal file
85
lib/libedit/acinclude.m4
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
dnl
|
||||
dnl read lib version from file (and trim trailing newline)
|
||||
dnl
|
||||
define([EL_RELEASE], [patsubst(esyscmd([. src/shlib_version; echo $major.$minor]), [
|
||||
])])
|
||||
|
||||
dnl
|
||||
dnl read cvsexport timestamp from file (and trim trailing newline)
|
||||
dnl
|
||||
define([EL_TIMESTAMP], [patsubst(esyscmd([date +"%Y%m%d"]), [
|
||||
])])
|
||||
|
||||
|
||||
dnl
|
||||
dnl NetBSD use the -mdoc macro package for manpages, but e.g.
|
||||
dnl AIX and Solaris only support the -man package.
|
||||
dnl
|
||||
AC_DEFUN([EL_MANTYPE],
|
||||
[
|
||||
MANTYPE=
|
||||
TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
|
||||
AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
|
||||
if ${NROFF} -mdoc ${srcdir}/doc/editrc.5.roff >/dev/null 2>&1; then
|
||||
MANTYPE=mdoc
|
||||
fi
|
||||
AC_SUBST(MANTYPE)
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check if getpwnam_r and getpwuid_r are POSIX.1 compatible
|
||||
dnl POSIX draft version returns 'struct passwd *' (used on Solaris)
|
||||
dnl NOTE: getpwent_r is not POSIX so we always use getpwent
|
||||
dnl
|
||||
AC_DEFUN([EL_GETPW_R_POSIX],
|
||||
[
|
||||
AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix like])
|
||||
# The prototype for the POSIX version is:
|
||||
# int getpwnam_r(char *, struct passwd *, char *, size_t, struct passwd **)
|
||||
# int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>],
|
||||
[getpwnam_r(NULL, NULL, NULL, (size_t)0, NULL);
|
||||
getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
|
||||
[AC_DEFINE([HAVE_GETPW_R_POSIX], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1 compatible.])
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
])
|
||||
|
||||
AC_DEFUN([EL_GETPW_R_DRAFT],
|
||||
[
|
||||
AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix _draft_ like])
|
||||
# The prototype for the POSIX draft version is:
|
||||
# struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
|
||||
# struct passwd *getpwnam_r(char *, struct passwd *, char *, int);
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>],
|
||||
[getpwnam_r(NULL, NULL, NULL, (size_t)0);
|
||||
getpwuid_r((uid_t)0, NULL, NULL, (size_t)0);],
|
||||
[AC_DEFINE([HAVE_GETPW_R_DRAFT], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1 versions.])
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl use option --enable-widec to turn on use of wide-character support
|
||||
dnl
|
||||
AC_DEFUN([EL_ENABLE_WIDEC],
|
||||
[
|
||||
AC_MSG_CHECKING(if you want wide-character code)
|
||||
AC_ARG_ENABLE(widec,
|
||||
[ --enable-widec compile with wide-char/UTF-8 code],
|
||||
[with_widec=$enableval],
|
||||
[with_widec=no])
|
||||
AC_MSG_RESULT($with_widec)
|
||||
if test "$with_widec" = yes ; then
|
||||
AC_DEFINE(WIDECHAR, 1, [Define to 1 if you want wide-character code])
|
||||
fi
|
||||
AM_CONDITIONAL([WIDECHAR], [test "$with_widec" = yes])
|
||||
])
|
||||
|
8937
lib/libedit/aclocal.m4
vendored
Normal file
8937
lib/libedit/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15269
lib/libedit/autom4te.cache/output.0
Normal file
15269
lib/libedit/autom4te.cache/output.0
Normal file
File diff suppressed because it is too large
Load Diff
15265
lib/libedit/autom4te.cache/output.1
Normal file
15265
lib/libedit/autom4te.cache/output.1
Normal file
File diff suppressed because it is too large
Load Diff
567
lib/libedit/autom4te.cache/requests
Normal file
567
lib/libedit/autom4te.cache/requests
Normal file
@@ -0,0 +1,567 @@
|
||||
# This file was generated.
|
||||
# It contains the lists of macros which have been traced.
|
||||
# It can be safely removed.
|
||||
|
||||
@request = (
|
||||
bless( [
|
||||
'0',
|
||||
1,
|
||||
[
|
||||
'/Users/lha/prefix/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/Users/lha/prefix/share/autoconf/autoconf/autoconf.m4f',
|
||||
'/Users/lha/prefix/share/aclocal/argz.m4',
|
||||
'/Users/lha/prefix/share/aclocal/libtool.m4',
|
||||
'/Users/lha/prefix/share/aclocal/ltdl.m4',
|
||||
'/Users/lha/prefix/share/aclocal/ltoptions.m4',
|
||||
'/Users/lha/prefix/share/aclocal/ltsugar.m4',
|
||||
'/Users/lha/prefix/share/aclocal/ltversion.m4',
|
||||
'/Users/lha/prefix/share/aclocal/lt~obsolete.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/amversion.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/auxdir.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/cond.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/depend.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/depout.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/init.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/install-sh.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/lead-dot.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/make.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/missing.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/mkdirp.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/options.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/runlog.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/sanity.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/silent.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/strip.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/substnot.m4',
|
||||
'/Users/lha/prefix/share/aclocal-1.11/tar.m4',
|
||||
'acinclude.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AM_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_LANG_RC_CONFIG' => 1,
|
||||
'_LT_AC_SHELL_INIT' => 1,
|
||||
'AC_DEFUN' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'_LT_AC_LANG_CXX_CONFIG' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_MISSING_PROG' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1,
|
||||
'_LT_AC_LANG_C_CONFIG' => 1,
|
||||
'AM_PROG_INSTALL_STRIP' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_LIBTOOL_OBJDIR' => 1,
|
||||
'gl_FUNC_ARGZ' => 1,
|
||||
'LTOBSOLETE_VERSION' => 1,
|
||||
'AM_SANITY_CHECK' => 1,
|
||||
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
|
||||
'LT_LIB_M' => 1,
|
||||
'_LT_AC_CHECK_DLFCN' => 1,
|
||||
'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1,
|
||||
'LTSUGAR_VERSION' => 1,
|
||||
'_LT_PROG_LTMAIN' => 1,
|
||||
'LT_SYS_SYMBOL_USCORE' => 1,
|
||||
'_AM_PROG_TAR' => 1,
|
||||
'AC_LIBTOOL_GCJ' => 1,
|
||||
'_LT_WITH_SYSROOT' => 1,
|
||||
'LT_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'LT_FUNC_DLSYM_USCORE' => 1,
|
||||
'AC_LIBTOOL_CONFIG' => 1,
|
||||
'_LT_AC_LANG_F77' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_LTDL_DLLIB' => 1,
|
||||
'_AM_AUTOCONF_VERSION' => 1,
|
||||
'AM_DISABLE_SHARED' => 1,
|
||||
'_LT_PROG_ECHO_BACKSLASH' => 1,
|
||||
'_LTDL_SETUP' => 1,
|
||||
'_LT_AC_LANG_CXX' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'AC_LIB_LTDL' => 1,
|
||||
'_LT_AC_FILE_LTDLL_C' => 1,
|
||||
'AM_PROG_LD' => 1,
|
||||
'EL_GETPW_R_POSIX' => 1,
|
||||
'AU_DEFUN' => 1,
|
||||
'AC_PROG_NM' => 1,
|
||||
'AC_LIBTOOL_DLOPEN' => 1,
|
||||
'AC_PROG_LD' => 1,
|
||||
'AC_PROG_LD_GNU' => 1,
|
||||
'AC_ENABLE_FAST_INSTALL' => 1,
|
||||
'AC_LIBTOOL_FC' => 1,
|
||||
'LTDL_CONVENIENCE' => 1,
|
||||
'_AM_SET_OPTION' => 1,
|
||||
'AC_LTDL_PREOPEN' => 1,
|
||||
'_LT_LINKER_BOILERPLATE' => 1,
|
||||
'_LT_PREPARE_SED_QUOTE_VARS' => 1,
|
||||
'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_CC_C_O' => 1,
|
||||
'gl_PREREQ_ARGZ' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'LT_PROG_RC' => 1,
|
||||
'LT_SYS_MODULE_EXT' => 1,
|
||||
'AC_DEFUN_ONCE' => 1,
|
||||
'_LT_AC_LANG_GCJ' => 1,
|
||||
'AC_LTDL_OBJDIR' => 1,
|
||||
'_LT_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_RC' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AC_DISABLE_FAST_INSTALL' => 1,
|
||||
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
|
||||
'_LT_AC_SYS_LIBPATH_AIX' => 1,
|
||||
'_LT_AC_TRY_DLOPEN_SELF' => 1,
|
||||
'include' => 1,
|
||||
'LT_AC_PROG_SED' => 1,
|
||||
'AM_ENABLE_SHARED' => 1,
|
||||
'LTDL_INSTALLABLE' => 1,
|
||||
'_LT_AC_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_ENABLE_SHARED' => 1,
|
||||
'AC_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
|
||||
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
|
||||
'_LT_AC_TAGVAR' => 1,
|
||||
'EL_MANTYPE' => 1,
|
||||
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'LT_LIB_DLLOAD' => 1,
|
||||
'LTDL_INIT' => 1,
|
||||
'_LT_PROG_F77' => 1,
|
||||
'_LT_PROG_CXX' => 1,
|
||||
'LTVERSION_VERSION' => 1,
|
||||
'AM_PROG_INSTALL_SH' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_PROG_EGREP' => 1,
|
||||
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
|
||||
'AC_PATH_MAGIC' => 1,
|
||||
'AC_LTDL_SYSSEARCHPATH' => 1,
|
||||
'AM_MAKE_INCLUDE' => 1,
|
||||
'LT_CMD_MAX_LEN' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_LT_LINKER_OPTION' => 1,
|
||||
'AC_LIBTOOL_COMPILER_OPTION' => 1,
|
||||
'AC_DISABLE_SHARED' => 1,
|
||||
'_LT_COMPILER_BOILERPLATE' => 1,
|
||||
'AC_LIBTOOL_WIN32_DLL' => 1,
|
||||
'AC_LIBTOOL_SETUP' => 1,
|
||||
'AC_PROG_LD_RELOAD_FLAG' => 1,
|
||||
'AC_LTDL_DLSYM_USCORE' => 1,
|
||||
'AM_MISSING_HAS_RUN' => 1,
|
||||
'LT_LANG' => 1,
|
||||
'LT_SYS_DLSEARCH_PATH' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_LIBTOOL_DLOPEN_SELF' => 1,
|
||||
'LT_OUTPUT' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_SHLIBS' => 1,
|
||||
'AC_WITH_LTDL' => 1,
|
||||
'AC_LIBTOOL_LINKER_OPTION' => 1,
|
||||
'LT_AC_PROG_RC' => 1,
|
||||
'AC_LIBTOOL_CXX' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'LT_AC_PROG_GCJ' => 1,
|
||||
'LT_SYS_DLOPEN_SELF' => 1,
|
||||
'_LT_AC_PROG_CXXCPP' => 1,
|
||||
'AM_DEP_TRACK' => 1,
|
||||
'AM_DISABLE_STATIC' => 1,
|
||||
'_AC_PROG_LIBTOOL' => 1,
|
||||
'_AM_IF_OPTION' => 1,
|
||||
'EL_ENABLE_WIDEC' => 1,
|
||||
'AC_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_F77' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_SET_LEADING_DOT' => 1,
|
||||
'LT_AC_PROG_EGREP' => 1,
|
||||
'_LT_PROG_FC' => 1,
|
||||
'_AM_DEPENDENCIES' => 1,
|
||||
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
|
||||
'LTOPTIONS_VERSION' => 1,
|
||||
'_LT_AC_SYS_COMPILER' => 1,
|
||||
'AM_PROG_NM' => 1,
|
||||
'EL_GETPW_R_DRAFT' => 1,
|
||||
'AC_LIBLTDL_CONVENIENCE' => 1,
|
||||
'AC_DEPLIBS_CHECK_METHOD' => 1,
|
||||
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
|
||||
'AC_LIBLTDL_INSTALLABLE' => 1,
|
||||
'AC_LTDL_ENABLE_INSTALL' => 1,
|
||||
'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
|
||||
'LT_PROG_GCJ' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_DISABLE_STATIC' => 1,
|
||||
'LT_PATH_NM' => 1,
|
||||
'AC_LTDL_SHLIBEXT' => 1,
|
||||
'_LT_AC_LOCK' => 1,
|
||||
'_LT_AC_LANG_RC_CONFIG' => 1,
|
||||
'LT_SYS_MODULE_PATH' => 1,
|
||||
'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
|
||||
'LT_WITH_LTDL' => 1,
|
||||
'AC_LTDL_SHLIBPATH' => 1,
|
||||
'AM_AUX_DIR_EXPAND' => 1,
|
||||
'_LT_AC_LANG_F77_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
|
||||
'_AM_SET_OPTIONS' => 1,
|
||||
'_LT_COMPILER_OPTION' => 1,
|
||||
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'AM_RUN_LOG' => 1,
|
||||
'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
|
||||
'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'AC_LIBTOOL_PICMODE' => 1,
|
||||
'LT_PATH_LD' => 1,
|
||||
'AC_CHECK_LIBM' => 1,
|
||||
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
|
||||
'_AM_MANGLE_OPTION' => 1,
|
||||
'AC_LTDL_SYMBOL_USCORE' => 1,
|
||||
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
|
||||
'AM_SET_DEPDIR' => 1,
|
||||
'_LT_CC_BASENAME' => 1,
|
||||
'_LT_LIBOBJ' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'1',
|
||||
1,
|
||||
[
|
||||
'/Users/lha/prefix/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/Users/lha/prefix/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'include' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'm4_include' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'AC_SUBST_TRACE' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'2',
|
||||
1,
|
||||
[
|
||||
'/usr/local/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/local/share/autoconf/autoconf/autoconf.m4f',
|
||||
'/usr/local/share/aclocal/argz.m4',
|
||||
'/usr/local/share/aclocal/libtool.m4',
|
||||
'/usr/local/share/aclocal/ltdl.m4',
|
||||
'/usr/local/share/aclocal/ltoptions.m4',
|
||||
'/usr/local/share/aclocal/ltsugar.m4',
|
||||
'/usr/local/share/aclocal/ltversion.m4',
|
||||
'/usr/local/share/aclocal/lt~obsolete.m4',
|
||||
'/usr/local/share/aclocal-1.10/amversion.m4',
|
||||
'/usr/local/share/aclocal-1.10/auxdir.m4',
|
||||
'/usr/local/share/aclocal-1.10/cond.m4',
|
||||
'/usr/local/share/aclocal-1.10/depend.m4',
|
||||
'/usr/local/share/aclocal-1.10/depout.m4',
|
||||
'/usr/local/share/aclocal-1.10/init.m4',
|
||||
'/usr/local/share/aclocal-1.10/install-sh.m4',
|
||||
'/usr/local/share/aclocal-1.10/lead-dot.m4',
|
||||
'/usr/local/share/aclocal-1.10/make.m4',
|
||||
'/usr/local/share/aclocal-1.10/missing.m4',
|
||||
'/usr/local/share/aclocal-1.10/mkdirp.m4',
|
||||
'/usr/local/share/aclocal-1.10/options.m4',
|
||||
'/usr/local/share/aclocal-1.10/runlog.m4',
|
||||
'/usr/local/share/aclocal-1.10/sanity.m4',
|
||||
'/usr/local/share/aclocal-1.10/strip.m4',
|
||||
'/usr/local/share/aclocal-1.10/substnot.m4',
|
||||
'/usr/local/share/aclocal-1.10/tar.m4',
|
||||
'acinclude.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AM_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_LANG_RC_CONFIG' => 1,
|
||||
'_LT_AC_SHELL_INIT' => 1,
|
||||
'AC_DEFUN' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'_LT_AC_LANG_CXX_CONFIG' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_MISSING_PROG' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1,
|
||||
'_LT_AC_LANG_C_CONFIG' => 1,
|
||||
'AM_PROG_INSTALL_STRIP' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_LIBTOOL_OBJDIR' => 1,
|
||||
'gl_FUNC_ARGZ' => 1,
|
||||
'AM_SANITY_CHECK' => 1,
|
||||
'LTOBSOLETE_VERSION' => 1,
|
||||
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
|
||||
'LT_LIB_M' => 1,
|
||||
'_LT_AC_CHECK_DLFCN' => 1,
|
||||
'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1,
|
||||
'LTSUGAR_VERSION' => 1,
|
||||
'_LT_PROG_LTMAIN' => 1,
|
||||
'LT_SYS_SYMBOL_USCORE' => 1,
|
||||
'_AM_PROG_TAR' => 1,
|
||||
'AC_LIBTOOL_GCJ' => 1,
|
||||
'LT_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'LT_FUNC_DLSYM_USCORE' => 1,
|
||||
'_LT_AC_LANG_F77' => 1,
|
||||
'AC_LIBTOOL_CONFIG' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_LTDL_DLLIB' => 1,
|
||||
'_AM_AUTOCONF_VERSION' => 1,
|
||||
'AM_DISABLE_SHARED' => 1,
|
||||
'_LT_PROG_ECHO_BACKSLASH' => 1,
|
||||
'_LTDL_SETUP' => 1,
|
||||
'_LT_AC_LANG_CXX' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'AC_LIB_LTDL' => 1,
|
||||
'_LT_AC_FILE_LTDLL_C' => 1,
|
||||
'AM_PROG_LD' => 1,
|
||||
'EL_GETPW_R_POSIX' => 1,
|
||||
'AU_DEFUN' => 1,
|
||||
'AC_PROG_NM' => 1,
|
||||
'AC_LIBTOOL_DLOPEN' => 1,
|
||||
'AC_PROG_LD' => 1,
|
||||
'AC_PROG_LD_GNU' => 1,
|
||||
'AC_ENABLE_FAST_INSTALL' => 1,
|
||||
'AC_LIBTOOL_FC' => 1,
|
||||
'LTDL_CONVENIENCE' => 1,
|
||||
'_AM_SET_OPTION' => 1,
|
||||
'AC_LTDL_PREOPEN' => 1,
|
||||
'_LT_LINKER_BOILERPLATE' => 1,
|
||||
'_LT_PREPARE_SED_QUOTE_VARS' => 1,
|
||||
'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_CC_C_O' => 1,
|
||||
'gl_PREREQ_ARGZ' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'LT_PROG_RC' => 1,
|
||||
'LT_SYS_MODULE_EXT' => 1,
|
||||
'AC_DEFUN_ONCE' => 1,
|
||||
'_LT_AC_LANG_GCJ' => 1,
|
||||
'AC_LTDL_OBJDIR' => 1,
|
||||
'_LT_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_RC' => 1,
|
||||
'AC_DISABLE_FAST_INSTALL' => 1,
|
||||
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
|
||||
'_LT_AC_SYS_LIBPATH_AIX' => 1,
|
||||
'_LT_AC_TRY_DLOPEN_SELF' => 1,
|
||||
'include' => 1,
|
||||
'LT_AC_PROG_SED' => 1,
|
||||
'AM_ENABLE_SHARED' => 1,
|
||||
'LTDL_INSTALLABLE' => 1,
|
||||
'_LT_AC_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_ENABLE_SHARED' => 1,
|
||||
'AC_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
|
||||
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
|
||||
'_LT_AC_TAGVAR' => 1,
|
||||
'EL_MANTYPE' => 1,
|
||||
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'LT_LIB_DLLOAD' => 1,
|
||||
'LTDL_INIT' => 1,
|
||||
'_LT_PROG_F77' => 1,
|
||||
'_LT_PROG_CXX' => 1,
|
||||
'LTVERSION_VERSION' => 1,
|
||||
'AM_PROG_INSTALL_SH' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_PROG_EGREP' => 1,
|
||||
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
|
||||
'AC_PATH_MAGIC' => 1,
|
||||
'AC_LTDL_SYSSEARCHPATH' => 1,
|
||||
'AM_MAKE_INCLUDE' => 1,
|
||||
'LT_CMD_MAX_LEN' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_LT_LINKER_OPTION' => 1,
|
||||
'AC_LIBTOOL_COMPILER_OPTION' => 1,
|
||||
'AC_DISABLE_SHARED' => 1,
|
||||
'_LT_COMPILER_BOILERPLATE' => 1,
|
||||
'AC_LIBTOOL_WIN32_DLL' => 1,
|
||||
'AC_LIBTOOL_SETUP' => 1,
|
||||
'AC_PROG_LD_RELOAD_FLAG' => 1,
|
||||
'AC_LTDL_DLSYM_USCORE' => 1,
|
||||
'AM_MISSING_HAS_RUN' => 1,
|
||||
'LT_LANG' => 1,
|
||||
'LT_SYS_DLSEARCH_PATH' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_LIBTOOL_DLOPEN_SELF' => 1,
|
||||
'LT_OUTPUT' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_SHLIBS' => 1,
|
||||
'AC_WITH_LTDL' => 1,
|
||||
'AC_LIBTOOL_LINKER_OPTION' => 1,
|
||||
'LT_AC_PROG_RC' => 1,
|
||||
'AC_LIBTOOL_CXX' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'LT_AC_PROG_GCJ' => 1,
|
||||
'LT_SYS_DLOPEN_SELF' => 1,
|
||||
'_LT_AC_PROG_CXXCPP' => 1,
|
||||
'AM_DEP_TRACK' => 1,
|
||||
'AM_DISABLE_STATIC' => 1,
|
||||
'_AC_PROG_LIBTOOL' => 1,
|
||||
'_AM_IF_OPTION' => 1,
|
||||
'EL_ENABLE_WIDEC' => 1,
|
||||
'AC_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_F77' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_SET_LEADING_DOT' => 1,
|
||||
'LT_AC_PROG_EGREP' => 1,
|
||||
'_LT_PROG_FC' => 1,
|
||||
'_AM_DEPENDENCIES' => 1,
|
||||
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
|
||||
'LTOPTIONS_VERSION' => 1,
|
||||
'_LT_AC_SYS_COMPILER' => 1,
|
||||
'AM_PROG_NM' => 1,
|
||||
'EL_GETPW_R_DRAFT' => 1,
|
||||
'AC_LIBLTDL_CONVENIENCE' => 1,
|
||||
'AC_DEPLIBS_CHECK_METHOD' => 1,
|
||||
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
|
||||
'AC_LIBLTDL_INSTALLABLE' => 1,
|
||||
'AC_LTDL_ENABLE_INSTALL' => 1,
|
||||
'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
|
||||
'LT_PROG_GCJ' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_DISABLE_STATIC' => 1,
|
||||
'LT_PATH_NM' => 1,
|
||||
'AC_LTDL_SHLIBEXT' => 1,
|
||||
'_LT_AC_LOCK' => 1,
|
||||
'_LT_AC_LANG_RC_CONFIG' => 1,
|
||||
'LT_SYS_MODULE_PATH' => 1,
|
||||
'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
|
||||
'LT_WITH_LTDL' => 1,
|
||||
'AC_LTDL_SHLIBPATH' => 1,
|
||||
'AM_AUX_DIR_EXPAND' => 1,
|
||||
'_LT_AC_LANG_F77_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
|
||||
'_AM_SET_OPTIONS' => 1,
|
||||
'_LT_COMPILER_OPTION' => 1,
|
||||
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'AM_RUN_LOG' => 1,
|
||||
'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
|
||||
'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'AC_LIBTOOL_PICMODE' => 1,
|
||||
'LT_PATH_LD' => 1,
|
||||
'AC_CHECK_LIBM' => 1,
|
||||
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
|
||||
'_AM_MANGLE_OPTION' => 1,
|
||||
'AC_LTDL_SYMBOL_USCORE' => 1,
|
||||
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
|
||||
'AM_SET_DEPDIR' => 1,
|
||||
'_LT_CC_BASENAME' => 1,
|
||||
'_LT_LIBOBJ' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'3',
|
||||
1,
|
||||
[
|
||||
'/usr/local/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/local/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'include' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
'm4_include' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'AC_SUBST_TRACE' => 1
|
||||
}
|
||||
], 'Autom4te::Request' )
|
||||
);
|
||||
|
2490
lib/libedit/autom4te.cache/traces.0
Normal file
2490
lib/libedit/autom4te.cache/traces.0
Normal file
File diff suppressed because it is too large
Load Diff
780
lib/libedit/autom4te.cache/traces.1
Normal file
780
lib/libedit/autom4te.cache/traces.1
Normal file
@@ -0,0 +1,780 @@
|
||||
m4trace:aclocal.m4:9406: -1- m4_include([acinclude.m4])
|
||||
m4trace:configure.ac:13: -1- AC_INIT([libedit], [EL_RELEASE], [], [libedit-EL_TIMESTAMP])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?A[CHUM]_])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([_AC_])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^AS_FLAGS$])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?m4_])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([^dnl$])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?AS_])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([SHELL])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([SHELL])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^SHELL$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PATH_SEPARATOR])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PATH_SEPARATOR])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PATH_SEPARATOR$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_NAME])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_TARNAME])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_VERSION])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_STRING])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_URL])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_URL$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([exec_prefix], [NONE])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([exec_prefix])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^exec_prefix$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([prefix], [NONE])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([prefix])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^prefix$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([program_transform_name], [s,x,x,])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([program_transform_name])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^program_transform_name$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([bindir], ['${exec_prefix}/bin'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([bindir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^bindir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sbindir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^sbindir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([libexecdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^libexecdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([datarootdir], ['${prefix}/share'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([datarootdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^datarootdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([datadir], ['${datarootdir}'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([datadir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^datadir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([sysconfdir], ['${prefix}/etc'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sysconfdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^sysconfdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([sharedstatedir], ['${prefix}/com'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sharedstatedir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^sharedstatedir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([localstatedir], ['${prefix}/var'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([localstatedir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^localstatedir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([includedir], ['${prefix}/include'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([includedir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^includedir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([oldincludedir], ['/usr/include'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([oldincludedir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^oldincludedir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
|
||||
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
|
||||
['${datarootdir}/doc/${PACKAGE}'])])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([docdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^docdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([infodir], ['${datarootdir}/info'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([infodir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^infodir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([htmldir], ['${docdir}'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([htmldir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^htmldir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([dvidir], ['${docdir}'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([dvidir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^dvidir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([pdfdir], ['${docdir}'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([pdfdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^pdfdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([psdir], ['${docdir}'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([psdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^psdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([libdir], ['${exec_prefix}/lib'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([libdir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^libdir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([localedir], ['${datarootdir}/locale'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([localedir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^localedir$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([mandir], ['${datarootdir}/man'])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([mandir])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^mandir$])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */
|
||||
@%:@undef PACKAGE_NAME])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */
|
||||
@%:@undef PACKAGE_TARNAME])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */
|
||||
@%:@undef PACKAGE_VERSION])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */
|
||||
@%:@undef PACKAGE_STRING])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */
|
||||
@%:@undef PACKAGE_BUGREPORT])
|
||||
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_URL$])
|
||||
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */
|
||||
@%:@undef PACKAGE_URL])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([DEFS])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([DEFS])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^DEFS$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_C])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_C])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_C$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_N])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_N])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_N$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_T])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_T])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_T$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([LIBS])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([LIBS])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^LIBS$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([build_alias])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([build_alias])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^build_alias$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([host_alias])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([host_alias])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^host_alias$])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST([target_alias])
|
||||
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([target_alias])
|
||||
m4trace:configure.ac:13: -1- m4_pattern_allow([^target_alias$])
|
||||
m4trace:configure.ac:15: -1- AC_CONFIG_HEADERS([config.h])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CFLAGS])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CFLAGS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CFLAGS$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([LDFLAGS])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([LDFLAGS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^LDFLAGS$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([LIBS])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([LIBS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^LIBS$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([ac_ct_CC])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([ac_ct_CC])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^ac_ct_CC$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([EXEEXT])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^EXEEXT$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([OBJEXT], [$ac_cv_objext])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([OBJEXT])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^OBJEXT$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CPP])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CPP])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CPP$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([CPP])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([CPP])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^CPP$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([GREP])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([GREP])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^GREP$])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST([EGREP])
|
||||
m4trace:configure.ac:18: -1- AC_SUBST_TRACE([EGREP])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^EGREP$])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^STDC_HEADERS$])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */
|
||||
@%:@undef STDC_HEADERS])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
@%:@undef HAVE_SYS_TYPES_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
@%:@undef HAVE_SYS_STAT_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
@%:@undef HAVE_STDLIB_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */
|
||||
@%:@undef HAVE_STRING_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */
|
||||
@%:@undef HAVE_MEMORY_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */
|
||||
@%:@undef HAVE_STRINGS_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
@%:@undef HAVE_INTTYPES_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */
|
||||
@%:@undef HAVE_STDINT_H])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
|
||||
@%:@undef HAVE_UNISTD_H])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_POSIX_SOURCE])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_POSIX_SOURCE$])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([_POSIX_SOURCE], [/* Define to 1 if you need to in order for `stat\' and other things to work. */
|
||||
@%:@undef _POSIX_SOURCE])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_POSIX_1_SOURCE])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_POSIX_1_SOURCE$])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([_POSIX_1_SOURCE], [/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
@%:@undef _POSIX_1_SOURCE])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_MINIX])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_MINIX$])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([_MINIX], [/* Define to 1 if on MINIX. */
|
||||
@%:@undef _MINIX])
|
||||
m4trace:configure.ac:18: -1- AH_OUTPUT([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([__EXTENSIONS__])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^__EXTENSIONS__$])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_ALL_SOURCE])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_ALL_SOURCE$])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_GNU_SOURCE])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_GNU_SOURCE$])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_POSIX_PTHREAD_SEMANTICS])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_POSIX_PTHREAD_SEMANTICS$])
|
||||
m4trace:configure.ac:18: -1- AC_DEFINE_TRACE_LITERAL([_TANDEM_SOURCE])
|
||||
m4trace:configure.ac:18: -1- m4_pattern_allow([^_TANDEM_SOURCE$])
|
||||
m4trace:configure.ac:20: -1- AM_INIT_AUTOMAKE
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
|
||||
m4trace:configure.ac:20: -1- AM_AUTOMAKE_VERSION([1.11.1])
|
||||
m4trace:configure.ac:20: -1- AC_REQUIRE_AUX_FILE([install-sh])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_PROGRAM])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([INSTALL_PROGRAM])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_SCRIPT])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([INSTALL_SCRIPT])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_DATA])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([INSTALL_DATA])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^INSTALL_DATA$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__isrc], [' -I$(srcdir)'])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__isrc])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__isrc$])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__isrc])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([CYGPATH_W])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CYGPATH_W])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^CYGPATH_W$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([PACKAGE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^PACKAGE$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([VERSION])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^VERSION$])
|
||||
m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^PACKAGE$])
|
||||
m4trace:configure.ac:20: -1- AH_OUTPUT([PACKAGE], [/* Name of package */
|
||||
@%:@undef PACKAGE])
|
||||
m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([VERSION])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^VERSION$])
|
||||
m4trace:configure.ac:20: -1- AH_OUTPUT([VERSION], [/* Version number of package */
|
||||
@%:@undef VERSION])
|
||||
m4trace:configure.ac:20: -1- AC_REQUIRE_AUX_FILE([missing])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([ACLOCAL])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([ACLOCAL])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^ACLOCAL$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AUTOCONF])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AUTOCONF])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AUTOCONF$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AUTOMAKE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AUTOMAKE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AUTOMAKE$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AUTOHEADER])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AUTOHEADER])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AUTOHEADER$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([MAKEINFO])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([MAKEINFO])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^MAKEINFO$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([install_sh])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([install_sh])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^install_sh$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([STRIP])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([STRIP])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^STRIP$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_STRIP_PROGRAM])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$])
|
||||
m4trace:configure.ac:20: -1- AC_REQUIRE_AUX_FILE([install-sh])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([MKDIR_P])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([MKDIR_P])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^MKDIR_P$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([mkdir_p], ["$MKDIR_P"])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([mkdir_p])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^mkdir_p$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AWK])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AWK])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AWK$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([SET_MAKE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([SET_MAKE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^SET_MAKE$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__leading_dot])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__leading_dot])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__leading_dot$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AMTAR])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMTAR])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMTAR$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__tar])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__tar])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__tar$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__untar])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__untar])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__untar$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([DEPDIR])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^DEPDIR$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__include])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__include])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__include$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__quote])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__quote])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__quote$])
|
||||
m4trace:configure.ac:20: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AMDEP_TRUE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEP_TRUE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_TRUE$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AMDEP_FALSE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEP_FALSE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_FALSE$])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([AMDEPBACKSLASH])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEPBACKSLASH])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEPBACKSLASH$])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CCDEPMODE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^CCDEPMODE$])
|
||||
m4trace:configure.ac:20: -1- AM_CONDITIONAL([am__fastdepCC], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__fastdepCC_TRUE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_TRUE$])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST([am__fastdepCC_FALSE])
|
||||
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE])
|
||||
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_FALSE$])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE])
|
||||
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE])
|
||||
m4trace:configure.ac:21: -1- AC_PROG_LIBTOOL
|
||||
m4trace:configure.ac:21: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
|
||||
You should run autoupdate.], [aclocal.m4:128: AC_PROG_LIBTOOL is expanded from...
|
||||
configure.ac:21: the top level])
|
||||
m4trace:configure.ac:21: -1- LT_INIT
|
||||
m4trace:configure.ac:21: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])
|
||||
m4trace:configure.ac:21: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([LIBTOOL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([LIBTOOL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^LIBTOOL$])
|
||||
m4trace:configure.ac:21: -1- AC_CANONICAL_HOST
|
||||
m4trace:configure.ac:21: -1- AC_CANONICAL_BUILD
|
||||
m4trace:configure.ac:21: -1- AC_REQUIRE_AUX_FILE([config.sub])
|
||||
m4trace:configure.ac:21: -1- AC_REQUIRE_AUX_FILE([config.guess])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([build], [$ac_cv_build])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([build])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^build$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([build_cpu], [$[1]])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([build_cpu])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^build_cpu$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([build_vendor], [$[2]])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([build_vendor])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^build_vendor$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([build_os])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([build_os])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^build_os$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([host], [$ac_cv_host])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([host])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^host$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([host_cpu], [$[1]])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([host_cpu])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^host_cpu$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([host_vendor], [$[2]])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([host_vendor])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^host_vendor$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([host_os])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([host_os])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^host_os$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([SED])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([SED])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^SED$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([FGREP])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([FGREP])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^FGREP$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([GREP])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([GREP])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^GREP$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([LD])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([LD])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^LD$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^DUMPBIN$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([ac_ct_DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([ac_ct_DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^ac_ct_DUMPBIN$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([DUMPBIN])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^DUMPBIN$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([NM])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([NM])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^NM$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([LN_S], [$as_ln_s])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([LN_S])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^LN_S$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([OBJDUMP])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([OBJDUMP])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^OBJDUMP$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([OBJDUMP])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([OBJDUMP])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^OBJDUMP$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([DLLTOOL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([DLLTOOL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^DLLTOOL$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([DLLTOOL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([DLLTOOL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^DLLTOOL$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([AR])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([AR])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^AR$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([ac_ct_AR])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([ac_ct_AR])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^ac_ct_AR$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([STRIP])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([STRIP])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^STRIP$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([RANLIB])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([RANLIB])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^RANLIB$])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([LT_OBJDIR])
|
||||
m4trace:configure.ac:21: -1- AC_DEFINE_TRACE_LITERAL([LT_OBJDIR])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^LT_OBJDIR$])
|
||||
m4trace:configure.ac:21: -1- AH_OUTPUT([LT_OBJDIR], [/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
@%:@undef LT_OBJDIR])
|
||||
m4trace:configure.ac:21: -1- LT_SUPPORTED_TAG([CC])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([MANIFEST_TOOL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([MANIFEST_TOOL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^MANIFEST_TOOL$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([DSYMUTIL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([DSYMUTIL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^DSYMUTIL$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([NMEDIT])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([NMEDIT])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^NMEDIT$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([LIPO])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([LIPO])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^LIPO$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([OTOOL])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([OTOOL])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^OTOOL$])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST([OTOOL64])
|
||||
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([OTOOL64])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^OTOOL64$])
|
||||
m4trace:configure.ac:21: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
@%:@undef HAVE_DLFCN_H])
|
||||
m4trace:configure.ac:21: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H])
|
||||
m4trace:configure.ac:21: -1- m4_pattern_allow([^HAVE_DLFCN_H$])
|
||||
m4trace:configure.ac:24: -1- AC_SUBST([LT_VERSION], [0:36:0])
|
||||
m4trace:configure.ac:24: -1- AC_SUBST_TRACE([LT_VERSION])
|
||||
m4trace:configure.ac:24: -1- m4_pattern_allow([^LT_VERSION$])
|
||||
m4trace:configure.ac:26: -1- AM_SILENT_RULES([yes])
|
||||
m4trace:configure.ac:26: -1- AC_SUBST([AM_DEFAULT_VERBOSITY])
|
||||
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([AM_DEFAULT_VERBOSITY])
|
||||
m4trace:configure.ac:26: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$])
|
||||
m4trace:configure.ac:26: -1- AC_SUBST([AM_BACKSLASH])
|
||||
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([AM_BACKSLASH])
|
||||
m4trace:configure.ac:26: -1- m4_pattern_allow([^AM_BACKSLASH$])
|
||||
m4trace:configure.ac:26: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH])
|
||||
m4trace:configure.ac:31: -1- AC_SUBST([LN_S], [$as_ln_s])
|
||||
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([LN_S])
|
||||
m4trace:configure.ac:31: -1- m4_pattern_allow([^LN_S$])
|
||||
m4trace:configure.ac:32: -1- AC_SUBST([AWK])
|
||||
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([AWK])
|
||||
m4trace:configure.ac:32: -1- m4_pattern_allow([^AWK$])
|
||||
m4trace:configure.ac:33: -1- AC_SUBST([NROFF])
|
||||
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([NROFF])
|
||||
m4trace:configure.ac:33: -1- m4_pattern_allow([^NROFF$])
|
||||
m4trace:configure.ac:33: -1- AC_SUBST([MANTYPE])
|
||||
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([MANTYPE])
|
||||
m4trace:configure.ac:33: -1- m4_pattern_allow([^MANTYPE$])
|
||||
m4trace:configure.ac:38: -1- AH_OUTPUT([HAVE_LIBCURSES], [/* Define to 1 if you have the `curses\' library (-lcurses). */
|
||||
@%:@undef HAVE_LIBCURSES])
|
||||
m4trace:configure.ac:38: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCURSES])
|
||||
m4trace:configure.ac:38: -1- m4_pattern_allow([^HAVE_LIBCURSES$])
|
||||
m4trace:configure.ac:38: -1- AH_OUTPUT([HAVE_LIBNCURSES], [/* Define to 1 if you have the `ncurses\' library (-lncurses). */
|
||||
@%:@undef HAVE_LIBNCURSES])
|
||||
m4trace:configure.ac:38: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBNCURSES])
|
||||
m4trace:configure.ac:38: -1- m4_pattern_allow([^HAVE_LIBNCURSES$])
|
||||
m4trace:configure.ac:42: -1- AC_DEFINE_TRACE_LITERAL([WIDECHAR])
|
||||
m4trace:configure.ac:42: -1- m4_pattern_allow([^WIDECHAR$])
|
||||
m4trace:configure.ac:42: -1- AH_OUTPUT([WIDECHAR], [/* Define to 1 if you want wide-character code */
|
||||
@%:@undef WIDECHAR])
|
||||
m4trace:configure.ac:42: -1- AM_CONDITIONAL([WIDECHAR], [test "$with_widec" = yes])
|
||||
m4trace:configure.ac:42: -1- AC_SUBST([WIDECHAR_TRUE])
|
||||
m4trace:configure.ac:42: -1- AC_SUBST_TRACE([WIDECHAR_TRUE])
|
||||
m4trace:configure.ac:42: -1- m4_pattern_allow([^WIDECHAR_TRUE$])
|
||||
m4trace:configure.ac:42: -1- AC_SUBST([WIDECHAR_FALSE])
|
||||
m4trace:configure.ac:42: -1- AC_SUBST_TRACE([WIDECHAR_FALSE])
|
||||
m4trace:configure.ac:42: -1- m4_pattern_allow([^WIDECHAR_FALSE$])
|
||||
m4trace:configure.ac:42: -1- _AM_SUBST_NOTMAKE([WIDECHAR_TRUE])
|
||||
m4trace:configure.ac:42: -1- _AM_SUBST_NOTMAKE([WIDECHAR_FALSE])
|
||||
m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^HAVE_ALLOCA_H$])
|
||||
m4trace:configure.ac:45: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
@%:@undef HAVE_ALLOCA_H])
|
||||
m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^HAVE_ALLOCA$])
|
||||
m4trace:configure.ac:45: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */
|
||||
@%:@undef HAVE_ALLOCA])
|
||||
m4trace:configure.ac:45: -1- AC_LIBSOURCE([alloca.c])
|
||||
m4trace:configure.ac:45: -1- AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])
|
||||
m4trace:configure.ac:45: -1- AC_SUBST_TRACE([ALLOCA])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^ALLOCA$])
|
||||
m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^C_ALLOCA$])
|
||||
m4trace:configure.ac:45: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */
|
||||
@%:@undef C_ALLOCA])
|
||||
m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^CRAY_STACKSEG_END$])
|
||||
m4trace:configure.ac:45: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c\' support on those systems.
|
||||
*/
|
||||
@%:@undef CRAY_STACKSEG_END])
|
||||
m4trace:configure.ac:45: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
@%:@undef STACK_DIRECTION])
|
||||
m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION])
|
||||
m4trace:configure.ac:45: -1- m4_pattern_allow([^STACK_DIRECTION$])
|
||||
m4trace:configure.ac:46: -1- AH_OUTPUT([HAVE_DIRENT_H], [/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR\'.
|
||||
*/
|
||||
@%:@undef HAVE_DIRENT_H])
|
||||
m4trace:configure.ac:46: -1- AH_OUTPUT([HAVE_SYS_NDIR_H], [/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR\'.
|
||||
*/
|
||||
@%:@undef HAVE_SYS_NDIR_H])
|
||||
m4trace:configure.ac:46: -1- AH_OUTPUT([HAVE_SYS_DIR_H], [/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR\'.
|
||||
*/
|
||||
@%:@undef HAVE_SYS_DIR_H])
|
||||
m4trace:configure.ac:46: -1- AH_OUTPUT([HAVE_NDIR_H], [/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR\'. */
|
||||
@%:@undef HAVE_NDIR_H])
|
||||
m4trace:configure.ac:47: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS])
|
||||
m4trace:configure.ac:47: -1- m4_pattern_allow([^STDC_HEADERS$])
|
||||
m4trace:configure.ac:47: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */
|
||||
@%:@undef STDC_HEADERS])
|
||||
m4trace:configure.ac:48: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYS_WAIT_H])
|
||||
m4trace:configure.ac:48: -1- m4_pattern_allow([^HAVE_SYS_WAIT_H$])
|
||||
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_SYS_WAIT_H], [/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
@%:@undef HAVE_SYS_WAIT_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
@%:@undef HAVE_FCNTL_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the <limits.h> header file. */
|
||||
@%:@undef HAVE_LIMITS_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the <malloc.h> header file. */
|
||||
@%:@undef HAVE_MALLOC_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
@%:@undef HAVE_STDLIB_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */
|
||||
@%:@undef HAVE_STRING_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
@%:@undef HAVE_SYS_IOCTL_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
@%:@undef HAVE_SYS_PARAM_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
|
||||
@%:@undef HAVE_UNISTD_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_CURSES_H], [/* Define to 1 if you have the <curses.h> header file. */
|
||||
@%:@undef HAVE_CURSES_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_NCURSES_H], [/* Define to 1 if you have the <ncurses.h> header file. */
|
||||
@%:@undef HAVE_NCURSES_H])
|
||||
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_SYS_CDEFS_H], [/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
@%:@undef HAVE_SYS_CDEFS_H])
|
||||
m4trace:configure.ac:60: -1- AH_OUTPUT([HAVE_TERM_H], [/* Define to 1 if you have the <term.h> header file. */
|
||||
@%:@undef HAVE_TERM_H])
|
||||
m4trace:configure.ac:60: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TERM_H])
|
||||
m4trace:configure.ac:60: -1- m4_pattern_allow([^HAVE_TERM_H$])
|
||||
m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([const])
|
||||
m4trace:configure.ac:63: -1- m4_pattern_allow([^const$])
|
||||
m4trace:configure.ac:63: -1- AH_OUTPUT([const], [/* Define to empty if `const\' does not conform to ANSI C. */
|
||||
@%:@undef const])
|
||||
m4trace:configure.ac:64: -1- AC_DEFINE_TRACE_LITERAL([pid_t])
|
||||
m4trace:configure.ac:64: -1- m4_pattern_allow([^pid_t$])
|
||||
m4trace:configure.ac:64: -1- AH_OUTPUT([pid_t], [/* Define to `int\' if <sys/types.h> does not define. */
|
||||
@%:@undef pid_t])
|
||||
m4trace:configure.ac:65: -1- AC_DEFINE_TRACE_LITERAL([size_t])
|
||||
m4trace:configure.ac:65: -1- m4_pattern_allow([^size_t$])
|
||||
m4trace:configure.ac:65: -1- AH_OUTPUT([size_t], [/* Define to `unsigned int\' if <sys/types.h> does not define. */
|
||||
@%:@undef size_t])
|
||||
m4trace:configure.ac:66: -1- AC_DEFINE_TRACE_LITERAL([HAVE_U_INT32_T])
|
||||
m4trace:configure.ac:66: -1- m4_pattern_allow([^HAVE_U_INT32_T$])
|
||||
m4trace:configure.ac:66: -1- AH_OUTPUT([HAVE_U_INT32_T], [/* Define to 1 if the system has the type `u_int32_t\'. */
|
||||
@%:@undef HAVE_U_INT32_T])
|
||||
m4trace:configure.ac:69: -1- AC_DEFINE_TRACE_LITERAL([CLOSEDIR_VOID])
|
||||
m4trace:configure.ac:69: -1- m4_pattern_allow([^CLOSEDIR_VOID$])
|
||||
m4trace:configure.ac:69: -1- AH_OUTPUT([CLOSEDIR_VOID], [/* Define to 1 if the `closedir\' function returns void instead of `int\'. */
|
||||
@%:@undef CLOSEDIR_VOID])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([HAVE_VFORK_H], [/* Define to 1 if you have the <vfork.h> header file. */
|
||||
@%:@undef HAVE_VFORK_H])
|
||||
m4trace:configure.ac:70: -1- AC_DEFINE_TRACE_LITERAL([HAVE_VFORK_H])
|
||||
m4trace:configure.ac:70: -1- m4_pattern_allow([^HAVE_VFORK_H$])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([HAVE_FORK], [/* Define to 1 if you have the `fork\' function. */
|
||||
@%:@undef HAVE_FORK])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([HAVE_VFORK], [/* Define to 1 if you have the `vfork\' function. */
|
||||
@%:@undef HAVE_VFORK])
|
||||
m4trace:configure.ac:70: -1- AC_DEFINE_TRACE_LITERAL([HAVE_WORKING_VFORK])
|
||||
m4trace:configure.ac:70: -1- m4_pattern_allow([^HAVE_WORKING_VFORK$])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([HAVE_WORKING_VFORK], [/* Define to 1 if `vfork\' works. */
|
||||
@%:@undef HAVE_WORKING_VFORK])
|
||||
m4trace:configure.ac:70: -1- AC_DEFINE_TRACE_LITERAL([vfork])
|
||||
m4trace:configure.ac:70: -1- m4_pattern_allow([^vfork$])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([vfork], [/* Define as `fork\' if `vfork\' does not work. */
|
||||
@%:@undef vfork])
|
||||
m4trace:configure.ac:70: -1- AC_DEFINE_TRACE_LITERAL([HAVE_WORKING_FORK])
|
||||
m4trace:configure.ac:70: -1- m4_pattern_allow([^HAVE_WORKING_FORK$])
|
||||
m4trace:configure.ac:70: -1- AH_OUTPUT([HAVE_WORKING_FORK], [/* Define to 1 if `fork\' works. */
|
||||
@%:@undef HAVE_WORKING_FORK])
|
||||
m4trace:configure.ac:75: -1- _m4_warn([obsolete], [The macro `AC_TYPE_SIGNAL' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/types.m4:751: AC_TYPE_SIGNAL is expanded from...
|
||||
configure.ac:75: the top level])
|
||||
m4trace:configure.ac:75: -1- AC_DEFINE_TRACE_LITERAL([RETSIGTYPE])
|
||||
m4trace:configure.ac:75: -1- m4_pattern_allow([^RETSIGTYPE$])
|
||||
m4trace:configure.ac:75: -1- AH_OUTPUT([RETSIGTYPE], [/* Define as the return type of signal handlers (`int\' or `void\'). */
|
||||
@%:@undef RETSIGTYPE])
|
||||
m4trace:configure.ac:76: -1- AC_DEFINE_TRACE_LITERAL([LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
m4trace:configure.ac:76: -1- m4_pattern_allow([^LSTAT_FOLLOWS_SLASHED_SYMLINK$])
|
||||
m4trace:configure.ac:76: -1- AH_OUTPUT([LSTAT_FOLLOWS_SLASHED_SYMLINK], [/* Define to 1 if `lstat\' dereferences a symlink specified with a trailing
|
||||
slash. */
|
||||
@%:@undef LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
m4trace:configure.ac:76: -1- AC_LIBSOURCE([lstat.c])
|
||||
m4trace:configure.ac:76: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS lstat.$ac_objext"])
|
||||
m4trace:configure.ac:76: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.ac:76: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.ac:76: -1- AC_LIBSOURCE([stat.c])
|
||||
m4trace:configure.ac:76: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS stat.$ac_objext"])
|
||||
m4trace:configure.ac:76: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.ac:76: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.ac:76: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STAT_EMPTY_STRING_BUG])
|
||||
m4trace:configure.ac:76: -1- m4_pattern_allow([^HAVE_STAT_EMPTY_STRING_BUG$])
|
||||
m4trace:configure.ac:76: -1- AH_OUTPUT([HAVE_STAT_EMPTY_STRING_BUG], [/* Define to 1 if `stat\' has the bug that it succeeds when given the
|
||||
zero-length file name argument. */
|
||||
@%:@undef HAVE_STAT_EMPTY_STRING_BUG])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_ENDPWENT], [/* Define to 1 if you have the `endpwent\' function. */
|
||||
@%:@undef HAVE_ENDPWENT])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_ISASCII], [/* Define to 1 if you have the `isascii\' function. */
|
||||
@%:@undef HAVE_ISASCII])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_MEMCHR], [/* Define to 1 if you have the `memchr\' function. */
|
||||
@%:@undef HAVE_MEMCHR])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */
|
||||
@%:@undef HAVE_MEMSET])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_RE_COMP], [/* Define to 1 if you have the `re_comp\' function. */
|
||||
@%:@undef HAVE_RE_COMP])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_REGCOMP], [/* Define to 1 if you have the `regcomp\' function. */
|
||||
@%:@undef HAVE_REGCOMP])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */
|
||||
@%:@undef HAVE_STRCASECMP])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRCHR], [/* Define to 1 if you have the `strchr\' function. */
|
||||
@%:@undef HAVE_STRCHR])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRCSPN], [/* Define to 1 if you have the `strcspn\' function. */
|
||||
@%:@undef HAVE_STRCSPN])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */
|
||||
@%:@undef HAVE_STRDUP])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRERROR], [/* Define to 1 if you have the `strerror\' function. */
|
||||
@%:@undef HAVE_STRERROR])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRRCHR], [/* Define to 1 if you have the `strrchr\' function. */
|
||||
@%:@undef HAVE_STRRCHR])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRSTR], [/* Define to 1 if you have the `strstr\' function. */
|
||||
@%:@undef HAVE_STRSTR])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_STRTOL], [/* Define to 1 if you have the `strtol\' function. */
|
||||
@%:@undef HAVE_STRTOL])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_ISSETUGID], [/* Define to 1 if you have the `issetugid\' function. */
|
||||
@%:@undef HAVE_ISSETUGID])
|
||||
m4trace:configure.ac:77: -1- AH_OUTPUT([HAVE_WCSDUP], [/* Define to 1 if you have the `wcsdup\' function. */
|
||||
@%:@undef HAVE_WCSDUP])
|
||||
m4trace:configure.ac:78: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2655: AC_TRY_LINK is expanded from...
|
||||
acinclude.m4:50: EL_GETPW_R_POSIX is expanded from...
|
||||
configure.ac:78: the top level])
|
||||
m4trace:configure.ac:78: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_R_POSIX])
|
||||
m4trace:configure.ac:78: -1- m4_pattern_allow([^HAVE_GETPW_R_POSIX$])
|
||||
m4trace:configure.ac:78: -1- AH_OUTPUT([HAVE_GETPW_R_POSIX], [/* Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1
|
||||
compatible. */
|
||||
@%:@undef HAVE_GETPW_R_POSIX])
|
||||
m4trace:configure.ac:79: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2655: AC_TRY_LINK is expanded from...
|
||||
acinclude.m4:66: EL_GETPW_R_DRAFT is expanded from...
|
||||
configure.ac:79: the top level])
|
||||
m4trace:configure.ac:79: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_R_DRAFT])
|
||||
m4trace:configure.ac:79: -1- m4_pattern_allow([^HAVE_GETPW_R_DRAFT$])
|
||||
m4trace:configure.ac:79: -1- AH_OUTPUT([HAVE_GETPW_R_DRAFT], [/* Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1
|
||||
versions. */
|
||||
@%:@undef HAVE_GETPW_R_DRAFT])
|
||||
m4trace:configure.ac:87: -1- AH_OUTPUT([zzzz1], [
|
||||
#include "sys.h"
|
||||
#define SCCSID
|
||||
#undef LIBC_SCCS
|
||||
#define lint
|
||||
])
|
||||
m4trace:configure.ac:93: -1- AC_CONFIG_FILES([Makefile
|
||||
libedit.pc
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
examples/Makefile])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.ac:94: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([LTLIBOBJS])
|
||||
m4trace:configure.ac:94: -1- m4_pattern_allow([^LTLIBOBJS$])
|
||||
m4trace:configure.ac:94: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST([am__EXEEXT_TRUE])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([am__EXEEXT_TRUE])
|
||||
m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_TRUE$])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST([am__EXEEXT_FALSE])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([am__EXEEXT_FALSE])
|
||||
m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_FALSE$])
|
||||
m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE])
|
||||
m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_builddir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_build_prefix])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([srcdir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_srcdir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_srcdir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_top_srcdir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([builddir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_builddir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_top_builddir])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([INSTALL])
|
||||
m4trace:configure.ac:94: -1- AC_SUBST_TRACE([MKDIR_P])
|
||||
m4trace:configure.ac:94: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])
|
278
lib/libedit/config.h.in
Normal file
278
lib/libedit/config.h.in
Normal file
@@ -0,0 +1,278 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
||||
#undef CLOSEDIR_VOID
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the <curses.h> header file. */
|
||||
#undef HAVE_CURSES_H
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `endpwent' function. */
|
||||
#undef HAVE_ENDPWENT
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1
|
||||
versions. */
|
||||
#undef HAVE_GETPW_R_DRAFT
|
||||
|
||||
/* Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1
|
||||
compatible. */
|
||||
#undef HAVE_GETPW_R_POSIX
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `isascii' function. */
|
||||
#undef HAVE_ISASCII
|
||||
|
||||
/* Define to 1 if you have the `issetugid' function. */
|
||||
#undef HAVE_ISSETUGID
|
||||
|
||||
/* Define to 1 if you have the `curses' library (-lcurses). */
|
||||
#undef HAVE_LIBCURSES
|
||||
|
||||
/* Define to 1 if you have the `ncurses' library (-lncurses). */
|
||||
#undef HAVE_LIBNCURSES
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the `memchr' function. */
|
||||
#undef HAVE_MEMCHR
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
||||
#undef HAVE_NCURSES_H
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the `regcomp' function. */
|
||||
#undef HAVE_REGCOMP
|
||||
|
||||
/* Define to 1 if you have the `re_comp' function. */
|
||||
#undef HAVE_RE_COMP
|
||||
|
||||
/* Define to 1 if `stat' has the bug that it succeeds when given the
|
||||
zero-length file name argument. */
|
||||
#undef HAVE_STAT_EMPTY_STRING_BUG
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the `strcspn' function. */
|
||||
#undef HAVE_STRCSPN
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strrchr' function. */
|
||||
#undef HAVE_STRRCHR
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#undef HAVE_STRTOL
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the <term.h> header file. */
|
||||
#undef HAVE_TERM_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if the system has the type `u_int32_t'. */
|
||||
#undef HAVE_U_INT32_T
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if you have the `wcsdup' function. */
|
||||
#undef HAVE_WCSDUP
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
||||
slash. */
|
||||
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if you want wide-character code */
|
||||
#undef WIDECHAR
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
||||
|
||||
|
||||
#include "sys.h"
|
||||
#define SCCSID
|
||||
#undef LIBC_SCCS
|
||||
#define lint
|
||||
|
92
lib/libedit/configure.ac
Normal file
92
lib/libedit/configure.ac
Normal file
@@ -0,0 +1,92 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# Compile with debug symbols:
|
||||
# CFLAGS="-ggdb -pedandic -O0" ./configure
|
||||
# CFLAGS="-ggdb -Wall -Wextra -pedantic -O0" ./configure
|
||||
#
|
||||
# Verbose output can be enabled with
|
||||
# "./configure --disable-silent-rules" or "make V=1"
|
||||
#
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT(libedit, [EL_RELEASE],, libedit-[EL_TIMESTAMP])
|
||||
AC_CONFIG_SRCDIR([src/strlcat.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
||||
# features of Posix that are extensions to C (define _GNU_SOURCE)
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# libtool -version-info
|
||||
AC_SUBST(LT_VERSION, [0:36:0])
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC_C99
|
||||
#AC_PROG_CC
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_AWK
|
||||
EL_MANTYPE
|
||||
|
||||
|
||||
AC_CHECK_LIB(curses, tgetent,,
|
||||
[AC_CHECK_LIB(ncurses, tgetent,,
|
||||
[AC_MSG_ERROR([libcurses or libncurses are required!])] )] )
|
||||
|
||||
|
||||
### use option --enable-widec to turn on use of wide-character support
|
||||
EL_ENABLE_WIDEC
|
||||
|
||||
# Checks for header files.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h curses.h ncurses.h sys/cdefs.h])
|
||||
|
||||
AC_CHECK_HEADER([termios.h], [], [AC_MSG_ERROR([termios.h is required!])],[])
|
||||
|
||||
## include curses.h to prevent "Present But Cannot Be Compiled"
|
||||
AC_CHECK_HEADERS([term.h],,,
|
||||
[[#if HAVE_CURSES_H
|
||||
# include <curses.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
# include <ncurses.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_TYPES([u_int32_t])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_FUNC_FORK
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
## _AIX is offended by rpl_malloc and rpl_realloc
|
||||
#AC_FUNC_MALLOC
|
||||
#AC_FUNC_REALLOC
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_STAT
|
||||
AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid wcsdup])
|
||||
EL_GETPW_R_POSIX
|
||||
EL_GETPW_R_DRAFT
|
||||
|
||||
|
||||
AH_BOTTOM([
|
||||
#include "sys.h"
|
||||
#define SCCSID
|
||||
#undef LIBC_SCCS
|
||||
#define lint
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
630
lib/libedit/depcomp
Executable file
630
lib/libedit/depcomp
Executable file
@@ -0,0 +1,630 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
33
lib/libedit/doc/Makefile.am
Normal file
33
lib/libedit/doc/Makefile.am
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
EL_MANS = editline.3 editrc.5
|
||||
|
||||
man_MANS = $(EL_MANS)
|
||||
|
||||
EL_MAN_LINKS = el_init.3 el_end.3 el_reset.3 el_gets.3 el_getc.3 \
|
||||
el_push.3 el_parse.3 el_set.3 el_get.3 el_source.3 \
|
||||
el_resize.3 el_line.3 el_insertstr.3 el_deletestr.3 \
|
||||
el_history_init.3 el_history_end.3 el_history.3 el_tok_init.3 \
|
||||
el_tok_end.3 el_tok_reset.3 el_tok_line.3 el_tok_str.3
|
||||
|
||||
install-data-hook: $(EL_MAN_LINKS)
|
||||
|
||||
$(EL_MAN_LINKS):
|
||||
(cd $(DESTDIR)$(man3dir) && rm -f $@ && $(LN_S) editline.3 $@)
|
||||
|
||||
$(EL_MANS):
|
||||
@if test "$(MANTYPE)" = "mdoc"; then\
|
||||
cp $(srcdir)/$@.roff $@;\
|
||||
else\
|
||||
$(AWK) -f $(srcdir)/mdoc2man.awk $(srcdir)/$@.roff > $@ || rm -f $@;\
|
||||
fi;
|
||||
|
||||
uninstall-local:
|
||||
(cd $(DESTDIR)$(man3dir) && rm -f $(EL_MAN_LINKS))
|
||||
|
||||
CLEANFILES = $(EL_MANS)
|
||||
EXTRA_DIST = editline.3.roff editrc.5.roff mdoc2man.awk
|
||||
|
||||
changelog.txt: ../ChangeLog
|
||||
@sed 's/@/ (at)/g; s/&/\&/g; s/</\</g; s/>/\>/g;' $(srcdir)/$< > $@;
|
||||
|
||||
|
883
lib/libedit/doc/editline.3.roff
Normal file
883
lib/libedit/doc/editline.3.roff
Normal file
@@ -0,0 +1,883 @@
|
||||
.\" $NetBSD: editline.3,v 1.74 2010/12/16 17:42:28 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This file was contributed to The NetBSD Foundation by Luke Mewburn.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
.\"
|
||||
.Dd January 3, 2010
|
||||
.Dt EDITLINE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm editline ,
|
||||
.Nm el_init ,
|
||||
.Nm el_end ,
|
||||
.Nm el_reset ,
|
||||
.Nm el_gets ,
|
||||
.Nm el_wgets ,
|
||||
.Nm el_getc ,
|
||||
.Nm el_wgetc ,
|
||||
.Nm el_push ,
|
||||
.Nm el_wpush ,
|
||||
.Nm el_parse ,
|
||||
.Nm el_wparse ,
|
||||
.Nm el_set ,
|
||||
.Nm el_wset ,
|
||||
.Nm el_get ,
|
||||
.Nm el_wget ,
|
||||
.Nm el_source ,
|
||||
.Nm el_resize ,
|
||||
.Nm el_line ,
|
||||
.Nm el_wline ,
|
||||
.Nm el_insertstr ,
|
||||
.Nm el_winsertstr ,
|
||||
.Nm el_deletestr ,
|
||||
.Nm el_wdeletestr ,
|
||||
.Nm history_init ,
|
||||
.Nm history_winit ,
|
||||
.Nm history_end ,
|
||||
.Nm history_wend ,
|
||||
.Nm history ,
|
||||
.Nm history_w ,
|
||||
.Nm tok_init ,
|
||||
.Nm tok_winit ,
|
||||
.Nm tok_end ,
|
||||
.Nm tok_wend ,
|
||||
.Nm tok_reset ,
|
||||
.Nm tok_wreset ,
|
||||
.Nm tok_line ,
|
||||
.Nm tok_wline ,
|
||||
.Nm tok_str
|
||||
.Nm tok_wstr
|
||||
.Nd line editor, history and tokenization functions
|
||||
.Sh LIBRARY
|
||||
.Lb libedit
|
||||
.Sh SYNOPSIS
|
||||
.In histedit.h
|
||||
.Ft EditLine *
|
||||
.Fn el_init "const char *prog" "FILE *fin" "FILE *fout" "FILE *ferr"
|
||||
.Ft void
|
||||
.Fn el_end "EditLine *e"
|
||||
.Ft void
|
||||
.Fn el_reset "EditLine *e"
|
||||
.Ft const char *
|
||||
.Fn el_gets "EditLine *e" "int *count"
|
||||
.Ft const wchar_t *
|
||||
.Fn el_wgets "EditLine *e" "int *count"
|
||||
.Ft int
|
||||
.Fn el_getc "EditLine *e" "char *ch"
|
||||
.Ft int
|
||||
.Fn el_wgetc "EditLine *e" "wchar_t *ch"
|
||||
.Ft void
|
||||
.Fn el_push "EditLine *e" "const char *str"
|
||||
.Ft void
|
||||
.Fn el_wpush "EditLine *e" "const wchar_t *str"
|
||||
.Ft int
|
||||
.Fn el_parse "EditLine *e" "int argc" "const char *argv[]"
|
||||
.Ft int
|
||||
.Fn el_wparse "EditLine *e" "int argc" "const wchar_t *argv[]"
|
||||
.Ft int
|
||||
.Fn el_set "EditLine *e" "int op" "..."
|
||||
.Ft int
|
||||
.Fn el_wset "EditLine *e" "int op" "..."
|
||||
.Ft int
|
||||
.Fn el_get "EditLine *e" "int op" "..."
|
||||
.Ft int
|
||||
.Fn el_wget "EditLine *e" "int op" "..."
|
||||
.Ft int
|
||||
.Fn el_source "EditLine *e" "const char *file"
|
||||
.Ft void
|
||||
.Fn el_resize "EditLine *e"
|
||||
.Ft const LineInfo *
|
||||
.Fn el_line "EditLine *e"
|
||||
.Ft int
|
||||
.Fn el_insertstr "EditLine *e" "const char *str"
|
||||
.Ft int
|
||||
.Fn el_winsertstr "EditLine *e" "const wchar_t *str"
|
||||
.Ft void
|
||||
.Fn el_deletestr "EditLine *e" "int count"
|
||||
.Ft void
|
||||
.Fn el_wdeletestr "EditLine *e" "int count"
|
||||
.Ft History *
|
||||
.Fn history_init
|
||||
.Ft HistoryW *
|
||||
.Fn history_winit
|
||||
.Ft void
|
||||
.Fn history_end "History *h"
|
||||
.Ft void
|
||||
.Fn history_wend "HistoryW *h"
|
||||
.Ft int
|
||||
.Fn history "History *h" "HistEvent *ev" "int op" "..."
|
||||
.Ft int
|
||||
.Fn history_w "HistoryW *h" "HistEventW *ev" "int op" "..."
|
||||
.Ft Tokenizer *
|
||||
.Fn tok_init "const char *IFS"
|
||||
.Ft TokenizerW *
|
||||
.Fn tok_winit "const wchar_t *IFS"
|
||||
.Ft void
|
||||
.Fn tok_end "Tokenizer *t"
|
||||
.Ft void
|
||||
.Fn tok_wend "TokenizerW *t"
|
||||
.Ft void
|
||||
.Fn tok_reset "Tokenizer *t"
|
||||
.Ft void
|
||||
.Fn tok_wreset "TokenizerW *t"
|
||||
.Ft int
|
||||
.Fn tok_line "Tokenizer *t" "const LineInfo *li" "int *argc" "const char **argv[]" "int *cursorc" "int *cursoro"
|
||||
.Ft int
|
||||
.Fn tok_wline "TokenizerW *t" "const LineInfoW *li" "int *argc" "const wchar_t **argv[]" "int *cursorc" "int *cursoro"
|
||||
.Ft int
|
||||
.Fn tok_str "Tokenizer *t" "const char *str" "int *argc" "const char **argv[]"
|
||||
.Ft int
|
||||
.Fn tok_wstr "TokenizerW *t" "const wchar_t *str" "int *argc" "const wchar_t **argv[]"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
library provides generic line editing, history and tokenization functions,
|
||||
similar to those found in
|
||||
.Xr sh 1 .
|
||||
.Pp
|
||||
These functions are available in the
|
||||
.Nm libedit
|
||||
library (which needs the
|
||||
.Nm libtermcap
|
||||
library).
|
||||
Programs should be linked with
|
||||
.Fl ledit ltermcap .
|
||||
.Sh LINE EDITING FUNCTIONS
|
||||
The line editing functions use a common data structure,
|
||||
.Fa EditLine ,
|
||||
which is created by
|
||||
.Fn el_init
|
||||
and freed by
|
||||
.Fn el_end .
|
||||
.Pp
|
||||
The wide-character functions behave the same way as their narrow
|
||||
counterparts.
|
||||
.Pp
|
||||
The following functions are available:
|
||||
.Bl -tag -width 4n
|
||||
.It Fn el_init
|
||||
Initialise the line editor, and return a data structure
|
||||
to be used by all other line editing functions.
|
||||
.Fa prog
|
||||
is the name of the invoking program, used when reading the
|
||||
.Xr editrc 5
|
||||
file to determine which settings to use.
|
||||
.Fa fin ,
|
||||
.Fa fout
|
||||
and
|
||||
.Fa ferr
|
||||
are the input, output, and error streams (respectively) to use.
|
||||
In this documentation, references to
|
||||
.Dq the tty
|
||||
are actually to this input/output stream combination.
|
||||
.It Fn el_end
|
||||
Clean up and finish with
|
||||
.Fa e ,
|
||||
assumed to have been created with
|
||||
.Fn el_init .
|
||||
.It Fn el_reset
|
||||
Reset the tty and the parser.
|
||||
This should be called after an error which may have upset the tty's
|
||||
state.
|
||||
.It Fn el_gets
|
||||
Read a line from the tty.
|
||||
.Fa count
|
||||
is modified to contain the number of characters read.
|
||||
Returns the line read if successful, or
|
||||
.Dv NULL
|
||||
if no characters were read or if an error occurred.
|
||||
If an error occurred,
|
||||
.Fa count
|
||||
is set to \-1 and
|
||||
.Dv errno
|
||||
contains the error code that caused it.
|
||||
The return value may not remain valid across calls to
|
||||
.Fn el_gets
|
||||
and must be copied if the data is to be retained.
|
||||
.It Fn el_getc
|
||||
Read a character from the tty.
|
||||
.Fa ch
|
||||
is modified to contain the character read.
|
||||
Returns the number of characters read if successful, \-1 otherwise.
|
||||
.It Fn el_push
|
||||
Pushes
|
||||
.Fa str
|
||||
back onto the input stream.
|
||||
This is used by the macro expansion mechanism.
|
||||
Refer to the description of
|
||||
.Ic bind
|
||||
.Fl s
|
||||
in
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Fn el_parse
|
||||
Parses the
|
||||
.Fa argv
|
||||
array (which is
|
||||
.Fa argc
|
||||
elements in size)
|
||||
to execute builtin
|
||||
.Nm
|
||||
commands.
|
||||
If the command is prefixed with
|
||||
.Dq prog :
|
||||
then
|
||||
.Fn el_parse
|
||||
will only execute the command if
|
||||
.Dq prog
|
||||
matches the
|
||||
.Fa prog
|
||||
argument supplied to
|
||||
.Fn el_init .
|
||||
The return value is
|
||||
\-1 if the command is unknown,
|
||||
0 if there was no error or
|
||||
.Dq prog
|
||||
didn't match, or
|
||||
1 if the command returned an error.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Fn el_set
|
||||
Set
|
||||
.Nm
|
||||
parameters.
|
||||
.Fa op
|
||||
determines which parameter to set, and each operation has its
|
||||
own parameter list.
|
||||
.Pp
|
||||
The following values for
|
||||
.Fa op
|
||||
are supported, along with the required argument list:
|
||||
.Bl -tag -width 4n
|
||||
.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)"
|
||||
Define prompt printing function as
|
||||
.Fa f ,
|
||||
which is to return a string that contains the prompt.
|
||||
.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c"
|
||||
Same as
|
||||
.Dv EL_PROMPT ,
|
||||
but the
|
||||
.Fa c
|
||||
argument indicates the start/stop literal prompt character.
|
||||
.Pp
|
||||
If a start/stop literal character is found in the prompt, the
|
||||
character itself
|
||||
is not printed, but characters after it are printed directly to the
|
||||
terminal without affecting the state of the current line.
|
||||
A subsequent second start/stop literal character ends this behavior.
|
||||
This is typically used to embed literal escape sequences that change the
|
||||
color/style of the terminal in the prompt.
|
||||
.Dv 0
|
||||
unsets it.
|
||||
.It Dv EL_REFRESH
|
||||
Re-display the current line on the next terminal line.
|
||||
.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)"
|
||||
Define right side prompt printing function as
|
||||
.Fa f ,
|
||||
which is to return a string that contains the prompt.
|
||||
.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c"
|
||||
Define the right prompt printing function but with a literal escape character.
|
||||
.It Dv EL_TERMINAL , Fa "const char *type"
|
||||
Define terminal type of the tty to be
|
||||
.Fa type ,
|
||||
or to
|
||||
.Ev TERM
|
||||
if
|
||||
.Fa type
|
||||
is
|
||||
.Dv NULL .
|
||||
.It Dv EL_EDITOR , Fa "const char *mode"
|
||||
Set editing mode to
|
||||
.Fa mode ,
|
||||
which must be one of
|
||||
.Dq emacs
|
||||
or
|
||||
.Dq vi .
|
||||
.It Dv EL_SIGNAL , Fa "int flag"
|
||||
If
|
||||
.Fa flag
|
||||
is non-zero,
|
||||
.Nm
|
||||
will install its own signal handler for the following signals when
|
||||
reading command input:
|
||||
.Dv SIGCONT ,
|
||||
.Dv SIGHUP ,
|
||||
.Dv SIGINT ,
|
||||
.Dv SIGQUIT ,
|
||||
.Dv SIGSTOP ,
|
||||
.Dv SIGTERM ,
|
||||
.Dv SIGTSTP ,
|
||||
and
|
||||
.Dv SIGWINCH .
|
||||
Otherwise, the current signal handlers will be used.
|
||||
.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL
|
||||
Perform the
|
||||
.Ic bind
|
||||
builtin command.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL
|
||||
Perform the
|
||||
.Ic echotc
|
||||
builtin command.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL
|
||||
Perform the
|
||||
.Ic settc
|
||||
builtin command.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL
|
||||
Perform the
|
||||
.Ic setty
|
||||
builtin command.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL
|
||||
Perform the
|
||||
.Ic telltc
|
||||
builtin command.
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.It Dv EL_ADDFN , Fa "const char *name" , Fa "const char *help" , \
|
||||
Fa "unsigned char (*func)(EditLine *e, int ch)"
|
||||
Add a user defined function,
|
||||
.Fn func ,
|
||||
referred to as
|
||||
.Fa name
|
||||
which is invoked when a key which is bound to
|
||||
.Fa name
|
||||
is entered.
|
||||
.Fa help
|
||||
is a description of
|
||||
.Fa name .
|
||||
At invocation time,
|
||||
.Fa ch
|
||||
is the key which caused the invocation.
|
||||
The return value of
|
||||
.Fn func
|
||||
should be one of:
|
||||
.Bl -tag -width "CC_REDISPLAY"
|
||||
.It Dv CC_NORM
|
||||
Add a normal character.
|
||||
.It Dv CC_NEWLINE
|
||||
End of line was entered.
|
||||
.It Dv CC_EOF
|
||||
EOF was entered.
|
||||
.It Dv CC_ARGHACK
|
||||
Expecting further command input as arguments, do nothing visually.
|
||||
.It Dv CC_REFRESH
|
||||
Refresh display.
|
||||
.It Dv CC_REFRESH_BEEP
|
||||
Refresh display, and beep.
|
||||
.It Dv CC_CURSOR
|
||||
Cursor moved, so update and perform
|
||||
.Dv CC_REFRESH .
|
||||
.It Dv CC_REDISPLAY
|
||||
Redisplay entire input line.
|
||||
This is useful if a key binding outputs extra information.
|
||||
.It Dv CC_ERROR
|
||||
An error occurred.
|
||||
Beep, and flush tty.
|
||||
.It Dv CC_FATAL
|
||||
Fatal error, reset tty to known state.
|
||||
.El
|
||||
.It Dv EL_HIST , Fa "History *(*func)(History *, int op, ...)" , \
|
||||
Fa "const char *ptr"
|
||||
Defines which history function to use, which is usually
|
||||
.Fn history .
|
||||
.Fa ptr
|
||||
should be the value returned by
|
||||
.Fn history_init .
|
||||
.It Dv EL_EDITMODE , Fa "int flag"
|
||||
If
|
||||
.Fa flag
|
||||
is non-zero,
|
||||
editing is enabled (the default).
|
||||
Note that this is only an indication, and does not
|
||||
affect the operation of
|
||||
.Nm .
|
||||
At this time, it is the caller's responsibility to
|
||||
check this
|
||||
(using
|
||||
.Fn el_get )
|
||||
to determine if editing should be enabled or not.
|
||||
.It Dv EL_GETCFN , Fa "int (*f)(EditLine *, char *c)"
|
||||
Define the character reading function as
|
||||
.Fa f ,
|
||||
which is to return the number of characters read and store them in
|
||||
.Fa c .
|
||||
This function is called internally by
|
||||
.Fn el_gets
|
||||
and
|
||||
.Fn el_getc .
|
||||
The builtin function can be set or restored with the special function
|
||||
name
|
||||
.Dq Dv EL_BUILTIN_GETCFN .
|
||||
.It Dv EL_CLIENTDATA , Fa "void *data"
|
||||
Register
|
||||
.Fa data
|
||||
to be associated with this EditLine structure.
|
||||
It can be retrieved with the corresponding
|
||||
.Fn el_get
|
||||
call.
|
||||
.It Dv EL_SETFP , Fa "int fd" , Fa "FILE *fp"
|
||||
Set the current
|
||||
.Nm editline
|
||||
file pointer for
|
||||
.Dq input
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 0 ,
|
||||
.Dq output
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 1 ,
|
||||
or
|
||||
.Dq error
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 2
|
||||
from
|
||||
.Fa fp .
|
||||
.El
|
||||
.It Fn el_get
|
||||
Get
|
||||
.Nm
|
||||
parameters.
|
||||
.Fa op
|
||||
determines which parameter to retrieve into
|
||||
.Fa result .
|
||||
Returns 0 if successful, \-1 otherwise.
|
||||
.Pp
|
||||
The following values for
|
||||
.Fa op
|
||||
are supported, along with actual type of
|
||||
.Fa result :
|
||||
.Bl -tag -width 4n
|
||||
.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
|
||||
Return a pointer to the function that displays the prompt in
|
||||
.Fa f .
|
||||
If
|
||||
.Fa c
|
||||
is not
|
||||
.Dv NULL ,
|
||||
return the start/stop literal prompt character in it.
|
||||
.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
|
||||
Return a pointer to the function that displays the prompt in
|
||||
.Fa f .
|
||||
If
|
||||
.Fa c
|
||||
is not
|
||||
.Dv NULL ,
|
||||
return the start/stop literal prompt character in it.
|
||||
.It Dv EL_EDITOR , Fa "const char **"
|
||||
Return the name of the editor, which will be one of
|
||||
.Dq emacs
|
||||
or
|
||||
.Dq vi .
|
||||
.It Dv EL_GETTC , Fa "const char *name" , Fa "void *value"
|
||||
Return non-zero if
|
||||
.Fa name
|
||||
is a valid
|
||||
.Xr termcap 5
|
||||
capability
|
||||
and set
|
||||
.Fa value
|
||||
to the current value of that capability.
|
||||
.It Dv EL_SIGNAL , Fa "int *"
|
||||
Return non-zero if
|
||||
.Nm
|
||||
has installed private signal handlers (see
|
||||
.Fn el_get
|
||||
above).
|
||||
.It Dv EL_EDITMODE , Fa "int *"
|
||||
Return non-zero if editing is enabled.
|
||||
.It Dv EL_GETCFN , Fa "int (**f)(EditLine *, char *)"
|
||||
Return a pointer to the function that read characters, which is equal to
|
||||
.Dq Dv EL_BUILTIN_GETCFN
|
||||
in the case of the default builtin function.
|
||||
.It Dv EL_CLIENTDATA , Fa "void **data"
|
||||
Retrieve
|
||||
.Fa data
|
||||
previously registered with the corresponding
|
||||
.Fn el_set
|
||||
call.
|
||||
.It Dv EL_UNBUFFERED , Fa "int"
|
||||
Sets or clears unbuffered mode.
|
||||
In this mode,
|
||||
.Fn el_gets
|
||||
will return immediately after processing a single character.
|
||||
.It Dv EL_PREP_TERM , Fa "int"
|
||||
Sets or clears terminal editing mode.
|
||||
.It Dv EL_GETFP , Fa "int fd", Fa "FILE **fp"
|
||||
Return in
|
||||
.Fa fp
|
||||
the current
|
||||
.Nm editline
|
||||
file pointer for
|
||||
.Dq input
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 0 ,
|
||||
.Dq output
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 1 ,
|
||||
or
|
||||
.Dq error
|
||||
.Fa fd
|
||||
=
|
||||
.Dv 2 .
|
||||
.El
|
||||
.It Fn el_source
|
||||
Initialise
|
||||
.Nm
|
||||
by reading the contents of
|
||||
.Fa file .
|
||||
.Fn el_parse
|
||||
is called for each line in
|
||||
.Fa file .
|
||||
If
|
||||
.Fa file
|
||||
is
|
||||
.Dv NULL ,
|
||||
try
|
||||
.Pa $PWD/.editrc
|
||||
then
|
||||
.Pa $HOME/.editrc .
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for details on the format of
|
||||
.Fa file .
|
||||
.It Fn el_resize
|
||||
Must be called if the terminal size changes.
|
||||
If
|
||||
.Dv EL_SIGNAL
|
||||
has been set with
|
||||
.Fn el_set ,
|
||||
then this is done automatically.
|
||||
Otherwise, it's the responsibility of the application to call
|
||||
.Fn el_resize
|
||||
on the appropriate occasions.
|
||||
.It Fn el_line
|
||||
Return the editing information for the current line in a
|
||||
.Fa LineInfo
|
||||
structure, which is defined as follows:
|
||||
.Bd -literal
|
||||
typedef struct lineinfo {
|
||||
const char *buffer; /* address of buffer */
|
||||
const char *cursor; /* address of cursor */
|
||||
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
|
||||
into the line at the cursor.
|
||||
Returns \-1 if
|
||||
.Fa str
|
||||
is empty or won't fit, and 0 otherwise.
|
||||
.It Fn el_deletestr
|
||||
Delete
|
||||
.Fa count
|
||||
characters before the cursor.
|
||||
.El
|
||||
.Sh HISTORY LIST FUNCTIONS
|
||||
The history functions use a common data structure,
|
||||
.Fa History ,
|
||||
which is created by
|
||||
.Fn history_init
|
||||
and freed by
|
||||
.Fn history_end .
|
||||
.Pp
|
||||
The following functions are available:
|
||||
.Bl -tag -width 4n
|
||||
.It Fn history_init
|
||||
Initialise the history list, and return a data structure
|
||||
to be used by all other history list functions.
|
||||
.It Fn history_end
|
||||
Clean up and finish with
|
||||
.Fa h ,
|
||||
assumed to have been created with
|
||||
.Fn history_init .
|
||||
.It Fn history
|
||||
Perform operation
|
||||
.Fa op
|
||||
on the history list, with optional arguments as needed by the
|
||||
operation.
|
||||
.Fa ev
|
||||
is changed accordingly to operation.
|
||||
The following values for
|
||||
.Fa op
|
||||
are supported, along with the required argument list:
|
||||
.Bl -tag -width 4n
|
||||
.It Dv H_SETSIZE , Fa "int size"
|
||||
Set size of history to
|
||||
.Fa size
|
||||
elements.
|
||||
.It Dv H_GETSIZE
|
||||
Get number of events currently in history.
|
||||
.It Dv H_END
|
||||
Cleans up and finishes with
|
||||
.Fa h ,
|
||||
assumed to be created with
|
||||
.Fn history_init .
|
||||
.It Dv H_CLEAR
|
||||
Clear the history.
|
||||
.It Dv H_FUNC , Fa "void *ptr" , Fa "history_gfun_t first" , \
|
||||
Fa "history_gfun_t next" , Fa "history_gfun_t last" , \
|
||||
Fa "history_gfun_t prev" , Fa "history_gfun_t curr" , \
|
||||
Fa "history_sfun_t set" , Fa "history_vfun_t clear" , \
|
||||
Fa "history_efun_t enter" , Fa "history_efun_t add"
|
||||
Define functions to perform various history operations.
|
||||
.Fa ptr
|
||||
is the argument given to a function when it's invoked.
|
||||
.It Dv H_FIRST
|
||||
Return the first element in the history.
|
||||
.It Dv H_LAST
|
||||
Return the last element in the history.
|
||||
.It Dv H_PREV
|
||||
Return the previous element in the history.
|
||||
.It Dv H_NEXT
|
||||
Return the next element in the history.
|
||||
.It Dv H_CURR
|
||||
Return the current element in the history.
|
||||
.It Dv H_SET
|
||||
Set the cursor to point to the requested element.
|
||||
.It Dv H_ADD , Fa "const char *str"
|
||||
Append
|
||||
.Fa str
|
||||
to the current element of the history, or perform the
|
||||
.Dv H_ENTER
|
||||
operation with argument
|
||||
.Fa str
|
||||
if there is no current element.
|
||||
.It Dv H_APPEND , Fa "const char *str"
|
||||
Append
|
||||
.Fa str
|
||||
to the last new element of the history.
|
||||
.It Dv H_ENTER , Fa "const char *str"
|
||||
Add
|
||||
.Fa str
|
||||
as a new element to the history, and, if necessary,
|
||||
removing the oldest entry to keep the list to the created size.
|
||||
If
|
||||
.Dv H_SETUNIQUE
|
||||
was has been called with a non-zero arguments, the element
|
||||
will not be entered into the history if its contents match
|
||||
the ones of the current history element.
|
||||
If the element is entered
|
||||
.Fn history
|
||||
returns 1, if it is ignored as a duplicate returns 0.
|
||||
Finally
|
||||
.Fn history
|
||||
returns \-1 if an error occurred.
|
||||
.It Dv H_PREV_STR , Fa "const char *str"
|
||||
Return the closest previous event that starts with
|
||||
.Fa str .
|
||||
.It Dv H_NEXT_STR , Fa "const char *str"
|
||||
Return the closest next event that starts with
|
||||
.Fa str .
|
||||
.It Dv H_PREV_EVENT , Fa "int e"
|
||||
Return the previous event numbered
|
||||
.Fa e .
|
||||
.It Dv H_NEXT_EVENT , Fa "int e"
|
||||
Return the next event numbered
|
||||
.Fa e .
|
||||
.It Dv H_LOAD , Fa "const char *file"
|
||||
Load the history list stored in
|
||||
.Fa file .
|
||||
.It Dv H_SAVE , Fa "const char *file"
|
||||
Save the history list to
|
||||
.Fa file .
|
||||
.It Dv H_SETUNIQUE , Fa "int unique"
|
||||
Set flag that adjacent identical event strings should not be entered
|
||||
into the history.
|
||||
.It Dv H_GETUNIQUE
|
||||
Retrieve the current setting if adjacent identical elements should
|
||||
be entered into the history.
|
||||
.It Dv H_DEL , Fa "int e"
|
||||
Delete the event numbered
|
||||
.Fa e .
|
||||
This function is only provided for
|
||||
.Xr readline 3
|
||||
compatibility.
|
||||
The caller is responsible for free'ing the string in the returned
|
||||
.Fa HistEvent .
|
||||
.El
|
||||
.Pp
|
||||
.Fn history
|
||||
returns \*[Gt]= 0 if the operation
|
||||
.Fa op
|
||||
succeeds.
|
||||
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
|
||||
.Aq space ,
|
||||
.Aq tab ,
|
||||
and
|
||||
.Aq 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
|
||||
.Aq 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
|
||||
.Xr sh 1 ,
|
||||
.Xr signal 3 ,
|
||||
.Xr termcap 3 ,
|
||||
.Xr editrc 5 ,
|
||||
.Xr termcap 5
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
library first appeared in
|
||||
.Bx 4.4 .
|
||||
.Dv CC_REDISPLAY
|
||||
appeared in
|
||||
.Nx 1.3 .
|
||||
.Dv CC_REFRESH_BEEP ,
|
||||
.Dv EL_EDITMODE
|
||||
and the readline emulation appeared in
|
||||
.Nx 1.4 .
|
||||
.Dv EL_RPROMPT
|
||||
appeared in
|
||||
.Nx 1.5 .
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
library was written by Christos Zoulas.
|
||||
Luke Mewburn wrote this manual and implemented
|
||||
.Dv CC_REDISPLAY ,
|
||||
.Dv CC_REFRESH_BEEP ,
|
||||
.Dv EL_EDITMODE ,
|
||||
and
|
||||
.Dv EL_RPROMPT .
|
||||
Jaromir Dolecek implemented the readline emulation.
|
||||
Johny Mattsson implemented wide-character support.
|
||||
.Sh BUGS
|
||||
At this time, it is the responsibility of the caller to
|
||||
check the result of the
|
||||
.Dv EL_EDITMODE
|
||||
operation of
|
||||
.Fn el_get
|
||||
(after an
|
||||
.Fn el_source
|
||||
or
|
||||
.Fn el_parse )
|
||||
to determine if
|
||||
.Nm
|
||||
should be used for further input.
|
||||
I.e.,
|
||||
.Dv EL_EDITMODE
|
||||
is purely an indication of the result of the most recent
|
||||
.Xr editrc 5
|
||||
.Ic edit
|
||||
command.
|
490
lib/libedit/doc/editrc.5.roff
Normal file
490
lib/libedit/doc/editrc.5.roff
Normal file
@@ -0,0 +1,490 @@
|
||||
.\" $NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This file was contributed to The NetBSD Foundation by Luke Mewburn.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
.\"
|
||||
.Dd October 18, 2003
|
||||
.Dt EDITRC 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm editrc
|
||||
.Nd configuration file for editline library
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
file defines various settings to be used by the
|
||||
.Xr editline 3
|
||||
library.
|
||||
.Pp
|
||||
The format of each line is:
|
||||
.Dl [prog:]command [arg [...]]
|
||||
.Pp
|
||||
.Ar command
|
||||
is one of the
|
||||
.Xr editline 3
|
||||
builtin commands.
|
||||
Refer to
|
||||
.Sx BUILTIN COMMANDS
|
||||
for more information.
|
||||
.Pp
|
||||
.Ar prog
|
||||
is the program name string that a program defines when it calls
|
||||
.Xr el_init 3
|
||||
to set up
|
||||
.Xr editline 3 ,
|
||||
which is usually
|
||||
.Va argv[0] .
|
||||
.Ar command
|
||||
will be executed for any program which matches
|
||||
.Ar prog .
|
||||
.Pp
|
||||
.Ar prog
|
||||
may also be a
|
||||
.Xr regex 3
|
||||
style
|
||||
regular expression, in which case
|
||||
.Ar command
|
||||
will be executed for any program that matches the regular expression.
|
||||
.Pp
|
||||
If
|
||||
.Ar prog
|
||||
is absent,
|
||||
.Ar command
|
||||
is executed for all programs.
|
||||
.Sh BUILTIN COMMANDS
|
||||
The
|
||||
.Nm editline
|
||||
library has some builtin commands, which affect the way
|
||||
that the line editing and history functions operate.
|
||||
These are based on similar named builtins present in the
|
||||
.Xr tcsh 1
|
||||
shell.
|
||||
.Pp
|
||||
The following builtin commands are available:
|
||||
.Bl -tag -width 4n
|
||||
.It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \
|
||||
Oo Fl s Oc Oo Fl v Oc Oo Ar key Op Ar command Oc
|
||||
Without options, list all bound keys, and the editor command to which
|
||||
each is bound.
|
||||
If
|
||||
.Ar key
|
||||
is supplied, show the bindings for
|
||||
.Ar key .
|
||||
If
|
||||
.Ar key command
|
||||
is supplied, bind
|
||||
.Ar command
|
||||
to
|
||||
.Ar key .
|
||||
Options include:
|
||||
.Bl -tag -width 4n
|
||||
.It Fl e
|
||||
Bind all keys to the standard GNU Emacs-like bindings.
|
||||
.It Fl v
|
||||
Bind all keys to the standard
|
||||
.Xr vi 1 Ns -like
|
||||
bindings.
|
||||
.It Fl a
|
||||
List or change key bindings in the
|
||||
.Xr vi 1
|
||||
mode alternate (command mode) key map.
|
||||
.It Fl k
|
||||
.Ar key
|
||||
is interpreted as a symbolic arrow key name, which may be one of
|
||||
.Sq up ,
|
||||
.Sq down ,
|
||||
.Sq left
|
||||
or
|
||||
.Sq right .
|
||||
.It Fl l
|
||||
List all editor commands and a short description of each.
|
||||
.It Fl r
|
||||
Remove a key's binding.
|
||||
.It Fl s
|
||||
.Ar command
|
||||
is taken as a literal string and treated as terminal input when
|
||||
.Ar key
|
||||
is typed.
|
||||
Bound keys in
|
||||
.Ar command
|
||||
are themselves reinterpreted, and this continues for ten levels of
|
||||
interpretation.
|
||||
.El
|
||||
.Pp
|
||||
.Ar command
|
||||
may be one of the commands documented in
|
||||
.Sx "EDITOR COMMANDS"
|
||||
below, or another key.
|
||||
.Pp
|
||||
.Ar key
|
||||
and
|
||||
.Ar command
|
||||
can contain control characters of the form
|
||||
.Sm off
|
||||
.Sq No ^ Ar character
|
||||
.Sm on
|
||||
.Po
|
||||
e.g.
|
||||
.Sq ^A
|
||||
.Pc ,
|
||||
and the following backslashed escape sequences:
|
||||
.Pp
|
||||
.Bl -tag -compact -offset indent -width 4n
|
||||
.It Ic \ea
|
||||
Bell
|
||||
.It Ic \eb
|
||||
Backspace
|
||||
.It Ic \ee
|
||||
Escape
|
||||
.It Ic \ef
|
||||
Formfeed
|
||||
.It Ic \en
|
||||
Newline
|
||||
.It Ic \er
|
||||
Carriage return
|
||||
.It Ic \et
|
||||
Horizontal tab
|
||||
.It Ic \ev
|
||||
Vertical tab
|
||||
.Sm off
|
||||
.It Sy \e Ar nnn
|
||||
.Sm on
|
||||
The ASCII character corresponding to the octal number
|
||||
.Ar nnn .
|
||||
.El
|
||||
.Pp
|
||||
.Sq \e
|
||||
nullifies the special meaning of the following character,
|
||||
if it has any, notably
|
||||
.Sq \e
|
||||
and
|
||||
.Sq ^ .
|
||||
.It Ic echotc Oo Fl sv Oc Ar arg Ar ...
|
||||
Exercise terminal capabilities given in
|
||||
.Ar arg Ar ... .
|
||||
If
|
||||
.Ar arg
|
||||
is
|
||||
.Sq baud ,
|
||||
.Sq cols ,
|
||||
.Sq lines ,
|
||||
.Sq rows ,
|
||||
.Sq meta or
|
||||
.Sq tabs ,
|
||||
the value of that capability is printed, with
|
||||
.Dq yes
|
||||
or
|
||||
.Dq no
|
||||
indicating that the terminal does or does not have that capability.
|
||||
.Pp
|
||||
.Fl s
|
||||
returns an empty string for non-existent capabilities, rather than
|
||||
causing an error.
|
||||
.Fl v
|
||||
causes messages to be verbose.
|
||||
.It Ic edit Op Li on | Li off
|
||||
Enable or disable the
|
||||
.Nm editline
|
||||
functionality in a program.
|
||||
.It Ic history Ar list | Ar size Dv n | Ar unique Dv n
|
||||
The
|
||||
.Ar list
|
||||
command lists all entries in the history.
|
||||
The
|
||||
.Ar size
|
||||
command sets the history size to
|
||||
.Dv n
|
||||
entries.
|
||||
The
|
||||
.Ar unique
|
||||
command controls if history should keep duplicate entries.
|
||||
If
|
||||
.Dv n
|
||||
is non zero, only keep unique history entries.
|
||||
If
|
||||
.Dv n
|
||||
is zero, then keep all entries (the default).
|
||||
.It Ic telltc
|
||||
List the values of all the terminal capabilities (see
|
||||
.Xr termcap 5 ) .
|
||||
.It Ic settc Ar cap Ar val
|
||||
Set the terminal capability
|
||||
.Ar cap
|
||||
to
|
||||
.Ar val ,
|
||||
as defined in
|
||||
.Xr termcap 5 .
|
||||
No sanity checking is done.
|
||||
.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \
|
||||
Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=c Oc
|
||||
Control which tty modes that
|
||||
.Nm
|
||||
won't allow the user to change.
|
||||
.Fl d ,
|
||||
.Fl q
|
||||
or
|
||||
.Fl x
|
||||
tells
|
||||
.Ic setty
|
||||
to act on the
|
||||
.Sq edit ,
|
||||
.Sq quote
|
||||
or
|
||||
.Sq execute
|
||||
set of tty modes respectively; defaulting to
|
||||
.Fl x .
|
||||
.Pp
|
||||
Without other arguments,
|
||||
.Ic setty
|
||||
lists the modes in the chosen set which are fixed on
|
||||
.Po
|
||||
.Sq +mode
|
||||
.Pc
|
||||
or off
|
||||
.Po
|
||||
.Sq -mode
|
||||
.Pc .
|
||||
.Fl a
|
||||
lists all tty modes in the chosen set regardless of the setting.
|
||||
With
|
||||
.Ar +mode ,
|
||||
.Ar -mode
|
||||
or
|
||||
.Ar mode ,
|
||||
fixes
|
||||
.Ar mode
|
||||
on or off or removes control of
|
||||
.Ar mode
|
||||
in the chosen set.
|
||||
.Pp
|
||||
.Ic Setty
|
||||
can also be used to set tty characters to particular values using
|
||||
.Ar char=value .
|
||||
If
|
||||
.Ar value
|
||||
is empty
|
||||
then the character is set to
|
||||
.Dv _POSIX_VDISABLE .
|
||||
.El
|
||||
.Sh EDITOR COMMANDS
|
||||
The following editor commands are available for use in key bindings:
|
||||
.\" Section automatically generated with makelist
|
||||
.Bl -tag -width 4n
|
||||
.It Ic vi-paste-next
|
||||
Vi paste previous deletion to the right of the cursor.
|
||||
.It Ic vi-paste-prev
|
||||
Vi paste previous deletion to the left of the cursor.
|
||||
.It Ic vi-prev-space-word
|
||||
Vi move to the previous space delimited word.
|
||||
.It Ic vi-prev-word
|
||||
Vi move to the previous word.
|
||||
.It Ic vi-next-space-word
|
||||
Vi move to the next space delimited word.
|
||||
.It Ic vi-next-word
|
||||
Vi move to the next word.
|
||||
.It Ic vi-change-case
|
||||
Vi change case of character under the cursor and advance one character.
|
||||
.It Ic vi-change-meta
|
||||
Vi change prefix command.
|
||||
.It Ic vi-insert-at-bol
|
||||
Vi enter insert mode at the beginning of line.
|
||||
.It Ic vi-replace-char
|
||||
Vi replace character under the cursor with the next character typed.
|
||||
.It Ic vi-replace-mode
|
||||
Vi enter replace mode.
|
||||
.It Ic vi-substitute-char
|
||||
Vi replace character under the cursor and enter insert mode.
|
||||
.It Ic vi-substitute-line
|
||||
Vi substitute entire line.
|
||||
.It Ic vi-change-to-eol
|
||||
Vi change to end of line.
|
||||
.It Ic vi-insert
|
||||
Vi enter insert mode.
|
||||
.It Ic vi-add
|
||||
Vi enter insert mode after the cursor.
|
||||
.It Ic vi-add-at-eol
|
||||
Vi enter insert mode at end of line.
|
||||
.It Ic vi-delete-meta
|
||||
Vi delete prefix command.
|
||||
.It Ic vi-end-word
|
||||
Vi move to the end of the current space delimited word.
|
||||
.It Ic vi-to-end-word
|
||||
Vi move to the end of the current word.
|
||||
.It Ic vi-undo
|
||||
Vi undo last change.
|
||||
.It Ic vi-command-mode
|
||||
Vi enter command mode (use alternative key bindings).
|
||||
.It Ic vi-zero
|
||||
Vi move to the beginning of line.
|
||||
.It Ic vi-delete-prev-char
|
||||
Vi move to previous character (backspace).
|
||||
.It Ic vi-list-or-eof
|
||||
Vi list choices for completion or indicate end of file if empty line.
|
||||
.It Ic vi-kill-line-prev
|
||||
Vi cut from beginning of line to cursor.
|
||||
.It Ic vi-search-prev
|
||||
Vi search history previous.
|
||||
.It Ic vi-search-next
|
||||
Vi search history next.
|
||||
.It Ic vi-repeat-search-next
|
||||
Vi repeat current search in the same search direction.
|
||||
.It Ic vi-repeat-search-prev
|
||||
Vi repeat current search in the opposite search direction.
|
||||
.It Ic vi-next-char
|
||||
Vi move to the character specified next.
|
||||
.It Ic vi-prev-char
|
||||
Vi move to the character specified previous.
|
||||
.It Ic vi-to-next-char
|
||||
Vi move up to the character specified next.
|
||||
.It Ic vi-to-prev-char
|
||||
Vi move up to the character specified previous.
|
||||
.It Ic vi-repeat-next-char
|
||||
Vi repeat current character search in the same search direction.
|
||||
.It Ic vi-repeat-prev-char
|
||||
Vi repeat current character search in the opposite search direction.
|
||||
.It Ic em-delete-or-list
|
||||
Delete character under cursor or list completions if at end of line.
|
||||
.It Ic em-delete-next-word
|
||||
Cut from cursor to end of current word.
|
||||
.It Ic em-yank
|
||||
Paste cut buffer at cursor position.
|
||||
.It Ic em-kill-line
|
||||
Cut the entire line and save in cut buffer.
|
||||
.It Ic em-kill-region
|
||||
Cut area between mark and cursor and save in cut buffer.
|
||||
.It Ic em-copy-region
|
||||
Copy area between mark and cursor to cut buffer.
|
||||
.It Ic em-gosmacs-transpose
|
||||
Exchange the two characters before the cursor.
|
||||
.It Ic em-next-word
|
||||
Move next to end of current word.
|
||||
.It Ic em-upper-case
|
||||
Uppercase the characters from cursor to end of current word.
|
||||
.It Ic em-capitol-case
|
||||
Capitalize the characters from cursor to end of current word.
|
||||
.It Ic em-lower-case
|
||||
Lowercase the characters from cursor to end of current word.
|
||||
.It Ic em-set-mark
|
||||
Set the mark at cursor.
|
||||
.It Ic em-exchange-mark
|
||||
Exchange the cursor and mark.
|
||||
.It Ic em-universal-argument
|
||||
Universal argument (argument times 4).
|
||||
.It Ic em-meta-next
|
||||
Add 8th bit to next character typed.
|
||||
.It Ic em-toggle-overwrite
|
||||
Switch from insert to overwrite mode or vice versa.
|
||||
.It Ic em-copy-prev-word
|
||||
Copy current word to cursor.
|
||||
.It Ic em-inc-search-next
|
||||
Emacs incremental next search.
|
||||
.It Ic em-inc-search-prev
|
||||
Emacs incremental reverse search.
|
||||
.It Ic ed-end-of-file
|
||||
Indicate end of file.
|
||||
.It Ic ed-insert
|
||||
Add character to the line.
|
||||
.It Ic ed-delete-prev-word
|
||||
Delete from beginning of current word to cursor.
|
||||
.It Ic ed-delete-next-char
|
||||
Delete character under cursor.
|
||||
.It Ic ed-kill-line
|
||||
Cut to the end of line.
|
||||
.It Ic ed-move-to-end
|
||||
Move cursor to the end of line.
|
||||
.It Ic ed-move-to-beg
|
||||
Move cursor to the beginning of line.
|
||||
.It Ic ed-transpose-chars
|
||||
Exchange the character to the left of the cursor with the one under it.
|
||||
.It Ic ed-next-char
|
||||
Move to the right one character.
|
||||
.It Ic ed-prev-word
|
||||
Move to the beginning of the current word.
|
||||
.It Ic ed-prev-char
|
||||
Move to the left one character.
|
||||
.It Ic ed-quoted-insert
|
||||
Add the next character typed verbatim.
|
||||
.It Ic ed-digit
|
||||
Adds to argument or enters a digit.
|
||||
.It Ic ed-argument-digit
|
||||
Digit that starts argument.
|
||||
.It Ic ed-unassigned
|
||||
Indicates unbound character.
|
||||
.It Ic ed-tty-sigint
|
||||
Tty interrupt character.
|
||||
.It Ic ed-tty-dsusp
|
||||
Tty delayed suspend character.
|
||||
.It Ic ed-tty-flush-output
|
||||
Tty flush output characters.
|
||||
.It Ic ed-tty-sigquit
|
||||
Tty quit character.
|
||||
.It Ic ed-tty-sigtstp
|
||||
Tty suspend character.
|
||||
.It Ic ed-tty-stop-output
|
||||
Tty disallow output characters.
|
||||
.It Ic ed-tty-start-output
|
||||
Tty allow output characters.
|
||||
.It Ic ed-newline
|
||||
Execute command.
|
||||
.It Ic ed-delete-prev-char
|
||||
Delete the character to the left of the cursor.
|
||||
.It Ic ed-clear-screen
|
||||
Clear screen leaving current line at the top.
|
||||
.It Ic ed-redisplay
|
||||
Redisplay everything.
|
||||
.It Ic ed-start-over
|
||||
Erase current line and start from scratch.
|
||||
.It Ic ed-sequence-lead-in
|
||||
First character in a bound sequence.
|
||||
.It Ic ed-prev-history
|
||||
Move to the previous history line.
|
||||
.It Ic ed-next-history
|
||||
Move to the next history line.
|
||||
.It Ic ed-search-prev-history
|
||||
Search previous in history for a line matching the current.
|
||||
.It Ic ed-search-next-history
|
||||
Search next in history for a line matching the current.
|
||||
.It Ic ed-prev-line
|
||||
Move up one line.
|
||||
.It Ic ed-next-line
|
||||
Move down one line.
|
||||
.It Ic ed-command
|
||||
Editline extended command.
|
||||
.El
|
||||
.\" End of section automatically generated with makelist
|
||||
.Sh SEE ALSO
|
||||
.Xr editline 3 ,
|
||||
.Xr regex 3 ,
|
||||
.Xr termcap 5
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm editline
|
||||
library was written by Christos Zoulas,
|
||||
and this manual was written by Luke Mewburn,
|
||||
with some sections inspired by
|
||||
.Xr tcsh 1 .
|
459
lib/libedit/doc/mdoc2man.awk
Normal file
459
lib/libedit/doc/mdoc2man.awk
Normal file
@@ -0,0 +1,459 @@
|
||||
#!/usr/bin/awk
|
||||
#
|
||||
# Version history:
|
||||
# v3, I put the program under a proper license
|
||||
# Dan Nelson <dnelson@allantgroup.com> added .An, .Aq and fixed a typo
|
||||
# v2, fixed to work on GNU awk --posix and MacOS X
|
||||
# v1, first attempt, didn't work on MacOS X
|
||||
#
|
||||
# Copyright (c) 2003 Peter Stuge <stuge-mdoc2man@cdy.org>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
BEGIN {
|
||||
optlist=0
|
||||
oldoptlist=0
|
||||
nospace=0
|
||||
synopsis=0
|
||||
reference=0
|
||||
block=0
|
||||
ext=0
|
||||
extopt=0
|
||||
literal=0
|
||||
prenl=0
|
||||
breakw=0
|
||||
line=""
|
||||
proto=0
|
||||
bl_level=0
|
||||
}
|
||||
|
||||
function wtail() {
|
||||
retval=""
|
||||
while(w<nwords) {
|
||||
if(length(retval))
|
||||
retval=retval OFS
|
||||
retval=retval words[++w]
|
||||
}
|
||||
return retval
|
||||
}
|
||||
|
||||
function add(str) {
|
||||
for(;prenl;prenl--)
|
||||
line=line "\n"
|
||||
line=line str
|
||||
}
|
||||
|
||||
! /^\./ {
|
||||
for(;prenl;prenl--)
|
||||
print ""
|
||||
print
|
||||
if(literal)
|
||||
print ".br"
|
||||
next
|
||||
}
|
||||
|
||||
/^\.\\"/ { next }
|
||||
|
||||
{
|
||||
option=0
|
||||
parens=0
|
||||
angles=0
|
||||
sub("^\\.","")
|
||||
nwords=split($0,words)
|
||||
for(w=1;w<=nwords;w++) {
|
||||
skip=0
|
||||
if(match(words[w],"^Li|Pf$")) {
|
||||
skip=1
|
||||
} else if(match(words[w],"^Xo$")) {
|
||||
skip=1
|
||||
ext=1
|
||||
if(length(line)&&!(match(line," $")||prenl))
|
||||
add(OFS)
|
||||
} else if(match(words[w],"^Xc$")) {
|
||||
skip=1
|
||||
ext=0
|
||||
if(!extopt)
|
||||
prenl++
|
||||
w=nwords
|
||||
} else if(match(words[w],"^Bd$")) {
|
||||
skip=1
|
||||
if(match(words[w+1],"-literal")) {
|
||||
literal=1
|
||||
prenl++
|
||||
w=nwords
|
||||
}
|
||||
} else if(match(words[w],"^Po$")) {
|
||||
skip=1
|
||||
add("(")
|
||||
if(!nospace)
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Pc$")) {
|
||||
skip=1
|
||||
add(")")
|
||||
if(!nospace)
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Ed$")) {
|
||||
skip=1
|
||||
literal=0
|
||||
} else if(match(words[w],"^Ns$")) {
|
||||
skip=1
|
||||
if(!nospace)
|
||||
nospace=1
|
||||
sub(" $","",line)
|
||||
} else if(match(words[w],"^No$")) {
|
||||
skip=1
|
||||
sub(" $","",line)
|
||||
add(words[++w])
|
||||
} else if(match(words[w],"^Dq$")) {
|
||||
skip=1
|
||||
add("``")
|
||||
add(words[++w])
|
||||
while(w<nwords&&!match(words[w+1],"^[\\.,]"))
|
||||
add(OFS words[++w])
|
||||
add("''")
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Va$")) {
|
||||
skip=1
|
||||
add("\\fI" words[++w])
|
||||
while(w<nwords&&!match(words[w+1],"^[\\.,]"))
|
||||
add(OFS words[++w])
|
||||
add("\\fP")
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Sq|Ql$")) {
|
||||
skip=1
|
||||
add("`" words[++w] "'")
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Oo$")) {
|
||||
skip=1
|
||||
extopt=1
|
||||
if(!nospace)
|
||||
nospace=1
|
||||
add("[")
|
||||
} else if(match(words[w],"^Oc$")) {
|
||||
skip=1
|
||||
extopt=0
|
||||
add("]")
|
||||
}
|
||||
if(!skip) {
|
||||
if(!nospace&&length(line)&&!(match(line," $")||prenl))
|
||||
add(OFS)
|
||||
if(nospace==1)
|
||||
nospace=0
|
||||
}
|
||||
if(match(words[w],"^Dd$")) {
|
||||
date=wtail()
|
||||
next
|
||||
} else if(match(words[w],"^Dt$")) {
|
||||
id=wtail()
|
||||
next
|
||||
} else if(match(words[w],"^Os$")) {
|
||||
add(".TH " id " \"" date "\" \"" wtail() "\"")
|
||||
} else if(match(words[w],"^Sh$")) {
|
||||
add(".SH")
|
||||
synopsis=match(words[w+1],"SYNOPSIS")
|
||||
} else if(match(words[w],"^Xr$")) {
|
||||
#add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w])
|
||||
add("\\fB" words[++w] "\\fP(" words[++w] ")")
|
||||
sub("^Ns$", "", words[w+1])
|
||||
add(words[++w])
|
||||
} else if(match(words[w],"^Rs$")) {
|
||||
split("",refauthors)
|
||||
nrefauthors=0
|
||||
reftitle=""
|
||||
refissue=""
|
||||
refdate=""
|
||||
refopt=""
|
||||
reference=1
|
||||
next
|
||||
} else if(match(words[w],"^Re$")) {
|
||||
prenl++
|
||||
for(i=nrefauthors-1;i>0;i--) {
|
||||
add(refauthors[i])
|
||||
if(i>1)
|
||||
add(", ")
|
||||
}
|
||||
if(nrefauthors>1)
|
||||
add(" and ")
|
||||
add(refauthors[0] ", \\fI" reftitle "\\fP")
|
||||
if(length(refissue))
|
||||
add(", " refissue)
|
||||
if(length(refdate))
|
||||
add(", " refdate)
|
||||
if(length(refopt))
|
||||
add(", " refopt)
|
||||
add(".")
|
||||
reference=0
|
||||
} else if(reference) {
|
||||
if(match(words[w],"^%A$")) { refauthors[nrefauthors++]=wtail() }
|
||||
if(match(words[w],"^%T$")) {
|
||||
reftitle=wtail()
|
||||
sub("^\"","",reftitle)
|
||||
sub("\"$","",reftitle)
|
||||
}
|
||||
if(match(words[w],"^%N$")) { refissue=wtail() }
|
||||
if(match(words[w],"^%D$")) { refdate=wtail() }
|
||||
if(match(words[w],"^%O$")) { refopt=wtail() }
|
||||
} else if(match(words[w],"^Nm$")) {
|
||||
if(synopsis) {
|
||||
add(".br")
|
||||
prenl++
|
||||
}
|
||||
n=words[++w]
|
||||
if(!length(name))
|
||||
name=n
|
||||
if(!length(n))
|
||||
n=name
|
||||
add("\\fB" n "\\fP")
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Nd$")) {
|
||||
add("\\- " wtail())
|
||||
} else if(match(words[w],"^Fl$")) {
|
||||
add("\\fB\\-" words[++w] "\\fP")
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Ar$")) {
|
||||
add("\\fI")
|
||||
if(w==nwords)
|
||||
add("file ...\\fP")
|
||||
else {
|
||||
add(words[++w] "\\fP")
|
||||
while(match(words[w+1],"^\\|$"))
|
||||
add(OFS words[++w] " \\fI" words[++w] "\\fP")
|
||||
}
|
||||
if(!nospace&&match(words[w+1],"^[\\.,]"))
|
||||
nospace=1
|
||||
} else if(match(words[w],"^Cm$")) {
|
||||
add("\\fB" words[++w] "\\fP")
|
||||
while(w<nwords&&match(words[w+1],"^[\\.,:;)]"))
|
||||
add(words[++w])
|
||||
} else if(match(words[w],"^Op$")) {
|
||||
option=1
|
||||
if(!nospace)
|
||||
nospace=1
|
||||
add("[")
|
||||
} else if(match(words[w],"^Pp$")) {
|
||||
prenl++
|
||||
} else if(match(words[w],"^An$")) {
|
||||
prenl++
|
||||
} else if(match(words[w],"^Ss$")) {
|
||||
add(".SS")
|
||||
} else if(match(words[w],"^Pa$")&&!option) {
|
||||
add("\\fI")
|
||||
w++
|
||||
if(match(words[w],"^\\."))
|
||||
add("\\&")
|
||||
add(words[w] "\\fP")
|
||||
while(w<nwords&&match(words[w+1],"^[\\.,:;)]"))
|
||||
add(words[++w])
|
||||
} else if(match(words[w],"^Dv$")) {
|
||||
#add(".BR")
|
||||
} else if(match(words[w],"^Em|Ev$")) {
|
||||
add(".IR")
|
||||
} else if(match(words[w],"^Pq$")) {
|
||||
add("(")
|
||||
nospace=1
|
||||
parens=1
|
||||
} else if(match(words[w],"^Aq$")) {
|
||||
add("<")
|
||||
nospace=1
|
||||
angles=1
|
||||
} else if(match(words[w],"^S[xy]$")) {
|
||||
add(".B " wtail())
|
||||
} else if(match(words[w],"^Ic$")) {
|
||||
plain=1
|
||||
add("\\fB")
|
||||
while(w<nwords) {
|
||||
w++
|
||||
if(match(words[w],"^Op$")) {
|
||||
w++
|
||||
add("[")
|
||||
words[nwords]=words[nwords] "]"
|
||||
}
|
||||
if(match(words[w],"^Ar$")) {
|
||||
add("\\fI" words[++w] "\\fP")
|
||||
} else if(match(words[w],"^[\\.,]")) {
|
||||
sub(" $","",line)
|
||||
if(plain) {
|
||||
add("\\fP")
|
||||
plain=0
|
||||
}
|
||||
add(words[w])
|
||||
} else if(match(words[w],"^Xo$")) {
|
||||
} else {
|
||||
if(!plain) {
|
||||
add("\\fB")
|
||||
plain=1
|
||||
}
|
||||
add(words[w])
|
||||
}
|
||||
if(!nospace)
|
||||
add(OFS)
|
||||
}
|
||||
sub(" $","",line)
|
||||
if(plain)
|
||||
add("\\fP")
|
||||
} else if(match(words[w],"^Dl$")) {
|
||||
## remove is ok for editrc.5
|
||||
} else if(match(words[w],"^Bl$")) {
|
||||
++bl_level
|
||||
if (bl_level > 1)
|
||||
add(".RS")
|
||||
oldoptlist=optlist
|
||||
if(match(words[w+1],"-bullet"))
|
||||
optlist=1
|
||||
else if(match(words[w+1],"-enum")) {
|
||||
optlist=2
|
||||
enum=0
|
||||
} else if(match(words[w+1],"-tag"))
|
||||
optlist=3
|
||||
else if(match(words[w+1],"-item"))
|
||||
optlist=4
|
||||
else if(match(words[w+1],"-bullet"))
|
||||
optlist=1
|
||||
w=nwords
|
||||
} else if(match(words[w],"^El$")) {
|
||||
if (bl_level > 1)
|
||||
add(".RE")
|
||||
--bl_level
|
||||
optlist=oldoptlist
|
||||
} else if(match(words[w],"^Bk$")) {
|
||||
if(match(words[w+1],"-words")) {
|
||||
w++
|
||||
breakw=1
|
||||
}
|
||||
} else if(match(words[w],"^Ek$")) {
|
||||
breakw=0
|
||||
} else if(match(words[w],"^It$")&&optlist) {
|
||||
if(optlist==1)
|
||||
add(".IP \\(bu")
|
||||
else if(optlist==2)
|
||||
add(".IP " ++enum ".")
|
||||
else if(optlist==3) {
|
||||
add(".TP")
|
||||
prenl++
|
||||
if(match(words[w+1],"^Pa$|^Ev$")) {
|
||||
add(".B")
|
||||
w++
|
||||
}
|
||||
} else if(optlist==4)
|
||||
add(".IP")
|
||||
} else if(match(words[w],"^Sm$")) {
|
||||
if(match(words[w+1],"off"))
|
||||
nospace=2
|
||||
else if(match(words[w+1],"on"))
|
||||
nospace=0
|
||||
w++
|
||||
} else if(match(words[w],"^Lb$")) {
|
||||
wtail()
|
||||
add("Command Line Editor Library (libedit, -ledit)")
|
||||
} else if(match(words[w],"^In$")) {
|
||||
add(".PP\n")
|
||||
add("\\fB#include <" wtail() ">\\fP")
|
||||
} else if(match(words[w],"^Ft$")) {
|
||||
add(".PP\n")
|
||||
add("\\fI" wtail() "\\fP\n")
|
||||
add(".br")
|
||||
proto=1
|
||||
} else if(match(words[w],"^Fn$")) {
|
||||
add("\\fB" words[++w] "\\fP(")
|
||||
punct=0
|
||||
while(++w<=nwords) {
|
||||
if(match(words[w], "^\".*\"$")) {
|
||||
sub("^\"", "", words[w])
|
||||
sub("\"$", "", words[w])
|
||||
add("\\fI" words[w] "\\fP")
|
||||
if (w!=nwords) {
|
||||
add(", ")
|
||||
}
|
||||
} else if(match(words[w], "^\"")) {
|
||||
sub("^\"", "", words[w])
|
||||
add("\\fI" words[w] " ")
|
||||
} else if (match(words[w], "\"$")) {
|
||||
sub("\"$", "", words[w])
|
||||
add(words[w] "\\fP")
|
||||
if (w!=nwords) {
|
||||
add(", ")
|
||||
}
|
||||
} else {
|
||||
if (w==nwords&&(match(words[w], "^[.,]$"))) {
|
||||
punct=1
|
||||
} else {
|
||||
add(words[w] " ")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
add(")")
|
||||
if (punct==1) {
|
||||
add(words[w-1])
|
||||
} else {
|
||||
if (proto==1) {
|
||||
add(";")
|
||||
proto=0
|
||||
}
|
||||
}
|
||||
} else if(match(words[w],"^Fa$")) {
|
||||
punct=0
|
||||
add("\\fI")
|
||||
while(++w<=nwords) {
|
||||
if(match(words[w], "^\".*\"$")) {
|
||||
sub("^\"", "", words[w])
|
||||
sub("\"$", "", words[w])
|
||||
add(words[w])
|
||||
} else if(match(words[w], "^\"")) {
|
||||
sub("^\"", "", words[w])
|
||||
add(words[w] " ")
|
||||
} else if (match(words[w], "\"$")) {
|
||||
sub("\"$", "", words[w])
|
||||
add(words[w])
|
||||
} else {
|
||||
if (w==nwords&&(match(words[w], "^[.,]$"))) {
|
||||
punct=1
|
||||
} else {
|
||||
if (w+1==nwords&&(match(words[w+1], "^[.,]$"))) {
|
||||
add(words[w])
|
||||
} else {
|
||||
add(words[w] " ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add("\\fP")
|
||||
if (punct==1) {
|
||||
add(words[w-1])
|
||||
}
|
||||
} else if(!skip) {
|
||||
add(words[w])
|
||||
}
|
||||
}
|
||||
if(match(line,"^\\.[^a-zA-Z]"))
|
||||
sub("^\\.","",line)
|
||||
if(parens)
|
||||
add(")")
|
||||
if(angles)
|
||||
add(">")
|
||||
if(option)
|
||||
add("]")
|
||||
if(ext&&!extopt&&!match(line," $"))
|
||||
add(OFS)
|
||||
if(!ext&&!extopt&&length(line)) {
|
||||
print line
|
||||
prenl=0
|
||||
line=""
|
||||
}
|
||||
}
|
14
lib/libedit/examples/Makefile.am
Normal file
14
lib/libedit/examples/Makefile.am
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
LDADD = $(top_builddir)/src/libedit.la
|
||||
AM_CFLAGS = -I$(top_srcdir)/src
|
||||
|
||||
noinst_PROGRAMS = tc1 fileman
|
||||
|
||||
tc1_SOURCES = tc1.c
|
||||
fileman_SOURCES = fileman.c
|
||||
|
||||
if WIDECHAR
|
||||
noinst_PROGRAMS += wtc1
|
||||
wtc1_SOURCES = wtc1.c
|
||||
endif
|
||||
|
496
lib/libedit/examples/fileman.c
Normal file
496
lib/libedit/examples/fileman.c
Normal file
@@ -0,0 +1,496 @@
|
||||
/* fileman.c -- A tiny application which demonstrates how to use the
|
||||
GNU Readline library. This application interactively allows users
|
||||
to manipulate files and their modes.
|
||||
|
||||
NOTE: this was taken from the GNU Readline documentation and ported
|
||||
to libedit. A commad to output the history list was added.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
/* GNU readline
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
*/
|
||||
#include <editline/readline.h>
|
||||
|
||||
void * xmalloc (size_t size);
|
||||
void too_dangerous (char *caller);
|
||||
void initialize_readline ();
|
||||
int execute_line (char *line);
|
||||
int valid_argument (char *caller, char *arg);
|
||||
|
||||
typedef int rl_icpfunc_t (char *);
|
||||
|
||||
/* The names of functions that actually do the manipulation. */
|
||||
int com_list (char *);
|
||||
int com_view (char *);
|
||||
int com_history (char *);
|
||||
int com_rename(char *);
|
||||
int com_stat(char *);
|
||||
int com_pwd(char *);
|
||||
int com_delete(char *);
|
||||
int com_help(char *);
|
||||
int com_cd(char *);
|
||||
int com_quit(char *);
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
|
||||
typedef struct {
|
||||
char *name; /* User printable name of the function. */
|
||||
rl_icpfunc_t *func; /* Function to call to do the job. */
|
||||
char *doc; /* Documentation for this function. */
|
||||
} COMMAND;
|
||||
|
||||
COMMAND commands[] = {
|
||||
{ "cd", com_cd, "Change to directory DIR" },
|
||||
{ "delete", com_delete, "Delete FILE" },
|
||||
{ "help", com_help, "Display this text" },
|
||||
{ "?", com_help, "Synonym for `help'" },
|
||||
{ "list", com_list, "List files in DIR" },
|
||||
{ "ls", com_list, "Synonym for `list'" },
|
||||
{ "pwd", com_pwd, "Print the current working directory" },
|
||||
{ "quit", com_quit, "Quit using Fileman" },
|
||||
{ "rename", com_rename, "Rename FILE to NEWNAME" },
|
||||
{ "stat", com_stat, "Print out statistics on FILE" },
|
||||
{ "view", com_view, "View the contents of FILE" },
|
||||
{ "history", com_history, "List editline history" },
|
||||
{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
char *stripwhite ();
|
||||
COMMAND *find_command ();
|
||||
|
||||
/* The name of this program, as taken from argv[0]. */
|
||||
char *progname;
|
||||
|
||||
/* When non-zero, this means the user is done using this program. */
|
||||
int done;
|
||||
|
||||
char *
|
||||
dupstr (char* s)
|
||||
{
|
||||
char *r;
|
||||
|
||||
r = xmalloc (strlen (s) + 1);
|
||||
strcpy (r, s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
initialize_readline(); /* Bind our completer. */
|
||||
|
||||
stifle_history(7);
|
||||
|
||||
/* Loop reading and executing lines until the user quits. */
|
||||
for ( ; done == 0; )
|
||||
{
|
||||
line = readline ("FileMan: ");
|
||||
|
||||
if (!line)
|
||||
break;
|
||||
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
s = stripwhite(line);
|
||||
|
||||
if (*s) {
|
||||
|
||||
char* expansion;
|
||||
int result;
|
||||
|
||||
result = history_expand(s, &expansion);
|
||||
|
||||
if (result < 0 || result == 2) {
|
||||
fprintf(stderr, "%s\n", expansion);
|
||||
} else {
|
||||
add_history(expansion);
|
||||
execute_line(expansion);
|
||||
}
|
||||
free(expansion);
|
||||
}
|
||||
|
||||
free(line);
|
||||
}
|
||||
exit (0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Execute a command line. */
|
||||
int
|
||||
execute_line (char *line)
|
||||
{
|
||||
register int i;
|
||||
COMMAND *command;
|
||||
char *word;
|
||||
|
||||
/* Isolate the command word. */
|
||||
i = 0;
|
||||
while (line[i] && isspace (line[i]))
|
||||
i++;
|
||||
word = line + i;
|
||||
|
||||
while (line[i] && !isspace (line[i]))
|
||||
i++;
|
||||
|
||||
if (line[i])
|
||||
line[i++] = '\0';
|
||||
|
||||
command = find_command (word);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
fprintf (stderr, "%s: No such command for FileMan.\n", word);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Get argument to command, if any. */
|
||||
while (isspace (line[i]))
|
||||
i++;
|
||||
|
||||
word = line + i;
|
||||
|
||||
/* Call the function. */
|
||||
return ((*(command->func)) (word));
|
||||
}
|
||||
|
||||
/* Look up NAME as the name of a command, and return a pointer to that
|
||||
command. Return a NULL pointer if NAME isn't a command name. */
|
||||
COMMAND *
|
||||
find_command (char *name)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
if (strcmp (name, commands[i].name) == 0)
|
||||
return (&commands[i]);
|
||||
|
||||
return ((COMMAND *)NULL);
|
||||
}
|
||||
|
||||
/* Strip whitespace from the start and end of STRING. Return a pointer
|
||||
into STRING. */
|
||||
char *
|
||||
stripwhite (char *string)
|
||||
{
|
||||
register char *s, *t;
|
||||
|
||||
for (s = string; isspace (*s); s++)
|
||||
;
|
||||
|
||||
if (*s == 0)
|
||||
return (s);
|
||||
|
||||
t = s + strlen (s) - 1;
|
||||
while (t > s && isspace (*t))
|
||||
t--;
|
||||
*++t = '\0';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Interface to Readline Completion */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *command_generator(const char *, int);
|
||||
char **fileman_completion(const char *, int, int);
|
||||
|
||||
/* Tell the GNU Readline library how to complete. We want to try to
|
||||
complete on command names if this is the first word in the line, or
|
||||
on filenames if not. */
|
||||
void
|
||||
initialize_readline ()
|
||||
{
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "FileMan";
|
||||
|
||||
/* Tell the completer that we want a crack first. */
|
||||
rl_attempted_completion_function = fileman_completion;
|
||||
}
|
||||
|
||||
/* Attempt to complete on the contents of TEXT. START and END
|
||||
bound the region of rl_line_buffer that contains the word to
|
||||
complete. TEXT is the word to complete. We can use the entire
|
||||
contents of rl_line_buffer in case we want to do some simple
|
||||
parsing. Returnthe array of matches, or NULL if there aren't any. */
|
||||
char **
|
||||
fileman_completion (const char* text, int start, int end)
|
||||
{
|
||||
char **matches;
|
||||
|
||||
matches = (char **)NULL;
|
||||
|
||||
/* If this word is at the start of the line, then it is a command
|
||||
to complete. Otherwise it is the name of a file in the current
|
||||
directory. */
|
||||
if (start == 0)
|
||||
/* TODO */
|
||||
matches = completion_matches (text, command_generator);
|
||||
/* matches = rl_completion_matches (text, command_generator); */
|
||||
|
||||
return (matches);
|
||||
}
|
||||
|
||||
/* Generator function for command completion. STATE lets us
|
||||
know whether to start from scratch; without any state
|
||||
(i.e. STATE == 0), then we start at the top of the list. */
|
||||
char *
|
||||
command_generator (text, state)
|
||||
const char *text;
|
||||
int state;
|
||||
{
|
||||
static int list_index, len;
|
||||
char *name;
|
||||
|
||||
/* If this is a new word to complete, initialize now. This
|
||||
includes saving the length of TEXT for efficiency, and
|
||||
initializing the index variable to 0. */
|
||||
if (!state)
|
||||
{
|
||||
list_index = 0;
|
||||
len = strlen (text);
|
||||
}
|
||||
|
||||
/* Return the next name which partially matches from the
|
||||
command list. */
|
||||
while (name = commands[list_index].name)
|
||||
{
|
||||
list_index++;
|
||||
|
||||
if (strncmp (name, text, len) == 0)
|
||||
return (dupstr(name));
|
||||
}
|
||||
|
||||
/* If no names matched, then return NULL. */
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* FileMan Commands */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* String to pass to system (). This is for the LIST, VIEW and RENAME
|
||||
commands. */
|
||||
static char syscom[1024];
|
||||
|
||||
/* List the file(s) named in arg. */
|
||||
int
|
||||
com_list (char *arg)
|
||||
{
|
||||
if (!arg)
|
||||
arg = "";
|
||||
|
||||
sprintf (syscom, "ls -FClg %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
int
|
||||
com_view (char *arg)
|
||||
{
|
||||
if (!valid_argument ("view", arg))
|
||||
return 1;
|
||||
|
||||
sprintf (syscom, "more %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
int
|
||||
com_history(char* arg)
|
||||
{
|
||||
HIST_ENTRY *he;
|
||||
|
||||
/* rewind history */
|
||||
while (next_history())
|
||||
;
|
||||
|
||||
for (he = current_history(); he != NULL; he = previous_history()) {
|
||||
//printf("%5d %s\n", *((int*)he->data) - 1, he->line);
|
||||
printf("%s\n", he->line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
com_rename (char *arg)
|
||||
{
|
||||
too_dangerous ("rename");
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
com_stat (char *arg)
|
||||
{
|
||||
struct stat finfo;
|
||||
|
||||
if (!valid_argument ("stat", arg))
|
||||
return (1);
|
||||
|
||||
if (stat (arg, &finfo) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return (1);
|
||||
}
|
||||
|
||||
printf ("Statistics for `%s':\n", arg);
|
||||
|
||||
printf ("%s has %ld link%s, and is %lld byte%s in length.\n", arg,
|
||||
(long) finfo.st_nlink,
|
||||
(finfo.st_nlink == 1) ? "" : "s",
|
||||
(long long) finfo.st_size,
|
||||
(finfo.st_size == 1) ? "" : "s");
|
||||
printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
|
||||
printf (" Last access at: %s", ctime (&finfo.st_atime));
|
||||
printf (" Last modified at: %s", ctime (&finfo.st_mtime));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
com_delete (char *arg)
|
||||
{
|
||||
too_dangerous ("delete");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Print out help for ARG, or for all of the commands if ARG is
|
||||
not present. */
|
||||
int
|
||||
com_help (char *arg)
|
||||
{
|
||||
register int i;
|
||||
int printed = 0;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
if (!*arg || (strcmp (arg, commands[i].name) == 0))
|
||||
{
|
||||
printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
|
||||
printed++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!printed)
|
||||
{
|
||||
printf ("No commands match `%s'. Possibilties are:\n", arg);
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
/* Print in six columns. */
|
||||
if (printed == 6)
|
||||
{
|
||||
printed = 0;
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
printf ("%s\t", commands[i].name);
|
||||
printed++;
|
||||
}
|
||||
|
||||
if (printed)
|
||||
printf ("\n");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Change to the directory ARG. */
|
||||
int
|
||||
com_cd (char *arg)
|
||||
{
|
||||
if (chdir (arg) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
com_pwd ("");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Print out the current working directory. */
|
||||
int
|
||||
com_pwd (char* ignore)
|
||||
{
|
||||
char dir[1024], *s;
|
||||
|
||||
s = (char*)getcwd(dir, sizeof(dir) - 1);
|
||||
if (s == 0)
|
||||
{
|
||||
printf ("Error getting pwd: %s\n", dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("Current directory is %s\n", dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The user wishes to quit using this program. Just set DONE
|
||||
non-zero. */
|
||||
int
|
||||
com_quit (char *arg)
|
||||
{
|
||||
done = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Function which tells you that you can't do this. */
|
||||
void
|
||||
too_dangerous (char *caller)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: Too dangerous for me to distribute.\n",
|
||||
caller);
|
||||
fprintf (stderr, "Write it yourself.\n");
|
||||
}
|
||||
|
||||
/* Return non-zero if ARG is a valid argument for CALLER,
|
||||
else print an error message and return zero. */
|
||||
int
|
||||
valid_argument (char *caller, char *arg)
|
||||
{
|
||||
if (!arg || !*arg)
|
||||
{
|
||||
fprintf (stderr, "%s: Argument required.\n", caller);
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void *
|
||||
xmalloc (size_t size)
|
||||
{
|
||||
register void *value = (void*)malloc(size);
|
||||
if (value == 0)
|
||||
fprintf(stderr, "virtual memory exhausted");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
309
lib/libedit/examples/tc1.c
Normal file
309
lib/libedit/examples/tc1.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/* $NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/* from src/sys/sys/cdefs.h */
|
||||
#ifndef __UNCONST
|
||||
# define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* test.c: A little test program
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "histedit.h"
|
||||
|
||||
static int continuation = 0;
|
||||
volatile sig_atomic_t gotsig = 0;
|
||||
|
||||
static unsigned char complete(EditLine *, int);
|
||||
int main(int, char **);
|
||||
static char *prompt(EditLine *);
|
||||
static void sig(int);
|
||||
|
||||
static char *
|
||||
prompt(EditLine *el)
|
||||
{
|
||||
static char a[] = "\1\033[7m\1Edit$\1\033[0m\1 ";
|
||||
static char b[] = "Edit> ";
|
||||
|
||||
return (continuation ? b : a);
|
||||
}
|
||||
|
||||
static void
|
||||
sig(int i)
|
||||
{
|
||||
gotsig = i;
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
complete(EditLine *el, int ch)
|
||||
{
|
||||
DIR *dd = opendir(".");
|
||||
struct dirent *dp;
|
||||
const char* ptr;
|
||||
const LineInfo *lf = el_line(el);
|
||||
int len;
|
||||
int res = CC_ERROR;
|
||||
|
||||
/*
|
||||
* Find the last word
|
||||
*/
|
||||
for (ptr = lf->cursor - 1;
|
||||
!isspace((unsigned char)*ptr) && ptr > lf->buffer; ptr--)
|
||||
continue;
|
||||
len = lf->cursor - ++ptr;
|
||||
|
||||
for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
|
||||
if (len > strlen(dp->d_name))
|
||||
continue;
|
||||
if (strncmp(dp->d_name, ptr, len) == 0) {
|
||||
if (el_insertstr(el, &dp->d_name[len]) == -1)
|
||||
res = CC_ERROR;
|
||||
else
|
||||
res = CC_REFRESH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dd);
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
EditLine *el = NULL;
|
||||
int num;
|
||||
const char *buf;
|
||||
Tokenizer *tok;
|
||||
#if 0
|
||||
int lastevent = 0;
|
||||
#endif
|
||||
int ncontinuation;
|
||||
History *hist;
|
||||
HistEvent ev;
|
||||
|
||||
(void) setlocale(LC_CTYPE, "");
|
||||
(void) signal(SIGINT, sig);
|
||||
(void) signal(SIGQUIT, sig);
|
||||
(void) signal(SIGHUP, sig);
|
||||
(void) signal(SIGTERM, sig);
|
||||
|
||||
hist = history_init(); /* Init the builtin history */
|
||||
/* Remember 100 events */
|
||||
history(hist, &ev, H_SETSIZE, 100);
|
||||
|
||||
tok = tok_init(NULL); /* Initialize the tokenizer */
|
||||
|
||||
/* Initialize editline */
|
||||
el = el_init(*argv, stdin, stdout, stderr);
|
||||
|
||||
el_set(el, EL_EDITOR, "vi"); /* Default editor is vi */
|
||||
el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */
|
||||
el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */
|
||||
|
||||
/* Tell editline to use this history interface */
|
||||
el_set(el, EL_HIST, history, hist);
|
||||
|
||||
/* Add a user-defined function */
|
||||
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
|
||||
|
||||
/* Bind tab to it */
|
||||
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
|
||||
|
||||
/*
|
||||
* Bind j, k in vi command mode to previous and next line, instead
|
||||
* of previous and next history.
|
||||
*/
|
||||
el_set(el, EL_BIND, "-a", "k", "ed-prev-line", NULL);
|
||||
el_set(el, EL_BIND, "-a", "j", "ed-next-line", NULL);
|
||||
|
||||
/*
|
||||
* Source the user's defaults file.
|
||||
*/
|
||||
el_source(el, NULL);
|
||||
|
||||
while ((buf = el_gets(el, &num)) != NULL && num != 0) {
|
||||
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, " > li `%.*s_%.*s'\n",
|
||||
(li->cursor - li->buffer), li->buffer,
|
||||
(li->lastchar - 1 - li->cursor),
|
||||
(li->cursor >= li->lastchar) ? "" : li->cursor);
|
||||
|
||||
#endif
|
||||
if (gotsig) {
|
||||
(void) fprintf(stderr, "Got signal %d.\n", gotsig);
|
||||
gotsig = 0;
|
||||
el_reset(el);
|
||||
}
|
||||
|
||||
if (!continuation && num == 1)
|
||||
continue;
|
||||
|
||||
ac = cc = co = 0;
|
||||
ncontinuation = tok_line(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) {
|
||||
/*
|
||||
* Append to the right event in case the user
|
||||
* moved around in history.
|
||||
*/
|
||||
if (history(hist, &ev, H_SET, lastevent) == -1)
|
||||
err(1, "%d: %s", lastevent, ev.str);
|
||||
history(hist, &ev, H_ADD , buf);
|
||||
} else {
|
||||
history(hist, &ev, H_ENTER, buf);
|
||||
lastevent = ev.num;
|
||||
}
|
||||
#else
|
||||
/* Simpler */
|
||||
history(hist, &ev, continuation ? H_APPEND : H_ENTER, buf);
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
switch (ac) {
|
||||
case 1:
|
||||
for (rv = history(hist, &ev, H_LAST); rv != -1;
|
||||
rv = history(hist, &ev, H_PREV))
|
||||
(void) fprintf(stdout, "%4d %s",
|
||||
ev.num, ev.str);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (strcmp(av[1], "clear") == 0)
|
||||
history(hist, &ev, H_CLEAR);
|
||||
else
|
||||
goto badhist;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (strcmp(av[1], "load") == 0)
|
||||
history(hist, &ev, H_LOAD, av[2]);
|
||||
else if (strcmp(av[1], "save") == 0)
|
||||
history(hist, &ev, H_SAVE, av[2]);
|
||||
break;
|
||||
|
||||
badhist:
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
"Bad history arguments\n");
|
||||
break;
|
||||
}
|
||||
} else if (el_parse(el, ac, av) == -1) {
|
||||
switch (fork()) {
|
||||
case 0:
|
||||
execvp(av[0], (char *const *)__UNCONST(av));
|
||||
perror(av[0]);
|
||||
_exit(1);
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
|
||||
case -1:
|
||||
perror("fork");
|
||||
break;
|
||||
|
||||
default:
|
||||
if (wait(&num) == -1)
|
||||
perror("wait");
|
||||
(void) fprintf(stderr, "Exit %x\n", num);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tok_reset(tok);
|
||||
}
|
||||
|
||||
el_end(el);
|
||||
tok_end(tok);
|
||||
history_end(hist);
|
||||
|
||||
return (0);
|
||||
}
|
269
lib/libedit/examples/wtc1.c
Normal file
269
lib/libedit/examples/wtc1.c
Normal file
@@ -0,0 +1,269 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <histedit.h>
|
||||
|
||||
|
||||
static int continuation;
|
||||
volatile sig_atomic_t gotsig;
|
||||
|
||||
static wchar_t *
|
||||
prompt(EditLine *el)
|
||||
{
|
||||
static wchar_t a[] = L"\1\033[7m\1Edit$\1\033[0m\1 ";
|
||||
static wchar_t b[] = L"Edit> ";
|
||||
|
||||
return continuation ? b : a;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sig(int i)
|
||||
{
|
||||
gotsig = i;
|
||||
}
|
||||
|
||||
const char *
|
||||
my_wcstombs(const wchar_t *wstr)
|
||||
{
|
||||
static struct {
|
||||
char *str;
|
||||
int len;
|
||||
} buf;
|
||||
|
||||
int needed = wcstombs(0, wstr, 0) + 1;
|
||||
if (needed > buf.len) {
|
||||
buf.str = malloc(needed);
|
||||
buf.len = needed;
|
||||
}
|
||||
wcstombs(buf.str, wstr, needed);
|
||||
buf.str[needed - 1] = 0;
|
||||
|
||||
return buf.str;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char
|
||||
complete(EditLine *el, int ch)
|
||||
{
|
||||
DIR *dd = opendir(".");
|
||||
struct dirent *dp;
|
||||
const wchar_t *ptr;
|
||||
char *buf, *bptr;
|
||||
const LineInfoW *lf = el_wline(el);
|
||||
int len, mblen, i;
|
||||
unsigned char res;
|
||||
|
||||
/* Find the last word */
|
||||
for (ptr = lf->cursor -1; !iswspace(*ptr) && ptr > lf->buffer; --ptr)
|
||||
continue;
|
||||
len = lf->cursor - ++ptr;
|
||||
|
||||
/* Convert last word to multibyte encoding, so we can compare to it */
|
||||
wctomb(NULL, 0); /* Reset shift state */
|
||||
mblen = MB_LEN_MAX * len + 1;
|
||||
buf = bptr =(char *)malloc(mblen);
|
||||
for (i = 0; i < len; ++i) {
|
||||
/* Note: really should test for -1 return from wctomb */
|
||||
bptr += wctomb(bptr, ptr[i]);
|
||||
}
|
||||
*bptr = 0; /* Terminate multibyte string */
|
||||
mblen = bptr - buf;
|
||||
|
||||
/* Scan directory for matching name */
|
||||
for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
|
||||
if (mblen > strlen(dp->d_name))
|
||||
continue;
|
||||
if (strncmp(dp->d_name, buf, mblen) == 0) {
|
||||
if (el_insertstr(el, &dp->d_name[mblen]) == -1)
|
||||
res = CC_ERROR;
|
||||
else
|
||||
res = CC_REFRESH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dd);
|
||||
free(buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
EditLine *el = NULL;
|
||||
int numc, ncontinuation;
|
||||
const wchar_t *line;
|
||||
TokenizerW *tok;
|
||||
HistoryW *hist;
|
||||
HistEventW ev;
|
||||
#ifdef DEBUG
|
||||
int i;
|
||||
#endif
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
(void)signal(SIGINT, sig);
|
||||
(void)signal(SIGQUIT, sig);
|
||||
(void)signal(SIGHUP, sig);
|
||||
(void)signal(SIGTERM, sig);
|
||||
|
||||
hist = history_winit(); /* Init built-in history */
|
||||
history_w(hist, &ev, H_SETSIZE, 100); /* Remember 100 events */
|
||||
|
||||
tok = tok_winit(NULL); /* Init the tokenizer */
|
||||
|
||||
el = el_init(argv[0], stdin, stdout, stderr);
|
||||
|
||||
el_wset(el, EL_EDITOR, L"vi"); /* Default editor is vi */
|
||||
el_wset(el, EL_SIGNAL, 1); /* Handle signals gracefully */
|
||||
el_wset(el, EL_PROMPT_ESC, prompt, '\1'); /* Set the prompt function */
|
||||
|
||||
el_wset(el, EL_HIST, history_w, hist); /* FIXME - history_w? */
|
||||
|
||||
/* Add a user-defined function */
|
||||
el_wset(el, EL_ADDFN, L"ed-complete", L"Complete argument", complete);
|
||||
|
||||
/* Bind <tab> to it */
|
||||
el_wset(el, EL_BIND, L"^I", L"ed-complete", NULL);
|
||||
|
||||
/*
|
||||
* Bind j, k in vi command mode to previous and next line, instead
|
||||
* of previous and next history.
|
||||
*/
|
||||
el_wset(el, EL_BIND, L"-a", L"k", L"ed-prev-line", NULL);
|
||||
el_wset(el, EL_BIND, L"-a", L"j", L"ed-next-line", NULL);
|
||||
|
||||
/* Source the user's defaults file. */
|
||||
el_source(el, NULL);
|
||||
|
||||
while((line = el_wgets(el, &numc)) != NULL && numc != 0) {
|
||||
int ac, cc, co, rc;
|
||||
const wchar_t **av;
|
||||
|
||||
const LineInfoW *li;
|
||||
li = el_wline(el);
|
||||
|
||||
#ifdef DEBUG
|
||||
(void)fwprintf(stderr, L"==> got %d %ls", numc, line);
|
||||
(void)fwprintf(stderr, L" > li `%.*ls_%.*ls'\n",
|
||||
(li->cursor - li->buffer), li->buffer,
|
||||
(li->lastchar - 1 - li->cursor),
|
||||
(li->cursor >= li->lastchar) ? L"" : li->cursor);
|
||||
#endif
|
||||
|
||||
if (gotsig) {
|
||||
(void)fprintf(stderr, "Got signal %d.\n", gotsig);
|
||||
gotsig = 0;
|
||||
el_reset(el);
|
||||
}
|
||||
|
||||
if(!continuation && numc == 1)
|
||||
continue; /* Only got a linefeed */
|
||||
|
||||
ac = cc = co = 0;
|
||||
ncontinuation = tok_wline(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
|
||||
history_w(hist, &ev, continuation ? H_APPEND : H_ENTER, line);
|
||||
|
||||
continuation = ncontinuation;
|
||||
ncontinuation = 0;
|
||||
if(continuation)
|
||||
continue;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; i < ac; ++i) {
|
||||
(void)fwprintf(stderr, L" > arg# %2d ", i);
|
||||
if (i != cc)
|
||||
(void)fwprintf(stderr, L"`%ls'\n", av[i]);
|
||||
else
|
||||
(void)fwprintf(stderr, L"`%.*ls_%ls'\n",
|
||||
co, av[i], av[i] + co);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wcscmp (av[0], L"history") == 0) {
|
||||
switch(ac) {
|
||||
case 1:
|
||||
for(rc = history_w(hist, &ev, H_LAST);
|
||||
rc != -1;
|
||||
rc = history_w(hist, &ev, H_PREV))
|
||||
(void)fwprintf(stdout, L"%4d %ls",
|
||||
ev.num, ev.str);
|
||||
break;
|
||||
case 2:
|
||||
if (wcscmp(av[1], L"clear") == 0)
|
||||
history_w(hist, &ev, H_CLEAR);
|
||||
else
|
||||
goto badhist;
|
||||
break;
|
||||
case 3:
|
||||
if (wcscmp(av[1], L"load") == 0)
|
||||
history_w(hist, &ev, H_LOAD,
|
||||
my_wcstombs(av[2]));
|
||||
else if (wcscmp(av[1], L"save") == 0)
|
||||
history_w(hist, &ev, H_SAVE,
|
||||
my_wcstombs(av[2]));
|
||||
else
|
||||
goto badhist;
|
||||
break;
|
||||
badhist:
|
||||
default:
|
||||
(void)fprintf(stderr,
|
||||
"Bad history arguments\n");
|
||||
break;
|
||||
}
|
||||
} else if (el_wparse(el, ac, av) == -1) {
|
||||
switch (fork()) {
|
||||
case 0: {
|
||||
Tokenizer *ntok = tok_init(NULL);
|
||||
int nargc;
|
||||
const char **nav;
|
||||
tok_str(ntok, my_wcstombs(line), &nargc, &nav);
|
||||
execvp(nav[0],(char **)nav);
|
||||
perror(nav[0]);
|
||||
_exit(1);
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
case -1:
|
||||
perror("fork");
|
||||
break;
|
||||
default:
|
||||
if (wait(&rc) == -1)
|
||||
perror("wait");
|
||||
(void)fprintf(stderr, "Exit %x\n", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tok_wreset(tok);
|
||||
}
|
||||
|
||||
el_end(el);
|
||||
tok_wend(tok);
|
||||
history_wend(hist);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
lib/libedit/libedit.pc.in
Normal file
12
lib/libedit/libedit.pc.in
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libedit
|
||||
Description: command line editor library provides generic line editing, history, and tokenization functions.
|
||||
Version: @VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -ledit @LIBS@
|
||||
Cflags: -I${includedir} -I${includedir}/editline
|
||||
|
9636
lib/libedit/ltmain.sh
Executable file
9636
lib/libedit/ltmain.sh
Executable file
File diff suppressed because it is too large
Load Diff
58
lib/libedit/src/Makefile.am
Normal file
58
lib/libedit/src/Makefile.am
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c
|
||||
if WIDECHAR
|
||||
BUILT_SOURCES += tokenizern.c historyn.c
|
||||
endif
|
||||
|
||||
AHDR= vi.h emacs.h common.h
|
||||
ASRC= $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
|
||||
|
||||
vi.h: Makefile $(srcdir)/vi.c
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -h $(srcdir)/vi.c > $@
|
||||
|
||||
emacs.h: Makefile $(srcdir)/emacs.c
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -h $(srcdir)/emacs.c > $@
|
||||
|
||||
common.h: Makefile $(srcdir)/common.c
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -h $(srcdir)/common.c > $@
|
||||
|
||||
fcns.h: Makefile $(AHDR)
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -fh $(AHDR) > $@
|
||||
|
||||
help.h: Makefile $(ASRC)
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -bh $(ASRC) > $@
|
||||
|
||||
fcns.c: Makefile $(AHDR)
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -fc $(AHDR) > $@
|
||||
|
||||
help.c: Makefile $(ASRC)
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -bc $(ASRC) > $@
|
||||
|
||||
tokenizern.c: Makefile $(srcdir)/tokenizer.c
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -n $(srcdir)/tokenizer.c > $@
|
||||
|
||||
historyn.c: Makefile $(srcdir)/history.c
|
||||
AWK=$(AWK) sh $(srcdir)/makelist -n $(srcdir)/history.c > $@
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
lib_LTLIBRARIES = libheimedit.la
|
||||
libheimedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c chartype.c parse.c \
|
||||
prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \
|
||||
fgetln.c strlcat.c strlcpy.c unvis.c vis.c wcsdup.c tokenizer.c \
|
||||
history.c filecomplete.c readline.c chared.h el.h hist.h \
|
||||
histedit.h key.h map.h chartype.h parse.h prompt.h read.h refresh.h \
|
||||
search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \
|
||||
editline/readline.h
|
||||
if WIDECHAR
|
||||
libheimedit_la_SOURCES += eln.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = makelist shlib_version
|
||||
#nobase_include_HEADERS = histedit.h editline/readline.h
|
||||
EXTRA_DIST += histedit.h editline/readline.h
|
||||
|
||||
nodist_libheimedit_la_SOURCES = $(BUILT_SOURCES)
|
||||
|
||||
libheimedit_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION)
|
||||
|
796
lib/libedit/src/chared.c
Normal file
796
lib/libedit/src/chared.c
Normal file
@@ -0,0 +1,796 @@
|
||||
/* $NetBSD: chared.c,v 1.29 2010/08/28 15:44:59 christos 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: chared.c,v 1.29 2010/08/28 15:44:59 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* chared.c: Character editor utilities
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include "el.h"
|
||||
|
||||
private void ch__clearmacro (EditLine *);
|
||||
|
||||
/* value to leave unused in line buffer */
|
||||
#define EL_LEAVE 2
|
||||
|
||||
/* cv_undo():
|
||||
* Handle state for the vi undo command
|
||||
*/
|
||||
protected void
|
||||
cv_undo(EditLine *el)
|
||||
{
|
||||
c_undo_t *vu = &el->el_chared.c_undo;
|
||||
c_redo_t *r = &el->el_chared.c_redo;
|
||||
size_t size;
|
||||
|
||||
/* Save entire line for undo */
|
||||
size = el->el_line.lastchar - el->el_line.buffer;
|
||||
vu->len = size;
|
||||
vu->cursor = (int)(el->el_line.cursor - el->el_line.buffer);
|
||||
(void)memcpy(vu->buf, el->el_line.buffer, size * sizeof(*vu->buf));
|
||||
|
||||
/* save command info for redo */
|
||||
r->count = el->el_state.doingarg ? el->el_state.argument : 0;
|
||||
r->action = el->el_chared.c_vcmd.action;
|
||||
r->pos = r->buf;
|
||||
r->cmd = el->el_state.thiscmd;
|
||||
r->ch = el->el_state.thisch;
|
||||
}
|
||||
|
||||
/* cv_yank():
|
||||
* Save yank/delete data for paste
|
||||
*/
|
||||
protected void
|
||||
cv_yank(EditLine *el, const Char *ptr, int size)
|
||||
{
|
||||
c_kill_t *k = &el->el_chared.c_kill;
|
||||
|
||||
(void)memcpy(k->buf, ptr, size * sizeof(*k->buf));
|
||||
k->last = k->buf + size;
|
||||
}
|
||||
|
||||
|
||||
/* c_insert():
|
||||
* Insert num characters
|
||||
*/
|
||||
protected void
|
||||
c_insert(EditLine *el, int num)
|
||||
{
|
||||
Char *cp;
|
||||
|
||||
if (el->el_line.lastchar + num >= el->el_line.limit) {
|
||||
if (!ch_enlargebufs(el, (size_t)num))
|
||||
return; /* can't go past end of buffer */
|
||||
}
|
||||
|
||||
if (el->el_line.cursor < el->el_line.lastchar) {
|
||||
/* if I must move chars */
|
||||
for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--)
|
||||
cp[num] = *cp;
|
||||
}
|
||||
el->el_line.lastchar += num;
|
||||
}
|
||||
|
||||
|
||||
/* c_delafter():
|
||||
* Delete num characters after the cursor
|
||||
*/
|
||||
protected void
|
||||
c_delafter(EditLine *el, int num)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor + num > el->el_line.lastchar)
|
||||
num = (int)(el->el_line.lastchar - el->el_line.cursor);
|
||||
|
||||
if (el->el_map.current != el->el_map.emacs) {
|
||||
cv_undo(el);
|
||||
cv_yank(el, el->el_line.cursor, num);
|
||||
}
|
||||
|
||||
if (num > 0) {
|
||||
Char *cp;
|
||||
|
||||
for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
|
||||
*cp = cp[num];
|
||||
|
||||
el->el_line.lastchar -= num;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* c_delafter1():
|
||||
* Delete the character after the cursor, do not yank
|
||||
*/
|
||||
protected void
|
||||
c_delafter1(EditLine *el)
|
||||
{
|
||||
Char *cp;
|
||||
|
||||
for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
|
||||
*cp = cp[1];
|
||||
|
||||
el->el_line.lastchar--;
|
||||
}
|
||||
|
||||
|
||||
/* c_delbefore():
|
||||
* Delete num characters before the cursor
|
||||
*/
|
||||
protected void
|
||||
c_delbefore(EditLine *el, int num)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor - num < el->el_line.buffer)
|
||||
num = (int)(el->el_line.cursor - el->el_line.buffer);
|
||||
|
||||
if (el->el_map.current != el->el_map.emacs) {
|
||||
cv_undo(el);
|
||||
cv_yank(el, el->el_line.cursor - num, num);
|
||||
}
|
||||
|
||||
if (num > 0) {
|
||||
Char *cp;
|
||||
|
||||
for (cp = el->el_line.cursor - num;
|
||||
cp <= el->el_line.lastchar;
|
||||
cp++)
|
||||
*cp = cp[num];
|
||||
|
||||
el->el_line.lastchar -= num;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* c_delbefore1():
|
||||
* Delete the character before the cursor, do not yank
|
||||
*/
|
||||
protected void
|
||||
c_delbefore1(EditLine *el)
|
||||
{
|
||||
Char *cp;
|
||||
|
||||
for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++)
|
||||
*cp = cp[1];
|
||||
|
||||
el->el_line.lastchar--;
|
||||
}
|
||||
|
||||
|
||||
/* ce__isword():
|
||||
* Return if p is part of a word according to emacs
|
||||
*/
|
||||
protected int
|
||||
ce__isword(Int p)
|
||||
{
|
||||
return (Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL);
|
||||
}
|
||||
|
||||
|
||||
/* cv__isword():
|
||||
* Return if p is part of a word according to vi
|
||||
*/
|
||||
protected int
|
||||
cv__isword(Int p)
|
||||
{
|
||||
if (Isalnum(p) || p == '_')
|
||||
return 1;
|
||||
if (Isgraph(p))
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* cv__isWord():
|
||||
* Return if p is part of a big word according to vi
|
||||
*/
|
||||
protected int
|
||||
cv__isWord(Int p)
|
||||
{
|
||||
return (!Isspace(p));
|
||||
}
|
||||
|
||||
|
||||
/* c__prev_word():
|
||||
* Find the previous word
|
||||
*/
|
||||
protected Char *
|
||||
c__prev_word(Char *p, Char *low, int n, int (*wtest)(Int))
|
||||
{
|
||||
p--;
|
||||
|
||||
while (n--) {
|
||||
while ((p >= low) && !(*wtest)(*p))
|
||||
p--;
|
||||
while ((p >= low) && (*wtest)(*p))
|
||||
p--;
|
||||
}
|
||||
|
||||
/* cp now points to one character before the word */
|
||||
p++;
|
||||
if (p < low)
|
||||
p = low;
|
||||
/* cp now points where we want it */
|
||||
return (p);
|
||||
}
|
||||
|
||||
|
||||
/* c__next_word():
|
||||
* Find the next word
|
||||
*/
|
||||
protected Char *
|
||||
c__next_word(Char *p, Char *high, int n, int (*wtest)(Int))
|
||||
{
|
||||
while (n--) {
|
||||
while ((p < high) && !(*wtest)(*p))
|
||||
p++;
|
||||
while ((p < high) && (*wtest)(*p))
|
||||
p++;
|
||||
}
|
||||
if (p > high)
|
||||
p = high;
|
||||
/* p now points where we want it */
|
||||
return (p);
|
||||
}
|
||||
|
||||
/* cv_next_word():
|
||||
* Find the next word vi style
|
||||
*/
|
||||
protected Char *
|
||||
cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(Int))
|
||||
{
|
||||
int test;
|
||||
|
||||
while (n--) {
|
||||
test = (*wtest)(*p);
|
||||
while ((p < high) && (*wtest)(*p) == test)
|
||||
p++;
|
||||
/*
|
||||
* vi historically deletes with cw only the word preserving the
|
||||
* trailing whitespace! This is not what 'w' does..
|
||||
*/
|
||||
if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT))
|
||||
while ((p < high) && Isspace(*p))
|
||||
p++;
|
||||
}
|
||||
|
||||
/* p now points where we want it */
|
||||
if (p > high)
|
||||
return (high);
|
||||
else
|
||||
return (p);
|
||||
}
|
||||
|
||||
|
||||
/* cv_prev_word():
|
||||
* Find the previous word vi style
|
||||
*/
|
||||
protected Char *
|
||||
cv_prev_word(Char *p, Char *low, int n, int (*wtest)(Int))
|
||||
{
|
||||
int test;
|
||||
|
||||
p--;
|
||||
while (n--) {
|
||||
while ((p > low) && Isspace(*p))
|
||||
p--;
|
||||
test = (*wtest)(*p);
|
||||
while ((p >= low) && (*wtest)(*p) == test)
|
||||
p--;
|
||||
}
|
||||
p++;
|
||||
|
||||
/* p now points where we want it */
|
||||
if (p < low)
|
||||
return (low);
|
||||
else
|
||||
return (p);
|
||||
}
|
||||
|
||||
|
||||
#ifdef notdef
|
||||
/* c__number():
|
||||
* Ignore character p points to, return number appearing after that.
|
||||
* A '$' by itself means a big number; "$-" is for negative; '^' means 1.
|
||||
* Return p pointing to last char used.
|
||||
*/
|
||||
protected Char *
|
||||
c__number(
|
||||
Char *p, /* character position */
|
||||
int *num, /* Return value */
|
||||
int dval) /* dval is the number to subtract from like $-3 */
|
||||
{
|
||||
int i;
|
||||
int sign = 1;
|
||||
|
||||
if (*++p == '^') {
|
||||
*num = 1;
|
||||
return (p);
|
||||
}
|
||||
if (*p == '$') {
|
||||
if (*++p != '-') {
|
||||
*num = 0x7fffffff; /* Handle $ */
|
||||
return (--p);
|
||||
}
|
||||
sign = -1; /* Handle $- */
|
||||
++p;
|
||||
}
|
||||
/* XXX: this assumes ASCII compatible digits */
|
||||
for (i = 0; Isdigit(*p); i = 10 * i + *p++ - '0')
|
||||
continue;
|
||||
*num = (sign < 0 ? dval - i : i);
|
||||
return (--p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* cv_delfini():
|
||||
* Finish vi delete action
|
||||
*/
|
||||
protected void
|
||||
cv_delfini(EditLine *el)
|
||||
{
|
||||
int size;
|
||||
int action = el->el_chared.c_vcmd.action;
|
||||
|
||||
if (action & INSERT)
|
||||
el->el_map.current = el->el_map.key;
|
||||
|
||||
if (el->el_chared.c_vcmd.pos == 0)
|
||||
/* sanity */
|
||||
return;
|
||||
|
||||
size = (int)(el->el_line.cursor - el->el_chared.c_vcmd.pos);
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
el->el_line.cursor = el->el_chared.c_vcmd.pos;
|
||||
if (action & YANK) {
|
||||
if (size > 0)
|
||||
cv_yank(el, el->el_line.cursor, size);
|
||||
else
|
||||
cv_yank(el, el->el_line.cursor + size, -size);
|
||||
} else {
|
||||
if (size > 0) {
|
||||
c_delafter(el, size);
|
||||
re_refresh_cursor(el);
|
||||
} else {
|
||||
c_delbefore(el, -size);
|
||||
el->el_line.cursor += size;
|
||||
}
|
||||
}
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
}
|
||||
|
||||
|
||||
#ifdef notdef
|
||||
/* ce__endword():
|
||||
* Go to the end of this word according to emacs
|
||||
*/
|
||||
protected Char *
|
||||
ce__endword(Char *p, Char *high, int n)
|
||||
{
|
||||
p++;
|
||||
|
||||
while (n--) {
|
||||
while ((p < high) && Isspace(*p))
|
||||
p++;
|
||||
while ((p < high) && !Isspace(*p))
|
||||
p++;
|
||||
}
|
||||
|
||||
p--;
|
||||
return (p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* cv__endword():
|
||||
* Go to the end of this word according to vi
|
||||
*/
|
||||
protected Char *
|
||||
cv__endword(Char *p, Char *high, int n, int (*wtest)(Int))
|
||||
{
|
||||
int test;
|
||||
|
||||
p++;
|
||||
|
||||
while (n--) {
|
||||
while ((p < high) && Isspace(*p))
|
||||
p++;
|
||||
|
||||
test = (*wtest)(*p);
|
||||
while ((p < high) && (*wtest)(*p) == test)
|
||||
p++;
|
||||
}
|
||||
p--;
|
||||
return (p);
|
||||
}
|
||||
|
||||
/* ch_init():
|
||||
* Initialize the character editor
|
||||
*/
|
||||
protected int
|
||||
ch_init(EditLine *el)
|
||||
{
|
||||
c_macro_t *ma = &el->el_chared.c_macro;
|
||||
|
||||
el->el_line.buffer = el_malloc(EL_BUFSIZ *
|
||||
sizeof(*el->el_line.buffer));
|
||||
if (el->el_line.buffer == NULL)
|
||||
return (-1);
|
||||
|
||||
(void) memset(el->el_line.buffer, 0, EL_BUFSIZ *
|
||||
sizeof(*el->el_line.buffer));
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE];
|
||||
|
||||
el->el_chared.c_undo.buf = el_malloc(EL_BUFSIZ *
|
||||
sizeof(*el->el_chared.c_undo.buf));
|
||||
if (el->el_chared.c_undo.buf == NULL)
|
||||
return (-1);
|
||||
(void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ *
|
||||
sizeof(*el->el_chared.c_undo.buf));
|
||||
el->el_chared.c_undo.len = -1;
|
||||
el->el_chared.c_undo.cursor = 0;
|
||||
el->el_chared.c_redo.buf = el_malloc(EL_BUFSIZ *
|
||||
sizeof(*el->el_chared.c_redo.buf));
|
||||
if (el->el_chared.c_redo.buf == NULL)
|
||||
return (-1);
|
||||
el->el_chared.c_redo.pos = el->el_chared.c_redo.buf;
|
||||
el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ;
|
||||
el->el_chared.c_redo.cmd = ED_UNASSIGNED;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_vcmd.pos = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_kill.buf = el_malloc(EL_BUFSIZ *
|
||||
sizeof(*el->el_chared.c_kill.buf));
|
||||
if (el->el_chared.c_kill.buf == NULL)
|
||||
return (-1);
|
||||
(void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ *
|
||||
sizeof(*el->el_chared.c_kill.buf));
|
||||
el->el_chared.c_kill.mark = el->el_line.buffer;
|
||||
el->el_chared.c_kill.last = el->el_chared.c_kill.buf;
|
||||
el->el_chared.c_resizefun = NULL;
|
||||
el->el_chared.c_resizearg = NULL;
|
||||
|
||||
el->el_map.current = el->el_map.key;
|
||||
|
||||
el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */
|
||||
el->el_state.doingarg = 0;
|
||||
el->el_state.metanext = 0;
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.lastcmd = ED_UNASSIGNED;
|
||||
|
||||
ma->level = -1;
|
||||
ma->offset = 0;
|
||||
ma->macro = el_malloc(EL_MAXMACRO * sizeof(*ma->macro));
|
||||
if (ma->macro == NULL)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ch_reset():
|
||||
* Reset the character editor
|
||||
*/
|
||||
protected void
|
||||
ch_reset(EditLine *el, int mclear)
|
||||
{
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_undo.len = -1;
|
||||
el->el_chared.c_undo.cursor = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_vcmd.pos = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_kill.mark = el->el_line.buffer;
|
||||
|
||||
el->el_map.current = el->el_map.key;
|
||||
|
||||
el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */
|
||||
el->el_state.doingarg = 0;
|
||||
el->el_state.metanext = 0;
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.lastcmd = ED_UNASSIGNED;
|
||||
|
||||
el->el_history.eventno = 0;
|
||||
|
||||
if (mclear)
|
||||
ch__clearmacro(el);
|
||||
}
|
||||
|
||||
private void
|
||||
ch__clearmacro(EditLine *el)
|
||||
{
|
||||
c_macro_t *ma = &el->el_chared.c_macro;
|
||||
while (ma->level >= 0)
|
||||
el_free((ptr_t)ma->macro[ma->level--]);
|
||||
}
|
||||
|
||||
/* ch_enlargebufs():
|
||||
* Enlarge line buffer to be able to hold twice as much characters.
|
||||
* Returns 1 if successful, 0 if not.
|
||||
*/
|
||||
protected int
|
||||
ch_enlargebufs(EditLine *el, size_t addlen)
|
||||
{
|
||||
size_t sz, newsz;
|
||||
Char *newbuffer, *oldbuf, *oldkbuf;
|
||||
|
||||
sz = el->el_line.limit - el->el_line.buffer + EL_LEAVE;
|
||||
newsz = sz * 2;
|
||||
/*
|
||||
* If newly required length is longer than current buffer, we need
|
||||
* to make the buffer big enough to hold both old and new stuff.
|
||||
*/
|
||||
if (addlen > sz) {
|
||||
while(newsz - sz < addlen)
|
||||
newsz *= 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reallocate line buffer.
|
||||
*/
|
||||
newbuffer = el_realloc(el->el_line.buffer, newsz * sizeof(*newbuffer));
|
||||
if (!newbuffer)
|
||||
return 0;
|
||||
|
||||
/* zero the newly added memory, leave old data in */
|
||||
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
|
||||
|
||||
oldbuf = el->el_line.buffer;
|
||||
|
||||
el->el_line.buffer = newbuffer;
|
||||
el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf);
|
||||
el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf);
|
||||
/* don't set new size until all buffers are enlarged */
|
||||
el->el_line.limit = &newbuffer[sz - EL_LEAVE];
|
||||
|
||||
/*
|
||||
* Reallocate kill buffer.
|
||||
*/
|
||||
newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz * sizeof(*newbuffer));
|
||||
if (!newbuffer)
|
||||
return 0;
|
||||
|
||||
/* zero the newly added memory, leave old data in */
|
||||
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
|
||||
|
||||
oldkbuf = el->el_chared.c_kill.buf;
|
||||
|
||||
el->el_chared.c_kill.buf = newbuffer;
|
||||
el->el_chared.c_kill.last = newbuffer +
|
||||
(el->el_chared.c_kill.last - oldkbuf);
|
||||
el->el_chared.c_kill.mark = el->el_line.buffer +
|
||||
(el->el_chared.c_kill.mark - oldbuf);
|
||||
|
||||
/*
|
||||
* Reallocate undo buffer.
|
||||
*/
|
||||
newbuffer = el_realloc(el->el_chared.c_undo.buf,
|
||||
newsz * sizeof(*newbuffer));
|
||||
if (!newbuffer)
|
||||
return 0;
|
||||
|
||||
/* zero the newly added memory, leave old data in */
|
||||
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
|
||||
el->el_chared.c_undo.buf = newbuffer;
|
||||
|
||||
newbuffer = el_realloc(el->el_chared.c_redo.buf,
|
||||
newsz * sizeof(*newbuffer));
|
||||
if (!newbuffer)
|
||||
return 0;
|
||||
el->el_chared.c_redo.pos = newbuffer +
|
||||
(el->el_chared.c_redo.pos - el->el_chared.c_redo.buf);
|
||||
el->el_chared.c_redo.lim = newbuffer +
|
||||
(el->el_chared.c_redo.lim - el->el_chared.c_redo.buf);
|
||||
el->el_chared.c_redo.buf = newbuffer;
|
||||
|
||||
if (!hist_enlargebuf(el, sz, newsz))
|
||||
return 0;
|
||||
|
||||
/* Safe to set enlarged buffer size */
|
||||
el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE];
|
||||
if (el->el_chared.c_resizefun)
|
||||
(*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ch_end():
|
||||
* Free the data structures used by the editor
|
||||
*/
|
||||
protected void
|
||||
ch_end(EditLine *el)
|
||||
{
|
||||
el_free((ptr_t) el->el_line.buffer);
|
||||
el->el_line.buffer = NULL;
|
||||
el->el_line.limit = NULL;
|
||||
el_free((ptr_t) el->el_chared.c_undo.buf);
|
||||
el->el_chared.c_undo.buf = NULL;
|
||||
el_free((ptr_t) el->el_chared.c_redo.buf);
|
||||
el->el_chared.c_redo.buf = NULL;
|
||||
el->el_chared.c_redo.pos = NULL;
|
||||
el->el_chared.c_redo.lim = NULL;
|
||||
el->el_chared.c_redo.cmd = ED_UNASSIGNED;
|
||||
el_free((ptr_t) el->el_chared.c_kill.buf);
|
||||
el->el_chared.c_kill.buf = NULL;
|
||||
ch_reset(el, 1);
|
||||
el_free((ptr_t) el->el_chared.c_macro.macro);
|
||||
el->el_chared.c_macro.macro = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* el_insertstr():
|
||||
* Insert string at cursorI
|
||||
*/
|
||||
public int
|
||||
FUN(el,insertstr)(EditLine *el, const Char *s)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if ((len = Strlen(s)) == 0)
|
||||
return (-1);
|
||||
if (el->el_line.lastchar + len >= el->el_line.limit) {
|
||||
if (!ch_enlargebufs(el, len))
|
||||
return (-1);
|
||||
}
|
||||
|
||||
c_insert(el, (int)len);
|
||||
while (*s)
|
||||
*el->el_line.cursor++ = *s++;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* el_deletestr():
|
||||
* Delete num characters before the cursor
|
||||
*/
|
||||
public void
|
||||
el_deletestr(EditLine *el, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return;
|
||||
|
||||
if (el->el_line.cursor < &el->el_line.buffer[n])
|
||||
return;
|
||||
|
||||
c_delbefore(el, n); /* delete before dot */
|
||||
el->el_line.cursor -= n;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
}
|
||||
|
||||
/* c_gets():
|
||||
* Get a string
|
||||
*/
|
||||
protected int
|
||||
c_gets(EditLine *el, Char *buf, const Char *prompt)
|
||||
{
|
||||
Char ch;
|
||||
ssize_t len;
|
||||
Char *cp = el->el_line.buffer;
|
||||
|
||||
if (prompt) {
|
||||
len = Strlen(prompt);
|
||||
(void)memcpy(cp, prompt, len * sizeof(*cp));
|
||||
cp += len;
|
||||
}
|
||||
len = 0;
|
||||
|
||||
for (;;) {
|
||||
el->el_line.cursor = cp;
|
||||
*cp = ' ';
|
||||
el->el_line.lastchar = cp + 1;
|
||||
re_refresh(el);
|
||||
|
||||
if (FUN(el,getc)(el, &ch) != 1) {
|
||||
ed_end_of_file(el, 0);
|
||||
len = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
|
||||
case 0010: /* Delete and backspace */
|
||||
case 0177:
|
||||
if (len == 0) {
|
||||
len = -1;
|
||||
break;
|
||||
}
|
||||
cp--;
|
||||
continue;
|
||||
|
||||
case 0033: /* ESC */
|
||||
case '\r': /* Newline */
|
||||
case '\n':
|
||||
buf[len] = ch;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (len >= EL_BUFSIZ - 16)
|
||||
term_beep(el);
|
||||
else {
|
||||
buf[len++] = ch;
|
||||
*cp++ = ch;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
return (int)len;
|
||||
}
|
||||
|
||||
|
||||
/* c_hpos():
|
||||
* Return the current horizontal position of the cursor
|
||||
*/
|
||||
protected int
|
||||
c_hpos(EditLine *el)
|
||||
{
|
||||
Char *ptr;
|
||||
|
||||
/*
|
||||
* Find how many characters till the beginning of this line.
|
||||
*/
|
||||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return (0);
|
||||
else {
|
||||
for (ptr = el->el_line.cursor - 1;
|
||||
ptr >= el->el_line.buffer && *ptr != '\n';
|
||||
ptr--)
|
||||
continue;
|
||||
return (int)(el->el_line.cursor - ptr - 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected int
|
||||
ch_resizefun(EditLine *el, el_zfunc_t f, void *a)
|
||||
{
|
||||
el->el_chared.c_resizefun = f;
|
||||
el->el_chared.c_resizearg = a;
|
||||
return 0;
|
||||
}
|
171
lib/libedit/src/chared.h
Normal file
171
lib/libedit/src/chared.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/* $NetBSD: chared.h,v 1.21 2010/08/28 15:44:59 christos 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.
|
||||
*
|
||||
* @(#)chared.h 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* el.chared.h: Character editor interface
|
||||
*/
|
||||
#ifndef _h_el_chared
|
||||
#define _h_el_chared
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "histedit.h"
|
||||
|
||||
#define EL_MAXMACRO 10
|
||||
|
||||
/*
|
||||
* This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works
|
||||
* like real vi: i.e. the transition from command<->insert modes moves
|
||||
* the cursor.
|
||||
*
|
||||
* On the other hand we really don't want to move the cursor, because
|
||||
* all the editing commands don't include the character under the cursor.
|
||||
* Probably the best fix is to make all the editing commands aware of
|
||||
* this fact.
|
||||
*/
|
||||
#define VI_MOVE
|
||||
|
||||
|
||||
typedef struct c_macro_t {
|
||||
int level;
|
||||
int offset;
|
||||
Char **macro;
|
||||
} c_macro_t;
|
||||
|
||||
/*
|
||||
* Undo information for vi - no undo in emacs (yet)
|
||||
*/
|
||||
typedef struct c_undo_t {
|
||||
ssize_t len; /* length of saved line */
|
||||
int cursor; /* position of saved cursor */
|
||||
Char *buf; /* full saved text */
|
||||
} c_undo_t;
|
||||
|
||||
/* redo for vi */
|
||||
typedef struct c_redo_t {
|
||||
Char *buf; /* redo insert key sequence */
|
||||
Char *pos;
|
||||
Char *lim;
|
||||
el_action_t cmd; /* command to redo */
|
||||
Char ch; /* char that invoked it */
|
||||
int count;
|
||||
int action; /* from cv_action() */
|
||||
} c_redo_t;
|
||||
|
||||
/*
|
||||
* Current action information for vi
|
||||
*/
|
||||
typedef struct c_vcmd_t {
|
||||
int action;
|
||||
Char *pos;
|
||||
} c_vcmd_t;
|
||||
|
||||
/*
|
||||
* Kill buffer for emacs
|
||||
*/
|
||||
typedef struct c_kill_t {
|
||||
Char *buf;
|
||||
Char *last;
|
||||
Char *mark;
|
||||
} c_kill_t;
|
||||
|
||||
typedef void (*el_zfunc_t)(EditLine *, void *);
|
||||
|
||||
/*
|
||||
* Note that we use both data structures because the user can bind
|
||||
* commands from both editors!
|
||||
*/
|
||||
typedef struct el_chared_t {
|
||||
c_undo_t c_undo;
|
||||
c_kill_t c_kill;
|
||||
c_redo_t c_redo;
|
||||
c_vcmd_t c_vcmd;
|
||||
c_macro_t c_macro;
|
||||
el_zfunc_t c_resizefun;
|
||||
void * c_resizearg;
|
||||
} el_chared_t;
|
||||
|
||||
|
||||
#define STRQQ "\"\""
|
||||
|
||||
#define isglob(a) (strchr("*[]?", (a)) != NULL)
|
||||
|
||||
#define NOP 0x00
|
||||
#define DELETE 0x01
|
||||
#define INSERT 0x02
|
||||
#define YANK 0x04
|
||||
|
||||
#define CHAR_FWD (+1)
|
||||
#define CHAR_BACK (-1)
|
||||
|
||||
#define MODE_INSERT 0
|
||||
#define MODE_REPLACE 1
|
||||
#define MODE_REPLACE_1 2
|
||||
|
||||
#include "common.h"
|
||||
#include "vi.h"
|
||||
#include "emacs.h"
|
||||
#include "search.h"
|
||||
#include "fcns.h"
|
||||
|
||||
|
||||
protected int cv__isword(Int);
|
||||
protected int cv__isWord(Int);
|
||||
protected void cv_delfini(EditLine *);
|
||||
protected Char *cv__endword(Char *, Char *, int, int (*)(Int));
|
||||
protected int ce__isword(Int);
|
||||
protected void cv_undo(EditLine *);
|
||||
protected void cv_yank(EditLine *, const Char *, int);
|
||||
protected Char *cv_next_word(EditLine*, Char *, Char *, int, int (*)(Int));
|
||||
protected Char *cv_prev_word(Char *, Char *, int, int (*)(Int));
|
||||
protected Char *c__next_word(Char *, Char *, int, int (*)(Int));
|
||||
protected Char *c__prev_word(Char *, Char *, int, int (*)(Int));
|
||||
protected void c_insert(EditLine *, int);
|
||||
protected void c_delbefore(EditLine *, int);
|
||||
protected void c_delbefore1(EditLine *);
|
||||
protected void c_delafter(EditLine *, int);
|
||||
protected void c_delafter1(EditLine *);
|
||||
protected int c_gets(EditLine *, Char *, const Char *);
|
||||
protected int c_hpos(EditLine *);
|
||||
|
||||
protected int ch_init(EditLine *);
|
||||
protected void ch_reset(EditLine *, int);
|
||||
protected int ch_resizefun(EditLine *, el_zfunc_t, void *);
|
||||
protected int ch_enlargebufs(EditLine *, size_t);
|
||||
protected void ch_end(EditLine *);
|
||||
|
||||
#endif /* _h_el_chared */
|
360
lib/libedit/src/chartype.c
Normal file
360
lib/libedit/src/chartype.c
Normal file
@@ -0,0 +1,360 @@
|
||||
/* $NetBSD: chartype.c,v 1.4 2010/04/15 00:55:57 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* chartype.c: character classification and meta information
|
||||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: chartype.c,v 1.4 2010/04/15 00:55:57 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
#include "el.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CT_BUFSIZ 1024
|
||||
|
||||
#ifdef WIDECHAR
|
||||
protected void
|
||||
ct_conv_buff_resize(ct_buffer_t *conv, size_t mincsize, size_t minwsize)
|
||||
{
|
||||
void *p;
|
||||
if (mincsize > conv->csize) {
|
||||
conv->csize = mincsize;
|
||||
p = el_realloc(conv->cbuff, conv->csize);
|
||||
if (p == NULL) {
|
||||
conv->csize = 0;
|
||||
el_free(conv->cbuff);
|
||||
conv->cbuff = NULL;
|
||||
} else
|
||||
conv->cbuff = p;
|
||||
}
|
||||
|
||||
if (minwsize > conv->wsize) {
|
||||
conv->wsize = minwsize;
|
||||
p = el_realloc(conv->wbuff, conv->wsize);
|
||||
if (p == NULL) {
|
||||
conv->wsize = 0;
|
||||
el_free(conv->wbuff);
|
||||
conv->wbuff = NULL;
|
||||
} else
|
||||
conv->wbuff = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public char *
|
||||
ct_encode_string(const Char *s, ct_buffer_t *conv)
|
||||
{
|
||||
char *dst;
|
||||
ssize_t used = 0;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
if (!conv->cbuff)
|
||||
ct_conv_buff_resize(conv, CT_BUFSIZ, 0);
|
||||
if (!conv->cbuff)
|
||||
return NULL;
|
||||
|
||||
dst = conv->cbuff;
|
||||
while (*s) {
|
||||
used = ct_encode_char(dst, (int)(conv->csize -
|
||||
(dst - conv->cbuff)), *s);
|
||||
if (used == -1) { /* failed to encode, need more buffer space */
|
||||
used = dst - conv->cbuff;
|
||||
ct_conv_buff_resize(conv, conv->csize + CT_BUFSIZ, 0);
|
||||
if (!conv->cbuff)
|
||||
return NULL;
|
||||
dst = conv->cbuff + used;
|
||||
/* don't increment s here - we want to retry it! */
|
||||
}
|
||||
else
|
||||
++s;
|
||||
dst += used;
|
||||
}
|
||||
if (dst >= (conv->cbuff + conv->csize)) {
|
||||
used = dst - conv->cbuff;
|
||||
ct_conv_buff_resize(conv, conv->csize + 1, 0);
|
||||
if (!conv->cbuff)
|
||||
return NULL;
|
||||
dst = conv->cbuff + used;
|
||||
}
|
||||
*dst = '\0';
|
||||
return conv->cbuff;
|
||||
}
|
||||
|
||||
public Char *
|
||||
ct_decode_string(const char *s, ct_buffer_t *conv)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
if (!conv->wbuff)
|
||||
ct_conv_buff_resize(conv, 0, CT_BUFSIZ);
|
||||
if (!conv->wbuff)
|
||||
return NULL;
|
||||
|
||||
len = ct_mbstowcs(0, s, 0);
|
||||
if (len > conv->wsize)
|
||||
ct_conv_buff_resize(conv, 0, len + 1);
|
||||
if (!conv->wbuff)
|
||||
return NULL;
|
||||
ct_mbstowcs(conv->wbuff, s, conv->wsize);
|
||||
return conv->wbuff;
|
||||
}
|
||||
|
||||
|
||||
protected Char **
|
||||
ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
|
||||
{
|
||||
size_t bufspace;
|
||||
int i;
|
||||
Char *p;
|
||||
Char **wargv;
|
||||
ssize_t bytes;
|
||||
|
||||
/* Make sure we have enough space in the conversion buffer to store all
|
||||
* the argv strings. */
|
||||
for (i = 0, bufspace = 0; i < argc; ++i)
|
||||
bufspace += argv[i] ? strlen(argv[i]) + 1 : 0;
|
||||
ct_conv_buff_resize(conv, 0, bufspace);
|
||||
if (!conv->wsize)
|
||||
return NULL;
|
||||
|
||||
wargv = el_malloc(argc * sizeof(*wargv));
|
||||
|
||||
for (i = 0, p = conv->wbuff; i < argc; ++i) {
|
||||
if (!argv[i]) { /* don't pass null pointers to mbstowcs */
|
||||
wargv[i] = NULL;
|
||||
continue;
|
||||
} else {
|
||||
wargv[i] = p;
|
||||
bytes = mbstowcs(p, argv[i], bufspace);
|
||||
}
|
||||
if (bytes == -1) {
|
||||
el_free(wargv);
|
||||
return NULL;
|
||||
} else
|
||||
bytes++; /* include '\0' in the count */
|
||||
bufspace -= bytes;
|
||||
p += bytes;
|
||||
}
|
||||
|
||||
return wargv;
|
||||
}
|
||||
|
||||
|
||||
protected size_t
|
||||
ct_enc_width(Char c)
|
||||
{
|
||||
/* UTF-8 encoding specific values */
|
||||
if (c < 0x80)
|
||||
return 1;
|
||||
else if (c < 0x0800)
|
||||
return 2;
|
||||
else if (c < 0x10000)
|
||||
return 3;
|
||||
else if (c < 0x110000)
|
||||
return 4;
|
||||
else
|
||||
return 0; /* not a valid codepoint */
|
||||
}
|
||||
|
||||
protected ssize_t
|
||||
ct_encode_char(char *dst, size_t len, Char c)
|
||||
{
|
||||
ssize_t l = 0;
|
||||
if (len < ct_enc_width(c))
|
||||
return -1;
|
||||
l = ct_wctomb(dst, c);
|
||||
|
||||
if (l < 0) {
|
||||
ct_wctomb_reset;
|
||||
l = 0;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected const Char *
|
||||
ct_visual_string(const Char *s)
|
||||
{
|
||||
static Char *buff = NULL;
|
||||
static size_t buffsize = 0;
|
||||
void *p;
|
||||
Char *dst;
|
||||
ssize_t used = 0;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
if (!buff) {
|
||||
buffsize = CT_BUFSIZ;
|
||||
buff = el_malloc(buffsize * sizeof(*buff));
|
||||
}
|
||||
dst = buff;
|
||||
while (*s) {
|
||||
used = ct_visual_char(dst, buffsize - (dst - buff), *s);
|
||||
if (used == -1) { /* failed to encode, need more buffer space */
|
||||
used = dst - buff;
|
||||
buffsize += CT_BUFSIZ;
|
||||
p = el_realloc(buff, buffsize * sizeof(*buff));
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
buff = p;
|
||||
dst = buff + used;
|
||||
/* don't increment s here - we want to retry it! */
|
||||
}
|
||||
else
|
||||
++s;
|
||||
dst += used;
|
||||
}
|
||||
if (dst >= (buff + buffsize)) { /* sigh */
|
||||
buffsize += 1;
|
||||
p = el_realloc(buff, buffsize * sizeof(*buff));
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
buff = p;
|
||||
dst = buff + buffsize - 1;
|
||||
}
|
||||
*dst = 0;
|
||||
return buff;
|
||||
out:
|
||||
el_free(buff);
|
||||
buffsize = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected int
|
||||
ct_visual_width(Char c)
|
||||
{
|
||||
int t = ct_chr_class(c);
|
||||
switch (t) {
|
||||
case CHTYPE_ASCIICTL:
|
||||
return 2; /* ^@ ^? etc. */
|
||||
case CHTYPE_TAB:
|
||||
return 1; /* Hmm, this really need to be handled outside! */
|
||||
case CHTYPE_NL:
|
||||
return 0; /* Should this be 1 instead? */
|
||||
#ifdef WIDECHAR
|
||||
case CHTYPE_PRINT:
|
||||
return wcwidth(c);
|
||||
case CHTYPE_NONPRINT:
|
||||
if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */
|
||||
return 8; /* \U+12345 */
|
||||
else
|
||||
return 7; /* \U+1234 */
|
||||
#else
|
||||
case CHTYPE_PRINT:
|
||||
return 1;
|
||||
case CHTYPE_NONPRINT:
|
||||
return 4; /* \123 */
|
||||
#endif
|
||||
default:
|
||||
return 0; /* should not happen */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected ssize_t
|
||||
ct_visual_char(Char *dst, size_t len, Char c)
|
||||
{
|
||||
int t = ct_chr_class(c);
|
||||
switch (t) {
|
||||
case CHTYPE_TAB:
|
||||
case CHTYPE_NL:
|
||||
case CHTYPE_ASCIICTL:
|
||||
if (len < 2)
|
||||
return -1; /* insufficient space */
|
||||
*dst++ = '^';
|
||||
if (c == '\177')
|
||||
*dst = '?'; /* DEL -> ^? */
|
||||
else
|
||||
*dst = c | 0100; /* uncontrolify it */
|
||||
return 2;
|
||||
case CHTYPE_PRINT:
|
||||
if (len < 1)
|
||||
return -1; /* insufficient space */
|
||||
*dst = c;
|
||||
return 1;
|
||||
case CHTYPE_NONPRINT:
|
||||
/* we only use single-width glyphs for display,
|
||||
* so this is right */
|
||||
if ((ssize_t)len < ct_visual_width(c))
|
||||
return -1; /* insufficient space */
|
||||
#ifdef WIDECHAR
|
||||
*dst++ = '\\';
|
||||
*dst++ = 'U';
|
||||
*dst++ = '+';
|
||||
#define tohexdigit(v) "0123456789ABCDEF"[v]
|
||||
if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */
|
||||
*dst++ = tohexdigit(((unsigned int) c >> 16) & 0xf);
|
||||
*dst++ = tohexdigit(((unsigned int) c >> 12) & 0xf);
|
||||
*dst++ = tohexdigit(((unsigned int) c >> 8) & 0xf);
|
||||
*dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf);
|
||||
*dst = tohexdigit(((unsigned int) c ) & 0xf);
|
||||
return (c > 0xffff) ? 8 : 7;
|
||||
#else
|
||||
*dst++ = '\\';
|
||||
#define tooctaldigit(v) ((v) + '0')
|
||||
*dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7);
|
||||
*dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7);
|
||||
*dst++ = tooctaldigit(((unsigned int) c ) & 0x7);
|
||||
#endif
|
||||
/*FALLTHROUGH*/
|
||||
/* these two should be handled outside this function */
|
||||
default: /* we should never hit the default */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected int
|
||||
ct_chr_class(Char c)
|
||||
{
|
||||
if (c == '\t')
|
||||
return CHTYPE_TAB;
|
||||
else if (c == '\n')
|
||||
return CHTYPE_NL;
|
||||
else if (IsASCII(c) && Iscntrl(c))
|
||||
return CHTYPE_ASCIICTL;
|
||||
else if (Isprint(c))
|
||||
return CHTYPE_PRINT;
|
||||
else
|
||||
return CHTYPE_NONPRINT;
|
||||
}
|
249
lib/libedit/src/chartype.h
Normal file
249
lib/libedit/src/chartype.h
Normal file
@@ -0,0 +1,249 @@
|
||||
/* $NetBSD: chartype.h,v 1.7 2010/12/16 17:42:28 wiz Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
#ifndef _h_chartype_f
|
||||
#define _h_chartype_f
|
||||
|
||||
|
||||
|
||||
#ifdef WIDECHAR
|
||||
|
||||
/* Ideally we should also test the value of the define to see if it
|
||||
* supports non-BMP code points without requiring UTF-16, but nothing
|
||||
* seems to actually advertise this properly, despite Unicode 3.1 having
|
||||
* been around since 2001... */
|
||||
#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
#ifndef __STDC_ISO_10646__
|
||||
/* In many places it is assumed that the first 127 code points are ASCII
|
||||
* compatible, so ensure wchar_t indeed does ISO 10646 and not some other
|
||||
* funky encoding that could break us in weird and wonderful ways. */
|
||||
#error wchar_t must store ISO 10646 characters
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Oh for a <uchar.h> with char32_t and __STDC_UTF_32__ in it...
|
||||
* ref: ISO/IEC DTR 19769
|
||||
*/
|
||||
#if WCHAR_MAX < INT32_MAX
|
||||
#warning Build environment does not support non-BMP characters
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSDUP
|
||||
wchar_t *wcsdup(const wchar_t *s);
|
||||
#endif
|
||||
|
||||
#define ct_mbtowc mbtowc
|
||||
#define ct_mbtowc_reset mbtowc(0,0,0)
|
||||
#define ct_wctomb wctomb
|
||||
#define ct_wctomb_reset wctomb(0,0)
|
||||
#define ct_wcstombs wcstombs
|
||||
#define ct_mbstowcs mbstowcs
|
||||
|
||||
#define Char wchar_t
|
||||
#define Int wint_t
|
||||
#define FUN(prefix,rest) prefix ## _w ## rest
|
||||
#define FUNW(type) type ## _w
|
||||
#define TYPE(type) type ## W
|
||||
#define FSTR "%ls"
|
||||
#define STR(x) L ## x
|
||||
#define UC(c) c
|
||||
#define Isalpha(x) iswalpha(x)
|
||||
#define Isalnum(x) iswalnum(x)
|
||||
#define Isgraph(x) iswgraph(x)
|
||||
#define Isspace(x) iswspace(x)
|
||||
#define Isdigit(x) iswdigit(x)
|
||||
#define Iscntrl(x) iswcntrl(x)
|
||||
#define Isprint(x) iswprint(x)
|
||||
|
||||
#define Isupper(x) iswupper(x)
|
||||
#define Islower(x) iswlower(x)
|
||||
#define Toupper(x) towupper(x)
|
||||
#define Tolower(x) towlower(x)
|
||||
|
||||
#define IsASCII(x) (x < 0x100)
|
||||
|
||||
#define Strlen(x) wcslen(x)
|
||||
#define Strchr(s,c) wcschr(s,c)
|
||||
#define Strrchr(s,c) wcsrchr(s,c)
|
||||
#define Strstr(s,v) wcsstr(s,v)
|
||||
#define Strdup(x) wcsdup(x)
|
||||
#define Strcpy(d,s) wcscpy(d,s)
|
||||
#define Strncpy(d,s,n) wcsncpy(d,s,n)
|
||||
#define Strncat(d,s,n) wcsncat(d,s,n)
|
||||
|
||||
#define Strcmp(s,v) wcscmp(s,v)
|
||||
#define Strncmp(s,v,n) wcsncmp(s,v,n)
|
||||
#define Strcspn(s,r) wcscspn(s,r)
|
||||
|
||||
#define Strtol(p,e,b) wcstol(p,e,b)
|
||||
|
||||
#define Width(c) wcwidth(c)
|
||||
|
||||
#else /* NARROW */
|
||||
|
||||
#define ct_mbtowc error
|
||||
#define ct_mbtowc_reset
|
||||
#define ct_wctomb error
|
||||
#define ct_wctomb_reset
|
||||
#define ct_wcstombs(a, b, c) (strncpy(a, b, c), strlen(a))
|
||||
#define ct_mbstowcs(a, b, c) (strncpy(a, b, c), strlen(a))
|
||||
|
||||
#define Char char
|
||||
#define Int int
|
||||
#define FUN(prefix,rest) prefix ## _ ## rest
|
||||
#define FUNW(type) type
|
||||
#define TYPE(type) type
|
||||
#define FSTR "%s"
|
||||
#define STR(x) x
|
||||
#define UC(c) (unsigned char)(c)
|
||||
|
||||
#define Isalpha(x) isalpha((unsigned char)x)
|
||||
#define Isalnum(x) isalnum((unsigned char)x)
|
||||
#define Isgraph(x) isgraph((unsigned char)x)
|
||||
#define Isspace(x) isspace((unsigned char)x)
|
||||
#define Isdigit(x) isdigit((unsigned char)x)
|
||||
#define Iscntrl(x) iscntrl((unsigned char)x)
|
||||
#define Isprint(x) isprint((unsigned char)x)
|
||||
|
||||
#define Isupper(x) isupper((unsigned char)x)
|
||||
#define Islower(x) islower((unsigned char)x)
|
||||
#define Toupper(x) toupper((unsigned char)x)
|
||||
#define Tolower(x) tolower((unsigned char)x)
|
||||
|
||||
#define IsASCII(x) isascii((unsigned char)x)
|
||||
|
||||
#define Strlen(x) strlen(x)
|
||||
#define Strchr(s,c) strchr(s,c)
|
||||
#define Strrchr(s,c) strrchr(s,c)
|
||||
#define Strstr(s,v) strstr(s,v)
|
||||
#define Strdup(x) strdup(x)
|
||||
#define Strcpy(d,s) strcpy(d,s)
|
||||
#define Strncpy(d,s,n) strncpy(d,s,n)
|
||||
#define Strncat(d,s,n) strncat(d,s,n)
|
||||
|
||||
#define Strcmp(s,v) strcmp(s,v)
|
||||
#define Strncmp(s,v,n) strncmp(s,v,n)
|
||||
#define Strcspn(s,r) strcspn(s,r)
|
||||
|
||||
#define Strtol(p,e,b) strtol(p,e,b)
|
||||
|
||||
#define Width(c) 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIDECHAR
|
||||
/*
|
||||
* Conversion buffer
|
||||
*/
|
||||
typedef struct ct_buffer_t {
|
||||
char *cbuff;
|
||||
size_t csize;
|
||||
Char *wbuff;
|
||||
size_t wsize;
|
||||
} ct_buffer_t;
|
||||
|
||||
#define ct_encode_string __ct_encode_string
|
||||
/* Encode a wide-character string and return the UTF-8 encoded result. */
|
||||
public char *ct_encode_string(const Char *, ct_buffer_t *);
|
||||
|
||||
#define ct_decode_string __ct_decode_string
|
||||
/* Decode a (multi)?byte string and return the wide-character string result. */
|
||||
public Char *ct_decode_string(const char *, ct_buffer_t *);
|
||||
|
||||
/* Decode a (multi)?byte argv string array.
|
||||
* The pointer returned must be free()d when done. */
|
||||
protected Char **ct_decode_argv(int, const char *[], ct_buffer_t *);
|
||||
|
||||
/* Resizes the conversion buffer(s) if needed. */
|
||||
protected void ct_conv_buff_resize(ct_buffer_t *, size_t, size_t);
|
||||
protected ssize_t ct_encode_char(char *, size_t, Char);
|
||||
protected size_t ct_enc_width(Char);
|
||||
|
||||
#define ct_free_argv(s) el_free(s)
|
||||
|
||||
#else
|
||||
#define ct_encode_string(s, b) (s)
|
||||
#define ct_decode_string(s, b) (s)
|
||||
#define ct_decode_argv(l, s, b) (s)
|
||||
#define ct_conv_buff_resize(b, os, ns)
|
||||
#define ct_encode_char(d, l, s) (*d = s, 1)
|
||||
#define ct_free_argv(s)
|
||||
#endif
|
||||
|
||||
#ifndef NARROWCHAR
|
||||
/* Encode a characted into the destination buffer, provided there is sufficent
|
||||
* buffer space available. Returns the number of bytes used up (zero if the
|
||||
* character cannot be encoded, -1 if there was not enough space available). */
|
||||
|
||||
/* The maximum buffer size to hold the most unwieldly visual representation,
|
||||
* in this case \U+nnnnn. */
|
||||
#define VISUAL_WIDTH_MAX 8
|
||||
|
||||
/* The terminal is thought of in terms of X columns by Y lines. In the cases
|
||||
* where a wide character takes up more than one column, the adjacent
|
||||
* occupied column entries will contain this faux character. */
|
||||
#define MB_FILL_CHAR ((Char)-1)
|
||||
|
||||
/* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn
|
||||
* style visual expansions. */
|
||||
protected int ct_visual_width(Char);
|
||||
|
||||
/* Turn the given character into the appropriate visual format, matching
|
||||
* the width given by ct_visual_width(). Returns the number of characters used
|
||||
* up, or -1 if insufficient space. Buffer length is in count of Char's. */
|
||||
protected ssize_t ct_visual_char(Char *, size_t, Char);
|
||||
|
||||
/* Convert the given string into visual format, using the ct_visual_char()
|
||||
* function. Uses a static buffer, so not threadsafe. */
|
||||
protected const Char *ct_visual_string(const Char *);
|
||||
|
||||
|
||||
/* printable character, use ct_visual_width() to find out display width */
|
||||
#define CHTYPE_PRINT ( 0)
|
||||
/* control character found inside the ASCII portion of the charset */
|
||||
#define CHTYPE_ASCIICTL (-1)
|
||||
/* a \t */
|
||||
#define CHTYPE_TAB (-2)
|
||||
/* a \n */
|
||||
#define CHTYPE_NL (-3)
|
||||
/* non-printable character */
|
||||
#define CHTYPE_NONPRINT (-4)
|
||||
/* classification of character c, as one of the above defines */
|
||||
protected int ct_chr_class(Char c);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _chartype_f */
|
921
lib/libedit/src/common.c
Normal file
921
lib/libedit/src/common.c
Normal file
@@ -0,0 +1,921 @@
|
||||
/* $NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* common.c: Common Editor functions
|
||||
*/
|
||||
#include "el.h"
|
||||
|
||||
/* ed_end_of_file():
|
||||
* Indicate end of file
|
||||
* [^D]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar = '\0';
|
||||
return (CC_EOF);
|
||||
}
|
||||
|
||||
|
||||
/* ed_insert():
|
||||
* Add character to the line
|
||||
* Insert a character [bound to all insert keys]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_insert(EditLine *el, Int c)
|
||||
{
|
||||
int count = el->el_state.argument;
|
||||
|
||||
if (c == '\0')
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_line.lastchar + el->el_state.argument >=
|
||||
el->el_line.limit) {
|
||||
/* end of buffer space, try to allocate more */
|
||||
if (!ch_enlargebufs(el, (size_t) count))
|
||||
return CC_ERROR; /* error allocating more */
|
||||
}
|
||||
|
||||
if (count == 1) {
|
||||
if (el->el_state.inputmode == MODE_INSERT
|
||||
|| el->el_line.cursor >= el->el_line.lastchar)
|
||||
c_insert(el, 1);
|
||||
|
||||
*el->el_line.cursor++ = c;
|
||||
re_fastaddc(el); /* fast refresh for one char. */
|
||||
} else {
|
||||
if (el->el_state.inputmode != MODE_REPLACE_1)
|
||||
c_insert(el, el->el_state.argument);
|
||||
|
||||
while (count-- && el->el_line.cursor < el->el_line.lastchar)
|
||||
*el->el_line.cursor++ = c;
|
||||
re_refresh(el);
|
||||
}
|
||||
|
||||
if (el->el_state.inputmode == MODE_REPLACE_1)
|
||||
return vi_command_mode(el, 0);
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_delete_prev_word():
|
||||
* Delete from beginning of current word to cursor
|
||||
* [M-^?] [^W]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char *cp, *p, *kp;
|
||||
|
||||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
|
||||
cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
|
||||
el->el_state.argument, ce__isword);
|
||||
|
||||
for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++)
|
||||
*kp++ = *p;
|
||||
el->el_chared.c_kill.last = kp;
|
||||
|
||||
c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
|
||||
el->el_line.cursor = cp;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer; /* bounds check */
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_delete_next_char():
|
||||
* Delete character under cursor
|
||||
* [^D] [x]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_next_char(EditLine *el, Int c)
|
||||
{
|
||||
#ifdef notdef /* XXX */
|
||||
#define EL el->el_line
|
||||
(void) fprintf(el->el_errlfile,
|
||||
"\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n",
|
||||
EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar,
|
||||
EL.lastchar, EL.limit, EL.limit);
|
||||
#endif
|
||||
if (el->el_line.cursor == el->el_line.lastchar) {
|
||||
/* if I'm at the end */
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
if (el->el_line.cursor == el->el_line.buffer) {
|
||||
/* if I'm also at the beginning */
|
||||
#ifdef KSHVI
|
||||
return (CC_ERROR);
|
||||
#else
|
||||
/* then do an EOF */
|
||||
term_writec(el, c);
|
||||
return (CC_EOF);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef KSHVI
|
||||
el->el_line.cursor--;
|
||||
#else
|
||||
return (CC_ERROR);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (el->el_line.cursor != el->el_line.buffer)
|
||||
el->el_line.cursor--;
|
||||
else
|
||||
return (CC_ERROR);
|
||||
}
|
||||
}
|
||||
c_delafter(el, el->el_state.argument); /* delete after dot */
|
||||
if (el->el_line.cursor >= el->el_line.lastchar &&
|
||||
el->el_line.cursor > el->el_line.buffer)
|
||||
/* bounds check */
|
||||
el->el_line.cursor = el->el_line.lastchar - 1;
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_kill_line():
|
||||
* Cut to the end of line
|
||||
* [^K] [^K]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char *kp, *cp;
|
||||
|
||||
cp = el->el_line.cursor;
|
||||
kp = el->el_chared.c_kill.buf;
|
||||
while (cp < el->el_line.lastchar)
|
||||
*kp++ = *cp++; /* copy it */
|
||||
el->el_chared.c_kill.last = kp;
|
||||
/* zap! -- delete to end */
|
||||
el->el_line.lastchar = el->el_line.cursor;
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_move_to_end():
|
||||
* Move cursor to the end of line
|
||||
* [^E] [^E]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
#ifdef VI_MOVE
|
||||
el->el_line.cursor--;
|
||||
#endif
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_move_to_beg():
|
||||
* Move cursor to the beginning of line
|
||||
* [^A] [^A]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
/* We want FIRST non space character */
|
||||
while (Isspace(*el->el_line.cursor))
|
||||
el->el_line.cursor++;
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_transpose_chars():
|
||||
* Exchange the character to the left of the cursor with the one under it
|
||||
* [^T] [^T]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_transpose_chars(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor < el->el_line.lastchar) {
|
||||
if (el->el_line.lastchar <= &el->el_line.buffer[1])
|
||||
return (CC_ERROR);
|
||||
else
|
||||
el->el_line.cursor++;
|
||||
}
|
||||
if (el->el_line.cursor > &el->el_line.buffer[1]) {
|
||||
/* must have at least two chars entered */
|
||||
c = el->el_line.cursor[-2];
|
||||
el->el_line.cursor[-2] = el->el_line.cursor[-1];
|
||||
el->el_line.cursor[-1] = c;
|
||||
return (CC_REFRESH);
|
||||
} else
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_next_char():
|
||||
* Move to the right one character
|
||||
* [^F] [^F]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char *lim = el->el_line.lastchar;
|
||||
|
||||
if (el->el_line.cursor >= lim ||
|
||||
(el->el_line.cursor == lim - 1 &&
|
||||
el->el_map.type == MAP_VI &&
|
||||
el->el_chared.c_vcmd.action == NOP))
|
||||
return (CC_ERROR);
|
||||
|
||||
el->el_line.cursor += el->el_state.argument;
|
||||
if (el->el_line.cursor > lim)
|
||||
el->el_line.cursor = lim;
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_prev_word():
|
||||
* Move to the beginning of the current word
|
||||
* [M-b] [b]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
|
||||
el->el_line.cursor = c__prev_word(el->el_line.cursor,
|
||||
el->el_line.buffer,
|
||||
el->el_state.argument,
|
||||
ce__isword);
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_prev_char():
|
||||
* Move to the left one character
|
||||
* [^B] [^B]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor > el->el_line.buffer) {
|
||||
el->el_line.cursor -= el->el_state.argument;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
} else
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_quoted_insert():
|
||||
* Add the next character typed verbatim
|
||||
* [^V] [^V]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_quoted_insert(EditLine *el, Int c)
|
||||
{
|
||||
int num;
|
||||
Char tc;
|
||||
|
||||
tty_quotemode(el);
|
||||
num = FUN(el,getc)(el, &tc);
|
||||
c = tc;
|
||||
tty_noquotemode(el);
|
||||
if (num == 1)
|
||||
return (ed_insert(el, c));
|
||||
else
|
||||
return (ed_end_of_file(el, 0));
|
||||
}
|
||||
|
||||
|
||||
/* ed_digit():
|
||||
* Adds to argument or enters a digit
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_digit(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (!Isdigit(c))
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_state.doingarg) {
|
||||
/* if doing an arg, add this in... */
|
||||
if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT)
|
||||
el->el_state.argument = c - '0';
|
||||
else {
|
||||
if (el->el_state.argument > 1000000)
|
||||
return (CC_ERROR);
|
||||
el->el_state.argument =
|
||||
(el->el_state.argument * 10) + (c - '0');
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
}
|
||||
|
||||
return ed_insert(el, c);
|
||||
}
|
||||
|
||||
|
||||
/* ed_argument_digit():
|
||||
* Digit that starts argument
|
||||
* For ESC-n
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_argument_digit(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (!Isdigit(c))
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_state.doingarg) {
|
||||
if (el->el_state.argument > 1000000)
|
||||
return (CC_ERROR);
|
||||
el->el_state.argument = (el->el_state.argument * 10) +
|
||||
(c - '0');
|
||||
} else { /* else starting an argument */
|
||||
el->el_state.argument = c - '0';
|
||||
el->el_state.doingarg = 1;
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
}
|
||||
|
||||
|
||||
/* ed_unassigned():
|
||||
* Indicates unbound character
|
||||
* Bound to keys that are not assigned
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_unassigned(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** TTY key handling.
|
||||
**/
|
||||
|
||||
/* ed_tty_sigint():
|
||||
* Tty interrupt character
|
||||
* [^C]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigint(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_dsusp():
|
||||
* Tty delayed suspend character
|
||||
* [^Y]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_flush_output():
|
||||
* Tty flush output characters
|
||||
* [^O]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_sigquit():
|
||||
* Tty quit character
|
||||
* [^\]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_sigtstp():
|
||||
* Tty suspend character
|
||||
* [^Z]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_stop_output():
|
||||
* Tty disallow output characters
|
||||
* [^S]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_tty_start_output():
|
||||
* Tty allow output characters
|
||||
* [^Q]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_start_output(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_newline():
|
||||
* Execute command
|
||||
* [^J]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_newline(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar++ = '\n';
|
||||
*el->el_line.lastchar = '\0';
|
||||
return (CC_NEWLINE);
|
||||
}
|
||||
|
||||
|
||||
/* ed_delete_prev_char():
|
||||
* Delete the character to the left of the cursor
|
||||
* [^?]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor <= el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
|
||||
c_delbefore(el, el->el_state.argument);
|
||||
el->el_line.cursor -= el->el_state.argument;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_clear_screen():
|
||||
* Clear screen leaving current line at the top
|
||||
* [^L]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
term_clear_screen(el); /* clear the whole real screen */
|
||||
re_clear_display(el); /* reset everything */
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_redisplay():
|
||||
* Redisplay everything
|
||||
* ^R
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_redisplay(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_REDISPLAY);
|
||||
}
|
||||
|
||||
|
||||
/* ed_start_over():
|
||||
* Erase current line and start from scratch
|
||||
* [^G]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
ch_reset(el, 0);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
/* ed_sequence_lead_in():
|
||||
* First character in a bound sequence
|
||||
* Placeholder for external keys
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* ed_prev_history():
|
||||
* Move to the previous history line
|
||||
* [^P] [k]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char beep = 0;
|
||||
int sv_event = el->el_history.eventno;
|
||||
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0) { /* save the current buffer
|
||||
* away */
|
||||
(void) Strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
EL_BUFSIZ);
|
||||
el->el_history.last = el->el_history.buf +
|
||||
(el->el_line.lastchar - el->el_line.buffer);
|
||||
}
|
||||
el->el_history.eventno += el->el_state.argument;
|
||||
|
||||
if (hist_get(el) == CC_ERROR) {
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
el->el_history.eventno = sv_event;
|
||||
|
||||
}
|
||||
beep = 1;
|
||||
/* el->el_history.eventno was fixed by first call */
|
||||
(void) hist_get(el);
|
||||
}
|
||||
if (beep)
|
||||
return CC_REFRESH_BEEP;
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
/* ed_next_history():
|
||||
* Move to the next history line
|
||||
* [^N] [j]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
el_action_t beep = CC_REFRESH, rval;
|
||||
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
el->el_history.eventno -= el->el_state.argument;
|
||||
|
||||
if (el->el_history.eventno < 0) {
|
||||
el->el_history.eventno = 0;
|
||||
beep = CC_REFRESH_BEEP;
|
||||
}
|
||||
rval = hist_get(el);
|
||||
if (rval == CC_REFRESH)
|
||||
return beep;
|
||||
return rval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ed_search_prev_history():
|
||||
* Search previous in history for a line matching the current
|
||||
* next search history [M-P] [K]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
const Char *hp;
|
||||
int h;
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
if (el->el_history.eventno < 0) {
|
||||
#ifdef DEBUG_EDIT
|
||||
(void) fprintf(el->el_errfile,
|
||||
"e_prev_search_hist(): eventno < 0;\n");
|
||||
#endif
|
||||
el->el_history.eventno = 0;
|
||||
return (CC_ERROR);
|
||||
}
|
||||
if (el->el_history.eventno == 0) {
|
||||
(void) Strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
EL_BUFSIZ);
|
||||
el->el_history.last = el->el_history.buf +
|
||||
(el->el_line.lastchar - el->el_line.buffer);
|
||||
}
|
||||
if (el->el_history.ref == NULL)
|
||||
return (CC_ERROR);
|
||||
|
||||
hp = HIST_FIRST(el);
|
||||
if (hp == NULL)
|
||||
return (CC_ERROR);
|
||||
|
||||
c_setpat(el); /* Set search pattern !! */
|
||||
|
||||
for (h = 1; h <= el->el_history.eventno; h++)
|
||||
hp = HIST_NEXT(el);
|
||||
|
||||
while (hp != NULL) {
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
|
||||
#endif
|
||||
if ((Strncmp(hp, el->el_line.buffer, (size_t)
|
||||
(el->el_line.lastchar - el->el_line.buffer)) ||
|
||||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
|
||||
c_hmatch(el, hp)) {
|
||||
found++;
|
||||
break;
|
||||
}
|
||||
h++;
|
||||
hp = HIST_NEXT(el);
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "not found\n");
|
||||
#endif
|
||||
return (CC_ERROR);
|
||||
}
|
||||
el->el_history.eventno = h;
|
||||
|
||||
return (hist_get(el));
|
||||
}
|
||||
|
||||
|
||||
/* ed_search_next_history():
|
||||
* Search next in history for a line matching the current
|
||||
* [M-N] [J]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
const Char *hp;
|
||||
int h;
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0)
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_history.ref == NULL)
|
||||
return (CC_ERROR);
|
||||
|
||||
hp = HIST_FIRST(el);
|
||||
if (hp == NULL)
|
||||
return (CC_ERROR);
|
||||
|
||||
c_setpat(el); /* Set search pattern !! */
|
||||
|
||||
for (h = 1; h < el->el_history.eventno && hp; h++) {
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
|
||||
#endif
|
||||
if ((Strncmp(hp, el->el_line.buffer, (size_t)
|
||||
(el->el_line.lastchar - el->el_line.buffer)) ||
|
||||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
|
||||
c_hmatch(el, hp))
|
||||
found = h;
|
||||
hp = HIST_NEXT(el);
|
||||
}
|
||||
|
||||
if (!found) { /* is it the current history number? */
|
||||
if (!c_hmatch(el, el->el_history.buf)) {
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "not found\n");
|
||||
#endif
|
||||
return (CC_ERROR);
|
||||
}
|
||||
}
|
||||
el->el_history.eventno = found;
|
||||
|
||||
return (hist_get(el));
|
||||
}
|
||||
|
||||
|
||||
/* ed_prev_line():
|
||||
* Move up one line
|
||||
* Could be [k] [^p]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char *ptr;
|
||||
int nchars = c_hpos(el);
|
||||
|
||||
/*
|
||||
* Move to the line requested
|
||||
*/
|
||||
if (*(ptr = el->el_line.cursor) == '\n')
|
||||
ptr--;
|
||||
|
||||
for (; ptr >= el->el_line.buffer; ptr--)
|
||||
if (*ptr == '\n' && --el->el_state.argument <= 0)
|
||||
break;
|
||||
|
||||
if (el->el_state.argument > 0)
|
||||
return (CC_ERROR);
|
||||
|
||||
/*
|
||||
* Move to the beginning of the line
|
||||
*/
|
||||
for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Move to the character requested
|
||||
*/
|
||||
for (ptr++;
|
||||
nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
|
||||
ptr++)
|
||||
continue;
|
||||
|
||||
el->el_line.cursor = ptr;
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_next_line():
|
||||
* Move down one line
|
||||
* Could be [j] [^n]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char *ptr;
|
||||
int nchars = c_hpos(el);
|
||||
|
||||
/*
|
||||
* Move to the line requested
|
||||
*/
|
||||
for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)
|
||||
if (*ptr == '\n' && --el->el_state.argument <= 0)
|
||||
break;
|
||||
|
||||
if (el->el_state.argument > 0)
|
||||
return (CC_ERROR);
|
||||
|
||||
/*
|
||||
* Move to the character requested
|
||||
*/
|
||||
for (ptr++;
|
||||
nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
|
||||
ptr++)
|
||||
continue;
|
||||
|
||||
el->el_line.cursor = ptr;
|
||||
return (CC_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
/* ed_command():
|
||||
* Editline extended command
|
||||
* [M-X] [:]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_command(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
Char tmpbuf[EL_BUFSIZ];
|
||||
int tmplen;
|
||||
|
||||
tmplen = c_gets(el, tmpbuf, STR("\n: "));
|
||||
term__putc(el, '\n');
|
||||
|
||||
if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
|
||||
term_beep(el);
|
||||
|
||||
el->el_map.current = el->el_map.key;
|
||||
re_clear_display(el);
|
||||
return CC_REFRESH;
|
||||
}
|
221
lib/libedit/src/editline/readline.h
Normal file
221
lib/libedit/src/editline/readline.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/* $NetBSD: readline.h,v 1.32 2010/09/16 20:08:52 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jaromir Dolecek.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
#ifndef _READLINE_H_
|
||||
#define _READLINE_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* list of readline stuff supported by editline library's readline wrapper */
|
||||
|
||||
/* typedefs */
|
||||
typedef int Function(const char *, int);
|
||||
typedef void VFunction(void);
|
||||
typedef void VCPFunction(char *);
|
||||
typedef char *CPFunction(const char *, int);
|
||||
typedef char **CPPFunction(const char *, int, int);
|
||||
typedef char *rl_compentry_func_t(const char *, int);
|
||||
typedef int rl_command_func_t(int, int);
|
||||
|
||||
/* only supports length */
|
||||
typedef struct {
|
||||
int length;
|
||||
} HISTORY_STATE;
|
||||
|
||||
typedef void *histdata_t;
|
||||
|
||||
typedef struct _hist_entry {
|
||||
const char *line;
|
||||
histdata_t data;
|
||||
} HIST_ENTRY;
|
||||
|
||||
typedef struct _keymap_entry {
|
||||
char type;
|
||||
#define ISFUNC 0
|
||||
#define ISKMAP 1
|
||||
#define ISMACR 2
|
||||
Function *function;
|
||||
} KEYMAP_ENTRY;
|
||||
|
||||
#define KEYMAP_SIZE 256
|
||||
|
||||
typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
|
||||
typedef KEYMAP_ENTRY *Keymap;
|
||||
|
||||
#define control_character_threshold 0x20
|
||||
#define control_character_bit 0x40
|
||||
|
||||
#ifndef CTRL
|
||||
#include <sys/ioctl.h>
|
||||
#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
|
||||
#include <sys/ttydefaults.h>
|
||||
#endif
|
||||
#ifndef CTRL
|
||||
#define CTRL(c) ((c) & 037)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef UNCTRL
|
||||
#define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit)
|
||||
#endif
|
||||
|
||||
#define RUBOUT 0x7f
|
||||
#define ABORT_CHAR CTRL('G')
|
||||
#define RL_READLINE_VERSION 0x0402
|
||||
#define RL_PROMPT_START_IGNORE '\1'
|
||||
#define RL_PROMPT_END_IGNORE '\2'
|
||||
|
||||
/* global variables used by readline enabled applications */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern const char *rl_library_version;
|
||||
extern int rl_readline_version;
|
||||
extern char *rl_readline_name;
|
||||
extern FILE *rl_instream;
|
||||
extern FILE *rl_outstream;
|
||||
extern char *rl_line_buffer;
|
||||
extern int rl_point, rl_end;
|
||||
extern int history_base, history_length;
|
||||
extern int max_input_history;
|
||||
extern char *rl_basic_word_break_characters;
|
||||
extern char *rl_completer_word_break_characters;
|
||||
extern char *rl_completer_quote_characters;
|
||||
extern Function *rl_completion_entry_function;
|
||||
extern CPPFunction *rl_attempted_completion_function;
|
||||
extern int rl_attempted_completion_over;
|
||||
extern int rl_completion_type;
|
||||
extern int rl_completion_query_items;
|
||||
extern char *rl_special_prefixes;
|
||||
extern int rl_completion_append_character;
|
||||
extern int rl_inhibit_completion;
|
||||
extern Function *rl_pre_input_hook;
|
||||
extern Function *rl_startup_hook;
|
||||
extern char *rl_terminal_name;
|
||||
extern int rl_already_prompted;
|
||||
extern char *rl_prompt;
|
||||
/*
|
||||
* The following is not implemented
|
||||
*/
|
||||
extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
|
||||
emacs_meta_keymap,
|
||||
emacs_ctlx_keymap;
|
||||
extern int rl_filename_completion_desired;
|
||||
extern int rl_ignore_completion_duplicates;
|
||||
extern int (*rl_getc_function)(FILE *);
|
||||
extern VFunction *rl_redisplay_function;
|
||||
extern VFunction *rl_completion_display_matches_hook;
|
||||
extern VFunction *rl_prep_term_function;
|
||||
extern VFunction *rl_deprep_term_function;
|
||||
extern int readline_echoing_p;
|
||||
extern int _rl_print_completions_horizontally;
|
||||
|
||||
/* supported functions */
|
||||
char *readline(const char *);
|
||||
int rl_initialize(void);
|
||||
|
||||
void using_history(void);
|
||||
int add_history(const char *);
|
||||
void clear_history(void);
|
||||
void stifle_history(int);
|
||||
int unstifle_history(void);
|
||||
int history_is_stifled(void);
|
||||
int where_history(void);
|
||||
HIST_ENTRY *current_history(void);
|
||||
HIST_ENTRY *history_get(int);
|
||||
HIST_ENTRY *remove_history(int);
|
||||
HIST_ENTRY *replace_history_entry(int, const char *, histdata_t);
|
||||
int history_total_bytes(void);
|
||||
int history_set_pos(int);
|
||||
HIST_ENTRY *previous_history(void);
|
||||
HIST_ENTRY *next_history(void);
|
||||
int history_search(const char *, int);
|
||||
int history_search_prefix(const char *, int);
|
||||
int history_search_pos(const char *, int, int);
|
||||
int read_history(const char *);
|
||||
int write_history(const char *);
|
||||
int history_truncate_file (const char *, int);
|
||||
int history_expand(char *, char **);
|
||||
char **history_tokenize(const char *);
|
||||
const char *get_history_event(const char *, int *, int);
|
||||
char *history_arg_extract(int, int, const char *);
|
||||
|
||||
char *tilde_expand(char *);
|
||||
char *filename_completion_function(const char *, int);
|
||||
char *username_completion_function(const char *, int);
|
||||
int rl_complete(int, int);
|
||||
int rl_read_key(void);
|
||||
char **completion_matches(const char *, CPFunction *);
|
||||
void rl_display_match_list(char **, int, int);
|
||||
|
||||
int rl_insert(int, int);
|
||||
int rl_insert_text(const char *);
|
||||
void rl_reset_terminal(const char *);
|
||||
int rl_bind_key(int, rl_command_func_t *);
|
||||
int rl_newline(int, int);
|
||||
void rl_callback_read_char(void);
|
||||
void rl_callback_handler_install(const char *, VCPFunction *);
|
||||
void rl_callback_handler_remove(void);
|
||||
void rl_redisplay(void);
|
||||
int rl_get_previous_history(int, int);
|
||||
void rl_prep_terminal(int);
|
||||
void rl_deprep_terminal(void);
|
||||
int rl_read_init_file(const char *);
|
||||
int rl_parse_and_bind(const char *);
|
||||
int rl_variable_bind(const char *, const char *);
|
||||
void rl_stuff_char(int);
|
||||
int rl_add_defun(const char *, Function *, int);
|
||||
HISTORY_STATE *history_get_history_state(void);
|
||||
void rl_get_screen_size(int *, int *);
|
||||
void rl_set_screen_size(int, int);
|
||||
char *rl_filename_completion_function (const char *, int);
|
||||
int _rl_abort_internal(void);
|
||||
int _rl_qsort_string_compare(char **, char **);
|
||||
char **rl_completion_matches(const char *, rl_compentry_func_t *);
|
||||
void rl_forced_update_display(void);
|
||||
int rl_set_prompt(const char *);
|
||||
int rl_on_new_line(void);
|
||||
|
||||
/*
|
||||
* The following are not implemented
|
||||
*/
|
||||
int rl_kill_text(int, int);
|
||||
Keymap rl_get_keymap(void);
|
||||
void rl_set_keymap(Keymap);
|
||||
Keymap rl_make_bare_keymap(void);
|
||||
int rl_generic_bind(int, const char *, const char *, Keymap);
|
||||
int rl_bind_key_in_map(int, rl_command_func_t *, Keymap);
|
||||
void rl_cleanup_after_signal(void);
|
||||
void rl_free_line_state(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _READLINE_H_ */
|
618
lib/libedit/src/el.c
Normal file
618
lib/libedit/src/el.c
Normal file
@@ -0,0 +1,618 @@
|
||||
/* $NetBSD: el.c,v 1.61 2011/01/27 23:11:40 christos 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: el.c,v 1.61 2011/01/27 23:11:40 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 4096
|
||||
#endif
|
||||
|
||||
/*
|
||||
* el.c: EditLine interface functions
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#include "el.h"
|
||||
|
||||
/* el_init():
|
||||
* Initialize editline and set default parameters.
|
||||
*/
|
||||
public EditLine *
|
||||
el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
|
||||
{
|
||||
EditLine *el = (EditLine *) el_malloc(sizeof(EditLine));
|
||||
|
||||
if (el == NULL)
|
||||
return (NULL);
|
||||
|
||||
memset(el, 0, sizeof(EditLine));
|
||||
|
||||
el->el_infile = fin;
|
||||
el->el_outfile = fout;
|
||||
el->el_errfile = ferr;
|
||||
|
||||
el->el_infd = fileno(fin);
|
||||
el->el_outfd = fileno(fout);
|
||||
el->el_errfd = fileno(ferr);
|
||||
|
||||
el->el_prog = Strdup(ct_decode_string(prog, &el->el_scratch));
|
||||
if (el->el_prog == NULL) {
|
||||
el_free(el);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize all the modules. Order is important!!!
|
||||
*/
|
||||
el->el_flags = 0;
|
||||
#ifdef WIDECHAR
|
||||
if (setlocale(LC_CTYPE, NULL) != NULL){
|
||||
if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
|
||||
el->el_flags |= CHARSET_IS_UTF8;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (term_init(el) == -1) {
|
||||
el_free(el->el_prog);
|
||||
el_free(el);
|
||||
return NULL;
|
||||
}
|
||||
(void) key_init(el);
|
||||
(void) map_init(el);
|
||||
if (tty_init(el) == -1)
|
||||
el->el_flags |= NO_TTY;
|
||||
(void) ch_init(el);
|
||||
(void) search_init(el);
|
||||
(void) hist_init(el);
|
||||
(void) prompt_init(el);
|
||||
(void) sig_init(el);
|
||||
(void) read_init(el);
|
||||
|
||||
return (el);
|
||||
}
|
||||
|
||||
|
||||
/* el_end():
|
||||
* Clean up.
|
||||
*/
|
||||
public void
|
||||
el_end(EditLine *el)
|
||||
{
|
||||
|
||||
if (el == NULL)
|
||||
return;
|
||||
|
||||
el_reset(el);
|
||||
|
||||
term_end(el);
|
||||
key_end(el);
|
||||
map_end(el);
|
||||
tty_end(el);
|
||||
ch_end(el);
|
||||
search_end(el);
|
||||
hist_end(el);
|
||||
prompt_end(el);
|
||||
sig_end(el);
|
||||
|
||||
el_free((ptr_t) el->el_prog);
|
||||
el_free((ptr_t) el);
|
||||
#ifdef WIDECHAR
|
||||
el_free((ptr_t) el->el_scratch.cbuff);
|
||||
el_free((ptr_t) el->el_scratch.wbuff);
|
||||
el_free((ptr_t) el->el_lgcyconv.cbuff);
|
||||
el_free((ptr_t) el->el_lgcyconv.wbuff);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* el_reset():
|
||||
* Reset the tty and the parser
|
||||
*/
|
||||
public void
|
||||
el_reset(EditLine *el)
|
||||
{
|
||||
|
||||
tty_cookedmode(el);
|
||||
ch_reset(el, 0); /* XXX: Do we want that? */
|
||||
}
|
||||
|
||||
|
||||
/* el_set():
|
||||
* set the editline parameters
|
||||
*/
|
||||
public int
|
||||
FUN(el,set)(EditLine *el, int op, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rv = 0;
|
||||
|
||||
if (el == NULL)
|
||||
return (-1);
|
||||
va_start(ap, op);
|
||||
|
||||
switch (op) {
|
||||
case EL_PROMPT:
|
||||
case EL_RPROMPT: {
|
||||
el_pfunc_t p = va_arg(ap, el_pfunc_t);
|
||||
|
||||
rv = prompt_set(el, p, 0, op, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_RESIZE: {
|
||||
el_zfunc_t p = va_arg(ap, el_zfunc_t);
|
||||
void *arg = va_arg(ap, void *);
|
||||
rv = ch_resizefun(el, p, arg);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_PROMPT_ESC:
|
||||
case EL_RPROMPT_ESC: {
|
||||
el_pfunc_t p = va_arg(ap, el_pfunc_t);
|
||||
int c = va_arg(ap, int);
|
||||
|
||||
rv = prompt_set(el, p, c, op, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_TERMINAL:
|
||||
rv = term_set(el, va_arg(ap, char *));
|
||||
break;
|
||||
|
||||
case EL_EDITOR:
|
||||
rv = map_set_editor(el, va_arg(ap, Char *));
|
||||
break;
|
||||
|
||||
case EL_SIGNAL:
|
||||
if (va_arg(ap, int))
|
||||
el->el_flags |= HANDLE_SIGNALS;
|
||||
else
|
||||
el->el_flags &= ~HANDLE_SIGNALS;
|
||||
break;
|
||||
|
||||
case EL_BIND:
|
||||
case EL_TELLTC:
|
||||
case EL_SETTC:
|
||||
case EL_ECHOTC:
|
||||
case EL_SETTY:
|
||||
{
|
||||
const Char *argv[20];
|
||||
int i;
|
||||
|
||||
for (i = 1; i < 20; i++)
|
||||
if ((argv[i] = va_arg(ap, Char *)) == NULL)
|
||||
break;
|
||||
|
||||
switch (op) {
|
||||
case EL_BIND:
|
||||
argv[0] = STR("bind");
|
||||
rv = map_bind(el, i, argv);
|
||||
break;
|
||||
|
||||
case EL_TELLTC:
|
||||
argv[0] = STR("telltc");
|
||||
rv = term_telltc(el, i, argv);
|
||||
break;
|
||||
|
||||
case EL_SETTC:
|
||||
argv[0] = STR("settc");
|
||||
rv = term_settc(el, i, argv);
|
||||
break;
|
||||
|
||||
case EL_ECHOTC:
|
||||
argv[0] = STR("echotc");
|
||||
rv = term_echotc(el, i, argv);
|
||||
break;
|
||||
|
||||
case EL_SETTY:
|
||||
argv[0] = STR("setty");
|
||||
rv = tty_stty(el, i, argv);
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
EL_ABORT((el->el_errfile, "Bad op %d\n", op));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_ADDFN:
|
||||
{
|
||||
Char *name = va_arg(ap, Char *);
|
||||
Char *help = va_arg(ap, Char *);
|
||||
el_func_t func = va_arg(ap, el_func_t);
|
||||
|
||||
rv = map_addfunc(el, name, help, func);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_HIST:
|
||||
{
|
||||
hist_fun_t func = va_arg(ap, hist_fun_t);
|
||||
ptr_t ptr = va_arg(ap, ptr_t);
|
||||
|
||||
rv = hist_set(el, func, ptr);
|
||||
if (!(el->el_flags & CHARSET_IS_UTF8))
|
||||
el->el_flags &= ~NARROW_HISTORY;
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_EDITMODE:
|
||||
if (va_arg(ap, int))
|
||||
el->el_flags &= ~EDIT_DISABLED;
|
||||
else
|
||||
el->el_flags |= EDIT_DISABLED;
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_GETCFN:
|
||||
{
|
||||
el_rfunc_t rc = va_arg(ap, el_rfunc_t);
|
||||
rv = el_read_setfn(el, rc);
|
||||
el->el_flags &= ~NARROW_READ;
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_CLIENTDATA:
|
||||
el->el_data = va_arg(ap, void *);
|
||||
break;
|
||||
|
||||
case EL_UNBUFFERED:
|
||||
rv = va_arg(ap, int);
|
||||
if (rv && !(el->el_flags & UNBUFFERED)) {
|
||||
el->el_flags |= UNBUFFERED;
|
||||
read_prepare(el);
|
||||
} else if (!rv && (el->el_flags & UNBUFFERED)) {
|
||||
el->el_flags &= ~UNBUFFERED;
|
||||
read_finish(el);
|
||||
}
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_PREP_TERM:
|
||||
rv = va_arg(ap, int);
|
||||
if (rv)
|
||||
(void) tty_rawmode(el);
|
||||
else
|
||||
(void) tty_cookedmode(el);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_SETFP:
|
||||
{
|
||||
FILE *fp;
|
||||
int what;
|
||||
|
||||
what = va_arg(ap, int);
|
||||
fp = va_arg(ap, FILE *);
|
||||
|
||||
rv = 0;
|
||||
switch (what) {
|
||||
case 0:
|
||||
el->el_infile = fp;
|
||||
el->el_infd = fileno(fp);
|
||||
break;
|
||||
case 1:
|
||||
el->el_outfile = fp;
|
||||
el->el_outfd = fileno(fp);
|
||||
break;
|
||||
case 2:
|
||||
el->el_errfile = fp;
|
||||
el->el_errfd = fileno(fp);
|
||||
break;
|
||||
default:
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_REFRESH:
|
||||
re_clear_display(el);
|
||||
re_refresh(el);
|
||||
term__flush(el);
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
||||
/* el_get():
|
||||
* retrieve the editline parameters
|
||||
*/
|
||||
public int
|
||||
FUN(el,get)(EditLine *el, int op, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rv;
|
||||
|
||||
if (el == NULL)
|
||||
return -1;
|
||||
|
||||
va_start(ap, op);
|
||||
|
||||
switch (op) {
|
||||
case EL_PROMPT:
|
||||
case EL_RPROMPT: {
|
||||
el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
|
||||
rv = prompt_get(el, p, 0, op);
|
||||
break;
|
||||
}
|
||||
case EL_PROMPT_ESC:
|
||||
case EL_RPROMPT_ESC: {
|
||||
el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
|
||||
Char *c = va_arg(ap, Char *);
|
||||
|
||||
rv = prompt_get(el, p, c, op);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_EDITOR:
|
||||
rv = map_get_editor(el, va_arg(ap, const Char **));
|
||||
break;
|
||||
|
||||
case EL_SIGNAL:
|
||||
*va_arg(ap, int *) = (el->el_flags & HANDLE_SIGNALS);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_EDITMODE:
|
||||
*va_arg(ap, int *) = !(el->el_flags & EDIT_DISABLED);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_TERMINAL:
|
||||
term_get(el, va_arg(ap, const char **));
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_GETTC:
|
||||
{
|
||||
static char name[] = "gettc";
|
||||
char *argv[20];
|
||||
int i;
|
||||
|
||||
for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++)
|
||||
if ((argv[i] = va_arg(ap, char *)) == NULL)
|
||||
break;
|
||||
|
||||
switch (op) {
|
||||
case EL_GETTC:
|
||||
argv[0] = name;
|
||||
rv = term_gettc(el, i, argv);
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
EL_ABORT((el->el_errfile, "Bad op %d\n", op));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_GETCFN:
|
||||
*va_arg(ap, el_rfunc_t *) = el_read_getfn(el);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_CLIENTDATA:
|
||||
*va_arg(ap, void **) = el->el_data;
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_UNBUFFERED:
|
||||
*va_arg(ap, int *) = (!(el->el_flags & UNBUFFERED));
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_GETFP:
|
||||
{
|
||||
int what;
|
||||
FILE **fpp;
|
||||
|
||||
what = va_arg(ap, int);
|
||||
fpp = va_arg(ap, FILE **);
|
||||
rv = 0;
|
||||
switch (what) {
|
||||
case 0:
|
||||
*fpp = el->el_infile;
|
||||
break;
|
||||
case 1:
|
||||
*fpp = el->el_outfile;
|
||||
break;
|
||||
case 2:
|
||||
*fpp = el->el_errfile;
|
||||
break;
|
||||
default:
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
||||
/* el_line():
|
||||
* Return editing info
|
||||
*/
|
||||
public const TYPE(LineInfo) *
|
||||
FUN(el,line)(EditLine *el)
|
||||
{
|
||||
|
||||
return (const TYPE(LineInfo) *) (void *) &el->el_line;
|
||||
}
|
||||
|
||||
|
||||
/* el_source():
|
||||
* Source a file
|
||||
*/
|
||||
public int
|
||||
el_source(EditLine *el, const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
size_t len;
|
||||
char *ptr;
|
||||
char path[MAXPATHLEN];
|
||||
const Char *dptr;
|
||||
|
||||
fp = NULL;
|
||||
if (fname == NULL) {
|
||||
static const char elpath[] = "/.editrc";
|
||||
|
||||
#ifdef HAVE_ISSETUGID
|
||||
if (issetugid())
|
||||
return (-1);
|
||||
#endif
|
||||
if ((ptr = getenv("HOME")) == NULL)
|
||||
return (-1);
|
||||
if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path))
|
||||
return (-1);
|
||||
if (strlcat(path, elpath, sizeof(path)) >= sizeof(path))
|
||||
return (-1);
|
||||
fname = path;
|
||||
}
|
||||
if (fp == NULL)
|
||||
fp = fopen(fname, "r");
|
||||
if (fp == NULL)
|
||||
return (-1);
|
||||
|
||||
while ((ptr = fgetln(fp, &len)) != NULL) {
|
||||
dptr = ct_decode_string(ptr, &el->el_scratch);
|
||||
if (!dptr)
|
||||
continue;
|
||||
if (len > 0 && dptr[len - 1] == '\n')
|
||||
--len;
|
||||
|
||||
/* loop until first non-space char or EOL */
|
||||
while (*dptr != '\0' && Isspace(*dptr))
|
||||
dptr++;
|
||||
if (*dptr == '#')
|
||||
continue; /* ignore, this is a comment line */
|
||||
if (parse_line(el, dptr) == -1) {
|
||||
(void) fclose(fp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose(fp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* el_resize():
|
||||
* Called from program when terminal is resized
|
||||
*/
|
||||
public void
|
||||
el_resize(EditLine *el)
|
||||
{
|
||||
int lins, cols;
|
||||
sigset_t oset, nset;
|
||||
|
||||
(void) sigemptyset(&nset);
|
||||
(void) sigaddset(&nset, SIGWINCH);
|
||||
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
|
||||
/* get the correct window size */
|
||||
if (term_get_size(el, &lins, &cols))
|
||||
term_change_size(el, lins, cols);
|
||||
|
||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* el_beep():
|
||||
* Called from the program to beep
|
||||
*/
|
||||
public void
|
||||
el_beep(EditLine *el)
|
||||
{
|
||||
|
||||
term_beep(el);
|
||||
}
|
||||
|
||||
|
||||
/* el_editmode()
|
||||
* Set the state of EDIT_DISABLED from the `edit' command.
|
||||
*/
|
||||
protected int
|
||||
/*ARGSUSED*/
|
||||
el_editmode(EditLine *el, int argc, const Char **argv)
|
||||
{
|
||||
const Char *how;
|
||||
|
||||
if (argv == NULL || argc != 2 || argv[1] == NULL)
|
||||
return (-1);
|
||||
|
||||
how = argv[1];
|
||||
if (Strcmp(how, STR("on")) == 0) {
|
||||
el->el_flags &= ~EDIT_DISABLED;
|
||||
tty_rawmode(el);
|
||||
} else if (Strcmp(how, STR("off")) == 0) {
|
||||
tty_cookedmode(el);
|
||||
el->el_flags |= EDIT_DISABLED;
|
||||
}
|
||||
else {
|
||||
(void) fprintf(el->el_errfile, "edit: Bad value `" FSTR "'.\n",
|
||||
how);
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
163
lib/libedit/src/el.h
Normal file
163
lib/libedit/src/el.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/* $NetBSD: el.h,v 1.22 2011/01/27 23:11:40 christos 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.
|
||||
*
|
||||
* @(#)el.h 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* el.h: Internal structures.
|
||||
*/
|
||||
#ifndef _h_el
|
||||
#define _h_el
|
||||
/*
|
||||
* Local defaults
|
||||
*/
|
||||
#define KSHVI
|
||||
#define VIDEFAULT
|
||||
#define ANCHOR
|
||||
|
||||
#include "histedit.h"
|
||||
#include "chartype.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define EL_BUFSIZ 1024 /* Maximum line size */
|
||||
|
||||
#define HANDLE_SIGNALS 0x01
|
||||
#define NO_TTY 0x02
|
||||
#define EDIT_DISABLED 0x04
|
||||
#define UNBUFFERED 0x08
|
||||
#define CHARSET_IS_UTF8 0x10
|
||||
#define IGNORE_EXTCHARS 0x20 /* Ignore characters read > 0xff */
|
||||
#define NARROW_HISTORY 0x40
|
||||
#define NARROW_READ 0x80
|
||||
|
||||
typedef int bool_t; /* True or not */
|
||||
|
||||
typedef unsigned char el_action_t; /* Index to command array */
|
||||
|
||||
typedef struct coord_t { /* Position on the screen */
|
||||
int h;
|
||||
int v;
|
||||
} coord_t;
|
||||
|
||||
typedef struct el_line_t {
|
||||
Char *buffer; /* Input line */
|
||||
Char *cursor; /* Cursor position */
|
||||
Char *lastchar; /* Last character */
|
||||
const Char *limit; /* Max position */
|
||||
} el_line_t;
|
||||
|
||||
/*
|
||||
* Editor state
|
||||
*/
|
||||
typedef struct el_state_t {
|
||||
int inputmode; /* What mode are we in? */
|
||||
int doingarg; /* Are we getting an argument? */
|
||||
int argument; /* Numeric argument */
|
||||
int metanext; /* Is the next char a meta char */
|
||||
el_action_t lastcmd; /* Previous command */
|
||||
el_action_t thiscmd; /* this command */
|
||||
Char thisch; /* char that generated it */
|
||||
} el_state_t;
|
||||
|
||||
/*
|
||||
* Until we come up with something better...
|
||||
*/
|
||||
#define el_malloc(a) malloc(a)
|
||||
#define el_realloc(a,b) realloc(a, b)
|
||||
#define el_free(a) free(a)
|
||||
|
||||
#include "tty.h"
|
||||
#include "prompt.h"
|
||||
#include "key.h"
|
||||
#include "el_term.h"
|
||||
#include "refresh.h"
|
||||
#include "chared.h"
|
||||
#include "common.h"
|
||||
#include "search.h"
|
||||
#include "hist.h"
|
||||
#include "map.h"
|
||||
#include "parse.h"
|
||||
#include "sig.h"
|
||||
#include "help.h"
|
||||
#include "read.h"
|
||||
|
||||
struct editline {
|
||||
Char *el_prog; /* the program name */
|
||||
FILE *el_infile; /* Stdio stuff */
|
||||
FILE *el_outfile; /* Stdio stuff */
|
||||
FILE *el_errfile; /* Stdio stuff */
|
||||
int el_infd; /* Input file descriptor */
|
||||
int el_outfd; /* Output file descriptor */
|
||||
int el_errfd; /* Error file descriptor */
|
||||
int el_flags; /* Various flags. */
|
||||
int el_errno; /* Local copy of errno */
|
||||
coord_t el_cursor; /* Cursor location */
|
||||
Char **el_display; /* Real screen image = what is there */
|
||||
Char **el_vdisplay; /* Virtual screen image = what we see */
|
||||
void *el_data; /* Client data */
|
||||
el_line_t el_line; /* The current line information */
|
||||
el_state_t el_state; /* Current editor state */
|
||||
el_term_t el_term; /* Terminal dependent stuff */
|
||||
el_tty_t el_tty; /* Tty dependent stuff */
|
||||
el_refresh_t el_refresh; /* Refresh stuff */
|
||||
el_prompt_t el_prompt; /* Prompt stuff */
|
||||
el_prompt_t el_rprompt; /* Prompt stuff */
|
||||
el_chared_t el_chared; /* Characted editor stuff */
|
||||
el_map_t el_map; /* Key mapping stuff */
|
||||
el_key_t el_key; /* Key binding stuff */
|
||||
el_history_t el_history; /* History stuff */
|
||||
el_search_t el_search; /* Search stuff */
|
||||
el_signal_t el_signal; /* Signal handling stuff */
|
||||
el_read_t el_read; /* Character reading stuff */
|
||||
#ifdef WIDECHAR
|
||||
ct_buffer_t el_scratch; /* Scratch conversion buffer */
|
||||
ct_buffer_t el_lgcyconv; /* Buffer for legacy wrappers */
|
||||
LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */
|
||||
#endif
|
||||
};
|
||||
|
||||
protected int el_editmode(EditLine *, int, const Char **);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define EL_ABORT(a) do { \
|
||||
fprintf(el->el_errfile, "%s, %d: ", \
|
||||
__FILE__, __LINE__); \
|
||||
fprintf a; \
|
||||
abort(); \
|
||||
} while( /*CONSTCOND*/0);
|
||||
#else
|
||||
#define EL_ABORT(a) abort()
|
||||
#endif
|
||||
#endif /* _h_el */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user