Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0) BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/client_settings.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/examples/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/func_in.result: Auto merged mysql-test/r/func_like.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/having.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/key.result: Auto merged mysql-test/r/lowercase_table.result: Auto merged mysql-test/r/ndb_autodiscover.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/ps_1general.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/rename.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/rpl_heap.test: Auto merged mysql-test/t/rpl_relayrotate.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged netware/mysql_test_run.c: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged sql/lex.h: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_sum.cc: Auto merged sql/protocol.cc: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.h: Auto merged sql/table.cc: Auto merged sql-common/client.c: Auto merged client/mysqlbinlog.cc: Merge with 4.1 configure.in: Merge with 4.1 include/mysqld_error.h: Add new error message (1) from 4.1 mysql-test/mysql-test-run.sh: Merge with 4.1 mysql-test/r/func_gconcat.result: Merge with 4.1 mysql-test/r/func_if.result: Merge with 4.1 mysql-test/r/grant.result: Merge with 4.1 mysql-test/r/join_outer.result: Merge with 4.1 mysql-test/r/rpl_charset.result: Merge with 4.1 (This has to be fixed before pushing) mysql-test/r/system_mysql_db.result: Merge with 4.1. Added collation to new privileges mysql-test/t/grant.test: Merge with 4.1 mysql-test/t/grant_cache.test: Merge with 4.1 mysql-test/t/show_check.test: Merge with 4.1 sql/Makefile.am: Merge with 4.1 sql/item.cc: Merge with 4.1 sql/item_cmpfunc.cc: Merge with 4.1 (arena code) sql/item_subselect.cc: Merge with 4.1 sql/item_subselect.h: Merge with 4.1 sql/item_sum.cc: Merge with 4.1 sql/item_sum.h: Merge with 4.1 sql/log.cc: Merge with 4.1 (Remove code that is not relevant for 5.0) sql/mysqld.cc: Merge with 4.1 sql/opt_range.cc: Merge with 4.1 sql/share/czech/errmsg.txt: Merge with 4.1 sql/share/danish/errmsg.txt: Merge with 4.1 sql/share/dutch/errmsg.txt: Merge with 4.1 sql/share/english/errmsg.txt: Merge with 4.1 sql/share/estonian/errmsg.txt: Merge with 4.1 sql/share/french/errmsg.txt: Merge with 4.1 sql/share/german/errmsg.txt: Merge with 4.1 sql/share/greek/errmsg.txt: Merge with 4.1 sql/share/hungarian/errmsg.txt: Merge with 4.1 sql/share/italian/errmsg.txt: Merge with 4.1 sql/share/japanese/errmsg.txt: Merge with 4.1 sql/share/korean/errmsg.txt: Merge with 4.1 sql/share/norwegian-ny/errmsg.txt: Merge with 4.1 sql/share/norwegian/errmsg.txt: Merge with 4.1 sql/share/polish/errmsg.txt: Merge with 4.1 sql/share/portuguese/errmsg.txt: Merge with 4.1 sql/share/romanian/errmsg.txt: Merge with 4.1 sql/share/russian/errmsg.txt: Merge with 4.1 sql/share/serbian/errmsg.txt: Merge with 4.1 sql/share/slovak/errmsg.txt: Merge with 4.1 sql/share/spanish/errmsg.txt: Merge with 4.1 sql/share/swedish/errmsg.txt: Merge with 4.1 sql/share/ukrainian/errmsg.txt: Merge with 4.1 sql/sql_base.cc: Merge with 4.1 sql/sql_class.cc: Merge with 4.1 Use arena code from 4.1 sql/sql_class.h: Merge with 4.1 Use arena code from 4.1 sql/sql_derived.cc: Merge with 4.1 sql/sql_lex.cc: Merge with 4.1 sql/sql_lex.h: Merge with 4.1 sql/sql_parse.cc: Merge with 4.1 sql/sql_prepare.cc: Merge with 4.1 sql/sql_select.cc: Merge with 4.1 sql/sql_table.cc: Merge with 4.1 sql/sql_union.cc: Merge with 4.1 sql/sql_yacc.yy: Merge with 4.1 sql/tztime.cc: Merge with 4.1 tests/client_test.c: Merge with 4.1
This commit is contained in:
commit
4ad51359c1
122
.bzrignore
122
.bzrignore
@ -14,6 +14,7 @@
|
||||
*/.pure
|
||||
*~
|
||||
.*.swp
|
||||
./config.h
|
||||
.defs.mk
|
||||
.depend
|
||||
.depend.mk
|
||||
@ -77,6 +78,7 @@ Docs/mysql.xml
|
||||
Docs/safe-mysql.xml
|
||||
Docs/tex.fmt
|
||||
Docs/texi2dvi.out
|
||||
EXCEPTIONS-CLIENT
|
||||
INSTALL-SOURCE
|
||||
INSTALL-WIN-SOURCE
|
||||
Logs/*
|
||||
@ -336,6 +338,7 @@ libmysqld/derror.cc
|
||||
libmysqld/discover.cc
|
||||
libmysqld/errmsg.c
|
||||
libmysqld/examples/client_test.c
|
||||
libmysqld/examples/client_test.cc
|
||||
libmysqld/examples/completion_hash.cc
|
||||
libmysqld/examples/completion_hash.h
|
||||
libmysqld/examples/link_sources
|
||||
@ -441,6 +444,7 @@ libmysqld/sql_udf.cc
|
||||
libmysqld/sql_union.cc
|
||||
libmysqld/sql_unions.cc
|
||||
libmysqld/sql_update.cc
|
||||
libmysqld/sql_view.cc
|
||||
libmysqld/sql_yacc.cc
|
||||
libmysqld/stacktrace.c
|
||||
libmysqld/strfunc.cc
|
||||
@ -656,7 +660,71 @@ ndb/lib/libREP_API.so
|
||||
ndb/lib/libndbclient.so
|
||||
ndb/lib/libndbclient_extra.so
|
||||
ndb/src/common/mgmcommon/printConfig/*.d
|
||||
ndb/src/cw/cpcd/ndb_cpcd
|
||||
ndb/src/kernel/blocks/backup/restore/ndb_restore
|
||||
ndb/src/kernel/ndbd
|
||||
ndb/src/mgmclient/ndb_mgm
|
||||
ndb/src/mgmclient/test_cpcd/*.d
|
||||
ndb/src/mgmsrv/ndb_mgmd
|
||||
ndb/test/ndbapi/bank/bankCreator
|
||||
ndb/test/ndbapi/bank/bankMakeGL
|
||||
ndb/test/ndbapi/bank/bankSumAccounts
|
||||
ndb/test/ndbapi/bank/bankTimer
|
||||
ndb/test/ndbapi/bank/bankTransactionMaker
|
||||
ndb/test/ndbapi/bank/bankValidateAllGLs
|
||||
ndb/test/ndbapi/bank/testBank
|
||||
ndb/test/ndbapi/create_all_tabs
|
||||
ndb/test/ndbapi/create_tab
|
||||
ndb/test/ndbapi/drop_all_tabs
|
||||
ndb/test/ndbapi/flexAsynch
|
||||
ndb/test/ndbapi/flexBench
|
||||
ndb/test/ndbapi/flexHammer
|
||||
ndb/test/ndbapi/flexTT
|
||||
ndb/test/ndbapi/testBackup
|
||||
ndb/test/ndbapi/testBasic
|
||||
ndb/test/ndbapi/testBasicAsynch
|
||||
ndb/test/ndbapi/testBlobs
|
||||
ndb/test/ndbapi/testDataBuffers
|
||||
ndb/test/ndbapi/testDeadlock
|
||||
ndb/test/ndbapi/testDict
|
||||
ndb/test/ndbapi/testIndex
|
||||
ndb/test/ndbapi/testMgm
|
||||
ndb/test/ndbapi/testNdbApi
|
||||
ndb/test/ndbapi/testNodeRestart
|
||||
ndb/test/ndbapi/testOIBasic
|
||||
ndb/test/ndbapi/testOperations
|
||||
ndb/test/ndbapi/testRestartGci
|
||||
ndb/test/ndbapi/testScan
|
||||
ndb/test/ndbapi/testScanInterpreter
|
||||
ndb/test/ndbapi/testScanPerf
|
||||
ndb/test/ndbapi/testSystemRestart
|
||||
ndb/test/ndbapi/testTimeout
|
||||
ndb/test/ndbapi/testTransactions
|
||||
ndb/test/ndbapi/test_event
|
||||
ndb/test/run-test/atrt
|
||||
ndb/test/tools/copy_tab
|
||||
ndb/test/tools/create_index
|
||||
ndb/test/tools/hugoCalculator
|
||||
ndb/test/tools/hugoFill
|
||||
ndb/test/tools/hugoLoad
|
||||
ndb/test/tools/hugoLockRecords
|
||||
ndb/test/tools/hugoPkDelete
|
||||
ndb/test/tools/hugoPkRead
|
||||
ndb/test/tools/hugoPkReadRecord
|
||||
ndb/test/tools/hugoPkUpdate
|
||||
ndb/test/tools/hugoScanRead
|
||||
ndb/test/tools/hugoScanUpdate
|
||||
ndb/test/tools/ndb_cpcc
|
||||
ndb/test/tools/restart
|
||||
ndb/test/tools/verify_index
|
||||
ndb/tools/ndb_delete_all
|
||||
ndb/tools/ndb_desc
|
||||
ndb/tools/ndb_drop_index
|
||||
ndb/tools/ndb_drop_table
|
||||
ndb/tools/ndb_select_all
|
||||
ndb/tools/ndb_select_count
|
||||
ndb/tools/ndb_show_tables
|
||||
ndb/tools/ndb_waiter
|
||||
pull.log
|
||||
regex/re
|
||||
repl-tests/test-repl-ts/repl-timestamp.master.reject
|
||||
@ -773,6 +841,7 @@ support-files/MacOSX/postinstall
|
||||
support-files/MacOSX/preinstall
|
||||
support-files/binary-configure
|
||||
support-files/my-huge.cnf
|
||||
support-files/my-innodb-heavy-4G.cnf
|
||||
support-files/my-large.cnf
|
||||
support-files/my-medium.cnf
|
||||
support-files/my-small.cnf
|
||||
@ -785,6 +854,57 @@ support-files/mysql-log-rotate
|
||||
support-files/mysql.server
|
||||
support-files/mysql.spec
|
||||
tags
|
||||
test/ndbapi/bank/bankCreator
|
||||
test/ndbapi/bank/bankMakeGL
|
||||
test/ndbapi/bank/bankSumAccounts
|
||||
test/ndbapi/bank/bankTimer
|
||||
test/ndbapi/bank/bankTransactionMaker
|
||||
test/ndbapi/bank/bankValidateAllGLs
|
||||
test/ndbapi/bank/testBank
|
||||
test/ndbapi/create_all_tabs
|
||||
test/ndbapi/create_tab
|
||||
test/ndbapi/drop_all_tabs
|
||||
test/ndbapi/flexAsynch
|
||||
test/ndbapi/flexBench
|
||||
test/ndbapi/flexHammer
|
||||
test/ndbapi/flexTT
|
||||
test/ndbapi/testBackup
|
||||
test/ndbapi/testBasic
|
||||
test/ndbapi/testBasicAsynch
|
||||
test/ndbapi/testBlobs
|
||||
test/ndbapi/testDataBuffers
|
||||
test/ndbapi/testDeadlock
|
||||
test/ndbapi/testDict
|
||||
test/ndbapi/testIndex
|
||||
test/ndbapi/testMgm
|
||||
test/ndbapi/testNdbApi
|
||||
test/ndbapi/testNodeRestart
|
||||
test/ndbapi/testOIBasic
|
||||
test/ndbapi/testOperations
|
||||
test/ndbapi/testRestartGci
|
||||
test/ndbapi/testScan
|
||||
test/ndbapi/testScanInterpreter
|
||||
test/ndbapi/testScanPerf
|
||||
test/ndbapi/testSystemRestart
|
||||
test/ndbapi/testTimeout
|
||||
test/ndbapi/testTransactions
|
||||
test/ndbapi/test_event
|
||||
test/run-test/atrt
|
||||
test/tools/copy_tab
|
||||
test/tools/create_index
|
||||
test/tools/hugoCalculator
|
||||
test/tools/hugoFill
|
||||
test/tools/hugoLoad
|
||||
test/tools/hugoLockRecords
|
||||
test/tools/hugoPkDelete
|
||||
test/tools/hugoPkRead
|
||||
test/tools/hugoPkReadRecord
|
||||
test/tools/hugoPkUpdate
|
||||
test/tools/hugoScanRead
|
||||
test/tools/hugoScanUpdate
|
||||
test/tools/ndb_cpcc
|
||||
test/tools/restart
|
||||
test/tools/verify_index
|
||||
test_xml
|
||||
tests/client_test
|
||||
tests/connect_test
|
||||
@ -799,5 +919,3 @@ vio/test-ssl
|
||||
vio/test-sslclient
|
||||
vio/test-sslserver
|
||||
vio/viotest-ssl
|
||||
libmysqld/sql_view.cc
|
||||
libmysqld/examples/client_test.cc
|
||||
|
@ -38,6 +38,7 @@ EXTRA_DIST = FINISH.sh \
|
||||
compile-solaris-sparc \
|
||||
compile-solaris-sparc-debug \
|
||||
compile-irix-mips64-mipspro \
|
||||
compile-hpux11-parisc2-aCC \
|
||||
compile-solaris-sparc-forte \
|
||||
compile-solaris-sparc-purify
|
||||
|
||||
|
80
BUILD/compile-hpux11-parisc2-aCC
Executable file
80
BUILD/compile-hpux11-parisc2-aCC
Executable file
@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "sql/mysqld.cc" ]; then
|
||||
echo "You must run this script from the MySQL top-level directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# -fast Expand into a set of compiler options to result in
|
||||
# improved application run-time. Options include: +O3,
|
||||
# +Onolooptransform, +Olibcalls, +FPD, +Oentryschedule,
|
||||
# +Ofastaccess.
|
||||
# +O4 Perform level 3 as well as doing link time optimizations.
|
||||
# Also sends +Oprocelim and +Ofastaccess to the linker
|
||||
# (see ld(1)).
|
||||
|
||||
release_flags="-fast +O3"
|
||||
|
||||
# -z Do not bind anything to address zero. This option
|
||||
# allows runtime detection of null pointers. See the
|
||||
# note on pointers below.
|
||||
cflags="-g -z +O0"
|
||||
cxxflags="-g0 -z +O0"
|
||||
debug_conigure_options="--with-debug"
|
||||
|
||||
while [ "$#" != 0 ]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
echo "Usage: $0 [options]"
|
||||
echo "Options:"
|
||||
echo "--help print this message"
|
||||
echo "--debug build debug binary [default] "
|
||||
echo "--release build optimised binary"
|
||||
echo "-32 build 32 bit binary [default]"
|
||||
echo "-64 build 64 bit binary"
|
||||
exit 0
|
||||
;;
|
||||
--debug)
|
||||
echo "Building debug binary"
|
||||
;;
|
||||
--release)
|
||||
echo "Building release binary"
|
||||
cflags="$release_flags"
|
||||
cxxflags="$release_flags"
|
||||
debug_configure_options=""
|
||||
;;
|
||||
-32)
|
||||
echo "Building 32-bit binary"
|
||||
;;
|
||||
-64)
|
||||
echo "Building 64-bit binary"
|
||||
cflags="$cflags +DA2.0W +DD64"
|
||||
cxxflags="$cxxflags +DA2.0W +DD64"
|
||||
;;
|
||||
*)
|
||||
echo "$0: invalid option '$1'; use --help to show usage"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
set -x
|
||||
make distclean
|
||||
aclocal
|
||||
autoheader
|
||||
libtoolize --automake --force
|
||||
automake --force --add-missing
|
||||
autoconf
|
||||
|
||||
(cd bdb/dist && sh s_all)
|
||||
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
|
||||
CC=cc CXX=aCC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \
|
||||
./configure --prefix=/usr/local/mysql --disable-shared \
|
||||
--with-extra-charsets=complex --enable-thread-safe-client \
|
||||
--without-extra-tools $debug_configure_options \
|
||||
--disable-dependency-tracking
|
||||
|
||||
gmake
|
@ -6,7 +6,7 @@ if [ ! -f "sql/mysqld.cc" ]; then
|
||||
fi
|
||||
|
||||
cflags="-64 -mips4"
|
||||
|
||||
config_args=
|
||||
if [ "$#" != 0 ]; then
|
||||
case "$1" in
|
||||
--help)
|
||||
@ -25,8 +25,7 @@ if [ "$#" != 0 ]; then
|
||||
cflags=""
|
||||
;;
|
||||
*)
|
||||
echo "$0: invalid option '$1'; use --help to show usage"
|
||||
exit 1
|
||||
config_args="$config_args $1"; shift
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@ -79,6 +78,7 @@ cxxflags="$cxxflags -LANG:libc_in_namespace_std=OFF"
|
||||
CC=cc CXX=CC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \
|
||||
./configure --prefix=/usr/local/mysql --disable-shared \
|
||||
--with-extra-charsets=complex --enable-thread-safe-client \
|
||||
--without-extra-tools --disable-dependency-tracking
|
||||
--without-extra-tools --disable-dependency-tracking \
|
||||
$config_args
|
||||
|
||||
make
|
||||
|
@ -7,11 +7,6 @@ extra_flags="$pentium_cflags $fast_cflags -g"
|
||||
extra_configs="$pentium_configs"
|
||||
#strip=yes
|
||||
|
||||
#extra_configs="$extra_configs --with-innodb --with-berkeley-db \
|
||||
# --with-embedded-server --enable-thread-safe-client \
|
||||
# --with-openssl --with-vio --with-raid --with-ndbcluster"
|
||||
# removed per discussion with Brian and Sanja because it makes Bootstrap
|
||||
# fail
|
||||
extra_configs="$extra_configs --with-innodb --with-berkeley-db \
|
||||
--with-embedded-server --enable-thread-safe-client \
|
||||
--with-openssl --with-vio --with-raid --with-ndbcluster"
|
||||
|
@ -9,7 +9,7 @@ cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs"
|
||||
|
||||
# We want to test isam when building with valgrind
|
||||
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-isam --with-embedded-server --with-openssl"
|
||||
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-isam --with-embedded-server --with-openssl --with-vio --with-raid --with-ndbcluster"
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
|
||||
|
@ -61,6 +61,7 @@ hf@genie.(none)
|
||||
igor@hundin.mysql.fi
|
||||
igor@rurik.mysql.com
|
||||
ingo@mysql.com
|
||||
jan@hundin.mysql.fi
|
||||
jani@a80-186-24-72.elisa-laajakaista.fi
|
||||
jani@dsl-jkl1657.dial.inet.fi
|
||||
jani@dsl-kpogw4gb5.dial.inet.fi
|
||||
@ -80,10 +81,12 @@ jcole@mugatu.jcole.us
|
||||
jcole@mugatu.spaceapes.com
|
||||
jcole@sarvik.tfr.cafe.ee
|
||||
jcole@tetra.spaceapes.com
|
||||
joerg@mysql.com
|
||||
joreland@mysql.com
|
||||
jorge@linux.jorge.mysql.com
|
||||
jplindst@t41.(none)
|
||||
kaj@work.mysql.com
|
||||
kent@mysql.com
|
||||
konstantin@mysql.com
|
||||
kostja@oak.local
|
||||
lenz@kallisto.mysql.com
|
||||
@ -94,9 +97,11 @@ miguel@hegel.(none)
|
||||
miguel@hegel.br
|
||||
miguel@hegel.local
|
||||
miguel@hegel.txg
|
||||
miguel@hegel.txg.br
|
||||
miguel@light.
|
||||
miguel@light.local
|
||||
miguel@sartre.local
|
||||
mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
|
||||
mikron@mikael-ronstr-ms-dator.local
|
||||
mmatthew@markslaptop.
|
||||
monty@bitch.mysql.fi
|
||||
@ -127,6 +132,8 @@ mysql@home.(none)
|
||||
mysqldev@build.mysql2.com
|
||||
mysqldev@melody.local
|
||||
mysqldev@mysql.com
|
||||
mysqldev@o2k.irixworld.net
|
||||
ndbdev@eel.hemma.oreland.se
|
||||
ndbdev@ndbmaster.mysql.com
|
||||
nick@mysql.com
|
||||
nick@nick.leippe.com
|
||||
@ -153,6 +160,7 @@ ram@gw.udmsearch.izhnet.ru
|
||||
ram@mysql.r18.ru
|
||||
ram@ram.(none)
|
||||
ranger@regul.home.lan
|
||||
rburnett@build.mysql.com
|
||||
root@home.(none)
|
||||
root@x3.internalnet
|
||||
salle@banica.(none)
|
||||
|
@ -28,8 +28,8 @@ else
|
||||
# Some predefined settings
|
||||
$build_command= "BUILD/compile-pentium-max";
|
||||
$PWD= cwd();
|
||||
$LOGFILE= $PWD . "/Bootstrap.log";
|
||||
$opt_docdir= $PWD . "/mysqldoc";
|
||||
$opt_archive_log= undef;
|
||||
$opt_build_command= undef;
|
||||
$opt_changelog= undef;
|
||||
$opt_delete= undef;
|
||||
@ -51,6 +51,7 @@ $version= "unknown";
|
||||
$major=$minor=$release=0;
|
||||
|
||||
GetOptions(
|
||||
"archive-log|a",
|
||||
"build-command|b=s",
|
||||
"changelog|c:s",
|
||||
"directory|d=s",
|
||||
@ -72,6 +73,17 @@ GetOptions(
|
||||
"quiet|q",
|
||||
) || print_help("");
|
||||
|
||||
#
|
||||
# Override predefined build command
|
||||
#
|
||||
if (defined $opt_build_command)
|
||||
{
|
||||
$build_command= $opt_build_command;
|
||||
}
|
||||
|
||||
print_help("") if ($opt_help);
|
||||
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
|
||||
|
||||
#
|
||||
# Override predefined Log file name
|
||||
#
|
||||
@ -90,16 +102,7 @@ if (defined $opt_log)
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Override predefined build command
|
||||
#
|
||||
if (defined $opt_build_command)
|
||||
{
|
||||
$build_command= $opt_build_command;
|
||||
}
|
||||
|
||||
print_help("") if ($opt_help);
|
||||
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
|
||||
$LOGFILE= $PWD . "/Bootstrap-" . $REPO . ".log" unless ($LOGFILE);
|
||||
|
||||
&logger("Starting build");
|
||||
&abort("The directory \"$REPO\" could not be found!") if (!-d $REPO);
|
||||
@ -120,14 +123,16 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
|
||||
if ($opt_pull)
|
||||
{
|
||||
&logger("Updating BK tree $REPO to latest ChangeSet first");
|
||||
$command= "cd $REPO; bk pull; cd ..";
|
||||
&run_command($command, "Could not update $REPO!");
|
||||
chdir ($REPO) or &abort("Could not chdir to $REPO!");
|
||||
&run_command("bk pull", "Could not update $REPO!");
|
||||
chdir ($PWD) or &abort("Could not chdir to $PWD!");
|
||||
|
||||
unless ($opt_skip_manual)
|
||||
{
|
||||
&logger("Updating manual tree in $opt_docdir");
|
||||
$command= "cd $opt_docdir; bk pull; cd ..";
|
||||
&run_command($command, "Could not update $opt_docdir!");
|
||||
chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!");
|
||||
&run_command("bk pull", "Could not update $opt_docdir!");
|
||||
chdir ($PWD) or &abort("Could not chdir to $PWD!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,6 +356,21 @@ if (!$opt_skip_check)
|
||||
# All done when we came down here
|
||||
#
|
||||
&logger("SUCCESS: Build finished successfully.") if (!$opt_dry_run);
|
||||
|
||||
#
|
||||
# Move the log file into the Log dir of the target dir
|
||||
#
|
||||
if ($opt_archive_log)
|
||||
{
|
||||
my $logdir= $target_dir . "/Logs";
|
||||
&logger("Moving $LOGFILE to $logdir");
|
||||
mkdir "$logdir" if (! -d $logdir);
|
||||
$command= "mv ";
|
||||
$command.= "-v " if ($opt_verbose || defined $opt_log);
|
||||
$command.= "$LOGFILE $logdir";
|
||||
&run_command($command, "Could not move $LOGFILE to $logdir!");
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
#
|
||||
@ -378,6 +398,8 @@ distribution check can be run before the source archive is being created.
|
||||
|
||||
Options:
|
||||
|
||||
-a, --archive-log Move the log file into the Logs directory of
|
||||
the exported tree after a successful build
|
||||
-b, --build-command=<cmd> Use <cmd> to compile the sources before packing
|
||||
the distribution.
|
||||
(default is "$build_command")
|
||||
@ -398,7 +420,7 @@ Options:
|
||||
do not build or test the source distribution
|
||||
-h, --help Print this help message
|
||||
-l, --log[=<filename>] Write a log file [to <filename>]
|
||||
(default is "$LOGFILE")
|
||||
(default is "./Bootstrap-<bk repository>.log")
|
||||
-m, --mail=<address> Mail a failure report to the given address (and
|
||||
include a log file snippet, if logging is enabled)
|
||||
Note that the \@-Sign needs to be quoted!
|
||||
|
@ -10,12 +10,13 @@ use Sys::Hostname;
|
||||
$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
|
||||
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
|
||||
$opt_tmp=$opt_version_suffix="";
|
||||
$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
|
||||
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
|
||||
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
|
||||
|
||||
GetOptions(
|
||||
"bdb",
|
||||
"build-thread=i",
|
||||
"bundled-zlib",
|
||||
"config-env=s" => \@config_env,
|
||||
"config-extra-env=s" => \@config_extra_env,
|
||||
"config-options=s" => \@config_options,
|
||||
@ -255,6 +256,7 @@ if ($opt_stage <= 1)
|
||||
log_system("$make clean") if ($opt_use_old_distribution);
|
||||
$opt_config_options.= " --disable-shared" if (!$opt_enable_shared); # Default for binary versions
|
||||
$opt_config_options.= " --with-berkeley-db" if ($opt_bdb);
|
||||
$opt_config_options.= " --with-zlib-dir=bundled" if ($opt_bundled_zlib);
|
||||
$opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client);
|
||||
$opt_config_options.= " --with-debug" if ($opt_with_debug);
|
||||
$opt_config_options.= " --with-libwrap" if ($opt_libwrap);
|
||||
@ -374,7 +376,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
|
||||
log_timestamp();
|
||||
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
|
||||
safe_cd("${test_dir}/mysql-test");
|
||||
check_system("./mysql-test-run $flags --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
|
||||
check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -101,6 +101,7 @@ sub main
|
||||
# on the toplevel of the directory instead. file 'PUBLIC' shouldn't
|
||||
# exist in the new mysql distributions, but let's be sure..
|
||||
unlink("$destdir/PUBLIC", "$destdir/README");
|
||||
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
|
||||
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
|
||||
|
||||
# remove readline, bdb subdirs and update 'configure'
|
||||
@ -114,6 +115,9 @@ sub main
|
||||
# fix file copyrights
|
||||
&fix_usage_copyright();
|
||||
&add_copyright();
|
||||
|
||||
# fix LICENSE tag in include/mysql_version.h
|
||||
&fix_mysql_version();
|
||||
|
||||
# rename the directory with new distribution name
|
||||
chdir("$WD/$dir");
|
||||
@ -140,6 +144,28 @@ sub main
|
||||
exit(0);
|
||||
}
|
||||
|
||||
####
|
||||
#### This function will s/GPL/Commercial/ in include/mysql_version.h for the
|
||||
#### LICENSE tag.
|
||||
####
|
||||
sub fix_mysql_version
|
||||
{
|
||||
chdir("$destdir");
|
||||
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
|
||||
|
||||
open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
|
||||
undef $/;
|
||||
my $mysql_version= <MYSQL_VERSION>;
|
||||
close(MYSQL_VERSION);
|
||||
|
||||
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
|
||||
|
||||
open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
|
||||
print MYSQL_VERSION $mysql_version;
|
||||
close(MYSQL_VERSION);
|
||||
chdir("$cwd");
|
||||
}
|
||||
|
||||
####
|
||||
#### This function will remove unwanted parts of a src tree for the mysqlcom
|
||||
#### distributions.
|
||||
@ -150,11 +176,7 @@ sub trim_the_fat
|
||||
my $cwd= getcwd();
|
||||
|
||||
system("rm -rf $destdir/${the_fat}");
|
||||
if ($win_flag)
|
||||
{
|
||||
chdir("$destdir") or die "Unable to change directory to $destdir!: $!\n";
|
||||
}
|
||||
else
|
||||
if (!$win_flag)
|
||||
{
|
||||
chdir("$destdir");
|
||||
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
|
||||
@ -182,7 +204,7 @@ sub trim_the_fat
|
||||
open(CONFIGURE,">configure.in") or die "Unable to open configure.in for write: $!\n";
|
||||
print CONFIGURE $configure;
|
||||
close(CONFIGURE);
|
||||
`autoconf`;
|
||||
`aclocal && autoheader && aclocal && automake && autoconf`;
|
||||
die "'./configure' was not produced!" unless (-f "configure");
|
||||
chdir("$cwd");
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
|
||||
|
||||
all: $(targets) txt_files
|
||||
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE \
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
|
||||
INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
|
||||
|
||||
CLEAN_FILES: $(BUILD_SOURCES)
|
||||
@ -204,7 +204,10 @@ INSTALL-BINARY: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "Installing binary" "Installing source" > $@
|
||||
|
||||
../COPYING: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "GPL license" "Function Index" > $@
|
||||
perl -w $(GT) mysql.info "GPL license" "MySQL FLOSS License Exception" > $@
|
||||
|
||||
../EXCEPTIONS-CLIENT: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "MySQL FLOSS License Exception" "Function Index" > $@
|
||||
|
||||
../support-files/MacOSX/ReadMe.txt: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "Mac OS X installation" "NetWare installation" > $@
|
||||
|
11
Makefile.am
11
Makefile.am
@ -19,8 +19,15 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
# These are built from source in the Docs directory
|
||||
EXTRA_DIST = INSTALL-SOURCE README COPYING zlib
|
||||
SUBDIRS = . include @docs_dirs@ \
|
||||
EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
|
||||
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
|
||||
@readline_topdir@ sql-common \
|
||||
@thread_dirs@ pstack @sql_client_dirs@ \
|
||||
@sql_server_dirs@ scripts man tests \
|
||||
netware @libmysqld_dirs@ \
|
||||
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
|
||||
|
||||
DIST_SUBDIRS = . include @docs_dirs@ zlib \
|
||||
@readline_topdir@ sql-common \
|
||||
@thread_dirs@ pstack @sql_client_dirs@ \
|
||||
@sql_server_dirs@ scripts man tests SSL\
|
||||
|
8
VC++Files/sql/message.mc
Normal file
8
VC++Files/sql/message.mc
Normal file
@ -0,0 +1,8 @@
|
||||
MessageId = 100
|
||||
Severity = Error
|
||||
Facility = Application
|
||||
SymbolicName = MSG_DEFAULT
|
||||
Language = English
|
||||
%1For more information, see Help and Support Center at http://www.mysql.com.
|
||||
|
||||
|
@ -187,7 +187,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /D MYSQL_SERVER_SUFFIX=-classic /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -243,7 +243,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-nt /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-classic-nt /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@ -920,6 +920,89 @@ SOURCE=.\log_event.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\message.mc
|
||||
|
||||
!IF "$(CFG)" == "mysqld - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
|
||||
|
||||
# Begin Custom Build - Compiling messages
|
||||
InputDir=.
|
||||
InputPath=.\message.mc
|
||||
InputName=message
|
||||
|
||||
BuildCmds= \
|
||||
mc.exe "$(InputDir)\$(InputName).mc"
|
||||
|
||||
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
|
||||
# Begin Custom Build - Compiling messages
|
||||
InputDir=.
|
||||
InputPath=.\message.mc
|
||||
InputName=message
|
||||
|
||||
BuildCmds= \
|
||||
mc.exe "$(InputDir)\$(InputName).mc"
|
||||
|
||||
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 classic"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 pro"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 classic nt"
|
||||
# Begin Custom Build - Compiling messages
|
||||
InputDir=.
|
||||
InputPath=.\message.mc
|
||||
InputName=message
|
||||
|
||||
BuildCmds= \
|
||||
mc.exe "$(InputDir)\$(InputName).mc"
|
||||
|
||||
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
!ELSEIF "$(CFG)" == "mysqld - Win32 pro nt"
|
||||
# Begin Custom Build - Compiling messages
|
||||
InputDir=.
|
||||
InputPath=.\message.mc
|
||||
InputName=message
|
||||
|
||||
BuildCmds= \
|
||||
mc.exe "$(InputDir)\$(InputName).mc"
|
||||
|
||||
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\message.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mf_iocache.cpp
|
||||
|
||||
!IF "$(CFG)" == "mysqld - Win32 Release"
|
||||
|
@ -155,25 +155,32 @@ enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
|
||||
#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */
|
||||
#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */
|
||||
|
||||
enum enum_shutdown_level {
|
||||
|
||||
/* Shutdown/kill enums and constants */
|
||||
|
||||
/* Bits for THD::killable. */
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3)
|
||||
|
||||
enum mysql_enum_shutdown_level {
|
||||
/*
|
||||
We want levels to be in growing order of hardness. So we leave room
|
||||
for future intermediate levels. For now, escalating one level is += 10;
|
||||
later if we insert new levels in between we will need a function
|
||||
next_shutdown_level(level). Note that DEFAULT does not respect the
|
||||
growing property.
|
||||
We want levels to be in growing order of hardness (because we use number
|
||||
comparisons). Note that DEFAULT does not respect the growing property, but
|
||||
it's ok.
|
||||
*/
|
||||
SHUTDOWN_DEFAULT= 0, /* mapped to WAIT_ALL_BUFFERS for now */
|
||||
/*
|
||||
Here is the list in growing order (the next does the previous plus
|
||||
something). WAIT_ALL_BUFFERS is what we have now. Others are "this MySQL
|
||||
server does not support this shutdown level yet".
|
||||
*/
|
||||
SHUTDOWN_WAIT_CONNECTIONS= 10, /* wait for existing connections to finish */
|
||||
SHUTDOWN_WAIT_TRANSACTIONS= 20, /* wait for existing trans to finish */
|
||||
SHUTDOWN_WAIT_STATEMENTS= 30, /* wait for existing updating stmts to finish */
|
||||
SHUTDOWN_WAIT_ALL_BUFFERS= 40, /* flush InnoDB buffers */
|
||||
SHUTDOWN_WAIT_CRITICAL_BUFFERS= 50, /* flush MyISAM buffs (no corruption) */
|
||||
DEFAULT= 0,
|
||||
/* wait for existing connections to finish */
|
||||
WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT,
|
||||
/* wait for existing trans to finish */
|
||||
WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS,
|
||||
/* wait for existing updates to finish (=> no partial MyISAM update) */
|
||||
WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE,
|
||||
/* flush InnoDB buffers and other storage engines' buffers*/
|
||||
WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
|
||||
/* don't flush InnoDB buffers, flush other storage engines' buffers*/
|
||||
WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
|
||||
/* Now the 2 levels of the KILL command */
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
KILL_QUERY= 254,
|
||||
|
372
acconfig.h
372
acconfig.h
@ -1,372 +0,0 @@
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
#undef C_ALLOCA
|
||||
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define the default charset name */
|
||||
#undef MYSQL_DEFAULT_CHARSET_NAME
|
||||
|
||||
/* Define the default charset name */
|
||||
#undef MYSQL_DEFAULT_COLLATION_NAME
|
||||
|
||||
/* Version of .frm files */
|
||||
#undef DOT_FRM_VERSION
|
||||
|
||||
/* If LOAD DATA LOCAL INFILE should be enabled by default */
|
||||
#undef ENABLED_LOCAL_INFILE
|
||||
|
||||
/* READLINE: */
|
||||
#undef FIONREAD_IN_SYS_IOCTL
|
||||
|
||||
/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */
|
||||
#undef GWINSZ_IN_SYS_IOCTL
|
||||
|
||||
/* Handing of large files on Solaris 2.6 */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Do we have FIONREAD */
|
||||
#undef FIONREAD_IN_SYS_IOCTL
|
||||
|
||||
/* Do we need to define _GNU_SOURCE */
|
||||
#undef _GNU_SOURCE
|
||||
|
||||
/* atomic_add() from <asm/atomic.h> (Linux only) */
|
||||
#undef HAVE_ATOMIC_ADD
|
||||
|
||||
/* atomic_sub() from <asm/atomic.h> (Linux only) */
|
||||
#undef HAVE_ATOMIC_SUB
|
||||
|
||||
/* If we have a working alloca() implementation */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* bool is not defined by all C++ compilators */
|
||||
#undef HAVE_BOOL
|
||||
|
||||
/* Have berkeley db installed */
|
||||
#undef HAVE_BERKELEY_DB
|
||||
|
||||
/* DSB style signals ? */
|
||||
#undef HAVE_BSD_SIGNALS
|
||||
|
||||
/* Can netinet be included */
|
||||
#undef HAVE_BROKEN_NETINET_INCLUDES
|
||||
|
||||
/* READLINE: */
|
||||
#undef HAVE_BSD_SIGNALS
|
||||
|
||||
/* Define charsets you want */
|
||||
#undef HAVE_CHARSET_armscii8
|
||||
#undef HAVE_CHARSET_ascii
|
||||
#undef HAVE_CHARSET_big5
|
||||
#undef HAVE_CHARSET_cp1250
|
||||
#undef HAVE_CHARSET_cp1251
|
||||
#undef HAVE_CHARSET_cp1256
|
||||
#undef HAVE_CHARSET_cp1257
|
||||
#undef HAVE_CHARSET_cp850
|
||||
#undef HAVE_CHARSET_cp852
|
||||
#undef HAVE_CHARSET_cp866
|
||||
#undef HAVE_CHARSET_dec8
|
||||
#undef HAVE_CHARSET_euckr
|
||||
#undef HAVE_CHARSET_gb2312
|
||||
#undef HAVE_CHARSET_gbk
|
||||
#undef HAVE_CHARSET_geostd8
|
||||
#undef HAVE_CHARSET_greek
|
||||
#undef HAVE_CHARSET_hebrew
|
||||
#undef HAVE_CHARSET_hp8
|
||||
#undef HAVE_CHARSET_keybcs2
|
||||
#undef HAVE_CHARSET_koi8r
|
||||
#undef HAVE_CHARSET_koi8u
|
||||
#undef HAVE_CHARSET_latin1
|
||||
#undef HAVE_CHARSET_latin2
|
||||
#undef HAVE_CHARSET_latin5
|
||||
#undef HAVE_CHARSET_latin7
|
||||
#undef HAVE_CHARSET_macce
|
||||
#undef HAVE_CHARSET_macroman
|
||||
#undef HAVE_CHARSET_sjis
|
||||
#undef HAVE_CHARSET_swe7
|
||||
#undef HAVE_CHARSET_tis620
|
||||
#undef HAVE_CHARSET_ucs2
|
||||
#undef HAVE_CHARSET_ujis
|
||||
#undef HAVE_CHARSET_utf8
|
||||
|
||||
/* ZLIB and compress: */
|
||||
#undef HAVE_COMPRESS
|
||||
|
||||
/* Define if we are using OSF1 DEC threads */
|
||||
#undef HAVE_DEC_THREADS
|
||||
|
||||
/* Define if we are using OSF1 DEC threads on 3.2 */
|
||||
#undef HAVE_DEC_3_2_THREADS
|
||||
|
||||
/* Builds Example DB */
|
||||
#undef HAVE_EXAMPLE_DB
|
||||
|
||||
/* Builds Archive Storage Engine */
|
||||
#undef HAVE_ARCHIVE_DB
|
||||
|
||||
/* fp_except from ieeefp.h */
|
||||
#undef HAVE_FP_EXCEPT
|
||||
|
||||
/* READLINE: */
|
||||
#undef HAVE_GETPW_DECLS
|
||||
|
||||
/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines
|
||||
this with 6 arguments */
|
||||
#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE
|
||||
|
||||
/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */
|
||||
#undef HAVE_GETHOSTBYNAME_R_RETURN_INT
|
||||
|
||||
/* Define if int8, int16 and int32 types exist */
|
||||
#undef HAVE_INT_8_16_32
|
||||
|
||||
/* Using Innobase DB */
|
||||
#undef HAVE_INNOBASE_DB
|
||||
|
||||
/* Using old ISAM tables */
|
||||
#undef HAVE_ISAM
|
||||
|
||||
/* Define if we have GNU readline */
|
||||
#undef HAVE_LIBREADLINE
|
||||
|
||||
/* Define if have -lwrap */
|
||||
#undef HAVE_LIBWRAP
|
||||
|
||||
/* Define if we are using Xavier Leroy's LinuxThreads */
|
||||
#undef HAVE_LINUXTHREADS
|
||||
|
||||
/* Do we have lstat */
|
||||
#undef HAVE_LSTAT
|
||||
|
||||
/* Do we use user level threads */
|
||||
#undef HAVE_mit_thread
|
||||
|
||||
/* Using Ndb Cluster DB */
|
||||
#undef HAVE_NDBCLUSTER_DB
|
||||
|
||||
/* Including Ndb Cluster DB shared memory transporter */
|
||||
#undef NDB_SHM_TRANSPORTER
|
||||
|
||||
/* Including Ndb Cluster DB sci transporter */
|
||||
#undef NDB_SCI_TRANSPORTER
|
||||
|
||||
/* For some non posix threads */
|
||||
#undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
|
||||
|
||||
/* For some non posix threads */
|
||||
#undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
|
||||
|
||||
/* READLINE: */
|
||||
#undef HAVE_POSIX_SIGNALS
|
||||
|
||||
/* Well.. */
|
||||
#undef HAVE_POSIX_SIGSETJMP
|
||||
|
||||
/* sigwait with one argument */
|
||||
#undef HAVE_NONPOSIX_SIGWAIT
|
||||
|
||||
/* ORBIT */
|
||||
#undef HAVE_ORBIT
|
||||
|
||||
/* pthread_attr_setscope */
|
||||
#undef HAVE_PTHREAD_ATTR_SETSCOPE
|
||||
|
||||
/* pthread_yield that doesn't take any arguments */
|
||||
#undef HAVE_PTHREAD_YIELD_ZERO_ARG
|
||||
|
||||
/* pthread_yield function with one argument */
|
||||
#undef HAVE_PTHREAD_YIELD_ONE_ARG
|
||||
|
||||
/* POSIX readdir_r */
|
||||
#undef HAVE_READDIR_R
|
||||
|
||||
/* Have Gemini db installed */
|
||||
#undef HAVE_GEMINI_DB
|
||||
|
||||
/* POSIX sigwait */
|
||||
#undef HAVE_SIGWAIT
|
||||
|
||||
/* crypt */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* If we want to have query cache */
|
||||
#undef HAVE_QUERY_CACHE
|
||||
|
||||
/* Spatial extentions */
|
||||
#undef HAVE_SPATIAL
|
||||
|
||||
/* RTree keys */
|
||||
#undef HAVE_RTREE_KEYS
|
||||
|
||||
/* Access checks in embedded library */
|
||||
#undef HAVE_EMBEDDED_PRIVILEGE_CONTROL
|
||||
|
||||
/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines
|
||||
this with 8 arguments */
|
||||
#undef HAVE_SOLARIS_STYLE_GETHOST
|
||||
|
||||
/* MIT pthreads does not support connecting with unix sockets */
|
||||
#undef HAVE_THREADS_WITHOUT_SOCKETS
|
||||
|
||||
/* Timespec has a ts_sec instead of tv_sev */
|
||||
#undef HAVE_TIMESPEC_TS_SEC
|
||||
|
||||
/* Have the tzname variable */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
/* Define if the system files define uchar */
|
||||
#undef HAVE_UCHAR
|
||||
|
||||
/* Define if the system files define uint */
|
||||
#undef HAVE_UINT
|
||||
|
||||
/* Define if the system files define ulong */
|
||||
#undef HAVE_ULONG
|
||||
|
||||
/* Define if the system files define in_addr_t */
|
||||
#undef HAVE_IN_ADDR_T
|
||||
|
||||
/* UNIXWARE7 threads are not posix */
|
||||
#undef HAVE_UNIXWARE7_THREADS
|
||||
|
||||
/* new UNIXWARE7 threads that are not yet posix */
|
||||
#undef HAVE_UNIXWARE7_POSIX
|
||||
|
||||
/* OpenSSL */
|
||||
#undef HAVE_OPENSSL
|
||||
|
||||
/* READLINE: */
|
||||
#undef HAVE_USG_SIGHOLD
|
||||
|
||||
/* Virtual IO */
|
||||
#undef HAVE_VIO
|
||||
|
||||
/* Handling of large files on Solaris 2.6 */
|
||||
#undef _LARGEFILE_SOURCE
|
||||
|
||||
/* Handling of large files on Solaris 2.6 */
|
||||
#undef _LARGEFILE64_SOURCE
|
||||
|
||||
/* Define if want -lwrap */
|
||||
#undef LIBWRAP
|
||||
|
||||
/* Define to machine type name eg sun10 */
|
||||
#undef MACHINE_TYPE
|
||||
|
||||
#undef MUST_REINSTALL_SIGHANDLERS
|
||||
|
||||
/* Defined to used character set */
|
||||
#undef MY_CHARSET_CURRENT
|
||||
|
||||
/* READLINE: no sys file*/
|
||||
#undef NO_SYS_FILE
|
||||
|
||||
/* Program name */
|
||||
#undef PACKAGE
|
||||
|
||||
/* mysql client protocoll version */
|
||||
#undef PROTOCOL_VERSION
|
||||
|
||||
/* ndb version */
|
||||
#undef NDB_VERSION_MAJOR
|
||||
#undef NDB_VERSION_MINOR
|
||||
#undef NDB_VERSION_BUILD
|
||||
#undef NDB_VERSION_STATUS
|
||||
|
||||
/* Define if qsort returns void */
|
||||
#undef QSORT_TYPE_IS_VOID
|
||||
|
||||
/* Define as the return type of qsort (int or void). */
|
||||
#undef RETQSORTTYPE
|
||||
|
||||
/* Size of off_t */
|
||||
#undef SIZEOF_OFF_T
|
||||
|
||||
/* Define as the base type of the last arg to accept */
|
||||
#undef SOCKET_SIZE_TYPE
|
||||
|
||||
/* Last argument to get/setsockopt */
|
||||
#undef SOCKOPT_OPTLEN_TYPE
|
||||
|
||||
#undef SPEED_T_IN_SYS_TYPES
|
||||
#undef SPRINTF_RETURNS_PTR
|
||||
#undef SPRINTF_RETURNS_INT
|
||||
#undef SPRINTF_RETURNS_GARBAGE
|
||||
|
||||
/* Needed to get large file support on HPUX 10.20 */
|
||||
#undef __STDC_EXT__
|
||||
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
#undef STRCOLL_BROKEN
|
||||
|
||||
#undef STRUCT_DIRENT_HAS_D_FILENO
|
||||
#undef STRUCT_DIRENT_HAS_D_INO
|
||||
|
||||
#undef STRUCT_WINSIZE_IN_SYS_IOCTL
|
||||
#undef STRUCT_WINSIZE_IN_TERMIOS
|
||||
|
||||
/* Define to name of system eg solaris*/
|
||||
#undef SYSTEM_TYPE
|
||||
|
||||
/* Define if you want to have threaded code. This may be undef on client code */
|
||||
#undef THREAD
|
||||
|
||||
/* Should be client be thread safe */
|
||||
#undef THREAD_SAFE_CLIENT
|
||||
|
||||
/* READLINE: */
|
||||
#undef TIOCSTAT_IN_SYS_IOCTL
|
||||
|
||||
/* Use multi-byte character routines */
|
||||
#undef USE_MB
|
||||
#undef USE_MB_IDENT
|
||||
|
||||
/* the pstack backtrace library */
|
||||
#undef USE_PSTACK
|
||||
|
||||
/* Use MySQL RAID */
|
||||
#undef USE_RAID
|
||||
|
||||
/* Program version */
|
||||
#undef VERSION
|
||||
|
||||
/* READLINE: */
|
||||
#undef VOID_SIGHANDLER
|
||||
|
||||
/* used libedit interface (can we dereference result of rl_completion_entry_function?) */
|
||||
#undef USE_LIBEDIT_INTERFACE
|
||||
|
||||
/* used new readline interface (does rl_completion_func_t and rl_compentry_func_t defined?) */
|
||||
#undef USE_NEW_READLINE_INTERFACE
|
||||
|
||||
/* macro for libedit */
|
||||
#undef HAVE_VIS_H
|
||||
#undef HAVE_FGETLN
|
||||
#undef HAVE_ISSETUGID
|
||||
#undef HAVE_STRLCPY
|
||||
#undef HAVE_GETLINE
|
||||
#undef HAVE_FLOCKFILE
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
312
acinclude.m4
312
acinclude.m4
@ -1,5 +1,26 @@
|
||||
# Local macros for automake & autoconf
|
||||
|
||||
|
||||
AC_DEFUN(MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY,[
|
||||
AC_CACHE_CHECK([HIST_ENTRY is declared in readline/readline.h], mysql_cv_hist_entry_declared,
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include "stdio.h"
|
||||
#include "readline/readline.h"
|
||||
],
|
||||
[
|
||||
HIST_ENTRY entry;
|
||||
],
|
||||
[
|
||||
mysql_cv_hist_entry_declared=yes
|
||||
AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, [1],
|
||||
[HIST_ENTRY is defined in the outer libeditreadline])
|
||||
],
|
||||
[mysql_cv_libedit_interface=no]
|
||||
)
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN(MYSQL_CHECK_LIBEDIT_INTERFACE,[
|
||||
AC_CACHE_CHECK([libedit variant of rl_completion_entry_function], mysql_cv_libedit_interface,
|
||||
AC_TRY_COMPILE(
|
||||
@ -13,7 +34,8 @@ AC_DEFUN(MYSQL_CHECK_LIBEDIT_INTERFACE,[
|
||||
],
|
||||
[
|
||||
mysql_cv_libedit_interface=yes
|
||||
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE)
|
||||
AC_DEFINE_UNQUOTED([USE_LIBEDIT_INTERFACE], [1],
|
||||
[used libedit interface (can we dereference result of rl_completion_entry_function)])
|
||||
],
|
||||
[mysql_cv_libedit_interface=no]
|
||||
)
|
||||
@ -33,7 +55,8 @@ AC_DEFUN(MYSQL_CHECK_NEW_RL_INTERFACE,[
|
||||
],
|
||||
[
|
||||
mysql_cv_new_rl_interface=yes
|
||||
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE)
|
||||
AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1],
|
||||
[used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)])
|
||||
],
|
||||
[mysql_cv_new_rl_interface=no]
|
||||
)
|
||||
@ -65,7 +88,7 @@ main()
|
||||
exit(0);
|
||||
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
|
||||
AC_MSG_RESULT($AC_CV_NAME)
|
||||
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
|
||||
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [ ])
|
||||
undefine([AC_TYPE_NAME])dnl
|
||||
undefine([AC_CV_NAME])dnl
|
||||
])
|
||||
@ -105,7 +128,8 @@ if test "$mysql_cv_btype_last_arg_accept" = "none"; then
|
||||
mysql_cv_btype_last_arg_accept=int
|
||||
fi)
|
||||
AC_LANG_RESTORE
|
||||
AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $mysql_cv_btype_last_arg_accept)
|
||||
AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
|
||||
[The base type of the last arg to accept])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
])
|
||||
#---END:
|
||||
@ -121,10 +145,11 @@ void qsort(void *base, size_t nel, size_t width,
|
||||
int (*compar) (const void *, const void *));
|
||||
],
|
||||
[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
|
||||
AC_DEFINE_UNQUOTED(RETQSORTTYPE, $mysql_cv_type_qsort)
|
||||
AC_DEFINE_UNQUOTED([RETQSORTTYPE], [$mysql_cv_type_qsort],
|
||||
[The return type of qsort (int or void).])
|
||||
if test "$mysql_cv_type_qsort" = "void"
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSORT_TYPE_IS_VOID, 1)
|
||||
AC_DEFINE_UNQUOTED([QSORT_TYPE_IS_VOID], [1], [qsort returns void])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -142,7 +167,8 @@ abstime.ts_nsec = 0;
|
||||
], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)])
|
||||
if test "$mysql_cv_timespec_ts" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_TIMESPEC_TS_SEC)
|
||||
AC_DEFINE([HAVE_TIMESPEC_TS_SEC], [1],
|
||||
[Timespec has a ts_sec instead of tv_sev])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -158,36 +184,120 @@ extern "C"
|
||||
], mysql_cv_tzname=yes, mysql_cv_tzname=no)])
|
||||
if test "$mysql_cv_tzname" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_TZNAME)
|
||||
AC_DEFINE([HAVE_TZNAME], [1], [Have the tzname variable])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [
|
||||
|
||||
dnl Define zlib paths to point at bundled zlib
|
||||
|
||||
AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
|
||||
ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
|
||||
ZLIB_LIBS="\$(top_builddir)/zlib/libz.la"
|
||||
zlib_dir="zlib"
|
||||
AC_SUBST([zlib_dir])
|
||||
mysql_cv_compress="yes"
|
||||
])
|
||||
|
||||
dnl Auxiliary macro to check for zlib at given path
|
||||
|
||||
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
|
||||
save_INCLUDES="$INCLUDES"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="-l$1 $LIBS"
|
||||
AC_CACHE_CHECK([if libz with compress], mysql_cv_compress,
|
||||
[AC_TRY_RUN([#include <zlib.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int main(int argv, char **argc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int link_test()
|
||||
{
|
||||
return compress(0, (unsigned long*) 0, "", 0);
|
||||
}
|
||||
], mysql_cv_compress=yes, mysql_cv_compress=no)])
|
||||
if test "$mysql_cv_compress" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_COMPRESS)
|
||||
else
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
INCLUDES="$INCLUDES $ZLIB_INCLUDES"
|
||||
LIBS="$LIBS $ZLIB_LIBS"
|
||||
AC_CACHE_VAL([mysql_cv_compress],
|
||||
[AC_TRY_LINK([#include <zlib.h>],
|
||||
[int link_test() { return compress(0, (unsigned long*) 0, "", 0); }],
|
||||
[mysql_cv_compress="yes"
|
||||
AC_MSG_RESULT([ok])],
|
||||
[mysql_cv_compress="no"])
|
||||
])
|
||||
INCLUDES="$save_INCLUDES"
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
|
||||
dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
|
||||
dnl
|
||||
dnl Provides the following configure options:
|
||||
dnl --with-zlib-dir=DIR
|
||||
dnl Possible DIR values are:
|
||||
dnl - "no" - the macro will disable use of compression functions
|
||||
dnl - "bundled" - means use zlib bundled along with MySQL sources
|
||||
dnl - empty, or not specified - the macro will try default system
|
||||
dnl library (if present), and in case of error will fall back to
|
||||
dnl bundled zlib
|
||||
dnl - zlib location prefix - given location prefix, the macro expects
|
||||
dnl to find the library headers in $prefix/include, and binaries in
|
||||
dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
|
||||
dnl macro bails out with error.
|
||||
dnl
|
||||
dnl If the library was found, this function #defines HAVE_COMPRESS
|
||||
dnl and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include) and
|
||||
dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz).
|
||||
|
||||
AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
|
||||
AC_MSG_CHECKING([for zlib compression library])
|
||||
case $SYSTEM_TYPE in
|
||||
dnl This is a quick fix for Netware if AC_TRY_LINK for some reason
|
||||
dnl won't work there. Uncomment in case of failure and on Netware
|
||||
dnl we'll always assume that zlib is present
|
||||
dnl *netware* | *modesto*)
|
||||
dnl AC_MSG_RESULT(ok)
|
||||
dnl AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
|
||||
dnl ;;
|
||||
*)
|
||||
AC_ARG_WITH([zlib-dir],
|
||||
AC_HELP_STRING([--with-zlib-dir=DIR],
|
||||
[Provide MySQL with a custom location of
|
||||
compression library. Given DIR, zlib binary is
|
||||
assumed to be in $DIR/lib and header files
|
||||
in $DIR/include.]),
|
||||
[mysql_zlib_dir=${withval}],
|
||||
[mysql_zlib_dir=""])
|
||||
case "$mysql_zlib_dir" in
|
||||
"no")
|
||||
mysql_cv_compress="no"
|
||||
AC_MSG_RESULT([disabled])
|
||||
;;
|
||||
"bundled")
|
||||
MYSQL_USE_BUNDLED_ZLIB
|
||||
AC_MSG_RESULT([using bundled zlib])
|
||||
;;
|
||||
"")
|
||||
ZLIB_INCLUDES=""
|
||||
ZLIB_LIBS="-lz"
|
||||
MYSQL_CHECK_ZLIB_DIR
|
||||
if test "$mysql_cv_compress" = "no"; then
|
||||
MYSQL_USE_BUNDLED_ZLIB
|
||||
AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test -f "$mysql_zlib_dir/lib/libz.a" -a \
|
||||
-f "$mysql_zlib_dir/include/zlib.h"; then
|
||||
ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
|
||||
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
|
||||
MYSQL_CHECK_ZLIB_DIR
|
||||
fi
|
||||
if test "x$mysql_cv_compress" != "xyes"; then
|
||||
AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,lib}])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$mysql_cv_compress" = "yes"; then
|
||||
AC_SUBST([ZLIB_LIBS])
|
||||
AC_SUBST([ZLIB_INCLUDES])
|
||||
AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
#---START: Used in for client configure
|
||||
AC_DEFUN(MYSQL_CHECK_ULONG,
|
||||
[AC_MSG_CHECKING(for type ulong)
|
||||
@ -203,7 +313,7 @@ main()
|
||||
AC_MSG_RESULT($ac_cv_ulong)
|
||||
if test "$ac_cv_ulong" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_ULONG)
|
||||
AC_DEFINE([HAVE_ULONG], [1], [system headers define ulong])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -221,7 +331,7 @@ main()
|
||||
AC_MSG_RESULT($ac_cv_uchar)
|
||||
if test "$ac_cv_uchar" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_UCHAR)
|
||||
AC_DEFINE([HAVE_UCHAR], [1], [system headers define uchar])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -239,7 +349,7 @@ main()
|
||||
AC_MSG_RESULT($ac_cv_uint)
|
||||
if test "$ac_cv_uint" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_UINT)
|
||||
AC_DEFINE([HAVE_UINT], [1], [system headers define uint])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -261,7 +371,7 @@ int main(int argc, char **argv)
|
||||
AC_MSG_RESULT($ac_cv_in_addr_t)
|
||||
if test "$ac_cv_in_addr_t" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_IN_ADDR_T)
|
||||
AC_DEFINE([HAVE_IN_ADDR_T], [1], [system headers define in_addr_t])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -279,7 +389,8 @@ extern "C"
|
||||
], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
|
||||
if test "$ac_cv_pthread_yield_zero_arg" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_PTHREAD_YIELD_ZERO_ARG)
|
||||
AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
|
||||
[pthread_yield that doesn't take any arguments])
|
||||
fi
|
||||
]
|
||||
[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
|
||||
@ -294,7 +405,8 @@ extern "C"
|
||||
], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
|
||||
if test "$ac_cv_pthread_yield_one_arg" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_PTHREAD_YIELD_ONE_ARG)
|
||||
AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
|
||||
[pthread_yield function with one argument])
|
||||
fi
|
||||
]
|
||||
)
|
||||
@ -318,7 +430,7 @@ main()
|
||||
AC_MSG_RESULT($ac_cv_fp_except)
|
||||
if test "$ac_cv_fp_except" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_FP_EXCEPT)
|
||||
AC_DEFINE([HAVE_FP_EXCEPT], [1], [fp_except from ieeefp.h])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -459,11 +571,12 @@ AC_CACHE_VAL(mysql_cv_signal_vintage,
|
||||
])
|
||||
AC_MSG_RESULT($mysql_cv_signal_vintage)
|
||||
if test "$mysql_cv_signal_vintage" = posix; then
|
||||
AC_DEFINE(HAVE_POSIX_SIGNALS)
|
||||
AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
|
||||
[Signal handling is POSIX (sigset/sighold, etc)])
|
||||
elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
|
||||
AC_DEFINE(HAVE_BSD_SIGNALS)
|
||||
AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
|
||||
elif test "$mysql_cv_signal_vintage" = svr3; then
|
||||
AC_DEFINE(HAVE_USG_SIGHOLD)
|
||||
AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -476,7 +589,7 @@ extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
|
||||
mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
|
||||
AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
|
||||
if test "$mysql_cv_can_redecl_getpw" = "no"; then
|
||||
AC_DEFINE(HAVE_GETPW_DECLS)
|
||||
AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -488,7 +601,8 @@ AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
|
||||
mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
|
||||
AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
|
||||
if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then
|
||||
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
|
||||
AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
|
||||
[READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -500,7 +614,7 @@ AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
|
||||
mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
|
||||
AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
|
||||
if test "$mysql_cv_fionread_in_ioctl" = "yes"; then
|
||||
AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
|
||||
AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -512,7 +626,8 @@ AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
|
||||
mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
|
||||
AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
|
||||
if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then
|
||||
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
|
||||
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
|
||||
[declaration of TIOCSTAT in sys/ioctl.h])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -545,10 +660,46 @@ struct dirent d; int z; z = d.d_ino;
|
||||
], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
|
||||
AC_MSG_RESULT($mysql_cv_dirent_has_dino)
|
||||
if test "$mysql_cv_dirent_has_dino" = "yes"; then
|
||||
AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
|
||||
AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
|
||||
[d_ino member present in struct dirent])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(MYSQL_STRUCT_DIRENT_D_NAMLEN,
|
||||
[AC_REQUIRE([AC_HEADER_DIRENT])
|
||||
AC_MSG_CHECKING(if struct dirent has a d_namlen member)
|
||||
AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#if defined(HAVE_DIRENT_H)
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# define dirent direct
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif /* SYSNDIR */
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif /* SYSDIR */
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif /* HAVE_DIRENT_H */
|
||||
],[
|
||||
struct dirent d; int z; z = (int)d.d_namlen;
|
||||
], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
|
||||
AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
|
||||
if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
|
||||
AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
|
||||
[d_namlen member present in struct dirent])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(MYSQL_TYPE_SIGHANDLER,
|
||||
[AC_MSG_CHECKING([whether signal handlers are of type void])
|
||||
AC_CACHE_VAL(mysql_cv_void_sighandler,
|
||||
@ -564,7 +715,7 @@ void (*signal ()) ();],
|
||||
[int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
|
||||
AC_MSG_RESULT($mysql_cv_void_sighandler)
|
||||
if test "$mysql_cv_void_sighandler" = "yes"; then
|
||||
AC_DEFINE(VOID_SIGHANDLER)
|
||||
AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -583,7 +734,7 @@ AC_LANG_RESTORE
|
||||
])
|
||||
AC_MSG_RESULT($mysql_cv_have_bool)
|
||||
if test "$mysql_cv_have_bool" = yes; then
|
||||
AC_DEFINE(HAVE_BOOL)
|
||||
AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
@ -624,7 +775,7 @@ then
|
||||
ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])
|
||||
if test "$ac_cv_header_alloca_h" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_ALLOCA)
|
||||
AC_DEFINE(HAVE_ALLOCA, 1)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
|
||||
@ -647,7 +798,7 @@ then
|
||||
], [char *p = (char *) alloca(1);],
|
||||
ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
|
||||
if test "$ac_cv_func_alloca_works" = "yes"; then
|
||||
AC_DEFINE(HAVE_ALLOCA)
|
||||
AC_DEFINE([HAVE_ALLOCA], [1], [If we have a working alloca() implementation])
|
||||
fi
|
||||
|
||||
if test "$ac_cv_func_alloca_works" = "no"; then
|
||||
@ -656,7 +807,7 @@ then
|
||||
# contain a buggy version. If you still want to use their alloca,
|
||||
# use ar to extract alloca.o from them instead of compiling alloca.c.
|
||||
ALLOCA=alloca.o
|
||||
AC_DEFINE(C_ALLOCA)
|
||||
AC_DEFINE(C_ALLOCA, 1)
|
||||
|
||||
AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
|
||||
[AC_EGREP_CPP(webecray,
|
||||
@ -761,7 +912,7 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
|
||||
then
|
||||
vio_dir="vio"
|
||||
vio_libs="../vio/libvio.la"
|
||||
AC_DEFINE(HAVE_VIO)
|
||||
AC_DEFINE(HAVE_VIO, 1)
|
||||
else
|
||||
vio_dir=""
|
||||
vio_libs=""
|
||||
@ -852,7 +1003,7 @@ AC_MSG_CHECKING(for OpenSSL)
|
||||
#force VIO use
|
||||
vio_dir="vio"
|
||||
vio_libs="../vio/libvio.la"
|
||||
AC_DEFINE(HAVE_VIO)
|
||||
AC_DEFINE([HAVE_VIO], [1], [Virtual IO])
|
||||
AC_MSG_RESULT(yes)
|
||||
openssl_libs="-L$OPENSSL_LIB -lssl -lcrypto"
|
||||
# Don't set openssl_includes to /usr/include as this gives us a lot of
|
||||
@ -866,7 +1017,7 @@ AC_MSG_CHECKING(for OpenSSL)
|
||||
then
|
||||
openssl_includes="$openssl_includes -I$OPENSSL_KERBEROS_INCLUDE"
|
||||
fi
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
AC_DEFINE([HAVE_OPENSSL], [1], [OpenSSL])
|
||||
|
||||
# openssl-devel-0.9.6 requires dlopen() and we can't link staticly
|
||||
# on many platforms (We should actually test this here, but it's quite
|
||||
@ -927,7 +1078,7 @@ then
|
||||
orbit_libs=`orbit-config --libs server`
|
||||
orbit_idl="$orbit_exec_prefix/bin/orbit-idl"
|
||||
AC_MSG_RESULT(found!)
|
||||
AC_DEFINE(HAVE_ORBIT)
|
||||
AC_DEFINE([HAVE_ORBIT], [1], [ORBIT])
|
||||
else
|
||||
orbit_exec_prefix=
|
||||
orbit_includes=
|
||||
@ -949,7 +1100,7 @@ AC_DEFUN([MYSQL_CHECK_ISAM], [
|
||||
isam_libs=
|
||||
if test X"$with_isam" = X"yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_ISAM)
|
||||
AC_DEFINE([HAVE_ISAM], [1], [Using old ISAM tables])
|
||||
isam_libs="\$(top_builddir)/isam/libnisam.a\
|
||||
\$(top_builddir)/merge/libmerge.a"
|
||||
fi
|
||||
@ -1245,7 +1396,7 @@ AC_DEFUN([MYSQL_CHECK_INNODB], [
|
||||
case "$innodb" in
|
||||
yes )
|
||||
AC_MSG_RESULT([Using Innodb])
|
||||
AC_DEFINE(HAVE_INNOBASE_DB)
|
||||
AC_DEFINE([HAVE_INNOBASE_DB], [1], [Using Innobase DB])
|
||||
have_innodb="yes"
|
||||
innodb_includes="-I../innobase/include"
|
||||
innodb_system_libs=""
|
||||
@ -1318,7 +1469,7 @@ AC_DEFUN([MYSQL_CHECK_EXAMPLEDB], [
|
||||
|
||||
case "$exampledb" in
|
||||
yes )
|
||||
AC_DEFINE(HAVE_EXAMPLE_DB)
|
||||
AC_DEFINE([HAVE_EXAMPLE_DB], [1], [Builds Example DB])
|
||||
AC_MSG_RESULT([yes])
|
||||
[exampledb=yes]
|
||||
;;
|
||||
@ -1348,7 +1499,7 @@ AC_DEFUN([MYSQL_CHECK_ARCHIVEDB], [
|
||||
|
||||
case "$archivedb" in
|
||||
yes )
|
||||
AC_DEFINE(HAVE_ARCHIVE_DB)
|
||||
AC_DEFINE([HAVE_ARCHIVE_DB], [1], [Builds Archive Storage Engine])
|
||||
AC_MSG_RESULT([yes])
|
||||
[archivedb=yes]
|
||||
;;
|
||||
@ -1363,6 +1514,37 @@ dnl ---------------------------------------------------------------------------
|
||||
dnl END OF MYSQL_CHECK_ARCHIVE SECTION
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Macro: MYSQL_CHECK_CSVDB
|
||||
dnl Sets HAVE_CSV_DB if --with-csv-storage-engine is used
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_DEFUN([MYSQL_CHECK_CSVDB], [
|
||||
AC_ARG_WITH([csv-storage-engine],
|
||||
[
|
||||
--with-csv-storage-engine
|
||||
Enable the CSV Storage Engine],
|
||||
[csvdb="$withval"],
|
||||
[csvdb=no])
|
||||
AC_MSG_CHECKING([for csv storage engine])
|
||||
|
||||
case "$csvdb" in
|
||||
yes )
|
||||
AC_DEFINE([HAVE_CSV_DB], [1], [Builds the CSV Storage Engine])
|
||||
AC_MSG_RESULT([yes])
|
||||
[csvdb=yes]
|
||||
;;
|
||||
* )
|
||||
AC_MSG_RESULT([no])
|
||||
[csvdb=no]
|
||||
;;
|
||||
esac
|
||||
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl END OF MYSQL_CHECK_CSV SECTION
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Macro: MYSQL_CHECK_NDBCLUSTER
|
||||
dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
|
||||
@ -1397,7 +1579,8 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
|
||||
case "$ndb_shm" in
|
||||
yes )
|
||||
AC_MSG_RESULT([-- including shared memory transporter])
|
||||
AC_DEFINE(NDB_SHM_TRANSPORTER)
|
||||
AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
|
||||
[Including Ndb Cluster DB shared memory transporter])
|
||||
have_ndb_shm="yes"
|
||||
;;
|
||||
* )
|
||||
@ -1409,7 +1592,8 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
|
||||
case "$ndb_sci" in
|
||||
yes )
|
||||
AC_MSG_RESULT([-- including sci transporter])
|
||||
AC_DEFINE(NDB_SCI_TRANSPORTER)
|
||||
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
|
||||
[Including Ndb Cluster DB sci transporter])
|
||||
have_ndb_sci="yes"
|
||||
;;
|
||||
* )
|
||||
@ -1457,7 +1641,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
|
||||
case "$ndbcluster" in
|
||||
yes )
|
||||
AC_MSG_RESULT([Using NDB Cluster])
|
||||
AC_DEFINE(HAVE_NDBCLUSTER_DB)
|
||||
AC_DEFINE([HAVE_NDBCLUSTER_DB], [1], [Using Ndb Cluster DB])
|
||||
have_ndbcluster="yes"
|
||||
ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi"
|
||||
ndbcluster_libs="\$(top_builddir)/ndb/src/.libs/libndbclient.a"
|
||||
@ -1602,7 +1786,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE,
|
||||
esac])
|
||||
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
||||
ac_cv_sys_largefile_source,
|
||||
[Define to make fseeko etc. visible, on some hosts.],
|
||||
[makes fseeko etc. visible, on some hosts.],
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
@ -1610,7 +1794,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE,
|
||||
esac])
|
||||
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
||||
ac_cv_sys_large_files,
|
||||
[Define for large files, on AIX-style hosts.],
|
||||
[Large files support on AIX-style hosts.],
|
||||
[case "$host_os" in
|
||||
# AIX 4.2 and later
|
||||
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
||||
|
2
bdb/dist/configure.ac
vendored
2
bdb/dist/configure.ac
vendored
@ -555,7 +555,7 @@ fi
|
||||
LIB@&t@OBJS=`echo "$LIB@&t@OBJS" |
|
||||
sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
|
||||
LTLIBOBJS=`echo "$LIB@&t@OBJS" |
|
||||
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
|
||||
sed "s,\.[[^.]]* ,$o ,g;s,\.[[^.]]*$,$o,"`
|
||||
AC_SUBST(LTLIBOBJS)
|
||||
|
||||
# Initial output file list.
|
||||
|
22
bdb/dist/gen_inc.awk
vendored
22
bdb/dist/gen_inc.awk
vendored
@ -18,20 +18,20 @@
|
||||
# i_pfile include file that contains internal (PUBLIC) prototypes
|
||||
/PUBLIC:/ {
|
||||
sub("^.*PUBLIC:[ ][ ]*", "")
|
||||
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
||||
if ($0 ~ /^#(if|ifdef|ifndef|else|endif)/) {
|
||||
print $0 >> i_pfile
|
||||
print $0 >> i_dfile
|
||||
next
|
||||
}
|
||||
pline = sprintf("%s %s", pline, $0)
|
||||
if (pline ~ "));") {
|
||||
if (pline ~ /\)\);/) {
|
||||
sub("^[ ]*", "", pline)
|
||||
print pline >> i_pfile
|
||||
if (pline !~ db_version_unique_name) {
|
||||
def = gensub("[ ][ ]*__P.*", "", 1, pline)
|
||||
sub("^.*[ ][*]*", "", def)
|
||||
sub("[ ][ ]*__P.*", "", pline)
|
||||
sub("^.*[ ][*]*", "", pline)
|
||||
printf("#define %s %s@DB_VERSION_UNIQUE_NAME@\n",
|
||||
def, def) >> i_dfile
|
||||
pline, pline) >> i_dfile
|
||||
}
|
||||
pline = ""
|
||||
}
|
||||
@ -53,20 +53,20 @@
|
||||
# functions in libraries built with that configuration option.
|
||||
/EXTERN:/ {
|
||||
sub("^.*EXTERN:[ ][ ]*", "")
|
||||
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
||||
if ($0 ~ /^#(if|ifdef|ifndef|else|endif)/) {
|
||||
print $0 >> e_pfile
|
||||
print $0 >> e_dfile
|
||||
next
|
||||
}
|
||||
eline = sprintf("%s %s", eline, $0)
|
||||
if (eline ~ "));") {
|
||||
if (eline ~ /\)\);/) {
|
||||
sub("^[ ]*", "", eline)
|
||||
print eline >> e_pfile
|
||||
if (eline !~ db_version_unique_name && eline !~ "^int txn_") {
|
||||
def = gensub("[ ][ ]*__P.*", "", 1, eline)
|
||||
sub("^.*[ ][*]*", "", def)
|
||||
if (eline !~ db_version_unique_name && eline !~ /^int txn_/) {
|
||||
sub("[ ][ ]*__P.*", "", eline)
|
||||
sub("^.*[ ][*]*", "", eline)
|
||||
printf("#define %s %s@DB_VERSION_UNIQUE_NAME@\n",
|
||||
def, def) >> e_dfile
|
||||
eline, eline) >> e_dfile
|
||||
}
|
||||
eline = ""
|
||||
}
|
||||
|
@ -43,5 +43,6 @@ enum options_client
|
||||
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
|
||||
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
|
||||
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
|
||||
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS
|
||||
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
|
||||
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME
|
||||
};
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
const char *VER= "14.5";
|
||||
const char *VER= "14.6";
|
||||
|
||||
/* Don't try to make a nice table if the data is too big */
|
||||
#define MAX_COLUMN_LENGTH 1024
|
||||
@ -294,7 +294,7 @@ static const char *server_default_groups[]=
|
||||
HIST_ENTRY is defined for libedit, but not for the real readline
|
||||
Need to redefine it for real readline to find it
|
||||
*/
|
||||
#if !defined(USE_LIBEDIT_INTERFACE)
|
||||
#if !defined(HAVE_HIST_ENTRY)
|
||||
typedef struct _hist_entry {
|
||||
const char *line;
|
||||
const char *data;
|
||||
@ -607,7 +607,7 @@ static struct my_option my_long_options[] =
|
||||
{"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -753,8 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
opt_nopager= 1;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) ==
|
||||
~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
@ -793,6 +792,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
while (*argument) *argument++= 'x'; // Destroy argument
|
||||
if (*start)
|
||||
start[1]=0 ;
|
||||
tty_password= 0;
|
||||
}
|
||||
else
|
||||
tty_password= 1;
|
||||
@ -1670,15 +1670,15 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
if (num_fields == 2)
|
||||
{
|
||||
put_info("Many help items for your request exist", INFO_INFO);
|
||||
put_info("For more specific request please type 'help <item>' where item is one of next", INFO_INFO);
|
||||
put_info("To make a more specific request, please type 'help <item>',\nwhere item is one of next", INFO_INFO);
|
||||
num_name= 0;
|
||||
num_cat= 1;
|
||||
last_char= '_';
|
||||
}
|
||||
else if ((cur= mysql_fetch_row(result)))
|
||||
{
|
||||
tee_fprintf(PAGER, "You asked help about help category: \"%s\"\n", cur[0]);
|
||||
put_info("For a more information type 'help <item>' where item is one of the following", INFO_INFO);
|
||||
tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]);
|
||||
put_info("For more information, type 'help <item>', where item is one of the following", INFO_INFO);
|
||||
num_name= 1;
|
||||
num_cat= 2;
|
||||
print_help_item(&cur,1,2,&last_char);
|
||||
@ -1692,7 +1692,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
else
|
||||
{
|
||||
put_info("\nNothing found", INFO_INFO);
|
||||
put_info("Please try to run 'help contents' for list of all accessible topics\n", INFO_INFO);
|
||||
put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1711,9 +1711,9 @@ com_help(String *buffer __attribute__((unused)),
|
||||
if (help_arg)
|
||||
return com_server_help(buffer,line,help_arg+1);
|
||||
|
||||
put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
|
||||
put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
|
||||
put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
|
||||
put_info("\nFor the complete MySQL Manual online, visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
|
||||
put_info("For info on technical support from MySQL developers, visit:\n http://www.mysql.com/support\n", INFO_INFO);
|
||||
put_info("For info on MySQL books, utilities, consultants, etc., visit:\n http://www.mysql.com/portal\n", INFO_INFO);
|
||||
put_info("List of all MySQL commands:", INFO_INFO);
|
||||
if (!named_cmds)
|
||||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||
@ -2020,21 +2020,27 @@ print_table_data(MYSQL_RES *result)
|
||||
|
||||
while ((cur= mysql_fetch_row(result)))
|
||||
{
|
||||
ulong *lengths= mysql_fetch_lengths(result);
|
||||
(void) tee_fputs("|", PAGER);
|
||||
mysql_field_seek(result, 0);
|
||||
for (uint off= 0; off < mysql_num_fields(result); off++)
|
||||
{
|
||||
const char *str= cur[off] ? cur[off] : "NULL";
|
||||
field= mysql_fetch_field(result);
|
||||
uint length= field->max_length;
|
||||
if (length > MAX_COLUMN_LENGTH)
|
||||
uint maxlength= field->max_length;
|
||||
if (maxlength > MAX_COLUMN_LENGTH)
|
||||
{
|
||||
tee_fputs(str, PAGER);
|
||||
tee_fputs(" |", PAGER);
|
||||
}
|
||||
else
|
||||
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
|
||||
length, str);
|
||||
{
|
||||
uint currlength= (uint) lengths[off];
|
||||
uint numcells= charset_info->cset->numcells(charset_info,
|
||||
str, str + currlength);
|
||||
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
|
||||
maxlength + currlength - numcells, str);
|
||||
}
|
||||
}
|
||||
(void) tee_fputs("\n", PAGER);
|
||||
}
|
||||
@ -2687,8 +2693,9 @@ char *get_arg(char *line, my_bool get_next_arg)
|
||||
ptr++;
|
||||
if (*ptr == '\\') // short command was used
|
||||
ptr+= 2;
|
||||
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
|
||||
ptr++;
|
||||
else
|
||||
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
|
||||
ptr++;
|
||||
}
|
||||
if (!*ptr)
|
||||
return NullS;
|
||||
@ -2836,13 +2843,16 @@ com_status(String *buffer __attribute__((unused)),
|
||||
MYSQL_RES *result;
|
||||
LINT_INIT(result);
|
||||
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
|
||||
if (!mysql_query(&mysql,"select DATABASE(),USER()") &&
|
||||
if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") &&
|
||||
(result=mysql_use_result(&mysql)))
|
||||
{
|
||||
MYSQL_ROW cur=mysql_fetch_row(result);
|
||||
tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
|
||||
tee_fprintf(stdout, "Current user:\t\t%s\n",cur[1]);
|
||||
(void) mysql_fetch_row(result); // Read eof
|
||||
if (cur)
|
||||
{
|
||||
tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
|
||||
tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (mysql.net.vio && mysql.net.vio->ssl_arg &&
|
||||
|
@ -151,7 +151,7 @@ static struct my_option my_long_options[] =
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -249,7 +249,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define MYSQL_CLIENT
|
||||
#undef MYSQL_SERVER
|
||||
#include "client_priv.h"
|
||||
#include <time.h>
|
||||
#include <my_time.h>
|
||||
#include "log_event.h"
|
||||
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
|
||||
#include "mysql_priv.h"
|
||||
@ -69,10 +69,18 @@ static int port = MYSQL_PORT;
|
||||
static const char* sock= 0;
|
||||
static const char* user = 0;
|
||||
static char* pass = 0;
|
||||
static ulonglong position = 0;
|
||||
|
||||
static ulonglong start_position, stop_position;
|
||||
#define start_position_mot ((my_off_t)start_position)
|
||||
#define stop_position_mot ((my_off_t)stop_position)
|
||||
|
||||
static char *start_datetime_str, *stop_datetime_str;
|
||||
static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
|
||||
static ulonglong rec_count= 0;
|
||||
static short binlog_flags = 0;
|
||||
static MYSQL* mysql = NULL;
|
||||
static const char* dirname_for_local_load= 0;
|
||||
static bool stop_passed= 0;
|
||||
|
||||
/*
|
||||
check_header() will set the pointer below.
|
||||
@ -327,14 +335,45 @@ Create_file event for file_id: %u\n",ae->file_id);
|
||||
Load_log_processor load_processor;
|
||||
|
||||
|
||||
int process_event(ulonglong *rec_count, LAST_EVENT_INFO *last_event_info,
|
||||
Log_event *ev, my_off_t pos)
|
||||
/*
|
||||
Process an event
|
||||
|
||||
SYNOPSIS
|
||||
process_event()
|
||||
|
||||
RETURN
|
||||
0 ok and continue
|
||||
1 error and terminate
|
||||
-1 ok and terminate
|
||||
|
||||
TODO
|
||||
This function returns 0 even in some error cases. This should be changed.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int process_event(LAST_EVENT_INFO *last_event_info, Log_event *ev,
|
||||
my_off_t pos)
|
||||
{
|
||||
char ll_buff[21];
|
||||
DBUG_ENTER("process_event");
|
||||
|
||||
if ((*rec_count) >= offset)
|
||||
if ((rec_count >= offset) &&
|
||||
((my_time_t)(ev->when) >= start_datetime))
|
||||
{
|
||||
/*
|
||||
We have found an event after start_datetime, from now on print
|
||||
everything (in case the binlog has timestamps increasing and decreasing,
|
||||
we do this to avoid cutting the middle).
|
||||
*/
|
||||
start_datetime= 0;
|
||||
offset= 0; // print everything and protect against cycling rec_count
|
||||
if (((my_time_t)(ev->when) >= stop_datetime)
|
||||
|| (pos >= stop_position_mot))
|
||||
{
|
||||
stop_passed= 1; // skip all next binlogs
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (!short_form)
|
||||
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
|
||||
|
||||
@ -424,7 +463,7 @@ Create_file event for file_id: %u\n",exv->file_id);
|
||||
}
|
||||
|
||||
end:
|
||||
(*rec_count)++;
|
||||
rec_count++;
|
||||
if (ev)
|
||||
delete ev;
|
||||
DBUG_RETURN(0);
|
||||
@ -454,13 +493,14 @@ static struct my_option my_long_options[] =
|
||||
{"port", 'P', "Use port to connect to the remote server.",
|
||||
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
|
||||
0, 0, 0},
|
||||
{"position", 'j', "Start reading the binlog at position N.",
|
||||
(gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"position", 'j', "Deprecated. Use --start-position instead.",
|
||||
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
|
||||
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
|
||||
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
|
||||
(ulonglong)(~(uint32)0), 0, 0, 0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL,
|
||||
"The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
||||
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
|
||||
@ -476,6 +516,35 @@ static struct my_option my_long_options[] =
|
||||
{"socket", 'S', "Socket file to use for connection.",
|
||||
(gptr*) &sock, (gptr*) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"start-datetime", OPT_START_DATETIME,
|
||||
"Start reading the binlog at first event having a datetime equal or "
|
||||
"posterior to the argument; the argument must be a date and time "
|
||||
"in the local time zone, in any format accepted by the MySQL server "
|
||||
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
|
||||
"(you should probably use quotes for your shell to set it properly).",
|
||||
(gptr*) &start_datetime_str, (gptr*) &start_datetime_str,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"stop-datetime", OPT_STOP_DATETIME,
|
||||
"Stop reading the binlog at first event having a datetime equal or "
|
||||
"posterior to the argument; the argument must be a date and time "
|
||||
"in the local time zone, in any format accepted by the MySQL server "
|
||||
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
|
||||
"(you should probably use quotes for your shell to set it properly).",
|
||||
(gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"start-position", OPT_START_POSITION,
|
||||
"Start reading the binlog at position N. Applies to the first binlog "
|
||||
"passed on the command line.",
|
||||
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
|
||||
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
|
||||
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
|
||||
(ulonglong)(~(uint32)0), 0, 0, 0},
|
||||
{"stop-position", OPT_STOP_POSITION,
|
||||
"Stop reading the binlog at position N. Applies to the last binlog "
|
||||
"passed on the command line.",
|
||||
(gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL,
|
||||
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
|
||||
(ulonglong)(~(my_off_t)0), 0, 0, 0},
|
||||
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
|
||||
requested binlog but rather continue printing until the end of the last \
|
||||
binlog of the MySQL server. If you send the output to the same MySQL server, \
|
||||
@ -550,6 +619,29 @@ the mysql command line client\n\n");
|
||||
my_print_variables(my_long_options);
|
||||
}
|
||||
|
||||
|
||||
static my_time_t convert_str_to_timestamp(const char* str)
|
||||
{
|
||||
int was_cut;
|
||||
MYSQL_TIME l_time;
|
||||
long dummy_my_timezone;
|
||||
bool dummy_in_dst_time_gap;
|
||||
/* We require a total specification (date AND time) */
|
||||
if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
|
||||
MYSQL_TIMESTAMP_DATETIME || was_cut)
|
||||
{
|
||||
fprintf(stderr, "Incorrect date and time argument: %s\n", str);
|
||||
exit(1);
|
||||
}
|
||||
/*
|
||||
Note that Feb 30th, Apr 31st cause no error messages and are mapped to
|
||||
the next existing day, like in mysqld. Maybe this could be changed when
|
||||
mysqld is changed too (with its "strict" mode?).
|
||||
*/
|
||||
return
|
||||
my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap);
|
||||
}
|
||||
|
||||
#include <help_end.h>
|
||||
|
||||
extern "C" my_bool
|
||||
@ -588,15 +680,19 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) ==
|
||||
~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OPT_START_DATETIME:
|
||||
start_datetime= convert_str_to_timestamp(start_datetime_str);
|
||||
break;
|
||||
case OPT_STOP_DATETIME:
|
||||
stop_datetime= convert_str_to_timestamp(stop_datetime_str);
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
@ -638,13 +734,14 @@ static MYSQL* safe_connect()
|
||||
return local_mysql;
|
||||
}
|
||||
|
||||
|
||||
static int dump_log_entries(const char* logname)
|
||||
{
|
||||
if (remote_opt)
|
||||
return dump_remote_log_entries(logname);
|
||||
return dump_local_log_entries(logname);
|
||||
return (remote_opt ? dump_remote_log_entries(logname) :
|
||||
dump_local_log_entries(logname));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This is not as smart as check_header() (used for local log); it will not work
|
||||
for a binlog which mixes format. TODO: fix this.
|
||||
@ -711,9 +808,20 @@ static int dump_remote_log_entries(const char* logname)
|
||||
char buf[128];
|
||||
LAST_EVENT_INFO last_event_info;
|
||||
uint len, logname_len;
|
||||
NET* net = &mysql->net;
|
||||
NET* net;
|
||||
int error= 0;
|
||||
my_off_t old_off= start_position_mot;
|
||||
char fname[FN_REFLEN+1];
|
||||
DBUG_ENTER("dump_remote_log_entries");
|
||||
|
||||
/*
|
||||
Even if we already read one binlog (case of >=2 binlogs on command line),
|
||||
we cannot re-use the same connection as before, because it is now dead
|
||||
(COM_BINLOG_DUMP kills the thread when it finishes).
|
||||
*/
|
||||
mysql= safe_connect();
|
||||
net= &mysql->net;
|
||||
|
||||
if (check_master_version(mysql, &description_event))
|
||||
{
|
||||
fprintf(stderr, "Could not find server version");
|
||||
@ -726,14 +834,11 @@ could be out of memory");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if (!position)
|
||||
position = BIN_LOG_HEADER_SIZE;
|
||||
if (position < BIN_LOG_HEADER_SIZE)
|
||||
{
|
||||
position = BIN_LOG_HEADER_SIZE;
|
||||
sql_print_error("Warning: The position in the binary log can't be less than %d.\nStarting from position %d\n", BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE);
|
||||
}
|
||||
int4store(buf, position);
|
||||
/*
|
||||
COM_BINLOG_DUMP accepts only 4 bytes for the position, so we are forced to
|
||||
cast to uint32.
|
||||
*/
|
||||
int4store(buf, (uint32)start_position);
|
||||
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
|
||||
logname_len = (uint) strlen(logname);
|
||||
int4store(buf + 6, 0);
|
||||
@ -741,22 +846,20 @@ could be out of memory");
|
||||
if (simple_command(mysql, COM_BINLOG_DUMP, buf, logname_len + 10, 1))
|
||||
{
|
||||
fprintf(stderr,"Got fatal error sending the log dump command\n");
|
||||
DBUG_RETURN(1);
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
my_off_t old_off= position;
|
||||
ulonglong rec_count= 0;
|
||||
char fname[FN_REFLEN+1];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const char *error;
|
||||
const char *error_msg;
|
||||
len = net_safe_read(mysql);
|
||||
if (len == packet_error)
|
||||
{
|
||||
fprintf(stderr, "Got error reading packet from server: %s\n",
|
||||
mysql_error(mysql));
|
||||
DBUG_RETURN(1);
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
if (len < 8 && net->read_pos[0] == 254)
|
||||
break; // end of data
|
||||
@ -768,11 +871,13 @@ could be out of memory");
|
||||
if (!ev)
|
||||
{
|
||||
fprintf(stderr, "Could not construct log event object\n");
|
||||
DBUG_RETURN(1);
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
Log_event_type type= ev->get_type_code();
|
||||
if (description_event->binlog_version >=3 || (type != LOAD_EVENT && type != CREATE_FILE_EVENT))
|
||||
if (description_event->binlog_version >= 3 ||
|
||||
(type != LOAD_EVENT && type != CREATE_FILE_EVENT))
|
||||
{
|
||||
/*
|
||||
If this is a Rotate event, maybe it's the end of the requested binlog;
|
||||
@ -793,20 +898,32 @@ could be out of memory");
|
||||
part of our log) and then we will stop when we receive the fake one
|
||||
soon.
|
||||
*/
|
||||
if ((rev->when == 0) && !to_last_remote_log)
|
||||
if (rev->when == 0)
|
||||
{
|
||||
if ((rev->ident_len != logname_len) ||
|
||||
memcmp(rev->new_log_ident, logname, logname_len))
|
||||
DBUG_RETURN(0);
|
||||
/*
|
||||
Otherwise, this is a fake Rotate for our log, at the very beginning
|
||||
for sure. Skip it.
|
||||
*/
|
||||
continue;
|
||||
if (!to_last_remote_log)
|
||||
{
|
||||
if ((rev->ident_len != logname_len) ||
|
||||
memcmp(rev->new_log_ident, logname, logname_len))
|
||||
{
|
||||
error= 0;
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
Otherwise, this is a fake Rotate for our log, at the very
|
||||
beginning for sure. Skip it, because it was not in the original
|
||||
log. If we are running with to_last_remote_log, we print it,
|
||||
because it serves as a useful marker between binlogs then.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
len= 1; // fake Rotate, so don't increment old_off
|
||||
}
|
||||
}
|
||||
if (process_event(&rec_count,&last_event_info,ev,old_off))
|
||||
DBUG_RETURN(1);
|
||||
if ((error= process_event(&last_event_info,ev,old_off)))
|
||||
{
|
||||
error= ((error < 0) ? 0 : 1);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -816,28 +933,35 @@ could be out of memory");
|
||||
File file;
|
||||
|
||||
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
|
||||
DBUG_RETURN(1);
|
||||
{
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (process_event(&rec_count,&last_event_info,ev,old_off))
|
||||
if ((error= process_event(&last_event_info,ev,old_off)))
|
||||
{
|
||||
my_close(file,MYF(MY_WME));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (load_processor.load_old_format_file(net,old_fname,old_len,file))
|
||||
{
|
||||
my_close(file,MYF(MY_WME));
|
||||
DBUG_RETURN(1);
|
||||
error= ((error < 0) ? 0 : 1);
|
||||
goto err;
|
||||
}
|
||||
error= load_processor.load_old_format_file(net,old_fname,old_len,file);
|
||||
my_close(file,MYF(MY_WME));
|
||||
if (error)
|
||||
{
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Let's adjust offset for remote log as for local log to produce
|
||||
similar text. As we don't print the fake Rotate event, all events are
|
||||
real so we can simply add the length.
|
||||
similar text.
|
||||
*/
|
||||
old_off+= len-1;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
mysql_close(mysql);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
@ -940,7 +1064,6 @@ static int dump_local_log_entries(const char* logname)
|
||||
{
|
||||
File fd = -1;
|
||||
IO_CACHE cache,*file= &cache;
|
||||
ulonglong rec_count = 0;
|
||||
LAST_EVENT_INFO last_event_info;
|
||||
byte tmp_buff[BIN_LOG_HEADER_SIZE];
|
||||
int error= 0;
|
||||
@ -949,7 +1072,7 @@ static int dump_local_log_entries(const char* logname)
|
||||
{
|
||||
if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
|
||||
return 1;
|
||||
if (init_io_cache(file, fd, 0, READ_CACHE, (my_off_t) position, 0,
|
||||
if (init_io_cache(file, fd, 0, READ_CACHE, start_position_mot, 0,
|
||||
MYF(MY_WME | MY_NABP)))
|
||||
{
|
||||
my_close(fd, MYF(MY_WME));
|
||||
@ -963,12 +1086,12 @@ static int dump_local_log_entries(const char* logname)
|
||||
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
|
||||
return 1;
|
||||
check_header(file, &description_event);
|
||||
if (position)
|
||||
if (start_position)
|
||||
{
|
||||
/* skip 'position' characters from stdout */
|
||||
/* skip 'start_position' characters from stdout */
|
||||
byte buff[IO_SIZE];
|
||||
my_off_t length,tmp;
|
||||
for (length= (my_off_t) position ; length > 0 ; length-=tmp)
|
||||
for (length= start_position_mot ; length > 0 ; length-=tmp)
|
||||
{
|
||||
tmp=min(length,sizeof(buff));
|
||||
if (my_b_read(file, buff, (uint) tmp))
|
||||
@ -978,14 +1101,14 @@ static int dump_local_log_entries(const char* logname)
|
||||
}
|
||||
}
|
||||
}
|
||||
file->pos_in_file=position;
|
||||
file->pos_in_file= start_position_mot;
|
||||
file->seek_not_done=0;
|
||||
}
|
||||
|
||||
if (!description_event || !description_event->is_valid())
|
||||
die("Invalid Format_description log event; could be out of memory");
|
||||
|
||||
if (!position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
|
||||
if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
|
||||
{
|
||||
error= 1;
|
||||
goto end;
|
||||
@ -1009,11 +1132,12 @@ static int dump_local_log_entries(const char* logname)
|
||||
// file->error == 0 means EOF, that's OK, we break in this case
|
||||
break;
|
||||
}
|
||||
if (process_event(&rec_count,&last_event_info,ev,old_off))
|
||||
{
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
if ((error= process_event(&last_event_info,ev,old_off)))
|
||||
{
|
||||
if (error < 0)
|
||||
error= 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
@ -1028,11 +1152,14 @@ end:
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
static char **defaults_argv;
|
||||
int exit_value;
|
||||
int exit_value= 0;
|
||||
ulonglong save_stop_position;
|
||||
MY_INIT(argv[0]);
|
||||
DBUG_ENTER("main");
|
||||
DBUG_PROCESS(argv[0]);
|
||||
|
||||
init_time(); // for time functions
|
||||
|
||||
parse_args(&argc, (char***)&argv);
|
||||
defaults_argv=argv;
|
||||
|
||||
@ -1044,8 +1171,6 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
my_set_max_open_files(open_files_limit);
|
||||
if (remote_opt)
|
||||
mysql = safe_connect();
|
||||
|
||||
MY_TMPDIR tmpdir;
|
||||
tmpdir.list= 0;
|
||||
@ -1063,24 +1188,26 @@ int main(int argc, char** argv)
|
||||
else
|
||||
load_processor.init_by_cur_dir();
|
||||
|
||||
exit_value= 0;
|
||||
fprintf(result_file,
|
||||
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
|
||||
while (--argc >= 0)
|
||||
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
|
||||
(--argc >= 0) && !stop_passed ; )
|
||||
{
|
||||
if (argc == 0) // last log, --stop-position applies
|
||||
stop_position= save_stop_position;
|
||||
if (dump_log_entries(*(argv++)))
|
||||
{
|
||||
exit_value=1;
|
||||
break;
|
||||
}
|
||||
// For next log, --start-position does not apply
|
||||
start_position= BIN_LOG_HEADER_SIZE;
|
||||
}
|
||||
|
||||
if (tmpdir.list)
|
||||
free_tmpdir(&tmpdir);
|
||||
if (result_file != stdout)
|
||||
my_fclose(result_file, MYF(0));
|
||||
if (remote_opt)
|
||||
mysql_close(mysql);
|
||||
cleanup();
|
||||
free_defaults(defaults_argv);
|
||||
my_free_open_file_info();
|
||||
|
@ -125,7 +125,7 @@ static struct my_option my_long_options[] =
|
||||
"Can fix almost anything except unique keys that aren't unique.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
case 'V': print_version(); exit(0);
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -276,7 +276,7 @@ static struct my_option my_long_options[] =
|
||||
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -582,8 +582,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
}
|
||||
case (int) OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib, 0))
|
||||
== ~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -123,7 +123,7 @@ static struct my_option my_long_options[] =
|
||||
{"replace", 'r', "If duplicate unique key was found, replace old row.",
|
||||
(gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -203,7 +203,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
#endif
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -188,7 +188,7 @@ static struct my_option my_long_options[] =
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
@ -268,7 +268,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -641,7 +641,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
|
||||
if (*var_name != '$')
|
||||
goto err;
|
||||
digit = *++var_name - '0';
|
||||
if (!(digit < 10 && digit >= 0))
|
||||
if (digit < 0 || digit >= 10)
|
||||
{
|
||||
const char* save_var_name = var_name, *end;
|
||||
uint length;
|
||||
@ -660,7 +660,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
|
||||
length < MAX_VAR_NAME)
|
||||
{
|
||||
char buff[MAX_VAR_NAME+1];
|
||||
strmake(buff, save_var_name, length);
|
||||
strmake(buff, save_var_name, length);
|
||||
v= var_from_env(buff, "");
|
||||
}
|
||||
var_name--; /* Point at last character */
|
||||
|
@ -1,3 +1,20 @@
|
||||
# Copyright (C) 2004 MySQL AB
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
|
||||
## Process this file with automake to create Makefile.in
|
||||
|
||||
SUBDIRS= @readline_basedir@
|
||||
|
@ -7,28 +7,30 @@ AHDR=vi.h emacs.h common.h
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(srcdir)/../.. -I..
|
||||
|
||||
noinst_LIBRARIES = liblibedit.a
|
||||
noinst_LIBRARIES = libedit.a
|
||||
|
||||
liblibedit_a_SOURCES = chared.c el.c fgetln.c history.c map.c \
|
||||
prompt.c readline.c search.c \
|
||||
strlcpy.c tokenizer.c vi.c common.c \
|
||||
emacs.c hist.c key.c parse.c read.c \
|
||||
refresh.c sig.c term.c tty.c help.c \
|
||||
fcns.c
|
||||
libedit_a_SOURCES = chared.c el.c history.c map.c prompt.c readline.c \
|
||||
search.c tokenizer.c vi.c common.c emacs.c \
|
||||
hist.c key.c parse.c read.c refresh.c sig.c term.c \
|
||||
tty.c help.c fcns.c
|
||||
|
||||
EXTRA_libedit_a_SOURCES = np/unvis.c np/strlcpy.c np/vis.c np/strlcat.c \
|
||||
np/fgetln.c
|
||||
|
||||
libedit_a_LIBADD = @LIBEDIT_LOBJECTS@
|
||||
libedit_a_DEPENDENCIES = @LIBEDIT_LOBJECTS@
|
||||
|
||||
pkginclude_HEADERS = readline/readline.h
|
||||
|
||||
noinst_HEADERS = chared.h el.h histedit.h key.h \
|
||||
parse.h refresh.h sig.h sys.h \
|
||||
tokenizer.h compat.h compat_conf.h fgetln.h \
|
||||
hist.h map.h prompt.h search.h \
|
||||
strlcpy.h libedit_term.h tty.h
|
||||
noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.h \
|
||||
sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
|
||||
search.h tty.h libedit_term.h
|
||||
|
||||
EXTRA_DIST = makelist.sh
|
||||
EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c
|
||||
|
||||
CLEANFILES = makelist
|
||||
CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c
|
||||
|
||||
DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR
|
||||
DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR
|
||||
|
||||
SUFFIXES = .sh
|
||||
|
||||
@ -73,13 +75,11 @@ fcns.c: ${AHDR} fcns.h makelist
|
||||
|
||||
chared.o: vi.h emacs.h common.h help.h fcns.h
|
||||
el.o: vi.h emacs.h common.h help.h fcns.h
|
||||
fgetln.o: vi.h emacs.h common.h help.h fcns.h
|
||||
history.o: vi.h emacs.h common.h help.h fcns.h
|
||||
map.o: vi.h emacs.h common.h help.h fcns.h
|
||||
prompt.o: vi.h emacs.h common.h help.h fcns.h
|
||||
readline.o: vi.h emacs.h common.h help.h fcns.h
|
||||
search.o: vi.h emacs.h common.h help.h fcns.h
|
||||
strlcpy.o: vi.h emacs.h common.h help.h fcns.h
|
||||
tokenizer.o: vi.h emacs.h common.h help.h fcns.h
|
||||
vi.o: vi.h emacs.h common.h help.h fcns.h
|
||||
common.o: vi.h emacs.h common.h help.h fcns.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chared.c,v 1.14 2001/05/17 01:02:17 christos Exp $ */
|
||||
/* $NetBSD: chared.c,v 1.18 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,13 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#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.18 2002/11/20 16:50:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* chared.c: Character editor utilities
|
||||
*/
|
||||
#include "sys.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "el.h"
|
||||
|
||||
@ -53,17 +58,36 @@
|
||||
* Handle state for the vi undo command
|
||||
*/
|
||||
protected void
|
||||
cv_undo(EditLine *el,int action, size_t size, char *ptr)
|
||||
cv_undo(EditLine *el)
|
||||
{
|
||||
c_undo_t *vu = &el->el_chared.c_undo;
|
||||
vu->action = action;
|
||||
vu->ptr = ptr;
|
||||
vu->isize = size;
|
||||
(void) memcpy(vu->buf, vu->ptr, size);
|
||||
#ifdef DEBUG_UNDO
|
||||
(void) fprintf(el->el_errfile, "Undo buffer \"%s\" size = +%d -%d\n",
|
||||
vu->ptr, vu->isize, vu->dsize);
|
||||
#endif
|
||||
c_redo_t *r = &el->el_chared.c_redo;
|
||||
int size;
|
||||
|
||||
/* Save entire line for undo */
|
||||
size = el->el_line.lastchar - el->el_line.buffer;
|
||||
vu->len = size;
|
||||
vu->cursor = el->el_line.cursor - el->el_line.buffer;
|
||||
memcpy(vu->buf, el->el_line.buffer, (size_t)size);
|
||||
|
||||
/* 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;
|
||||
|
||||
memcpy(k->buf, ptr, size +0u);
|
||||
k->last = k->buf + size;
|
||||
}
|
||||
|
||||
|
||||
@ -75,8 +99,10 @@ c_insert(EditLine *el, int num)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
if (el->el_line.lastchar + num >= el->el_line.limit)
|
||||
return; /* can't go past end of buffer */
|
||||
if (el->el_line.lastchar + num >= el->el_line.limit) {
|
||||
if (!ch_enlargebufs(el, num +0u))
|
||||
return; /* can't go past end of buffer */
|
||||
}
|
||||
|
||||
if (el->el_line.cursor < el->el_line.lastchar) {
|
||||
/* if I must move chars */
|
||||
@ -97,12 +123,14 @@ c_delafter(EditLine *el, int num)
|
||||
if (el->el_line.cursor + num > el->el_line.lastchar)
|
||||
num = 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;
|
||||
|
||||
if (el->el_map.current != el->el_map.emacs)
|
||||
cv_undo(el, INSERT, (size_t)num, el->el_line.cursor);
|
||||
|
||||
for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
|
||||
*cp = cp[num];
|
||||
|
||||
@ -121,13 +149,14 @@ c_delbefore(EditLine *el, int num)
|
||||
if (el->el_line.cursor - num < el->el_line.buffer)
|
||||
num = 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;
|
||||
|
||||
if (el->el_map.current != el->el_map.emacs)
|
||||
cv_undo(el, INSERT, (size_t)num,
|
||||
el->el_line.cursor - num);
|
||||
|
||||
for (cp = el->el_line.cursor - num;
|
||||
cp <= el->el_line.lastchar;
|
||||
cp++)
|
||||
@ -144,7 +173,7 @@ c_delbefore(EditLine *el, int num)
|
||||
protected int
|
||||
ce__isword(int p)
|
||||
{
|
||||
return (isalpha(p) || isdigit(p) || strchr("*?_-.[]~=", p) != NULL);
|
||||
return (isalnum(p) || strchr("*?_-.[]~=", p) != NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -153,6 +182,20 @@ ce__isword(int p)
|
||||
*/
|
||||
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));
|
||||
}
|
||||
@ -216,7 +259,7 @@ cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int))
|
||||
* vi historically deletes with cw only the word preserving the
|
||||
* trailing whitespace! This is not what 'w' does..
|
||||
*/
|
||||
if (el->el_chared.c_vcmd.action != (DELETE|INSERT))
|
||||
if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT))
|
||||
while ((p < high) && isspace((unsigned char) *p))
|
||||
p++;
|
||||
}
|
||||
@ -233,26 +276,19 @@ cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int))
|
||||
* Find the previous word vi style
|
||||
*/
|
||||
protected char *
|
||||
cv_prev_word(EditLine *el, char *p, char *low, int n, int (*wtest)(int))
|
||||
cv_prev_word(char *p, char *low, int n, int (*wtest)(int))
|
||||
{
|
||||
int test;
|
||||
|
||||
p--;
|
||||
while (n--) {
|
||||
p--;
|
||||
/*
|
||||
* vi historically deletes with cb only the word preserving the
|
||||
* leading whitespace! This is not what 'b' does..
|
||||
*/
|
||||
if (el->el_chared.c_vcmd.action != (DELETE|INSERT))
|
||||
while ((p > low) && isspace((unsigned char) *p))
|
||||
p--;
|
||||
while ((p > low) && isspace((unsigned char) *p))
|
||||
p--;
|
||||
test = (*wtest)((unsigned char) *p);
|
||||
while ((p >= low) && (*wtest)((unsigned char) *p) == test)
|
||||
p--;
|
||||
p++;
|
||||
while (isspace((unsigned char) *p))
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
|
||||
/* p now points where we want it */
|
||||
if (p < low)
|
||||
@ -303,47 +339,34 @@ protected void
|
||||
cv_delfini(EditLine *el)
|
||||
{
|
||||
int size;
|
||||
int oaction;
|
||||
int action = el->el_chared.c_vcmd.action;
|
||||
|
||||
if (el->el_chared.c_vcmd.action & INSERT)
|
||||
if (action & INSERT)
|
||||
el->el_map.current = el->el_map.key;
|
||||
|
||||
oaction = el->el_chared.c_vcmd.action;
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
|
||||
if (el->el_chared.c_vcmd.pos == 0)
|
||||
/* sanity */
|
||||
return;
|
||||
|
||||
|
||||
if (el->el_line.cursor > el->el_chared.c_vcmd.pos) {
|
||||
size = (int) (el->el_line.cursor - el->el_chared.c_vcmd.pos);
|
||||
c_delbefore(el, size);
|
||||
el->el_line.cursor = el->el_chared.c_vcmd.pos;
|
||||
re_refresh_cursor(el);
|
||||
} else if (el->el_line.cursor < el->el_chared.c_vcmd.pos) {
|
||||
size = (int)(el->el_chared.c_vcmd.pos - el->el_line.cursor);
|
||||
c_delafter(el, size);
|
||||
} else {
|
||||
size = el->el_line.cursor - el->el_chared.c_vcmd.pos;
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
c_delafter(el, size);
|
||||
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;
|
||||
}
|
||||
}
|
||||
switch (oaction) {
|
||||
case DELETE|INSERT:
|
||||
el->el_chared.c_undo.action = DELETE|INSERT;
|
||||
break;
|
||||
case DELETE:
|
||||
el->el_chared.c_undo.action = INSERT;
|
||||
break;
|
||||
case NOP:
|
||||
case INSERT:
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad oaction %d\n", oaction));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
el->el_chared.c_undo.ptr = el->el_line.cursor;
|
||||
el->el_chared.c_undo.dsize = size;
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
}
|
||||
|
||||
|
||||
@ -373,21 +396,19 @@ ce__endword(char *p, char *high, int n)
|
||||
* Go to the end of this word according to vi
|
||||
*/
|
||||
protected char *
|
||||
cv__endword(char *p, char *high, int n)
|
||||
cv__endword(char *p, char *high, int n, int (*wtest)(int))
|
||||
{
|
||||
int test;
|
||||
|
||||
p++;
|
||||
|
||||
while (n--) {
|
||||
while ((p < high) && isspace((unsigned char) *p))
|
||||
p++;
|
||||
|
||||
if (isalnum((unsigned char) *p))
|
||||
while ((p < high) && isalnum((unsigned char) *p))
|
||||
p++;
|
||||
else
|
||||
while ((p < high) && !(isspace((unsigned char) *p) ||
|
||||
isalnum((unsigned char) *p)))
|
||||
p++;
|
||||
test = (*wtest)((unsigned char) *p);
|
||||
while ((p < high) && (*wtest)((unsigned char) *p) == test)
|
||||
p++;
|
||||
}
|
||||
p--;
|
||||
return (p);
|
||||
@ -406,20 +427,23 @@ ch_init(EditLine *el)
|
||||
(void) memset(el->el_line.buffer, 0, EL_BUFSIZ);
|
||||
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 - 2];
|
||||
el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE];
|
||||
|
||||
el->el_chared.c_undo.buf = (char *) el_malloc(EL_BUFSIZ);
|
||||
if (el->el_chared.c_undo.buf == NULL)
|
||||
return (-1);
|
||||
(void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ);
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.isize = 0;
|
||||
el->el_chared.c_undo.dsize = 0;
|
||||
el->el_chared.c_undo.ptr = el->el_line.buffer;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
el->el_chared.c_undo.cursor = 0;
|
||||
el->el_chared.c_redo.buf = (char *) el_malloc(EL_BUFSIZ);
|
||||
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_vcmd.ins = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_kill.buf = (char *) el_malloc(EL_BUFSIZ);
|
||||
if (el->el_chared.c_kill.buf == NULL)
|
||||
@ -454,14 +478,11 @@ ch_reset(EditLine *el)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.isize = 0;
|
||||
el->el_chared.c_undo.dsize = 0;
|
||||
el->el_chared.c_undo.ptr = 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_vcmd.ins = el->el_line.buffer;
|
||||
|
||||
el->el_chared.c_kill.mark = el->el_line.buffer;
|
||||
|
||||
@ -516,7 +537,8 @@ ch_enlargebufs(el, addlen)
|
||||
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);
|
||||
el->el_line.limit = &newbuffer[newsz - EL_LEAVE];
|
||||
/* don't set new size until all buffers are enlarged */
|
||||
el->el_line.limit = &newbuffer[sz - EL_LEAVE];
|
||||
|
||||
/*
|
||||
* Reallocate kill buffer.
|
||||
@ -545,14 +567,22 @@ ch_enlargebufs(el, addlen)
|
||||
|
||||
/* zero the newly added memory, leave old data in */
|
||||
(void) memset(&newbuffer[sz], 0, newsz - sz);
|
||||
|
||||
el->el_chared.c_undo.ptr = el->el_line.buffer +
|
||||
(el->el_chared.c_undo.ptr - oldbuf);
|
||||
el->el_chared.c_undo.buf = newbuffer;
|
||||
|
||||
newbuffer = el_realloc(el->el_chared.c_redo.buf, newsz);
|
||||
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 = &newbuffer[newsz - EL_LEAVE];
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -567,6 +597,11 @@ ch_end(EditLine *el)
|
||||
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;
|
||||
el_free((ptr_t) el->el_chared.c_macro.macro);
|
||||
@ -619,51 +654,64 @@ el_deletestr(EditLine *el, int n)
|
||||
* Get a string
|
||||
*/
|
||||
protected int
|
||||
c_gets(EditLine *el, char *buf)
|
||||
c_gets(EditLine *el, char *buf, const char *prompt)
|
||||
{
|
||||
char ch;
|
||||
int len = 0;
|
||||
int len;
|
||||
char *cp = el->el_line.buffer;
|
||||
|
||||
if (prompt) {
|
||||
len = strlen(prompt);
|
||||
memcpy(cp, prompt, len + 0u);
|
||||
cp += len;
|
||||
}
|
||||
len = 0;
|
||||
|
||||
for (;;) {
|
||||
el->el_line.cursor = cp;
|
||||
*cp = ' ';
|
||||
el->el_line.lastchar = cp + 1;
|
||||
re_refresh(el);
|
||||
|
||||
if (el_getc(el, &ch) != 1) {
|
||||
ed_end_of_file(el, 0);
|
||||
len = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (ch = 0; ch == 0;) {
|
||||
if (el_getc(el, &ch) != 1)
|
||||
return (ed_end_of_file(el, 0));
|
||||
switch (ch) {
|
||||
|
||||
case 0010: /* Delete and backspace */
|
||||
case 0177:
|
||||
if (len > 1) {
|
||||
*el->el_line.cursor-- = '\0';
|
||||
el->el_line.lastchar = el->el_line.cursor;
|
||||
buf[len--] = '\0';
|
||||
} else {
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
return (CC_REFRESH);
|
||||
if (len <= 0) {
|
||||
len = -1;
|
||||
break;
|
||||
}
|
||||
re_refresh(el);
|
||||
ch = 0;
|
||||
break;
|
||||
cp--;
|
||||
continue;
|
||||
|
||||
case 0033: /* ESC */
|
||||
case '\r': /* Newline */
|
||||
case '\n':
|
||||
buf[len] = ch;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (len >= EL_BUFSIZ)
|
||||
if (len >= EL_BUFSIZ - 16)
|
||||
term_beep(el);
|
||||
else {
|
||||
buf[len++] = ch;
|
||||
*el->el_line.cursor++ = ch;
|
||||
el->el_line.lastchar = el->el_line.cursor;
|
||||
*cp++ = ch;
|
||||
}
|
||||
re_refresh(el);
|
||||
ch = 0;
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
buf[len] = ch;
|
||||
return (len);
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chared.h,v 1.6 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: chared.h,v 1.11 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -71,23 +71,31 @@ typedef struct c_macro_t {
|
||||
} c_macro_t;
|
||||
|
||||
/*
|
||||
* Undo information for both vi and emacs
|
||||
* Undo information for vi - no undo in emacs (yet)
|
||||
*/
|
||||
typedef struct c_undo_t {
|
||||
int action;
|
||||
size_t isize;
|
||||
size_t dsize;
|
||||
char *ptr;
|
||||
char *buf;
|
||||
int 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;
|
||||
char *ins;
|
||||
} c_vcmd_t;
|
||||
|
||||
/*
|
||||
@ -106,6 +114,7 @@ typedef struct c_kill_t {
|
||||
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_chared_t;
|
||||
@ -120,10 +129,10 @@ typedef struct el_chared_t {
|
||||
#define NOP 0x00
|
||||
#define DELETE 0x01
|
||||
#define INSERT 0x02
|
||||
#define CHANGE 0x04
|
||||
#define YANK 0x04
|
||||
|
||||
#define CHAR_FWD 0
|
||||
#define CHAR_BACK 1
|
||||
#define CHAR_FWD (+1)
|
||||
#define CHAR_BACK (-1)
|
||||
|
||||
#define MODE_INSERT 0
|
||||
#define MODE_REPLACE 1
|
||||
@ -137,23 +146,25 @@ typedef struct el_chared_t {
|
||||
|
||||
|
||||
protected int cv__isword(int);
|
||||
protected int cv__isWord(int);
|
||||
protected void cv_delfini(EditLine *);
|
||||
protected char *cv__endword(char *, char *, int);
|
||||
protected char *cv__endword(char *, char *, int, int (*)(int));
|
||||
protected int ce__isword(int);
|
||||
protected void cv_undo(EditLine *, int, size_t, char *);
|
||||
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(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_delafter(EditLine *, int);
|
||||
protected int c_gets(EditLine *, char *);
|
||||
protected int c_gets(EditLine *, char *, const char *);
|
||||
protected int c_hpos(EditLine *);
|
||||
|
||||
protected int ch_init(EditLine *);
|
||||
protected void ch_reset(EditLine *);
|
||||
protected int ch_enlargebufs __P((EditLine *, size_t));
|
||||
protected int ch_enlargebufs(EditLine *, size_t);
|
||||
protected void ch_end(EditLine *);
|
||||
|
||||
#endif /* _h_el_chared */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: common.c,v 1.10 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: common.c,v 1.14 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: common.c,v 1.14 2002/11/20 16:50:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* common.c: Common Editor functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
|
||||
/* ed_end_of_file():
|
||||
@ -66,7 +72,7 @@ ed_end_of_file(EditLine *el, int c __attribute__((unused)))
|
||||
protected el_action_t
|
||||
ed_insert(EditLine *el, int c)
|
||||
{
|
||||
int i;
|
||||
int count = el->el_state.argument;
|
||||
|
||||
if (c == '\0')
|
||||
return (CC_ERROR);
|
||||
@ -74,42 +80,28 @@ ed_insert(EditLine *el, int c)
|
||||
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) el->el_state.argument))
|
||||
if (!ch_enlargebufs(el, (size_t) count))
|
||||
return CC_ERROR; /* error allocating more */
|
||||
}
|
||||
|
||||
if (el->el_state.argument == 1) {
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
*el->el_line.cursor;
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, 1);
|
||||
}
|
||||
c_insert(el, 1);
|
||||
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;
|
||||
el->el_state.doingarg = 0; /* just in case */
|
||||
re_fastaddc(el); /* fast refresh for one char. */
|
||||
} else {
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
for (i = 0; i < el->el_state.argument; i++)
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
el->el_line.cursor[i];
|
||||
if (el->el_state.inputmode != MODE_REPLACE_1)
|
||||
c_insert(el, el->el_state.argument);
|
||||
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, el->el_state.argument);
|
||||
}
|
||||
c_insert(el, el->el_state.argument);
|
||||
|
||||
while (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)
|
||||
(void) vi_command_mode(el, 0);
|
||||
return vi_command_mode(el, 0);
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
@ -229,7 +221,7 @@ ed_move_to_end(EditLine *el, int c __attribute__((unused)))
|
||||
#ifdef VI_MOVE
|
||||
el->el_line.cursor--;
|
||||
#endif
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -253,7 +245,7 @@ ed_move_to_beg(EditLine *el, int c __attribute__((unused)))
|
||||
/* We want FIRST non space character */
|
||||
while (isspace((unsigned char) *el->el_line.cursor))
|
||||
el->el_line.cursor++;
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -295,16 +287,20 @@ 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 >= 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 > el->el_line.lastchar)
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
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 & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -330,7 +326,7 @@ ed_prev_word(EditLine *el, int c __attribute__((unused)))
|
||||
ce__isword);
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -353,7 +349,7 @@ ed_prev_char(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -405,25 +401,9 @@ ed_digit(EditLine *el, int c)
|
||||
(el->el_state.argument * 10) + (c - '0');
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
} else {
|
||||
if (el->el_line.lastchar + 1 >= el->el_line.limit) {
|
||||
if (!ch_enlargebufs(el, 1))
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
*el->el_line.cursor;
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, 1);
|
||||
}
|
||||
c_insert(el, 1);
|
||||
*el->el_line.cursor++ = c;
|
||||
el->el_state.doingarg = 0;
|
||||
re_fastaddc(el);
|
||||
}
|
||||
return (CC_NORM);
|
||||
|
||||
return ed_insert(el, c);
|
||||
}
|
||||
|
||||
|
||||
@ -457,12 +437,11 @@ ed_argument_digit(EditLine *el, int c)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_unassigned(EditLine *el, int c __attribute__((unused)))
|
||||
ed_unassigned(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
term_beep(el);
|
||||
term__flush();
|
||||
return (CC_NORM);
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -490,7 +469,7 @@ ed_tty_sigint(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -504,7 +483,7 @@ ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -518,7 +497,7 @@ ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -532,7 +511,7 @@ ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -546,7 +525,7 @@ ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -560,7 +539,7 @@ ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_start_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_start_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -580,8 +559,6 @@ ed_newline(EditLine *el, int c __attribute__((unused)))
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar++ = '\n';
|
||||
*el->el_line.lastchar = '\0';
|
||||
if (el->el_map.type == MAP_VI)
|
||||
el->el_chared.c_vcmd.ins = el->el_line.buffer;
|
||||
return (CC_NEWLINE);
|
||||
}
|
||||
|
||||
@ -627,7 +604,7 @@ ed_clear_screen(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_redisplay(EditLine *el __attribute__((unused)),
|
||||
ed_redisplay(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -655,7 +632,7 @@ ed_start_over(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((unused)),
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -672,8 +649,9 @@ protected el_action_t
|
||||
ed_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
{
|
||||
char beep = 0;
|
||||
int sv_event = el->el_history.eventno;
|
||||
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
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
|
||||
@ -686,15 +664,17 @@ ed_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
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;
|
||||
return CC_ERROR;
|
||||
}
|
||||
beep = 1;
|
||||
/* el->el_history.eventno was fixed by first call */
|
||||
(void) hist_get(el);
|
||||
}
|
||||
re_refresh(el);
|
||||
if (beep)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_NORM); /* was CC_UP_HIST */
|
||||
return CC_REFRESH_BEEP;
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -706,17 +686,22 @@ 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.action = NOP;
|
||||
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;
|
||||
return (CC_ERROR);/* make it beep */
|
||||
beep = CC_REFRESH_BEEP;
|
||||
}
|
||||
return (hist_get(el));
|
||||
rval = hist_get(el);
|
||||
if (rval == CC_REFRESH)
|
||||
return beep;
|
||||
return rval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -733,7 +718,7 @@ ed_search_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.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
|
||||
@ -801,7 +786,7 @@ ed_search_next_history(EditLine *el, int c __attribute__((unused)))
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0)
|
||||
@ -930,25 +915,13 @@ ed_command(EditLine *el, int c __attribute__((unused)))
|
||||
char tmpbuf[EL_BUFSIZ];
|
||||
int tmplen;
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
tmplen = c_gets(el, tmpbuf, "\n: ");
|
||||
term__putc('\n');
|
||||
|
||||
c_insert(el, 3); /* prompt + ": " */
|
||||
*el->el_line.cursor++ = '\n';
|
||||
*el->el_line.cursor++ = ':';
|
||||
*el->el_line.cursor++ = ' ';
|
||||
re_refresh(el);
|
||||
if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
|
||||
term_beep(el);
|
||||
|
||||
tmplen = c_gets(el, tmpbuf);
|
||||
tmpbuf[tmplen] = '\0';
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (parse_line(el, tmpbuf) == -1)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_REFRESH);
|
||||
el->el_map.current = el->el_map.key;
|
||||
re_clear_display(el);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
14
cmd-line-utils/libedit/config.h
Normal file
14
cmd-line-utils/libedit/config.h
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "my_config.h"
|
||||
#include "sys.h"
|
||||
|
||||
#define __RCSID(x)
|
||||
#define __COPYRIGHT(x)
|
||||
#define __RENAME(x)
|
||||
#define _DIAGASSERT(x)
|
||||
|
||||
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
#define __attribute__(A)
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: el.c,v 1.21 2001/01/05 22:45:30 christos Exp $ */
|
||||
/* $NetBSD: el.c,v 1.30 2002/11/12 00:00:23 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,13 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#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.30 2002/11/12 00:00:23 thorpej Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* el.c: EditLine interface functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
@ -58,9 +63,6 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
|
||||
{
|
||||
|
||||
EditLine *el = (EditLine *) el_malloc(sizeof(EditLine));
|
||||
#ifdef DEBUG
|
||||
char *tty;
|
||||
#endif
|
||||
|
||||
if (el == NULL)
|
||||
return (NULL);
|
||||
@ -77,8 +79,12 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
|
||||
*/
|
||||
el->el_flags = 0;
|
||||
|
||||
(void) term_init(el);
|
||||
(void) key_init(el);
|
||||
if (term_init(el) == -1) {
|
||||
free(el->el_prog);
|
||||
el_free(el);
|
||||
return NULL;
|
||||
}
|
||||
(void) el_key_init(el);
|
||||
(void) map_init(el);
|
||||
if (tty_init(el) == -1)
|
||||
el->el_flags |= NO_TTY;
|
||||
@ -87,6 +93,7 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
|
||||
(void) hist_init(el);
|
||||
(void) prompt_init(el);
|
||||
(void) sig_init(el);
|
||||
(void) read_init(el);
|
||||
|
||||
return (el);
|
||||
}
|
||||
@ -105,7 +112,7 @@ el_end(EditLine *el)
|
||||
el_reset(el);
|
||||
|
||||
term_end(el);
|
||||
key_end(el);
|
||||
el_key_end(el);
|
||||
map_end(el);
|
||||
tty_end(el);
|
||||
ch_end(el);
|
||||
@ -138,11 +145,12 @@ public int
|
||||
el_set(EditLine *el, int op, ...)
|
||||
{
|
||||
va_list va;
|
||||
int rv;
|
||||
va_start(va, op);
|
||||
int rv = 0;
|
||||
|
||||
if (el == NULL)
|
||||
return (-1);
|
||||
va_start(va, op);
|
||||
|
||||
switch (op) {
|
||||
case EL_PROMPT:
|
||||
case EL_RPROMPT:
|
||||
@ -162,7 +170,6 @@ el_set(EditLine *el, int op, ...)
|
||||
el->el_flags |= HANDLE_SIGNALS;
|
||||
else
|
||||
el->el_flags &= ~HANDLE_SIGNALS;
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_BIND:
|
||||
@ -239,8 +246,20 @@ el_set(EditLine *el, int op, ...)
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_GETCFN:
|
||||
{
|
||||
el_rfunc_t rc = va_arg(va, el_rfunc_t);
|
||||
rv = el_read_setfn(el, rc);
|
||||
break;
|
||||
}
|
||||
|
||||
case EL_CLIENTDATA:
|
||||
el->el_data = va_arg(va, void *);
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
va_end(va);
|
||||
@ -261,11 +280,11 @@ el_get(EditLine *el, int op, void *ret)
|
||||
switch (op) {
|
||||
case EL_PROMPT:
|
||||
case EL_RPROMPT:
|
||||
rv = prompt_get(el, (el_pfunc_t *) & ret, op);
|
||||
rv = prompt_get(el, (void *) &ret, op);
|
||||
break;
|
||||
|
||||
case EL_EDITOR:
|
||||
rv = map_get_editor(el, (const char **) &ret);
|
||||
rv = map_get_editor(el, (void *) &ret);
|
||||
break;
|
||||
|
||||
case EL_SIGNAL:
|
||||
@ -349,6 +368,16 @@ el_get(EditLine *el, int op, void *ret)
|
||||
break;
|
||||
#endif /* XXX */
|
||||
|
||||
case EL_GETCFN:
|
||||
*((el_rfunc_t *)ret) = el_read_getfn(el);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case EL_CLIENTDATA:
|
||||
*((void **)ret) = el->el_data;
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
}
|
||||
@ -367,15 +396,6 @@ el_line(EditLine *el)
|
||||
return (const LineInfo *) (void *) &el->el_line;
|
||||
}
|
||||
|
||||
static const char elpath[] = "/.editrc";
|
||||
|
||||
#if defined(MAXPATHLEN)
|
||||
#define LIBEDIT_MAXPATHLEN MAXPATHLEN
|
||||
#elif defined(PATH_MAX)
|
||||
#define LIBEDIT_MAXPATHLEN PATH_MAX
|
||||
#else
|
||||
#define LIBEDIT_MAXPATHLEN 1024
|
||||
#endif
|
||||
|
||||
/* el_source():
|
||||
* Source a file
|
||||
@ -385,10 +405,14 @@ el_source(EditLine *el, const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
size_t len;
|
||||
char *ptr, path[LIBEDIT_MAXPATHLEN];
|
||||
char *ptr;
|
||||
|
||||
fp = NULL;
|
||||
if (fname == NULL) {
|
||||
#ifdef HAVE_ISSETUGID
|
||||
static const char elpath[] = "/.editrc";
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
if (issetugid())
|
||||
return (-1);
|
||||
if ((ptr = getenv("HOME")) == NULL)
|
||||
@ -398,6 +422,14 @@ el_source(EditLine *el, const char *fname)
|
||||
if (strlcat(path, elpath, sizeof(path)) >= sizeof(path))
|
||||
return (-1);
|
||||
fname = path;
|
||||
#else
|
||||
/*
|
||||
* If issetugid() is missing, always return an error, in order
|
||||
* to keep from inadvertently opening up the user to a security
|
||||
* hole.
|
||||
*/
|
||||
return (-1);
|
||||
#endif
|
||||
}
|
||||
if (fp == NULL)
|
||||
fp = fopen(fname, "r");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: el.h,v 1.8 2001/01/06 14:44:50 jdolecek Exp $ */
|
||||
/* $NetBSD: el.h,v 1.13 2002/11/15 14:32:33 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -72,7 +72,7 @@ typedef struct el_line_t {
|
||||
char *buffer; /* Input line */
|
||||
char *cursor; /* Cursor position */
|
||||
char *lastchar; /* Last character */
|
||||
const char *limit; /* Max position */
|
||||
const char *limit; /* Max position */
|
||||
} el_line_t;
|
||||
|
||||
/*
|
||||
@ -84,6 +84,8 @@ typedef struct el_state_t {
|
||||
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;
|
||||
|
||||
/*
|
||||
@ -106,6 +108,7 @@ typedef struct el_state_t {
|
||||
#include "parse.h"
|
||||
#include "sig.h"
|
||||
#include "help.h"
|
||||
#include "read.h"
|
||||
|
||||
struct editline {
|
||||
char *el_prog; /* the program name */
|
||||
@ -116,6 +119,7 @@ struct editline {
|
||||
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 */
|
||||
@ -129,13 +133,18 @@ struct editline {
|
||||
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 */
|
||||
};
|
||||
|
||||
protected int el_editmode(EditLine *, int, const char **);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define EL_ABORT(a) (void) (fprintf(el->el_errfile, "%s, %d: ", \
|
||||
__FILE__, __LINE__), fprintf a, abort())
|
||||
#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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emacs.c,v 1.9 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: emacs.c,v 1.12 2002/11/15 14:32:33 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: emacs.c,v 1.12 2002/11/15 14:32:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* emacs.c: Emacs functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
|
||||
/* em_delete_or_list():
|
||||
@ -209,7 +215,7 @@ em_copy_region(EditLine *el, int c __attribute__((unused)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
|
||||
if (el->el_chared.c_kill.mark)
|
||||
if (!el->el_chared.c_kill.mark)
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_chared.c_kill.mark > el->el_line.cursor) {
|
||||
@ -265,7 +271,7 @@ em_next_word(EditLine *el, int c __attribute__((unused)))
|
||||
ce__isword);
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hist.c,v 1.9 2001/05/17 01:02:17 christos Exp $ */
|
||||
/* $NetBSD: hist.c,v 1.12 2003/01/21 18:40:23 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: hist.c,v 1.12 2003/01/21 18:40:23 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* hist.c: History access functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <stdlib.h>
|
||||
#include "el.h"
|
||||
|
||||
@ -126,18 +132,16 @@ hist_get(EditLine *el)
|
||||
el->el_history.eventno = h;
|
||||
return (CC_ERROR);
|
||||
}
|
||||
(void) strncpy(el->el_line.buffer, hp,
|
||||
(void) strlcpy(el->el_line.buffer, hp,
|
||||
(size_t)(el->el_line.limit - el->el_line.buffer));
|
||||
el->el_line.lastchar = el->el_line.buffer + strlen(el->el_line.buffer);
|
||||
|
||||
if (el->el_line.lastchar > el->el_line.buffer) {
|
||||
if (el->el_line.lastchar[-1] == '\n')
|
||||
el->el_line.lastchar--;
|
||||
if (el->el_line.lastchar[-1] == ' ')
|
||||
el->el_line.lastchar--;
|
||||
if (el->el_line.lastchar < el->el_line.buffer)
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
}
|
||||
if (el->el_line.lastchar > el->el_line.buffer
|
||||
&& el->el_line.lastchar[-1] == '\n')
|
||||
el->el_line.lastchar--;
|
||||
if (el->el_line.lastchar > el->el_line.buffer
|
||||
&& el->el_line.lastchar[-1] == ' ')
|
||||
el->el_line.lastchar--;
|
||||
#ifdef KSHVI
|
||||
if (el->el_map.type == MAP_VI)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
@ -149,22 +153,41 @@ hist_get(EditLine *el)
|
||||
}
|
||||
|
||||
|
||||
/* hist_list()
|
||||
* List history entries
|
||||
/* hist_command()
|
||||
* process a history command
|
||||
*/
|
||||
protected int
|
||||
/*ARGSUSED*/
|
||||
hist_list(EditLine *el, int argc __attribute__((unused)),
|
||||
const char **argv __attribute__((unused)))
|
||||
hist_command(EditLine *el, int argc, const char **argv)
|
||||
{
|
||||
const char *str;
|
||||
int num;
|
||||
HistEvent ev;
|
||||
|
||||
if (el->el_history.ref == NULL)
|
||||
return (-1);
|
||||
for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
|
||||
(void) fprintf(el->el_outfile, "%d %s",
|
||||
el->el_history.ev.num, str);
|
||||
return (0);
|
||||
|
||||
if (argc == 0 || strcmp(argv[0], "list") == 1) {
|
||||
/* List history entries */
|
||||
|
||||
for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
|
||||
(void) fprintf(el->el_outfile, "%d %s",
|
||||
el->el_history.ev.num, str);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (argc != 2)
|
||||
return (-1);
|
||||
|
||||
num = (int)strtol(argv[1], NULL, 0);
|
||||
|
||||
if (strcmp(argv[0], "size") == 0)
|
||||
return history(el->el_history.ref, &ev, H_SETSIZE, num);
|
||||
|
||||
if (strcmp(argv[0], "unique") == 0)
|
||||
return history(el->el_history.ref, &ev, H_SETUNIQUE, num);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* hist_enlargebuf()
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hist.h,v 1.6 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: hist.h,v 1.9 2003/01/21 18:40:23 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -66,7 +66,7 @@ typedef struct el_history_t {
|
||||
#define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL)
|
||||
#define HIST_LAST(el) HIST_FUN(el, H_LAST, NULL)
|
||||
#define HIST_PREV(el) HIST_FUN(el, H_PREV, NULL)
|
||||
#define HIST_EVENT(el, num) HIST_FUN(el, H_EVENT, num)
|
||||
#define HIST_SET(el, num) HIST_FUN(el, H_SET, num)
|
||||
#define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname)
|
||||
#define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname)
|
||||
|
||||
@ -74,7 +74,7 @@ protected int hist_init(EditLine *);
|
||||
protected void hist_end(EditLine *);
|
||||
protected el_action_t hist_get(EditLine *);
|
||||
protected int hist_set(EditLine *, hist_fun_t, ptr_t);
|
||||
protected int hist_list(EditLine *, int, const char **);
|
||||
protected int hist_command(EditLine *, int, const char **);
|
||||
protected int hist_enlargebuf(EditLine *, size_t, size_t);
|
||||
|
||||
#endif /* _h_el_hist */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: histedit.h,v 1.16 2000/09/04 22:06:30 lukem Exp $ */
|
||||
/* $NetBSD: histedit.h,v 1.21 2003/01/21 18:40:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -44,6 +44,9 @@
|
||||
#ifndef _HISTEDIT_H_
|
||||
#define _HISTEDIT_H_
|
||||
|
||||
#define LIBEDIT_MAJOR 2
|
||||
#define LIBEDIT_MINOR 6
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -90,7 +93,7 @@ void el_end(EditLine *);
|
||||
*/
|
||||
const char *el_gets(EditLine *, int *);
|
||||
int el_getc(EditLine *, char *);
|
||||
void el_push(EditLine *, const char *);
|
||||
void el_push(EditLine *, char *);
|
||||
|
||||
/*
|
||||
* Beep!
|
||||
@ -126,6 +129,10 @@ int el_get(EditLine *, int, void *);
|
||||
#define EL_HIST 10 /* , hist_fun_t, const char *); */
|
||||
#define EL_EDITMODE 11 /* , int); */
|
||||
#define EL_RPROMPT 12 /* , el_pfunc_t); */
|
||||
#define EL_GETCFN 13 /* , el_rfunc_t); */
|
||||
#define EL_CLIENTDATA 14 /* , void *); */
|
||||
|
||||
#define EL_BUILTIN_GETCFN (NULL)
|
||||
|
||||
/*
|
||||
* Source named file or $PWD/.editrc or $HOME/.editrc
|
||||
@ -174,7 +181,7 @@ int history(History *, HistEvent *, int, ...);
|
||||
#define H_PREV 5 /* , void); */
|
||||
#define H_NEXT 6 /* , void); */
|
||||
#define H_CURR 8 /* , const int); */
|
||||
#define H_SET 7 /* , void); */
|
||||
#define H_SET 7 /* , int); */
|
||||
#define H_ADD 9 /* , const char *); */
|
||||
#define H_ENTER 10 /* , const char *); */
|
||||
#define H_APPEND 11 /* , const char *); */
|
||||
@ -186,5 +193,7 @@ int history(History *, HistEvent *, int, ...);
|
||||
#define H_LOAD 17 /* , const char *); */
|
||||
#define H_SAVE 18 /* , const char *); */
|
||||
#define H_CLEAR 19 /* , void); */
|
||||
#define H_SETUNIQUE 20 /* , int); */
|
||||
#define H_GETUNIQUE 21 /* , void); */
|
||||
|
||||
#endif /* _HISTEDIT_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: history.c,v 1.17 2001/03/20 00:08:31 christos Exp $ */
|
||||
/* $NetBSD: history.c,v 1.22 2003/01/21 18:40:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,18 +36,25 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: history.c,v 1.22 2003/01/21 18:40:24 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* hist.c: History access functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_VIS_H
|
||||
#include <vis.h>
|
||||
#else
|
||||
#include "np/vis.h"
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -73,6 +80,7 @@ struct history {
|
||||
history_efun_t h_enter; /* Add an element */
|
||||
history_efun_t h_add; /* Append to an element */
|
||||
};
|
||||
|
||||
#define HNEXT(h, ev) (*(h)->h_next)((h)->h_ref, ev)
|
||||
#define HFIRST(h, ev) (*(h)->h_first)((h)->h_ref, ev)
|
||||
#define HPREV(h, ev) (*(h)->h_prev)((h)->h_ref, ev)
|
||||
@ -87,9 +95,17 @@ struct history {
|
||||
#define h_realloc(a, b) realloc((a), (b))
|
||||
#define h_free(a) free(a)
|
||||
|
||||
typedef struct {
|
||||
int num;
|
||||
char *str;
|
||||
} HistEventPrivate;
|
||||
|
||||
|
||||
|
||||
private int history_setsize(History *, HistEvent *, int);
|
||||
private int history_getsize(History *, HistEvent *);
|
||||
private int history_setunique(History *, HistEvent *, int);
|
||||
private int history_getunique(History *, HistEvent *);
|
||||
private int history_set_fun(History *, History *);
|
||||
private int history_load(History *, const char *);
|
||||
private int history_save(History *, const char *);
|
||||
@ -108,15 +124,17 @@ typedef struct hentry_t {
|
||||
HistEvent ev; /* What we return */
|
||||
struct hentry_t *next; /* Next entry */
|
||||
struct hentry_t *prev; /* Previous entry */
|
||||
} hentry_t;
|
||||
} hentry_t;
|
||||
|
||||
typedef struct history_t {
|
||||
hentry_t list; /* Fake list header element */
|
||||
hentry_t *cursor; /* Current element in the list */
|
||||
int max; /* Maximum number of events */
|
||||
int cur; /* Current number of events */
|
||||
hentry_t list; /* Fake list header element */
|
||||
hentry_t *cursor; /* Current element in the list */
|
||||
int max; /* Maximum number of events */
|
||||
int cur; /* Current number of events */
|
||||
int eventid; /* For generation of unique event id */
|
||||
} history_t;
|
||||
int flags; /* History flags */
|
||||
#define H_UNIQUE 1 /* Store only unique elements */
|
||||
} history_t;
|
||||
|
||||
private int history_def_first(ptr_t, HistEvent *);
|
||||
private int history_def_last(ptr_t, HistEvent *);
|
||||
@ -126,13 +144,19 @@ private int history_def_curr(ptr_t, HistEvent *);
|
||||
private int history_def_set(ptr_t, HistEvent *, const int n);
|
||||
private int history_def_enter(ptr_t, HistEvent *, const char *);
|
||||
private int history_def_add(ptr_t, HistEvent *, const char *);
|
||||
private void history_def_init(ptr_t *, HistEvent *, int);
|
||||
private int history_def_init(ptr_t *, HistEvent *, int);
|
||||
private void history_def_clear(ptr_t, HistEvent *);
|
||||
private int history_def_insert(history_t *, HistEvent *, const char *);
|
||||
private void history_def_delete(history_t *, HistEvent *, hentry_t *);
|
||||
|
||||
#define history_def_setsize(p, num)(void) (((history_t *) p)->max = (num))
|
||||
#define history_def_getsize(p) (((history_t *) p)->cur)
|
||||
#define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num))
|
||||
#define history_def_getsize(p) (((history_t *)p)->cur)
|
||||
#define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE) != 0)
|
||||
#define history_def_setunique(p, uni) \
|
||||
if (uni) \
|
||||
(((history_t *)p)->flags) |= H_UNIQUE; \
|
||||
else \
|
||||
(((history_t *)p)->flags) &= ~H_UNIQUE
|
||||
|
||||
#define he_strerror(code) he_errlist[code]
|
||||
#define he_seterrev(evp, code) {\
|
||||
@ -326,20 +350,20 @@ history_def_add(ptr_t p, HistEvent *ev, const char *str)
|
||||
history_t *h = (history_t *) p;
|
||||
size_t len;
|
||||
char *s;
|
||||
HistEventPrivate *evp = (void *)&h->cursor->ev;
|
||||
|
||||
if (h->cursor == &h->list)
|
||||
return (history_def_enter(p, ev, str));
|
||||
len = strlen(h->cursor->ev.str) + strlen(str) + 1;
|
||||
len = strlen(evp->str) + strlen(str) + 1;
|
||||
s = (char *) h_malloc(len);
|
||||
if (!s) {
|
||||
if (s == NULL) {
|
||||
he_seterrev(ev, _HE_MALLOC_FAILED);
|
||||
return (-1);
|
||||
}
|
||||
(void) strlcpy(s, h->cursor->ev.str, len);
|
||||
(void) strlcat(s, str, len);
|
||||
/* LINTED const cast */
|
||||
h_free((ptr_t) h->cursor->ev.str);
|
||||
h->cursor->ev.str = s;
|
||||
h_free((ptr_t)evp->str);
|
||||
evp->str = s;
|
||||
*ev = h->cursor->ev;
|
||||
return (0);
|
||||
}
|
||||
@ -350,16 +374,14 @@ history_def_add(ptr_t p, HistEvent *ev, const char *str)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
private void
|
||||
history_def_delete(history_t *h,
|
||||
HistEvent *ev __attribute__((unused)), hentry_t *hp)
|
||||
history_def_delete(history_t *h, HistEvent *ev __attribute__((unused)), hentry_t *hp)
|
||||
{
|
||||
|
||||
HistEventPrivate *evp = (void *)&hp->ev;
|
||||
if (hp == &h->list)
|
||||
abort();
|
||||
hp->prev->next = hp->next;
|
||||
hp->next->prev = hp->prev;
|
||||
/* LINTED const cast */
|
||||
h_free((ptr_t) hp->ev.str);
|
||||
h_free((ptr_t) evp->str);
|
||||
h_free(hp);
|
||||
h->cur--;
|
||||
}
|
||||
@ -373,11 +395,11 @@ history_def_insert(history_t *h, HistEvent *ev, const char *str)
|
||||
{
|
||||
|
||||
h->cursor = (hentry_t *) h_malloc(sizeof(hentry_t));
|
||||
if (h->cursor)
|
||||
h->cursor->ev.str = strdup(str);
|
||||
if (!h->cursor || !h->cursor->ev.str) {
|
||||
he_seterrev(ev, _HE_MALLOC_FAILED);
|
||||
return (-1);
|
||||
if (h->cursor == NULL)
|
||||
goto oomem;
|
||||
if ((h->cursor->ev.str = strdup(str)) == NULL) {
|
||||
h_free((ptr_t)h->cursor);
|
||||
goto oomem;
|
||||
}
|
||||
h->cursor->ev.num = ++h->eventid;
|
||||
h->cursor->next = h->list.next;
|
||||
@ -388,6 +410,9 @@ history_def_insert(history_t *h, HistEvent *ev, const char *str)
|
||||
|
||||
*ev = h->cursor->ev;
|
||||
return (0);
|
||||
oomem:
|
||||
he_seterrev(ev, _HE_MALLOC_FAILED);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@ -399,6 +424,10 @@ history_def_enter(ptr_t p, HistEvent *ev, const char *str)
|
||||
{
|
||||
history_t *h = (history_t *) p;
|
||||
|
||||
if ((h->flags & H_UNIQUE) != 0 && h->list.next != &h->list &&
|
||||
strcmp(h->list.next->ev.str, str) == 0)
|
||||
return (0);
|
||||
|
||||
if (history_def_insert(h, ev, str) == -1)
|
||||
return (-1); /* error, keep error message */
|
||||
|
||||
@ -406,10 +435,10 @@ history_def_enter(ptr_t p, HistEvent *ev, const char *str)
|
||||
* Always keep at least one entry.
|
||||
* This way we don't have to check for the empty list.
|
||||
*/
|
||||
while (h->cur - 1 > h->max)
|
||||
while (h->cur > h->max && h->cur > 0)
|
||||
history_def_delete(h, ev, h->list.prev);
|
||||
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
@ -417,10 +446,12 @@ history_def_enter(ptr_t p, HistEvent *ev, const char *str)
|
||||
* Default history initialization function
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
private void
|
||||
private int
|
||||
history_def_init(ptr_t *p, HistEvent *ev __attribute__((unused)), int n)
|
||||
{
|
||||
history_t *h = (history_t *) h_malloc(sizeof(history_t));
|
||||
if (h == NULL)
|
||||
return -1;
|
||||
|
||||
if (n <= 0)
|
||||
n = 0;
|
||||
@ -431,7 +462,9 @@ history_def_init(ptr_t *p, HistEvent *ev __attribute__((unused)), int n)
|
||||
h->list.ev.str = NULL;
|
||||
h->list.ev.num = 0;
|
||||
h->cursor = &h->list;
|
||||
h->flags = 0;
|
||||
*p = (ptr_t) h;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -460,10 +493,15 @@ history_def_clear(ptr_t p, HistEvent *ev)
|
||||
public History *
|
||||
history_init(void)
|
||||
{
|
||||
History *h = (History *) h_malloc(sizeof(History));
|
||||
HistEvent ev;
|
||||
History *h = (History *) h_malloc(sizeof(History));
|
||||
if (h == NULL)
|
||||
return NULL;
|
||||
|
||||
history_def_init(&h->h_ref, &ev, 0);
|
||||
if (history_def_init(&h->h_ref, &ev, 0) == -1) {
|
||||
h_free((ptr_t)h);
|
||||
return NULL;
|
||||
}
|
||||
h->h_ent = -1;
|
||||
h->h_next = history_def_next;
|
||||
h->h_first = history_def_first;
|
||||
@ -519,18 +557,46 @@ history_setsize(History *h, HistEvent *ev, int num)
|
||||
private int
|
||||
history_getsize(History *h, HistEvent *ev)
|
||||
{
|
||||
int retval = 0;
|
||||
if (h->h_next != history_def_next) {
|
||||
he_seterrev(ev, _HE_NOT_ALLOWED);
|
||||
return (-1);
|
||||
}
|
||||
ev->num = history_def_getsize(h->h_ref);
|
||||
if (ev->num < -1) {
|
||||
he_seterrev(ev, _HE_SIZE_NEGATIVE);
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* history_setunique():
|
||||
* Set if adjacent equal events should not be entered in history.
|
||||
*/
|
||||
private int
|
||||
history_setunique(History *h, HistEvent *ev, int uni)
|
||||
{
|
||||
|
||||
if (h->h_next != history_def_next) {
|
||||
he_seterrev(ev, _HE_NOT_ALLOWED);
|
||||
return (-1);
|
||||
}
|
||||
retval = history_def_getsize(h->h_ref);
|
||||
if (retval < -1) {
|
||||
he_seterrev(ev, _HE_SIZE_NEGATIVE);
|
||||
history_def_setunique(h->h_ref, uni);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* history_getunique():
|
||||
* Get if adjacent equal events should not be entered in history.
|
||||
*/
|
||||
private int
|
||||
history_getunique(History *h, HistEvent *ev)
|
||||
{
|
||||
if (h->h_next != history_def_next) {
|
||||
he_seterrev(ev, _HE_NOT_ALLOWED);
|
||||
return (-1);
|
||||
}
|
||||
ev->num = retval;
|
||||
ev->num = history_def_getunique(h->h_ref);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -595,13 +661,9 @@ history_load(History *h, const char *fname)
|
||||
if ((fp = fopen(fname, "r")) == NULL)
|
||||
return (i);
|
||||
|
||||
if ((line = fgetln(fp, &sz)) == NULL)
|
||||
goto done;
|
||||
|
||||
if (strncmp(line, hist_cookie, sz) != 0)
|
||||
goto done;
|
||||
|
||||
ptr = h_malloc(max_size = 1024);
|
||||
if (ptr == NULL)
|
||||
goto done;
|
||||
for (i = 0; (line = fgetln(fp, &sz)) != NULL; i++) {
|
||||
char c = line[sz];
|
||||
|
||||
@ -611,15 +673,24 @@ history_load(History *h, const char *fname)
|
||||
line[sz] = '\0';
|
||||
|
||||
if (max_size < sz) {
|
||||
char *nptr;
|
||||
max_size = (sz + 1023) & ~1023;
|
||||
ptr = h_realloc(ptr, max_size);
|
||||
nptr = h_realloc(ptr, max_size);
|
||||
if (nptr == NULL) {
|
||||
i = -1;
|
||||
goto oomem;
|
||||
}
|
||||
ptr = nptr;
|
||||
}
|
||||
(void) strunvis(ptr, line);
|
||||
line[sz] = c;
|
||||
HENTER(h, &ev, ptr);
|
||||
if (HENTER(h, &ev, ptr) == -1) {
|
||||
h_free((ptr_t)ptr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
h_free(ptr);
|
||||
|
||||
oomem:
|
||||
h_free((ptr_t)ptr);
|
||||
done:
|
||||
(void) fclose(fp);
|
||||
return (i);
|
||||
@ -634,28 +705,38 @@ history_save(History *h, const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
HistEvent ev;
|
||||
int i = 0, retval;
|
||||
int i = -1, retval;
|
||||
size_t len, max_size;
|
||||
char *ptr;
|
||||
|
||||
if ((fp = fopen(fname, "w")) == NULL)
|
||||
return (-1);
|
||||
|
||||
(void) fchmod(fileno(fp), S_IRUSR|S_IWUSR);
|
||||
(void) fputs(hist_cookie, fp);
|
||||
if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
|
||||
goto done;
|
||||
ptr = h_malloc(max_size = 1024);
|
||||
for (retval = HLAST(h, &ev);
|
||||
if (ptr == NULL)
|
||||
goto done;
|
||||
for (i = 0, retval = HLAST(h, &ev);
|
||||
retval != -1;
|
||||
retval = HPREV(h, &ev), i++) {
|
||||
len = strlen(ev.str) * 4;
|
||||
len = strlen(ev.str) * 4 + 1;
|
||||
if (len >= max_size) {
|
||||
max_size = (len + 1023) & 1023;
|
||||
ptr = h_realloc(ptr, max_size);
|
||||
char *nptr;
|
||||
max_size = (len + 1023) & ~1023;
|
||||
nptr = h_realloc(ptr, max_size);
|
||||
if (nptr == NULL) {
|
||||
i = -1;
|
||||
goto oomem;
|
||||
}
|
||||
ptr = nptr;
|
||||
}
|
||||
(void) strvis(ptr, ev.str, VIS_WHITE);
|
||||
(void) fprintf(fp, "%s\n", ev.str);
|
||||
}
|
||||
h_free(ptr);
|
||||
oomem:
|
||||
h_free((ptr_t)ptr);
|
||||
done:
|
||||
(void) fclose(fp);
|
||||
return (i);
|
||||
}
|
||||
@ -754,6 +835,14 @@ history(History *h, HistEvent *ev, int fun, ...)
|
||||
retval = history_setsize(h, ev, va_arg(va, int));
|
||||
break;
|
||||
|
||||
case H_GETUNIQUE:
|
||||
retval = history_getunique(h, ev);
|
||||
break;
|
||||
|
||||
case H_SETUNIQUE:
|
||||
retval = history_setunique(h, ev, va_arg(va, int));
|
||||
break;
|
||||
|
||||
case H_ADD:
|
||||
str = va_arg(va, const char *);
|
||||
retval = HADD(h, ev, str);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: key.c,v 1.12 2001/05/17 01:02:17 christos Exp $ */
|
||||
/* $NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,7 +36,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* key.c: This module contains the procedures for maintaining
|
||||
@ -59,7 +66,6 @@
|
||||
* 1) It is not possible to have one key that is a
|
||||
* substr of another.
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -85,8 +91,8 @@ private int node__try(EditLine *, key_node_t *, const char *,
|
||||
private key_node_t *node__get(int);
|
||||
private void node__put(EditLine *, key_node_t *);
|
||||
private int node__delete(EditLine *, key_node_t **, const char *);
|
||||
private int node_lookup(EditLine *, const char *,
|
||||
key_node_t *, int);
|
||||
private int node_lookup(EditLine *, const char *, key_node_t *,
|
||||
int);
|
||||
private int node_enum(EditLine *, key_node_t *, int);
|
||||
private int key__decode_char(char *, int, int);
|
||||
|
||||
@ -97,14 +103,14 @@ private int key__decode_char(char *, int, int);
|
||||
* Initialize the key maps
|
||||
*/
|
||||
protected int
|
||||
key_init(EditLine *el)
|
||||
el_key_init(EditLine *el)
|
||||
{
|
||||
|
||||
el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ);
|
||||
if (el->el_key.buf == NULL)
|
||||
return (-1);
|
||||
el->el_key.map = NULL;
|
||||
key_reset(el);
|
||||
el_key_reset(el);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -113,7 +119,7 @@ key_init(EditLine *el)
|
||||
* Free the key maps
|
||||
*/
|
||||
protected void
|
||||
key_end(EditLine *el)
|
||||
el_key_end(EditLine *el)
|
||||
{
|
||||
|
||||
el_free((ptr_t) el->el_key.buf);
|
||||
@ -127,7 +133,7 @@ key_end(EditLine *el)
|
||||
* Associate cmd with a key value
|
||||
*/
|
||||
protected key_value_t *
|
||||
key_map_cmd(EditLine *el, int cmd)
|
||||
el_key_map_cmd(EditLine *el, int cmd)
|
||||
{
|
||||
|
||||
el->el_key.val.cmd = (el_action_t) cmd;
|
||||
@ -139,7 +145,7 @@ key_map_cmd(EditLine *el, int cmd)
|
||||
* Associate str with a key value
|
||||
*/
|
||||
protected key_value_t *
|
||||
key_map_str(EditLine *el, char *str)
|
||||
el_key_map_str(EditLine *el, char *str)
|
||||
{
|
||||
|
||||
el->el_key.val.str = str;
|
||||
@ -153,7 +159,7 @@ key_map_str(EditLine *el, char *str)
|
||||
* [Always bind the ansi arrow keys?]
|
||||
*/
|
||||
protected void
|
||||
key_reset(EditLine *el)
|
||||
el_key_reset(EditLine *el)
|
||||
{
|
||||
|
||||
node__put(el, el->el_key.map);
|
||||
@ -171,7 +177,7 @@ key_reset(EditLine *el)
|
||||
* The last character read is returned in *ch.
|
||||
*/
|
||||
protected int
|
||||
key_get(EditLine *el, char *ch, key_value_t *val)
|
||||
el_key_get(EditLine *el, char *ch, key_value_t *val)
|
||||
{
|
||||
|
||||
return (node_trav(el, el->el_key.map, ch, val));
|
||||
@ -185,7 +191,7 @@ key_get(EditLine *el, char *ch, key_value_t *val)
|
||||
* out str or a unix command.
|
||||
*/
|
||||
protected void
|
||||
key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
el_key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
{
|
||||
|
||||
if (key[0] == '\0') {
|
||||
@ -213,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
*
|
||||
*/
|
||||
protected void
|
||||
key_clear(EditLine *el, el_action_t *map, const char *in)
|
||||
el_key_clear(EditLine *el, el_action_t *map, const char *in)
|
||||
{
|
||||
|
||||
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
|
||||
@ -221,7 +227,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
|
||||
el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
|
||||
(map == el->el_map.alt &&
|
||||
el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
|
||||
(void) key_delete(el, in);
|
||||
(void) el_key_delete(el, in);
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
|
||||
* they exists.
|
||||
*/
|
||||
protected int
|
||||
key_delete(EditLine *el, const char *key)
|
||||
el_key_delete(EditLine *el, const char *key)
|
||||
{
|
||||
|
||||
if (key[0] == '\0') {
|
||||
@ -251,7 +257,7 @@ key_delete(EditLine *el, const char *key)
|
||||
* Print entire el->el_key.map if null
|
||||
*/
|
||||
protected void
|
||||
key_print(EditLine *el, const char *key)
|
||||
el_key_print(EditLine *el, const char *key)
|
||||
{
|
||||
|
||||
/* do nothing if el->el_key.map is empty and null key specified */
|
||||
@ -498,7 +504,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
|
||||
if (str[1] == 0) {
|
||||
el->el_key.buf[ncnt + 1] = '"';
|
||||
el->el_key.buf[ncnt + 2] = '\0';
|
||||
key_kprint(el, el->el_key.buf,
|
||||
el_key_kprint(el, el->el_key.buf,
|
||||
&ptr->val, ptr->type);
|
||||
return (0);
|
||||
} else
|
||||
@ -546,7 +552,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
|
||||
/* print this key and function */
|
||||
el->el_key.buf[ncnt + 1] = '"';
|
||||
el->el_key.buf[ncnt + 2] = '\0';
|
||||
key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
|
||||
el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
|
||||
} else
|
||||
(void) node_enum(el, ptr->next, ncnt + 1);
|
||||
|
||||
@ -562,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
|
||||
* function specified by val
|
||||
*/
|
||||
protected void
|
||||
key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
el_key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
{
|
||||
el_bindings_t *fp;
|
||||
char unparsbuf[EL_BUFSIZ];
|
||||
@ -573,7 +579,7 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
case XK_STR:
|
||||
case XK_EXE:
|
||||
(void) fprintf(el->el_outfile, fmt, key,
|
||||
key__decode_str(val->str, unparsbuf,
|
||||
el_key__decode_str(val->str, unparsbuf,
|
||||
ntype == XK_STR ? "\"\"" : "[]"));
|
||||
break;
|
||||
case XK_CMD:
|
||||
@ -638,9 +644,9 @@ key__decode_char(char *buf, int cnt, int ch)
|
||||
* Make a printable version of the ey
|
||||
*/
|
||||
protected char *
|
||||
key__decode_str(const char *str, char *buf, const char *sep)
|
||||
el_key__decode_str(const char *str, char *buf, const char *sep)
|
||||
{
|
||||
char *b;
|
||||
char *b;
|
||||
const char *p;
|
||||
|
||||
b = buf;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: key.h,v 1.5 2001/01/23 15:55:30 jdolecek Exp $ */
|
||||
/* $NetBSD: key.h,v 1.6 2002/03/18 16:00:55 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -62,22 +62,19 @@ typedef struct el_key_t {
|
||||
#define XK_NOD 2
|
||||
#define XK_EXE 3
|
||||
|
||||
#undef key_end
|
||||
#undef key_clear
|
||||
#undef key_print
|
||||
|
||||
protected int key_init(EditLine *);
|
||||
protected void key_end(EditLine *);
|
||||
protected key_value_t *key_map_cmd(EditLine *, int);
|
||||
protected key_value_t *key_map_str(EditLine *, char *);
|
||||
protected void key_reset(EditLine *);
|
||||
protected int key_get(EditLine *, char *, key_value_t *);
|
||||
protected void key_add(EditLine *, const char *, key_value_t *, int);
|
||||
protected void key_clear(EditLine *, el_action_t *, const char *);
|
||||
protected int key_delete(EditLine *, const char *);
|
||||
protected void key_print(EditLine *, const char *);
|
||||
protected void key_kprint(EditLine *, const char *,
|
||||
key_value_t *, int);
|
||||
protected char *key__decode_str(const char *, char *, const char *);
|
||||
protected int el_key_init(EditLine *);
|
||||
protected void el_key_end(EditLine *);
|
||||
protected key_value_t *el_key_map_cmd(EditLine *, int);
|
||||
protected key_value_t *el_key_map_str(EditLine *, char *);
|
||||
protected void el_key_reset(EditLine *);
|
||||
protected int el_key_get(EditLine *, char *, key_value_t *);
|
||||
protected void el_key_add(EditLine *,
|
||||
const char *, key_value_t *, int);
|
||||
protected void el_key_clear(EditLine *, el_action_t *, const char *);
|
||||
protected int el_key_delete(EditLine *, const char *);
|
||||
protected void el_key_print(EditLine *, const char *);
|
||||
protected void el_key_kprint(EditLine *, const char *, key_value_t *,
|
||||
int);
|
||||
protected char *el_key__decode_str(const char *, char *, const char *);
|
||||
|
||||
#endif /* _h_el_key */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh -
|
||||
# $NetBSD: makelist,v 1.7 2001/01/09 19:22:31 jdolecek Exp $
|
||||
# $NetBSD: makelist,v 1.8 2003/03/10 21:21:10 christos Exp $
|
||||
#
|
||||
# Copyright (c) 1992, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
@ -87,7 +87,6 @@ case $FLAG in
|
||||
cat $FILES | $AWK '
|
||||
BEGIN {
|
||||
printf("/* Automatically generated file, do not edit */\n");
|
||||
printf("#include \"compat.h\"\n");
|
||||
printf("#include \"sys.h\"\n#include \"el.h\"\n");
|
||||
printf("private const struct el_bindings_t el_func_help[] = {\n");
|
||||
low = "abcdefghijklmnopqrstuvwxyz_";
|
||||
@ -170,7 +169,6 @@ case $FLAG in
|
||||
cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
|
||||
BEGIN {
|
||||
printf("/* Automatically generated file, do not edit */\n");
|
||||
printf("#include \"compat.h\"\n");
|
||||
printf("#include \"sys.h\"\n#include \"el.h\"\n");
|
||||
printf("private const el_func_t el_func[] = {");
|
||||
maxlen = 80;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: map.c,v 1.14 2001/01/09 17:22:09 jdolecek Exp $ */
|
||||
/* $NetBSD: map.c,v 1.18 2002/11/15 14:32:33 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: map.c,v 1.18 2002/11/15 14:32:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* map.c: Editor function definitions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <stdlib.h>
|
||||
#include "el.h"
|
||||
|
||||
@ -373,7 +379,7 @@ private const el_action_t el_map_vi_insert[] = {
|
||||
/* 5 */ ED_MOVE_TO_END, /* ^E */
|
||||
/* 6 */ ED_NEXT_CHAR, /* ^F */
|
||||
/* 7 */ ED_UNASSIGNED, /* ^G */
|
||||
/* 8 */ ED_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */
|
||||
/* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */
|
||||
/* 9 */ ED_UNASSIGNED, /* ^I */ /* Tab Key */
|
||||
/* 10 */ ED_NEWLINE, /* ^J */
|
||||
/* 11 */ ED_KILL_LINE, /* ^K */
|
||||
@ -493,135 +499,135 @@ private const el_action_t el_map_vi_insert[] = {
|
||||
/* 124 */ ED_INSERT, /* | */
|
||||
/* 125 */ ED_INSERT, /* } */
|
||||
/* 126 */ ED_INSERT, /* ~ */
|
||||
/* 127 */ ED_DELETE_PREV_CHAR, /* ^? */
|
||||
/* 128 */ ED_UNASSIGNED, /* M-^@ */
|
||||
/* 129 */ ED_UNASSIGNED, /* M-^A */
|
||||
/* 130 */ ED_UNASSIGNED, /* M-^B */
|
||||
/* 131 */ ED_UNASSIGNED, /* M-^C */
|
||||
/* 132 */ ED_UNASSIGNED, /* M-^D */
|
||||
/* 133 */ ED_UNASSIGNED, /* M-^E */
|
||||
/* 134 */ ED_UNASSIGNED, /* M-^F */
|
||||
/* 135 */ ED_UNASSIGNED, /* M-^G */
|
||||
/* 136 */ ED_UNASSIGNED, /* M-^H */
|
||||
/* 137 */ ED_UNASSIGNED, /* M-^I */
|
||||
/* 138 */ ED_UNASSIGNED, /* M-^J */
|
||||
/* 139 */ ED_UNASSIGNED, /* M-^K */
|
||||
/* 140 */ ED_UNASSIGNED, /* M-^L */
|
||||
/* 141 */ ED_UNASSIGNED, /* M-^M */
|
||||
/* 142 */ ED_UNASSIGNED, /* M-^N */
|
||||
/* 143 */ ED_UNASSIGNED, /* M-^O */
|
||||
/* 144 */ ED_UNASSIGNED, /* M-^P */
|
||||
/* 145 */ ED_UNASSIGNED, /* M-^Q */
|
||||
/* 146 */ ED_UNASSIGNED, /* M-^R */
|
||||
/* 147 */ ED_UNASSIGNED, /* M-^S */
|
||||
/* 148 */ ED_UNASSIGNED, /* M-^T */
|
||||
/* 149 */ ED_UNASSIGNED, /* M-^U */
|
||||
/* 150 */ ED_UNASSIGNED, /* M-^V */
|
||||
/* 151 */ ED_UNASSIGNED, /* M-^W */
|
||||
/* 152 */ ED_UNASSIGNED, /* M-^X */
|
||||
/* 153 */ ED_UNASSIGNED, /* M-^Y */
|
||||
/* 154 */ ED_UNASSIGNED, /* M-^Z */
|
||||
/* 155 */ ED_UNASSIGNED, /* M-^[ */
|
||||
/* 156 */ ED_UNASSIGNED, /* M-^\ */
|
||||
/* 157 */ ED_UNASSIGNED, /* M-^] */
|
||||
/* 158 */ ED_UNASSIGNED, /* M-^^ */
|
||||
/* 159 */ ED_UNASSIGNED, /* M-^_ */
|
||||
/* 160 */ ED_UNASSIGNED, /* M-SPACE */
|
||||
/* 161 */ ED_UNASSIGNED, /* M-! */
|
||||
/* 162 */ ED_UNASSIGNED, /* M-" */
|
||||
/* 163 */ ED_UNASSIGNED, /* M-# */
|
||||
/* 164 */ ED_UNASSIGNED, /* M-$ */
|
||||
/* 165 */ ED_UNASSIGNED, /* M-% */
|
||||
/* 166 */ ED_UNASSIGNED, /* M-& */
|
||||
/* 167 */ ED_UNASSIGNED, /* M-' */
|
||||
/* 168 */ ED_UNASSIGNED, /* M-( */
|
||||
/* 169 */ ED_UNASSIGNED, /* M-) */
|
||||
/* 170 */ ED_UNASSIGNED, /* M-* */
|
||||
/* 171 */ ED_UNASSIGNED, /* M-+ */
|
||||
/* 172 */ ED_UNASSIGNED, /* M-, */
|
||||
/* 173 */ ED_UNASSIGNED, /* M-- */
|
||||
/* 174 */ ED_UNASSIGNED, /* M-. */
|
||||
/* 175 */ ED_UNASSIGNED, /* M-/ */
|
||||
/* 176 */ ED_UNASSIGNED, /* M-0 */
|
||||
/* 177 */ ED_UNASSIGNED, /* M-1 */
|
||||
/* 178 */ ED_UNASSIGNED, /* M-2 */
|
||||
/* 179 */ ED_UNASSIGNED, /* M-3 */
|
||||
/* 180 */ ED_UNASSIGNED, /* M-4 */
|
||||
/* 181 */ ED_UNASSIGNED, /* M-5 */
|
||||
/* 182 */ ED_UNASSIGNED, /* M-6 */
|
||||
/* 183 */ ED_UNASSIGNED, /* M-7 */
|
||||
/* 184 */ ED_UNASSIGNED, /* M-8 */
|
||||
/* 185 */ ED_UNASSIGNED, /* M-9 */
|
||||
/* 186 */ ED_UNASSIGNED, /* M-: */
|
||||
/* 187 */ ED_UNASSIGNED, /* M-; */
|
||||
/* 188 */ ED_UNASSIGNED, /* M-< */
|
||||
/* 189 */ ED_UNASSIGNED, /* M-= */
|
||||
/* 190 */ ED_UNASSIGNED, /* M-> */
|
||||
/* 191 */ ED_UNASSIGNED, /* M-? */
|
||||
/* 192 */ ED_UNASSIGNED, /* M-@ */
|
||||
/* 193 */ ED_UNASSIGNED, /* M-A */
|
||||
/* 194 */ ED_UNASSIGNED, /* M-B */
|
||||
/* 195 */ ED_UNASSIGNED, /* M-C */
|
||||
/* 196 */ ED_UNASSIGNED, /* M-D */
|
||||
/* 197 */ ED_UNASSIGNED, /* M-E */
|
||||
/* 198 */ ED_UNASSIGNED, /* M-F */
|
||||
/* 199 */ ED_UNASSIGNED, /* M-G */
|
||||
/* 200 */ ED_UNASSIGNED, /* M-H */
|
||||
/* 201 */ ED_UNASSIGNED, /* M-I */
|
||||
/* 202 */ ED_UNASSIGNED, /* M-J */
|
||||
/* 203 */ ED_UNASSIGNED, /* M-K */
|
||||
/* 204 */ ED_UNASSIGNED, /* M-L */
|
||||
/* 205 */ ED_UNASSIGNED, /* M-M */
|
||||
/* 206 */ ED_UNASSIGNED, /* M-N */
|
||||
/* 207 */ ED_UNASSIGNED, /* M-O */
|
||||
/* 208 */ ED_UNASSIGNED, /* M-P */
|
||||
/* 209 */ ED_UNASSIGNED, /* M-Q */
|
||||
/* 210 */ ED_UNASSIGNED, /* M-R */
|
||||
/* 211 */ ED_UNASSIGNED, /* M-S */
|
||||
/* 212 */ ED_UNASSIGNED, /* M-T */
|
||||
/* 213 */ ED_UNASSIGNED, /* M-U */
|
||||
/* 214 */ ED_UNASSIGNED, /* M-V */
|
||||
/* 215 */ ED_UNASSIGNED, /* M-W */
|
||||
/* 216 */ ED_UNASSIGNED, /* M-X */
|
||||
/* 217 */ ED_UNASSIGNED, /* M-Y */
|
||||
/* 218 */ ED_UNASSIGNED, /* M-Z */
|
||||
/* 219 */ ED_UNASSIGNED, /* M-[ */
|
||||
/* 220 */ ED_UNASSIGNED, /* M-\ */
|
||||
/* 221 */ ED_UNASSIGNED, /* M-] */
|
||||
/* 222 */ ED_UNASSIGNED, /* M-^ */
|
||||
/* 223 */ ED_UNASSIGNED, /* M-_ */
|
||||
/* 224 */ ED_UNASSIGNED, /* M-` */
|
||||
/* 225 */ ED_UNASSIGNED, /* M-a */
|
||||
/* 226 */ ED_UNASSIGNED, /* M-b */
|
||||
/* 227 */ ED_UNASSIGNED, /* M-c */
|
||||
/* 228 */ ED_UNASSIGNED, /* M-d */
|
||||
/* 229 */ ED_UNASSIGNED, /* M-e */
|
||||
/* 230 */ ED_UNASSIGNED, /* M-f */
|
||||
/* 231 */ ED_UNASSIGNED, /* M-g */
|
||||
/* 232 */ ED_UNASSIGNED, /* M-h */
|
||||
/* 233 */ ED_UNASSIGNED, /* M-i */
|
||||
/* 234 */ ED_UNASSIGNED, /* M-j */
|
||||
/* 235 */ ED_UNASSIGNED, /* M-k */
|
||||
/* 236 */ ED_UNASSIGNED, /* M-l */
|
||||
/* 237 */ ED_UNASSIGNED, /* M-m */
|
||||
/* 238 */ ED_UNASSIGNED, /* M-n */
|
||||
/* 239 */ ED_UNASSIGNED, /* M-o */
|
||||
/* 240 */ ED_UNASSIGNED, /* M-p */
|
||||
/* 241 */ ED_UNASSIGNED, /* M-q */
|
||||
/* 242 */ ED_UNASSIGNED, /* M-r */
|
||||
/* 243 */ ED_UNASSIGNED, /* M-s */
|
||||
/* 244 */ ED_UNASSIGNED, /* M-t */
|
||||
/* 245 */ ED_UNASSIGNED, /* M-u */
|
||||
/* 246 */ ED_UNASSIGNED, /* M-v */
|
||||
/* 247 */ ED_UNASSIGNED, /* M-w */
|
||||
/* 248 */ ED_UNASSIGNED, /* M-x */
|
||||
/* 249 */ ED_UNASSIGNED, /* M-y */
|
||||
/* 250 */ ED_UNASSIGNED, /* M-z */
|
||||
/* 251 */ ED_UNASSIGNED, /* M-{ */
|
||||
/* 252 */ ED_UNASSIGNED, /* M-| */
|
||||
/* 253 */ ED_UNASSIGNED, /* M-} */
|
||||
/* 254 */ ED_UNASSIGNED, /* M-~ */
|
||||
/* 255 */ ED_UNASSIGNED /* M-^? */
|
||||
/* 127 */ VI_DELETE_PREV_CHAR, /* ^? */
|
||||
/* 128 */ ED_INSERT, /* M-^@ */
|
||||
/* 129 */ ED_INSERT, /* M-^A */
|
||||
/* 130 */ ED_INSERT, /* M-^B */
|
||||
/* 131 */ ED_INSERT, /* M-^C */
|
||||
/* 132 */ ED_INSERT, /* M-^D */
|
||||
/* 133 */ ED_INSERT, /* M-^E */
|
||||
/* 134 */ ED_INSERT, /* M-^F */
|
||||
/* 135 */ ED_INSERT, /* M-^G */
|
||||
/* 136 */ ED_INSERT, /* M-^H */
|
||||
/* 137 */ ED_INSERT, /* M-^I */
|
||||
/* 138 */ ED_INSERT, /* M-^J */
|
||||
/* 139 */ ED_INSERT, /* M-^K */
|
||||
/* 140 */ ED_INSERT, /* M-^L */
|
||||
/* 141 */ ED_INSERT, /* M-^M */
|
||||
/* 142 */ ED_INSERT, /* M-^N */
|
||||
/* 143 */ ED_INSERT, /* M-^O */
|
||||
/* 144 */ ED_INSERT, /* M-^P */
|
||||
/* 145 */ ED_INSERT, /* M-^Q */
|
||||
/* 146 */ ED_INSERT, /* M-^R */
|
||||
/* 147 */ ED_INSERT, /* M-^S */
|
||||
/* 148 */ ED_INSERT, /* M-^T */
|
||||
/* 149 */ ED_INSERT, /* M-^U */
|
||||
/* 150 */ ED_INSERT, /* M-^V */
|
||||
/* 151 */ ED_INSERT, /* M-^W */
|
||||
/* 152 */ ED_INSERT, /* M-^X */
|
||||
/* 153 */ ED_INSERT, /* M-^Y */
|
||||
/* 154 */ ED_INSERT, /* M-^Z */
|
||||
/* 155 */ ED_INSERT, /* M-^[ */
|
||||
/* 156 */ ED_INSERT, /* M-^\ */
|
||||
/* 157 */ ED_INSERT, /* M-^] */
|
||||
/* 158 */ ED_INSERT, /* M-^^ */
|
||||
/* 159 */ ED_INSERT, /* M-^_ */
|
||||
/* 160 */ ED_INSERT, /* M-SPACE */
|
||||
/* 161 */ ED_INSERT, /* M-! */
|
||||
/* 162 */ ED_INSERT, /* M-" */
|
||||
/* 163 */ ED_INSERT, /* M-# */
|
||||
/* 164 */ ED_INSERT, /* M-$ */
|
||||
/* 165 */ ED_INSERT, /* M-% */
|
||||
/* 166 */ ED_INSERT, /* M-& */
|
||||
/* 167 */ ED_INSERT, /* M-' */
|
||||
/* 168 */ ED_INSERT, /* M-( */
|
||||
/* 169 */ ED_INSERT, /* M-) */
|
||||
/* 170 */ ED_INSERT, /* M-* */
|
||||
/* 171 */ ED_INSERT, /* M-+ */
|
||||
/* 172 */ ED_INSERT, /* M-, */
|
||||
/* 173 */ ED_INSERT, /* M-- */
|
||||
/* 174 */ ED_INSERT, /* M-. */
|
||||
/* 175 */ ED_INSERT, /* M-/ */
|
||||
/* 176 */ ED_INSERT, /* M-0 */
|
||||
/* 177 */ ED_INSERT, /* M-1 */
|
||||
/* 178 */ ED_INSERT, /* M-2 */
|
||||
/* 179 */ ED_INSERT, /* M-3 */
|
||||
/* 180 */ ED_INSERT, /* M-4 */
|
||||
/* 181 */ ED_INSERT, /* M-5 */
|
||||
/* 182 */ ED_INSERT, /* M-6 */
|
||||
/* 183 */ ED_INSERT, /* M-7 */
|
||||
/* 184 */ ED_INSERT, /* M-8 */
|
||||
/* 185 */ ED_INSERT, /* M-9 */
|
||||
/* 186 */ ED_INSERT, /* M-: */
|
||||
/* 187 */ ED_INSERT, /* M-; */
|
||||
/* 188 */ ED_INSERT, /* M-< */
|
||||
/* 189 */ ED_INSERT, /* M-= */
|
||||
/* 190 */ ED_INSERT, /* M-> */
|
||||
/* 191 */ ED_INSERT, /* M-? */
|
||||
/* 192 */ ED_INSERT, /* M-@ */
|
||||
/* 193 */ ED_INSERT, /* M-A */
|
||||
/* 194 */ ED_INSERT, /* M-B */
|
||||
/* 195 */ ED_INSERT, /* M-C */
|
||||
/* 196 */ ED_INSERT, /* M-D */
|
||||
/* 197 */ ED_INSERT, /* M-E */
|
||||
/* 198 */ ED_INSERT, /* M-F */
|
||||
/* 199 */ ED_INSERT, /* M-G */
|
||||
/* 200 */ ED_INSERT, /* M-H */
|
||||
/* 201 */ ED_INSERT, /* M-I */
|
||||
/* 202 */ ED_INSERT, /* M-J */
|
||||
/* 203 */ ED_INSERT, /* M-K */
|
||||
/* 204 */ ED_INSERT, /* M-L */
|
||||
/* 205 */ ED_INSERT, /* M-M */
|
||||
/* 206 */ ED_INSERT, /* M-N */
|
||||
/* 207 */ ED_INSERT, /* M-O */
|
||||
/* 208 */ ED_INSERT, /* M-P */
|
||||
/* 209 */ ED_INSERT, /* M-Q */
|
||||
/* 210 */ ED_INSERT, /* M-R */
|
||||
/* 211 */ ED_INSERT, /* M-S */
|
||||
/* 212 */ ED_INSERT, /* M-T */
|
||||
/* 213 */ ED_INSERT, /* M-U */
|
||||
/* 214 */ ED_INSERT, /* M-V */
|
||||
/* 215 */ ED_INSERT, /* M-W */
|
||||
/* 216 */ ED_INSERT, /* M-X */
|
||||
/* 217 */ ED_INSERT, /* M-Y */
|
||||
/* 218 */ ED_INSERT, /* M-Z */
|
||||
/* 219 */ ED_INSERT, /* M-[ */
|
||||
/* 220 */ ED_INSERT, /* M-\ */
|
||||
/* 221 */ ED_INSERT, /* M-] */
|
||||
/* 222 */ ED_INSERT, /* M-^ */
|
||||
/* 223 */ ED_INSERT, /* M-_ */
|
||||
/* 224 */ ED_INSERT, /* M-` */
|
||||
/* 225 */ ED_INSERT, /* M-a */
|
||||
/* 226 */ ED_INSERT, /* M-b */
|
||||
/* 227 */ ED_INSERT, /* M-c */
|
||||
/* 228 */ ED_INSERT, /* M-d */
|
||||
/* 229 */ ED_INSERT, /* M-e */
|
||||
/* 230 */ ED_INSERT, /* M-f */
|
||||
/* 231 */ ED_INSERT, /* M-g */
|
||||
/* 232 */ ED_INSERT, /* M-h */
|
||||
/* 233 */ ED_INSERT, /* M-i */
|
||||
/* 234 */ ED_INSERT, /* M-j */
|
||||
/* 235 */ ED_INSERT, /* M-k */
|
||||
/* 236 */ ED_INSERT, /* M-l */
|
||||
/* 237 */ ED_INSERT, /* M-m */
|
||||
/* 238 */ ED_INSERT, /* M-n */
|
||||
/* 239 */ ED_INSERT, /* M-o */
|
||||
/* 240 */ ED_INSERT, /* M-p */
|
||||
/* 241 */ ED_INSERT, /* M-q */
|
||||
/* 242 */ ED_INSERT, /* M-r */
|
||||
/* 243 */ ED_INSERT, /* M-s */
|
||||
/* 244 */ ED_INSERT, /* M-t */
|
||||
/* 245 */ ED_INSERT, /* M-u */
|
||||
/* 246 */ ED_INSERT, /* M-v */
|
||||
/* 247 */ ED_INSERT, /* M-w */
|
||||
/* 248 */ ED_INSERT, /* M-x */
|
||||
/* 249 */ ED_INSERT, /* M-y */
|
||||
/* 250 */ ED_INSERT, /* M-z */
|
||||
/* 251 */ ED_INSERT, /* M-{ */
|
||||
/* 252 */ ED_INSERT, /* M-| */
|
||||
/* 253 */ ED_INSERT, /* M-} */
|
||||
/* 254 */ ED_INSERT, /* M-~ */
|
||||
/* 255 */ ED_INSERT /* M-^? */
|
||||
};
|
||||
|
||||
private const el_action_t el_map_vi_command[] = {
|
||||
@ -633,7 +639,7 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 5 */ ED_MOVE_TO_END, /* ^E */
|
||||
/* 6 */ ED_UNASSIGNED, /* ^F */
|
||||
/* 7 */ ED_UNASSIGNED, /* ^G */
|
||||
/* 8 */ ED_PREV_CHAR, /* ^H */
|
||||
/* 8 */ ED_DELETE_PREV_CHAR, /* ^H */
|
||||
/* 9 */ ED_UNASSIGNED, /* ^I */
|
||||
/* 10 */ ED_NEWLINE, /* ^J */
|
||||
/* 11 */ ED_KILL_LINE, /* ^K */
|
||||
@ -660,9 +666,9 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 32 */ ED_NEXT_CHAR, /* SPACE */
|
||||
/* 33 */ ED_UNASSIGNED, /* ! */
|
||||
/* 34 */ ED_UNASSIGNED, /* " */
|
||||
/* 35 */ ED_UNASSIGNED, /* # */
|
||||
/* 35 */ VI_COMMENT_OUT, /* # */
|
||||
/* 36 */ ED_MOVE_TO_END, /* $ */
|
||||
/* 37 */ ED_UNASSIGNED, /* % */
|
||||
/* 37 */ VI_MATCH, /* % */
|
||||
/* 38 */ ED_UNASSIGNED, /* & */
|
||||
/* 39 */ ED_UNASSIGNED, /* ' */
|
||||
/* 40 */ ED_UNASSIGNED, /* ( */
|
||||
@ -671,7 +677,7 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 43 */ ED_NEXT_HISTORY, /* + */
|
||||
/* 44 */ VI_REPEAT_PREV_CHAR, /* , */
|
||||
/* 45 */ ED_PREV_HISTORY, /* - */
|
||||
/* 46 */ ED_UNASSIGNED, /* . */
|
||||
/* 46 */ VI_REDO, /* . */
|
||||
/* 47 */ VI_SEARCH_PREV, /* / */
|
||||
/* 48 */ VI_ZERO, /* 0 */
|
||||
/* 49 */ ED_ARGUMENT_DIGIT, /* 1 */
|
||||
@ -689,14 +695,14 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 61 */ ED_UNASSIGNED, /* = */
|
||||
/* 62 */ ED_UNASSIGNED, /* > */
|
||||
/* 63 */ VI_SEARCH_NEXT, /* ? */
|
||||
/* 64 */ ED_UNASSIGNED, /* @ */
|
||||
/* 64 */ VI_ALIAS, /* @ */
|
||||
/* 65 */ VI_ADD_AT_EOL, /* A */
|
||||
/* 66 */ VI_PREV_SPACE_WORD, /* B */
|
||||
/* 66 */ VI_PREV_BIG_WORD, /* B */
|
||||
/* 67 */ VI_CHANGE_TO_EOL, /* C */
|
||||
/* 68 */ ED_KILL_LINE, /* D */
|
||||
/* 69 */ VI_TO_END_WORD, /* E */
|
||||
/* 69 */ VI_END_BIG_WORD, /* E */
|
||||
/* 70 */ VI_PREV_CHAR, /* F */
|
||||
/* 71 */ ED_UNASSIGNED, /* G */
|
||||
/* 71 */ VI_TO_HISTORY_LINE, /* G */
|
||||
/* 72 */ ED_UNASSIGNED, /* H */
|
||||
/* 73 */ VI_INSERT_AT_BOL, /* I */
|
||||
/* 74 */ ED_SEARCH_NEXT_HISTORY, /* J */
|
||||
@ -710,17 +716,17 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 82 */ VI_REPLACE_MODE, /* R */
|
||||
/* 83 */ VI_SUBSTITUTE_LINE, /* S */
|
||||
/* 84 */ VI_TO_PREV_CHAR, /* T */
|
||||
/* 85 */ ED_UNASSIGNED, /* U */
|
||||
/* 85 */ VI_UNDO_LINE, /* U */
|
||||
/* 86 */ ED_UNASSIGNED, /* V */
|
||||
/* 87 */ VI_NEXT_SPACE_WORD, /* W */
|
||||
/* 87 */ VI_NEXT_BIG_WORD, /* W */
|
||||
/* 88 */ ED_DELETE_PREV_CHAR, /* X */
|
||||
/* 89 */ ED_UNASSIGNED, /* Y */
|
||||
/* 89 */ VI_YANK_END, /* Y */
|
||||
/* 90 */ ED_UNASSIGNED, /* Z */
|
||||
/* 91 */ ED_SEQUENCE_LEAD_IN, /* [ */
|
||||
/* 92 */ ED_UNASSIGNED, /* \ */
|
||||
/* 93 */ ED_UNASSIGNED, /* ] */
|
||||
/* 94 */ ED_MOVE_TO_BEG, /* ^ */
|
||||
/* 95 */ ED_UNASSIGNED, /* _ */
|
||||
/* 95 */ VI_HISTORY_WORD, /* _ */
|
||||
/* 96 */ ED_UNASSIGNED, /* ` */
|
||||
/* 97 */ VI_ADD, /* a */
|
||||
/* 98 */ VI_PREV_WORD, /* b */
|
||||
@ -743,13 +749,13 @@ private const el_action_t el_map_vi_command[] = {
|
||||
/* 115 */ VI_SUBSTITUTE_CHAR, /* s */
|
||||
/* 116 */ VI_TO_NEXT_CHAR, /* t */
|
||||
/* 117 */ VI_UNDO, /* u */
|
||||
/* 118 */ ED_UNASSIGNED, /* v */
|
||||
/* 118 */ VI_HISTEDIT, /* v */
|
||||
/* 119 */ VI_NEXT_WORD, /* w */
|
||||
/* 120 */ ED_DELETE_NEXT_CHAR, /* x */
|
||||
/* 121 */ ED_UNASSIGNED, /* y */
|
||||
/* 121 */ VI_YANK, /* y */
|
||||
/* 122 */ ED_UNASSIGNED, /* z */
|
||||
/* 123 */ ED_UNASSIGNED, /* { */
|
||||
/* 124 */ ED_UNASSIGNED, /* | */
|
||||
/* 124 */ VI_TO_COLUMN, /* | */
|
||||
/* 125 */ ED_UNASSIGNED, /* } */
|
||||
/* 126 */ VI_CHANGE_CASE, /* ~ */
|
||||
/* 127 */ ED_DELETE_PREV_CHAR, /* ^? */
|
||||
@ -1005,7 +1011,8 @@ map_init_meta(EditLine *el)
|
||||
break;
|
||||
default:
|
||||
buf[1] = i & 0177;
|
||||
key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD);
|
||||
el_key_add(el, buf,
|
||||
el_key_map_cmd(el, (int) map[i]), XK_CMD);
|
||||
break;
|
||||
}
|
||||
map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN;
|
||||
@ -1027,7 +1034,7 @@ map_init_vi(EditLine *el)
|
||||
el->el_map.type = MAP_VI;
|
||||
el->el_map.current = el->el_map.key;
|
||||
|
||||
key_reset(el);
|
||||
el_key_reset(el);
|
||||
|
||||
for (i = 0; i < N_KEYS; i++) {
|
||||
key[i] = vii[i];
|
||||
@ -1056,7 +1063,7 @@ map_init_emacs(EditLine *el)
|
||||
|
||||
el->el_map.type = MAP_EMACS;
|
||||
el->el_map.current = el->el_map.key;
|
||||
key_reset(el);
|
||||
el_key_reset(el);
|
||||
|
||||
for (i = 0; i < N_KEYS; i++) {
|
||||
key[i] = emacs[i];
|
||||
@ -1069,7 +1076,7 @@ map_init_emacs(EditLine *el)
|
||||
buf[0] = CONTROL('X');
|
||||
buf[1] = CONTROL('X');
|
||||
buf[2] = 0;
|
||||
key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
|
||||
el_key_add(el, buf, el_key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
|
||||
|
||||
tty_bind_char(el, 1);
|
||||
term_bind_arrow(el);
|
||||
@ -1126,7 +1133,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
|
||||
el_bindings_t *bp;
|
||||
|
||||
if (in[0] == '\0' || in[1] == '\0') {
|
||||
(void) key__decode_str(in, outbuf, "");
|
||||
(void) el_key__decode_str(in, outbuf, "");
|
||||
for (bp = el->el_map.help; bp->name != NULL; bp++)
|
||||
if (bp->func == map[(unsigned char) *in]) {
|
||||
(void) fprintf(el->el_outfile,
|
||||
@ -1134,7 +1141,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
|
||||
return;
|
||||
}
|
||||
} else
|
||||
key_print(el, in);
|
||||
el_key_print(el, in);
|
||||
}
|
||||
|
||||
|
||||
@ -1156,20 +1163,20 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
|
||||
if (first == last)
|
||||
(void) fprintf(el->el_outfile,
|
||||
"%-15s-> is undefined\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ));
|
||||
el_key__decode_str(firstbuf, unparsbuf, STRQQ));
|
||||
return;
|
||||
}
|
||||
for (bp = el->el_map.help; bp->name != NULL; bp++) {
|
||||
if (bp->func == map[first]) {
|
||||
if (first == last) {
|
||||
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
bp->name);
|
||||
} else {
|
||||
(void) fprintf(el->el_outfile,
|
||||
"%-4s to %-7s-> %s\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
key__decode_str(lastbuf, extrabuf, STRQQ),
|
||||
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
el_key__decode_str(lastbuf, extrabuf, STRQQ),
|
||||
bp->name);
|
||||
}
|
||||
return;
|
||||
@ -1223,7 +1230,7 @@ map_print_all_keys(EditLine *el)
|
||||
map_print_some_keys(el, el->el_map.alt, prev, i - 1);
|
||||
|
||||
(void) fprintf(el->el_outfile, "Multi-character bindings\n");
|
||||
key_print(el, "");
|
||||
el_key_print(el, "");
|
||||
(void) fprintf(el->el_outfile, "Arrow key bindings\n");
|
||||
term_print_arrow(el, "");
|
||||
}
|
||||
@ -1316,9 +1323,9 @@ map_bind(EditLine *el, int argc, const char **argv)
|
||||
return (-1);
|
||||
}
|
||||
if (in[1])
|
||||
(void) key_delete(el, in);
|
||||
(void) el_key_delete(el, in);
|
||||
else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN)
|
||||
(void) key_delete(el, in);
|
||||
(void) el_key_delete(el, in);
|
||||
else
|
||||
map[(unsigned char) *in] = ED_UNASSIGNED;
|
||||
return (0);
|
||||
@ -1346,9 +1353,9 @@ map_bind(EditLine *el, int argc, const char **argv)
|
||||
return (-1);
|
||||
}
|
||||
if (key)
|
||||
term_set_arrow(el, in, key_map_str(el, out), ntype);
|
||||
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
|
||||
else
|
||||
key_add(el, in, key_map_str(el, out), ntype);
|
||||
el_key_add(el, in, el_key_map_str(el, out), ntype);
|
||||
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
|
||||
break;
|
||||
|
||||
@ -1359,13 +1366,13 @@ map_bind(EditLine *el, int argc, const char **argv)
|
||||
return (-1);
|
||||
}
|
||||
if (key)
|
||||
term_set_arrow(el, in, key_map_str(el, out), ntype);
|
||||
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
|
||||
else {
|
||||
if (in[1]) {
|
||||
key_add(el, in, key_map_cmd(el, cmd), ntype);
|
||||
el_key_add(el, in, el_key_map_cmd(el, cmd), ntype);
|
||||
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
|
||||
} else {
|
||||
key_clear(el, map, in);
|
||||
el_key_clear(el, map, in);
|
||||
map[(unsigned char) *in] = cmd;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: map.h,v 1.6 2001/01/09 17:22:09 jdolecek Exp $ */
|
||||
/* $NetBSD: map.h,v 1.7 2002/03/18 16:00:56 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
88
cmd-line-utils/libedit/np/fgetln.c
Normal file
88
cmd-line-utils/libedit/np/fgetln.c
Normal file
@ -0,0 +1,88 @@
|
||||
/* $NetBSD: fgetln.c,v 1.1.1.1 1999/04/12 07:43:21 crooksa Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
fgetln(fp, len)
|
||||
FILE *fp;
|
||||
size_t *len;
|
||||
{
|
||||
static char *buf = NULL;
|
||||
static size_t bufsiz = 0;
|
||||
char *ptr;
|
||||
|
||||
|
||||
if (buf == NULL) {
|
||||
bufsiz = BUFSIZ;
|
||||
if ((buf = malloc(bufsiz)) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fgets(buf, bufsiz, fp) == NULL)
|
||||
return NULL;
|
||||
*len = 0;
|
||||
|
||||
while ((ptr = strchr(&buf[*len], '\n')) == NULL) {
|
||||
size_t nbufsiz = bufsiz + BUFSIZ;
|
||||
char *nbuf = realloc(buf, nbufsiz);
|
||||
|
||||
if (nbuf == NULL) {
|
||||
int oerrno = errno;
|
||||
free(buf);
|
||||
errno = oerrno;
|
||||
buf = NULL;
|
||||
return NULL;
|
||||
} else
|
||||
buf = nbuf;
|
||||
|
||||
*len = bufsiz;
|
||||
if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL)
|
||||
return buf;
|
||||
|
||||
bufsiz = nbufsiz;
|
||||
}
|
||||
|
||||
*len = (ptr - buf) + 1;
|
||||
return buf;
|
||||
}
|
75
cmd-line-utils/libedit/np/strlcat.c
Normal file
75
cmd-line-utils/libedit/np/strlcat.c
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``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 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(LIBC_SCCS) && !defined(lint)
|
||||
static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD: src/lib/libc/string/strlcat.c,v 1.2.4.2 2001/07/09 23:30:06 obrien Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(initial dst) + strlen(src); if retval >= siz,
|
||||
* truncation occurred.
|
||||
*/
|
||||
size_t strlcat(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
75
cmd-line-utils/libedit/np/strlcpy.c
Normal file
75
cmd-line-utils/libedit/np/strlcpy.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``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 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(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.2.4.1 2001/07/09 23:30:06 obrien Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t strlcpy(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
322
cmd-line-utils/libedit/np/unvis.c
Normal file
322
cmd-line-utils/libedit/np/unvis.c
Normal file
@ -0,0 +1,322 @@
|
||||
/* $NetBSD: unvis.c,v 1.22 2002/03/23 17:38:27 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: unvis.c,v 1.22 2002/03/23 17:38:27 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include "np/vis.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(strunvis,_strunvis)
|
||||
__weak_alias(unvis,_unvis)
|
||||
#endif
|
||||
|
||||
#ifdef __warn_references
|
||||
__warn_references(unvis,
|
||||
"warning: reference to compatibility unvis(); include <vis.h> for correct reference")
|
||||
#endif
|
||||
|
||||
#if !HAVE_VIS_H
|
||||
/*
|
||||
* decode driven by state machine
|
||||
*/
|
||||
#define S_GROUND 0 /* haven't seen escape char */
|
||||
#define S_START 1 /* start decoding special sequence */
|
||||
#define S_META 2 /* metachar started (M) */
|
||||
#define S_META1 3 /* metachar more, regular char (-) */
|
||||
#define S_CTRL 4 /* control char started (^) */
|
||||
#define S_OCTAL2 5 /* octal digit 2 */
|
||||
#define S_OCTAL3 6 /* octal digit 3 */
|
||||
#define S_HEX1 7 /* hex digit */
|
||||
#define S_HEX2 8 /* hex digit 2 */
|
||||
|
||||
#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
|
||||
#define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
|
||||
|
||||
int
|
||||
unvis(cp, c, astate, flag)
|
||||
char *cp;
|
||||
int c;
|
||||
int *astate, flag;
|
||||
{
|
||||
return __unvis13(cp, (int)c, astate, flag);
|
||||
}
|
||||
|
||||
/*
|
||||
* unvis - decode characters previously encoded by vis
|
||||
*/
|
||||
int
|
||||
__unvis13(cp, c, astate, flag)
|
||||
char *cp;
|
||||
int c;
|
||||
int *astate, flag;
|
||||
{
|
||||
|
||||
_DIAGASSERT(cp != NULL);
|
||||
_DIAGASSERT(astate != NULL);
|
||||
|
||||
if (flag & UNVIS_END) {
|
||||
if (*astate == S_OCTAL2 || *astate == S_OCTAL3
|
||||
|| *astate == S_HEX2) {
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
}
|
||||
return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD);
|
||||
}
|
||||
|
||||
switch (*astate) {
|
||||
|
||||
case S_GROUND:
|
||||
*cp = 0;
|
||||
if (c == '\\') {
|
||||
*astate = S_START;
|
||||
return (0);
|
||||
}
|
||||
if ((flag & VIS_HTTPSTYLE) && c == '%') {
|
||||
*astate = S_HEX1;
|
||||
return (0);
|
||||
}
|
||||
*cp = c;
|
||||
return (UNVIS_VALID);
|
||||
|
||||
case S_START:
|
||||
switch(c) {
|
||||
case '\\':
|
||||
*cp = c;
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
*cp = (c - '0');
|
||||
*astate = S_OCTAL2;
|
||||
return (0);
|
||||
case 'M':
|
||||
*cp = (char)0200;
|
||||
*astate = S_META;
|
||||
return (0);
|
||||
case '^':
|
||||
*astate = S_CTRL;
|
||||
return (0);
|
||||
case 'n':
|
||||
*cp = '\n';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'r':
|
||||
*cp = '\r';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'b':
|
||||
*cp = '\b';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'a':
|
||||
*cp = '\007';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'v':
|
||||
*cp = '\v';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 't':
|
||||
*cp = '\t';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'f':
|
||||
*cp = '\f';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 's':
|
||||
*cp = ' ';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case 'E':
|
||||
*cp = '\033';
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
case '\n':
|
||||
/*
|
||||
* hidden newline
|
||||
*/
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_NOCHAR);
|
||||
case '$':
|
||||
/*
|
||||
* hidden marker
|
||||
*/
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_NOCHAR);
|
||||
}
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_SYNBAD);
|
||||
|
||||
case S_META:
|
||||
if (c == '-')
|
||||
*astate = S_META1;
|
||||
else if (c == '^')
|
||||
*astate = S_CTRL;
|
||||
else {
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_SYNBAD);
|
||||
}
|
||||
return (0);
|
||||
|
||||
case S_META1:
|
||||
*astate = S_GROUND;
|
||||
*cp |= c;
|
||||
return (UNVIS_VALID);
|
||||
|
||||
case S_CTRL:
|
||||
if (c == '?')
|
||||
*cp |= 0177;
|
||||
else
|
||||
*cp |= c & 037;
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALID);
|
||||
|
||||
case S_OCTAL2: /* second possible octal digit */
|
||||
if (isoctal(c)) {
|
||||
/*
|
||||
* yes - and maybe a third
|
||||
*/
|
||||
*cp = (*cp << 3) + (c - '0');
|
||||
*astate = S_OCTAL3;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* no - done with current sequence, push back passed char
|
||||
*/
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALIDPUSH);
|
||||
|
||||
case S_OCTAL3: /* third possible octal digit */
|
||||
*astate = S_GROUND;
|
||||
if (isoctal(c)) {
|
||||
*cp = (*cp << 3) + (c - '0');
|
||||
return (UNVIS_VALID);
|
||||
}
|
||||
/*
|
||||
* we were done, push back passed char
|
||||
*/
|
||||
return (UNVIS_VALIDPUSH);
|
||||
case S_HEX1:
|
||||
if (isxdigit(c)) {
|
||||
*cp = xtod(c);
|
||||
*astate = S_HEX2;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* no - done with current sequence, push back passed char
|
||||
*/
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_VALIDPUSH);
|
||||
case S_HEX2:
|
||||
*astate = S_GROUND;
|
||||
if (isxdigit(c)) {
|
||||
*cp = xtod(c) | (*cp << 4);
|
||||
return (UNVIS_VALID);
|
||||
}
|
||||
return (UNVIS_VALIDPUSH);
|
||||
default:
|
||||
/*
|
||||
* decoder in unknown state - (probably uninitialized)
|
||||
*/
|
||||
*astate = S_GROUND;
|
||||
return (UNVIS_SYNBAD);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* strunvis - decode src into dst
|
||||
*
|
||||
* Number of chars decoded into dst is returned, -1 on error.
|
||||
* Dst is null terminated.
|
||||
*/
|
||||
|
||||
int
|
||||
strunvisx(dst, src, flag)
|
||||
char *dst;
|
||||
const char *src;
|
||||
int flag;
|
||||
{
|
||||
char c;
|
||||
char *start = dst;
|
||||
int state = 0;
|
||||
|
||||
_DIAGASSERT(src != NULL);
|
||||
_DIAGASSERT(dst != NULL);
|
||||
|
||||
while ((c = *src++) != '\0') {
|
||||
again:
|
||||
switch (__unvis13(dst, c, &state, flag)) {
|
||||
case UNVIS_VALID:
|
||||
dst++;
|
||||
break;
|
||||
case UNVIS_VALIDPUSH:
|
||||
dst++;
|
||||
goto again;
|
||||
case 0:
|
||||
case UNVIS_NOCHAR:
|
||||
break;
|
||||
default:
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (__unvis13(dst, c, &state, UNVIS_END) == UNVIS_VALID)
|
||||
dst++;
|
||||
*dst = '\0';
|
||||
return (dst - start);
|
||||
}
|
||||
|
||||
int
|
||||
strunvis(dst, src)
|
||||
char *dst;
|
||||
const char *src;
|
||||
{
|
||||
return strunvisx(dst, src, 0);
|
||||
}
|
||||
#endif
|
347
cmd-line-utils/libedit/np/vis.c
Normal file
347
cmd-line-utils/libedit/np/vis.c
Normal file
@ -0,0 +1,347 @@
|
||||
/* $NetBSD: vis.c,v 1.22 2002/03/23 17:38:27 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: vis.c,v 1.22 2002/03/23 17:38:27 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "np/vis.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(strsvis,_strsvis)
|
||||
__weak_alias(strsvisx,_strsvisx)
|
||||
__weak_alias(strvis,_strvis)
|
||||
__weak_alias(strvisx,_strvisx)
|
||||
__weak_alias(svis,_svis)
|
||||
__weak_alias(vis,_vis)
|
||||
#endif
|
||||
|
||||
#if !HAVE_VIS_H
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#undef BELL
|
||||
#if defined(__STDC__)
|
||||
#define BELL '\a'
|
||||
#else
|
||||
#define BELL '\007'
|
||||
#endif
|
||||
|
||||
#define isoctal(c) (((unsigned char)(c)) >= '0' && ((unsigned char)(c)) <= '7')
|
||||
#define iswhite(c) (c == ' ' || c == '\t' || c == '\n')
|
||||
#define issafe(c) (c == '\b' || c == BELL || c == '\r')
|
||||
#define xtoa(c) "0123456789abcdef"[c]
|
||||
|
||||
#define MAXEXTRAS 5
|
||||
|
||||
|
||||
#define MAKEEXTRALIST(flag, extra, orig) \
|
||||
do { \
|
||||
const char *o = orig; \
|
||||
char *e; \
|
||||
while (*o++) \
|
||||
continue; \
|
||||
extra = alloca((size_t)((o - orig) + MAXEXTRAS)); \
|
||||
for (o = orig, e = extra; (*e++ = *o++) != '\0';) \
|
||||
continue; \
|
||||
e--; \
|
||||
if (flag & VIS_SP) *e++ = ' '; \
|
||||
if (flag & VIS_TAB) *e++ = '\t'; \
|
||||
if (flag & VIS_NL) *e++ = '\n'; \
|
||||
if ((flag & VIS_NOSLASH) == 0) *e++ = '\\'; \
|
||||
*e = '\0'; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
|
||||
/*
|
||||
* This is HVIS, the macro of vis used to HTTP style (RFC 1808)
|
||||
*/
|
||||
#define HVIS(dst, c, flag, nextc, extra) \
|
||||
do \
|
||||
if (!isascii(c) || !isalnum(c) || strchr("$-_.+!*'(),", c) != NULL) { \
|
||||
*dst++ = '%'; \
|
||||
*dst++ = xtoa(((unsigned int)c >> 4) & 0xf); \
|
||||
*dst++ = xtoa((unsigned int)c & 0xf); \
|
||||
} else { \
|
||||
SVIS(dst, c, flag, nextc, extra); \
|
||||
} \
|
||||
while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* This is SVIS, the central macro of vis.
|
||||
* dst: Pointer to the destination buffer
|
||||
* c: Character to encode
|
||||
* flag: Flag word
|
||||
* nextc: The character following 'c'
|
||||
* extra: Pointer to the list of extra characters to be
|
||||
* backslash-protected.
|
||||
*/
|
||||
#define SVIS(dst, c, flag, nextc, extra) \
|
||||
do { \
|
||||
int isextra, isc; \
|
||||
isextra = strchr(extra, c) != NULL; \
|
||||
if (!isextra && isascii(c) && (isgraph(c) || iswhite(c) || \
|
||||
((flag & VIS_SAFE) && issafe(c)))) { \
|
||||
*dst++ = c; \
|
||||
break; \
|
||||
} \
|
||||
isc = 0; \
|
||||
if (flag & VIS_CSTYLE) { \
|
||||
switch (c) { \
|
||||
case '\n': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'n'; \
|
||||
break; \
|
||||
case '\r': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'r'; \
|
||||
break; \
|
||||
case '\b': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'b'; \
|
||||
break; \
|
||||
case BELL: \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'a'; \
|
||||
break; \
|
||||
case '\v': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'v'; \
|
||||
break; \
|
||||
case '\t': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 't'; \
|
||||
break; \
|
||||
case '\f': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 'f'; \
|
||||
break; \
|
||||
case ' ': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = 's'; \
|
||||
break; \
|
||||
case '\0': \
|
||||
isc = 1; *dst++ = '\\'; *dst++ = '0'; \
|
||||
if (isoctal(nextc)) { \
|
||||
*dst++ = '0'; \
|
||||
*dst++ = '0'; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (isc) break; \
|
||||
if (isextra || ((c & 0177) == ' ') || (flag & VIS_OCTAL)) { \
|
||||
*dst++ = '\\'; \
|
||||
*dst++ = (unsigned char)(((unsigned int)(unsigned char)c >> 6) & 03) + '0'; \
|
||||
*dst++ = (unsigned char)(((unsigned int)(unsigned char)c >> 3) & 07) + '0'; \
|
||||
*dst++ = (c & 07) + '0'; \
|
||||
} else { \
|
||||
if ((flag & VIS_NOSLASH) == 0) *dst++ = '\\'; \
|
||||
if (c & 0200) { \
|
||||
c &= 0177; *dst++ = 'M'; \
|
||||
} \
|
||||
if (iscntrl(c)) { \
|
||||
*dst++ = '^'; \
|
||||
if (c == 0177) \
|
||||
*dst++ = '?'; \
|
||||
else \
|
||||
*dst++ = c + '@'; \
|
||||
} else { \
|
||||
*dst++ = '-'; *dst++ = c; \
|
||||
} \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
|
||||
/*
|
||||
* svis - visually encode characters, also encoding the characters
|
||||
* pointed to by `extra'
|
||||
*/
|
||||
char *
|
||||
svis(dst, c, flag, nextc, extra)
|
||||
char *dst;
|
||||
int c, flag, nextc;
|
||||
const char *extra;
|
||||
{
|
||||
char *nextra;
|
||||
_DIAGASSERT(dst != NULL);
|
||||
_DIAGASSERT(extra != NULL);
|
||||
MAKEEXTRALIST(flag, nextra, extra);
|
||||
if (flag & VIS_HTTPSTYLE)
|
||||
HVIS(dst, c, flag, nextc, nextra);
|
||||
else
|
||||
SVIS(dst, c, flag, nextc, nextra);
|
||||
*dst = '\0';
|
||||
return(dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* strsvis, strsvisx - visually encode characters from src into dst
|
||||
*
|
||||
* Extra is a pointer to a \0-terminated list of characters to
|
||||
* be encoded, too. These functions are useful e. g. to
|
||||
* encode strings in such a way so that they are not interpreted
|
||||
* by a shell.
|
||||
*
|
||||
* Dst must be 4 times the size of src to account for possible
|
||||
* expansion. The length of dst, not including the trailing NULL,
|
||||
* is returned.
|
||||
*
|
||||
* Strsvisx encodes exactly len bytes from src into dst.
|
||||
* This is useful for encoding a block of data.
|
||||
*/
|
||||
int
|
||||
strsvis(dst, src, flag, extra)
|
||||
char *dst;
|
||||
const char *src;
|
||||
int flag;
|
||||
const char *extra;
|
||||
{
|
||||
char c;
|
||||
char *start;
|
||||
char *nextra;
|
||||
|
||||
_DIAGASSERT(dst != NULL);
|
||||
_DIAGASSERT(src != NULL);
|
||||
_DIAGASSERT(extra != NULL);
|
||||
MAKEEXTRALIST(flag, nextra, extra);
|
||||
if (flag & VIS_HTTPSTYLE) {
|
||||
for (start = dst; (c = *src++) != '\0'; /* empty */)
|
||||
HVIS(dst, c, flag, *src, nextra);
|
||||
} else {
|
||||
for (start = dst; (c = *src++) != '\0'; /* empty */)
|
||||
SVIS(dst, c, flag, *src, nextra);
|
||||
}
|
||||
*dst = '\0';
|
||||
return (dst - start);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
strsvisx(dst, src, len, flag, extra)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t len;
|
||||
int flag;
|
||||
const char *extra;
|
||||
{
|
||||
char c;
|
||||
char *start;
|
||||
char *nextra;
|
||||
|
||||
_DIAGASSERT(dst != NULL);
|
||||
_DIAGASSERT(src != NULL);
|
||||
_DIAGASSERT(extra != NULL);
|
||||
MAKEEXTRALIST(flag, nextra, extra);
|
||||
|
||||
if (flag & VIS_HTTPSTYLE) {
|
||||
for (start = dst; len > 0; len--) {
|
||||
c = *src++;
|
||||
HVIS(dst, c, flag, len ? *src : '\0', nextra);
|
||||
}
|
||||
} else {
|
||||
for (start = dst; len > 0; len--) {
|
||||
c = *src++;
|
||||
SVIS(dst, c, flag, len ? *src : '\0', nextra);
|
||||
}
|
||||
}
|
||||
*dst = '\0';
|
||||
return (dst - start);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vis - visually encode characters
|
||||
*/
|
||||
char *
|
||||
vis(dst, c, flag, nextc)
|
||||
char *dst;
|
||||
int c, flag, nextc;
|
||||
|
||||
{
|
||||
char *extra;
|
||||
|
||||
_DIAGASSERT(dst != NULL);
|
||||
|
||||
MAKEEXTRALIST(flag, extra, "");
|
||||
if (flag & VIS_HTTPSTYLE)
|
||||
HVIS(dst, c, flag, nextc, extra);
|
||||
else
|
||||
SVIS(dst, c, flag, nextc, extra);
|
||||
*dst = '\0';
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* strvis, strvisx - visually encode characters from src into dst
|
||||
*
|
||||
* Dst must be 4 times the size of src to account for possible
|
||||
* expansion. The length of dst, not including the trailing NULL,
|
||||
* is returned.
|
||||
*
|
||||
* Strvisx encodes exactly len bytes from src into dst.
|
||||
* This is useful for encoding a block of data.
|
||||
*/
|
||||
int
|
||||
strvis(dst, src, flag)
|
||||
char *dst;
|
||||
const char *src;
|
||||
int flag;
|
||||
{
|
||||
char *extra;
|
||||
|
||||
MAKEEXTRALIST(flag, extra, "");
|
||||
return (strsvis(dst, src, flag, extra));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
strvisx(dst, src, len, flag)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t len;
|
||||
int flag;
|
||||
{
|
||||
char *extra;
|
||||
|
||||
MAKEEXTRALIST(flag, extra, "");
|
||||
return (strsvisx(dst, src, len, flag, extra));
|
||||
}
|
||||
#endif
|
96
cmd-line-utils/libedit/np/vis.h
Normal file
96
cmd-line-utils/libedit/np/vis.h
Normal file
@ -0,0 +1,96 @@
|
||||
/* $NetBSD: vis.h,v 1.12 2002/03/23 17:39:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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.
|
||||
*
|
||||
* @(#)vis.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _VIS_H_
|
||||
#define _VIS_H_
|
||||
|
||||
#ifdef HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* to select alternate encoding format
|
||||
*/
|
||||
#define VIS_OCTAL 0x01 /* use octal \ddd format */
|
||||
#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */
|
||||
|
||||
/*
|
||||
* to alter set of characters encoded (default is to encode all
|
||||
* non-graphic except space, tab, and newline).
|
||||
*/
|
||||
#define VIS_SP 0x04 /* also encode space */
|
||||
#define VIS_TAB 0x08 /* also encode tab */
|
||||
#define VIS_NL 0x10 /* also encode newline */
|
||||
#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
|
||||
#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
|
||||
|
||||
/*
|
||||
* other
|
||||
*/
|
||||
#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
|
||||
#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */
|
||||
|
||||
/*
|
||||
* unvis return codes
|
||||
*/
|
||||
#define UNVIS_VALID 1 /* character valid */
|
||||
#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
|
||||
#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */
|
||||
#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */
|
||||
#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
|
||||
|
||||
/*
|
||||
* unvis flags
|
||||
*/
|
||||
#define UNVIS_END 1 /* no more characters */
|
||||
|
||||
char *vis(char *, int, int, int);
|
||||
char *svis(char *, int, int, int, const char *);
|
||||
int strvis(char *, const char *, int);
|
||||
int strsvis(char *, const char *, int, const char *);
|
||||
int strvisx(char *, const char *, size_t, int);
|
||||
int strsvisx(char *, const char *, size_t, int, const char *);
|
||||
int strunvis(char *, const char *);
|
||||
int strunvisx(char *, const char *, int);
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
int unvis(char *, int, int *, int);
|
||||
int __unvis13(char *, int, int *, int);
|
||||
#else
|
||||
int unvis(char *, int, int *, int) __RENAME(__unvis13);
|
||||
#endif
|
||||
|
||||
#endif /* !_VIS_H_ */
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.14 2001/01/23 15:55:30 jdolecek Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.16 2003/01/21 18:40:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,7 +36,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.16 2003/01/21 18:40:24 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* parse.c: parse an editline extended command
|
||||
@ -51,7 +58,6 @@
|
||||
* settc
|
||||
* setty
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
#include "tokenizer.h"
|
||||
#include <stdlib.h>
|
||||
@ -63,7 +69,7 @@ private const struct {
|
||||
{ "bind", map_bind },
|
||||
{ "echotc", term_echotc },
|
||||
{ "edit", el_editmode },
|
||||
{ "history", hist_list },
|
||||
{ "history", hist_command },
|
||||
{ "telltc", term_telltc },
|
||||
{ "settc", term_settc },
|
||||
{ "setty", tty_stty },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prompt.c,v 1.8 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: prompt.c,v 1.9 2002/03/18 16:00:56 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: prompt.c,v 1.9 2002/03/18 16:00:56 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* prompt.c: Prompt printing functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <stdio.h>
|
||||
#include "el.h"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: read.c,v 1.19 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: read.c,v 1.24 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,13 +36,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: read.c,v 1.24 2002/11/20 16:50:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* read.c: Clean this junk up! This is horrible code.
|
||||
* Terminal read functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,12 +58,44 @@
|
||||
|
||||
private int read__fixio(int, int);
|
||||
private int read_preread(EditLine *);
|
||||
private int read_getcmd(EditLine *, el_action_t *, char *);
|
||||
private int read_char(EditLine *, char *);
|
||||
private int read_getcmd(EditLine *, el_action_t *, char *);
|
||||
|
||||
/* read_init():
|
||||
* Initialize the read stuff
|
||||
*/
|
||||
protected int
|
||||
read_init(EditLine *el)
|
||||
{
|
||||
/* builtin read_char */
|
||||
el->el_read.read_char = read_char;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* el_read_setfn():
|
||||
* Set the read char function to the one provided.
|
||||
* If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one.
|
||||
*/
|
||||
protected int
|
||||
el_read_setfn(EditLine *el, el_rfunc_t rc)
|
||||
{
|
||||
el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* el_read_getfn():
|
||||
* return the current read char function, or EL_BUILTIN_GETCFN
|
||||
* if it is the default one
|
||||
*/
|
||||
protected el_rfunc_t
|
||||
el_read_getfn(EditLine *el)
|
||||
{
|
||||
return (el->el_read.read_char == read_char) ?
|
||||
EL_BUILTIN_GETCFN : el->el_read.read_char;
|
||||
}
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(A,B) ((A) < (B) ? (A) : (B))
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_EDIT
|
||||
private void
|
||||
@ -83,7 +121,11 @@ read_debug(EditLine *el)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
private int
|
||||
read__fixio(int fd __attribute__((unused)), int e)
|
||||
read__fixio(int fd
|
||||
#if !(defined(TRY_AGAIN) && (defined(FIONBIO) || (defined(F_SETFL) && defined(O_NDELAY))))
|
||||
__attribute__((unused))
|
||||
#endif /* !(defined(TRY_AGAIN) && (defined(FIONBIO) || (defined(F_SETFL) && defined(O_NDELAY)))) */
|
||||
, int e)
|
||||
{
|
||||
|
||||
switch (e) {
|
||||
@ -156,6 +198,10 @@ read_preread(EditLine *el)
|
||||
return (0);
|
||||
|
||||
#ifdef FIONREAD
|
||||
|
||||
#ifndef MIN // definition of MIN is lacking on hpux..
|
||||
#define MIN(x,y) (((x)<(y))?(x):(y))
|
||||
#endif
|
||||
(void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
|
||||
if (chrs > 0) {
|
||||
char buf[EL_BUFSIZ];
|
||||
@ -178,14 +224,13 @@ read_preread(EditLine *el)
|
||||
* Push a macro
|
||||
*/
|
||||
public void
|
||||
el_push(EditLine *el, const char *str)
|
||||
el_push(EditLine *el, char *str)
|
||||
{
|
||||
c_macro_t *ma = &el->el_chared.c_macro;
|
||||
|
||||
if (str != NULL && ma->level + 1 < EL_MAXMACRO) {
|
||||
ma->level++;
|
||||
/* LINTED const cast */
|
||||
ma->macro[ma->level] = (char *) str;
|
||||
ma->macro[ma->level] = str;
|
||||
} else {
|
||||
term_beep(el);
|
||||
term__flush();
|
||||
@ -199,10 +244,10 @@ el_push(EditLine *el, const char *str)
|
||||
private int
|
||||
read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
|
||||
{
|
||||
el_action_t cmd = ED_UNASSIGNED;
|
||||
el_action_t cmd;
|
||||
int num;
|
||||
|
||||
while (cmd == ED_UNASSIGNED || cmd == ED_SEQUENCE_LEAD_IN) {
|
||||
do {
|
||||
if ((num = el_getc(el, ch)) != 1) /* if EOF or error */
|
||||
return (num);
|
||||
|
||||
@ -221,7 +266,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
|
||||
cmd = el->el_map.current[(unsigned char) *ch];
|
||||
if (cmd == ED_SEQUENCE_LEAD_IN) {
|
||||
key_value_t val;
|
||||
switch (key_get(el, ch, &val)) {
|
||||
switch (el_key_get(el, ch, &val)) {
|
||||
case XK_CMD:
|
||||
cmd = val.cmd;
|
||||
break;
|
||||
@ -241,7 +286,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
|
||||
}
|
||||
if (el->el_map.alt == NULL)
|
||||
el->el_map.current = el->el_map.key;
|
||||
}
|
||||
} while (cmd == ED_SEQUENCE_LEAD_IN);
|
||||
*cmdnum = cmd;
|
||||
return (OKCMD);
|
||||
}
|
||||
@ -307,7 +352,7 @@ el_getc(EditLine *el, char *cp)
|
||||
#ifdef DEBUG_READ
|
||||
(void) fprintf(el->el_errfile, "Reading a character\n");
|
||||
#endif /* DEBUG_READ */
|
||||
num_read = read_char(el, cp);
|
||||
num_read = (*el->el_read.read_char)(el, cp);
|
||||
#ifdef DEBUG_READ
|
||||
(void) fprintf(el->el_errfile, "Got it %c\n", *cp);
|
||||
#endif /* DEBUG_READ */
|
||||
@ -333,7 +378,7 @@ el_gets(EditLine *el, int *nread)
|
||||
char *cp = el->el_line.buffer;
|
||||
size_t idx;
|
||||
|
||||
while (read_char(el, cp) == 1) {
|
||||
while ((*el->el_read.read_char)(el, cp) == 1) {
|
||||
/* make sure there is space for next character */
|
||||
if (cp + 1 >= el->el_line.limit) {
|
||||
idx = (cp - el->el_line.buffer);
|
||||
@ -352,6 +397,11 @@ el_gets(EditLine *el, int *nread)
|
||||
*nread = el->el_line.cursor - el->el_line.buffer;
|
||||
return (el->el_line.buffer);
|
||||
}
|
||||
|
||||
/* This is relatively cheap, and things go terribly wrong if
|
||||
we have the wrong size. */
|
||||
el_resize(el);
|
||||
|
||||
re_clear_display(el); /* reset the display stuff */
|
||||
ch_reset(el);
|
||||
|
||||
@ -378,7 +428,7 @@ el_gets(EditLine *el, int *nread)
|
||||
|
||||
term__flush();
|
||||
|
||||
while (read_char(el, cp) == 1) {
|
||||
while ((*el->el_read.read_char)(el, cp) == 1) {
|
||||
/* make sure there is space next character */
|
||||
if (cp + 1 >= el->el_line.limit) {
|
||||
idx = (cp - el->el_line.buffer);
|
||||
@ -386,6 +436,8 @@ el_gets(EditLine *el, int *nread)
|
||||
break;
|
||||
cp = &el->el_line.buffer[idx];
|
||||
}
|
||||
if (*cp == 4) /* ought to be stty eof */
|
||||
break;
|
||||
cp++;
|
||||
if (cp[-1] == '\r' || cp[-1] == '\n')
|
||||
break;
|
||||
@ -397,6 +449,7 @@ el_gets(EditLine *el, int *nread)
|
||||
*nread = el->el_line.cursor - el->el_line.buffer;
|
||||
return (el->el_line.buffer);
|
||||
}
|
||||
|
||||
for (num = OKCMD; num == OKCMD;) { /* while still editing this
|
||||
* line */
|
||||
#ifdef DEBUG_EDIT
|
||||
@ -410,7 +463,8 @@ el_gets(EditLine *el, int *nread)
|
||||
#endif /* DEBUG_READ */
|
||||
break;
|
||||
}
|
||||
if ((int) cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
|
||||
if ((unsigned int)cmdnum >= (unsigned int)(el->el_map.nfunc))
|
||||
{ /* BUG CHECK command */
|
||||
#ifdef DEBUG_EDIT
|
||||
(void) fprintf(el->el_errfile,
|
||||
"ERROR: illegal command from key 0%o\r\n", ch);
|
||||
@ -432,7 +486,24 @@ el_gets(EditLine *el, int *nread)
|
||||
"Error command = %d\n", cmdnum);
|
||||
}
|
||||
#endif /* DEBUG_READ */
|
||||
/* vi redo needs these way down the levels... */
|
||||
el->el_state.thiscmd = cmdnum;
|
||||
el->el_state.thisch = ch;
|
||||
if (el->el_map.type == MAP_VI &&
|
||||
el->el_map.current == el->el_map.key &&
|
||||
el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
|
||||
if (cmdnum == VI_DELETE_PREV_CHAR &&
|
||||
el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
|
||||
&& isprint(el->el_chared.c_redo.pos[-1]))
|
||||
el->el_chared.c_redo.pos--;
|
||||
else
|
||||
*el->el_chared.c_redo.pos++ = ch;
|
||||
}
|
||||
retval = (*el->el_map.func[cmdnum]) (el, ch);
|
||||
#ifdef DEBUG_READ
|
||||
(void) fprintf(el->el_errfile,
|
||||
"Returned state %d\n", retval );
|
||||
#endif /* DEBUG_READ */
|
||||
|
||||
/* save the last command here */
|
||||
el->el_state.lastcmd = cmdnum;
|
||||
@ -440,8 +511,6 @@ el_gets(EditLine *el, int *nread)
|
||||
/* use any return value */
|
||||
switch (retval) {
|
||||
case CC_CURSOR:
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
re_refresh_cursor(el);
|
||||
break;
|
||||
|
||||
@ -451,26 +520,20 @@ el_gets(EditLine *el, int *nread)
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case CC_REFRESH:
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
re_refresh(el);
|
||||
break;
|
||||
|
||||
case CC_REFRESH_BEEP:
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
re_refresh(el);
|
||||
term_beep(el);
|
||||
break;
|
||||
|
||||
case CC_NORM: /* normal char */
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
break;
|
||||
|
||||
case CC_ARGHACK: /* Suggested by Rich Salz */
|
||||
/* <rsalz@pineapple.bbn.com> */
|
||||
break; /* keep going... */
|
||||
continue; /* keep going... */
|
||||
|
||||
case CC_EOF: /* end of file typed */
|
||||
num = 0;
|
||||
@ -489,8 +552,6 @@ el_gets(EditLine *el, int *nread)
|
||||
re_clear_display(el); /* reset the display stuff */
|
||||
ch_reset(el); /* reset the input pointers */
|
||||
re_refresh(el); /* print the prompt again */
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
break;
|
||||
|
||||
case CC_ERROR:
|
||||
@ -499,17 +560,18 @@ el_gets(EditLine *el, int *nread)
|
||||
(void) fprintf(el->el_errfile,
|
||||
"*** editor ERROR ***\r\n\n");
|
||||
#endif /* DEBUG_READ */
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
term_beep(el);
|
||||
term__flush();
|
||||
break;
|
||||
}
|
||||
el->el_state.argument = 1;
|
||||
el->el_state.doingarg = 0;
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
}
|
||||
|
||||
/* make sure the tty is set up correctly */
|
||||
(void) tty_cookedmode(el);
|
||||
term__flush(); /* flush any buffered output */
|
||||
/* make sure the tty is set up correctly */
|
||||
(void) tty_cookedmode(el);
|
||||
if (el->el_flags & HANDLE_SIGNALS)
|
||||
sig_clr(el);
|
||||
if (nread)
|
||||
|
55
cmd-line-utils/libedit/read.h
Normal file
55
cmd-line-utils/libedit/read.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* $NetBSD: read.h,v 1.1 2001/09/27 19:29:50 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Anthony Mallet.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* el.read.h: Character reading functions
|
||||
*/
|
||||
#ifndef _h_el_read
|
||||
#define _h_el_read
|
||||
|
||||
typedef int (*el_rfunc_t)(EditLine *, char *);
|
||||
|
||||
typedef struct el_read_t {
|
||||
el_rfunc_t read_char; /* Function to read a character */
|
||||
} el_read_t;
|
||||
|
||||
protected int read_init(EditLine *);
|
||||
protected int el_read_setfn(EditLine *, el_rfunc_t);
|
||||
protected el_rfunc_t el_read_getfn(EditLine *);
|
||||
|
||||
#endif /* _h_el_read */
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: readline.c,v 1.19 2001/01/10 08:10:45 jdolecek Exp $ */
|
||||
/* $NetBSD: readline.c,v 1.28 2003/03/10 01:14:54 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -36,7 +36,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: readline.c,v 1.28 2003/03/10 01:14:54 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
@ -47,14 +51,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include "histedit.h"
|
||||
#include "readline/readline.h"
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
#include "fcns.h" /* for EL_NUM_FCNS */
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include "histedit.h"
|
||||
#include "readline/readline.h"
|
||||
#include "el.h"
|
||||
#include "fcns.h" /* for EL_NUM_FCNS */
|
||||
|
||||
/* for rl_complete() */
|
||||
#define TAB '\r'
|
||||
@ -65,7 +68,11 @@
|
||||
/* readline compatibility stuff - look at readline sources/documentation */
|
||||
/* to see what these variables mean */
|
||||
const char *rl_library_version = "EditLine wrapper";
|
||||
const char *rl_readline_name = "";
|
||||
static char empty[] = { '\0' };
|
||||
static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' };
|
||||
static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
|
||||
'>', '<', '=', ';', '|', '&', '{', '(', '\0' };
|
||||
char *rl_readline_name = empty;
|
||||
FILE *rl_instream = NULL;
|
||||
FILE *rl_outstream = NULL;
|
||||
int rl_point = 0;
|
||||
@ -77,12 +84,12 @@ int history_length = 0;
|
||||
int max_input_history = 0;
|
||||
char history_expansion_char = '!';
|
||||
char history_subst_char = '^';
|
||||
const char *history_no_expand_chars = " \t\n=(";
|
||||
char *history_no_expand_chars = expand_chars;
|
||||
Function *history_inhibit_expansion_function = NULL;
|
||||
|
||||
int rl_inhibit_completion = 0;
|
||||
int rl_attempted_completion_over = 0;
|
||||
const char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(";
|
||||
char *rl_basic_word_break_characters = break_chars;
|
||||
char *rl_completer_word_break_characters = NULL;
|
||||
char *rl_completer_quote_characters = NULL;
|
||||
CPFunction *rl_completion_entry_function = NULL;
|
||||
@ -215,6 +222,11 @@ rl_initialize(void)
|
||||
|
||||
/* for proper prompt printing in readline() */
|
||||
el_rl_prompt = strdup("");
|
||||
if (el_rl_prompt == NULL) {
|
||||
history_end(h);
|
||||
el_end(e);
|
||||
return -1;
|
||||
}
|
||||
el_set(e, EL_PROMPT, _get_prompt);
|
||||
el_set(e, EL_SIGNAL, 1);
|
||||
|
||||
@ -250,8 +262,8 @@ rl_initialize(void)
|
||||
* and rl_line_buffer directly.
|
||||
*/
|
||||
li = el_line(e);
|
||||
/* LINTED const cast */
|
||||
rl_line_buffer = (char *) li->buffer;
|
||||
/* a cheesy way to get rid of const cast. */
|
||||
rl_line_buffer = memchr(li->buffer, *li->buffer, 1);
|
||||
rl_point = rl_end = 0;
|
||||
|
||||
return (0);
|
||||
@ -268,6 +280,7 @@ readline(const char *prompt)
|
||||
HistEvent ev;
|
||||
int count;
|
||||
const char *ret;
|
||||
char *buf;
|
||||
|
||||
if (e == NULL || h == NULL)
|
||||
rl_initialize();
|
||||
@ -278,28 +291,28 @@ readline(const char *prompt)
|
||||
if (strcmp(el_rl_prompt, prompt) != 0) {
|
||||
free(el_rl_prompt);
|
||||
el_rl_prompt = strdup(prompt);
|
||||
if (el_rl_prompt == NULL)
|
||||
return NULL;
|
||||
}
|
||||
/* get one line from input stream */
|
||||
ret = el_gets(e, &count);
|
||||
|
||||
if (ret && count > 0) {
|
||||
char *foo;
|
||||
int lastidx;
|
||||
|
||||
foo = strdup(ret);
|
||||
buf = strdup(ret);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
lastidx = count - 1;
|
||||
if (foo[lastidx] == '\n')
|
||||
foo[lastidx] = '\0';
|
||||
|
||||
ret = foo;
|
||||
if (buf[lastidx] == '\n')
|
||||
buf[lastidx] = '\0';
|
||||
} else
|
||||
ret = NULL;
|
||||
buf = NULL;
|
||||
|
||||
history(h, &ev, H_GETSIZE);
|
||||
history_length = ev.num;
|
||||
|
||||
/* LINTED const cast */
|
||||
return (char *) ret;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -333,6 +346,8 @@ _rl_compat_sub(const char *str, const char *what, const char *with,
|
||||
size_t size, i;
|
||||
|
||||
result = malloc((size = 16));
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
temp = str;
|
||||
with_len = strlen(with);
|
||||
what_len = strlen(what);
|
||||
@ -343,8 +358,14 @@ _rl_compat_sub(const char *str, const char *what, const char *with,
|
||||
i = new - temp;
|
||||
add = i + with_len;
|
||||
if (i + add + 1 >= size) {
|
||||
char *nresult;
|
||||
size += add + 1;
|
||||
result = realloc(result, size);
|
||||
nresult = realloc(result, size);
|
||||
if (nresult == NULL) {
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
result = nresult;
|
||||
}
|
||||
(void) strncpy(&result[len], temp, i);
|
||||
len += i;
|
||||
@ -354,8 +375,14 @@ _rl_compat_sub(const char *str, const char *what, const char *with,
|
||||
} else {
|
||||
add = strlen(temp);
|
||||
if (len + add + 1 >= size) {
|
||||
char *nresult;
|
||||
size += add + 1;
|
||||
result = realloc(result, size);
|
||||
nresult = realloc(result, size);
|
||||
if (nresult == NULL) {
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
result = nresult;
|
||||
}
|
||||
(void) strcpy(&result[len], temp); /* safe */
|
||||
len += add;
|
||||
@ -392,7 +419,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
|
||||
*result = NULL;
|
||||
|
||||
cmd = (char*) alloca(cmdlen + 1);
|
||||
cmd = alloca(cmdlen + 1);
|
||||
(void) strncpy(cmd, command, cmdlen);
|
||||
cmd[cmdlen] = 0;
|
||||
|
||||
@ -425,7 +452,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
return (-1);
|
||||
prefix = 0;
|
||||
}
|
||||
search = (char*) alloca(len + 1);
|
||||
search = alloca(len + 1);
|
||||
(void) strncpy(search, &cmd[idx], len);
|
||||
search[len] = '\0';
|
||||
|
||||
@ -498,6 +525,8 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
cmd++;
|
||||
|
||||
line = strdup(event_data);
|
||||
if (line == NULL)
|
||||
return 0;
|
||||
for (; *cmd; cmd++) {
|
||||
if (*cmd == ':')
|
||||
continue;
|
||||
@ -515,7 +544,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
g_on = 2;
|
||||
else if (*cmd == 's' || *cmd == '&') {
|
||||
char *what, *with, delim;
|
||||
size_t len, from_len;
|
||||
unsigned int len, from_len;
|
||||
size_t size;
|
||||
|
||||
if (*cmd == '&' && (from == NULL || to == NULL))
|
||||
@ -524,23 +553,36 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
delim = *(++cmd), cmd++;
|
||||
size = 16;
|
||||
what = realloc(from, size);
|
||||
if (what == NULL) {
|
||||
free(from);
|
||||
return 0;
|
||||
}
|
||||
len = 0;
|
||||
for (; *cmd && *cmd != delim; cmd++) {
|
||||
if (*cmd == '\\'
|
||||
&& *(cmd + 1) == delim)
|
||||
cmd++;
|
||||
if (len >= size)
|
||||
what = realloc(what,
|
||||
if (len >= size) {
|
||||
char *nwhat;
|
||||
nwhat = realloc(what,
|
||||
(size <<= 1));
|
||||
if (nwhat == NULL) {
|
||||
free(what);
|
||||
return 0;
|
||||
}
|
||||
what = nwhat;
|
||||
}
|
||||
what[len++] = *cmd;
|
||||
}
|
||||
what[len] = '\0';
|
||||
from = what;
|
||||
if (*what == '\0') {
|
||||
free(what);
|
||||
if (search)
|
||||
if (search) {
|
||||
from = strdup(search);
|
||||
else {
|
||||
if (from == NULL)
|
||||
return 0;
|
||||
} else {
|
||||
from = NULL;
|
||||
return (-1);
|
||||
}
|
||||
@ -551,12 +593,22 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
|
||||
size = 16;
|
||||
with = realloc(to, size);
|
||||
if (with == NULL) {
|
||||
free(to);
|
||||
return -1;
|
||||
}
|
||||
len = 0;
|
||||
from_len = strlen(from);
|
||||
for (; *cmd && *cmd != delim; cmd++) {
|
||||
if (len + from_len + 1 >= size) {
|
||||
char *nwith;
|
||||
size += from_len + 1;
|
||||
with = realloc(with, size);
|
||||
nwith = realloc(with, size);
|
||||
if (nwith == NULL) {
|
||||
free(with);
|
||||
return -1;
|
||||
}
|
||||
with = nwith;
|
||||
}
|
||||
if (*cmd == '&') {
|
||||
/* safe */
|
||||
@ -575,8 +627,10 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
|
||||
tempcmd = _rl_compat_sub(line, from, to,
|
||||
(g_on) ? 1 : 0);
|
||||
free(line);
|
||||
line = tempcmd;
|
||||
if (tempcmd) {
|
||||
free(line);
|
||||
line = tempcmd;
|
||||
}
|
||||
g_on = 0;
|
||||
}
|
||||
}
|
||||
@ -622,14 +676,21 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
|
||||
}
|
||||
|
||||
cmdsize = 1, cmdlen = 0;
|
||||
tempcmd = malloc(cmdsize);
|
||||
if ((tempcmd = malloc(cmdsize)) == NULL)
|
||||
return 0;
|
||||
for (i = start; start <= i && i <= end; i++) {
|
||||
int arr_len;
|
||||
|
||||
arr_len = strlen(arr[i]);
|
||||
if (cmdlen + arr_len + 1 >= cmdsize) {
|
||||
char *ntempcmd;
|
||||
cmdsize += arr_len + 1;
|
||||
tempcmd = realloc(tempcmd, cmdsize);
|
||||
ntempcmd = realloc(tempcmd, cmdsize);
|
||||
if (ntempcmd == NULL) {
|
||||
free(tempcmd);
|
||||
return 0;
|
||||
}
|
||||
tempcmd = ntempcmd;
|
||||
}
|
||||
(void) strcpy(&tempcmd[cmdlen], arr[i]); /* safe */
|
||||
cmdlen += arr_len;
|
||||
@ -662,10 +723,12 @@ history_expand(char *str, char **output)
|
||||
rl_initialize();
|
||||
|
||||
*output = strdup(str); /* do it early */
|
||||
if (*output == NULL)
|
||||
return 0;
|
||||
|
||||
if (str[0] == history_subst_char) {
|
||||
/* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */
|
||||
temp = (char*) alloca(4 + strlen(str) + 1);
|
||||
temp = alloca(4 + strlen(str) + 1);
|
||||
temp[0] = temp[1] = history_expansion_char;
|
||||
temp[2] = ':';
|
||||
temp[3] = 's';
|
||||
@ -674,8 +737,14 @@ history_expand(char *str, char **output)
|
||||
}
|
||||
#define ADD_STRING(what, len) \
|
||||
{ \
|
||||
if (idx + len + 1 > size) \
|
||||
result = realloc(result, (size += len + 1)); \
|
||||
if (idx + len + 1 > size) { \
|
||||
char *nresult = realloc(result, (size += len + 1));\
|
||||
if (nresult == NULL) { \
|
||||
free(*output); \
|
||||
return 0; \
|
||||
} \
|
||||
result = nresult; \
|
||||
} \
|
||||
(void)strncpy(&result[idx], what, len); \
|
||||
idx += len; \
|
||||
result[idx] = '\0'; \
|
||||
@ -789,11 +858,21 @@ history_tokenize(const char *str)
|
||||
}
|
||||
|
||||
if (result_idx + 2 >= size) {
|
||||
char **nresult;
|
||||
size <<= 1;
|
||||
result = realloc(result, size * sizeof(char *));
|
||||
nresult = realloc(result, size * sizeof(char *));
|
||||
if (nresult == NULL) {
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
result = nresult;
|
||||
}
|
||||
len = i - start;
|
||||
temp = malloc(len + 1);
|
||||
if (temp == NULL) {
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
(void) strncpy(temp, &str[start], len);
|
||||
temp[len] = '\0';
|
||||
result[result_idx++] = temp;
|
||||
@ -1158,11 +1237,15 @@ tilde_expand(char *txt)
|
||||
return (strdup(txt));
|
||||
|
||||
temp = strchr(txt + 1, '/');
|
||||
if (temp == NULL)
|
||||
if (temp == NULL) {
|
||||
temp = strdup(txt + 1);
|
||||
else {
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
} else {
|
||||
len = temp - txt + 1; /* text until string after slash */
|
||||
temp = malloc(len);
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
(void) strncpy(temp, txt + 1, len - 2);
|
||||
temp[len - 2] = '\0';
|
||||
}
|
||||
@ -1176,6 +1259,8 @@ tilde_expand(char *txt)
|
||||
txt += len;
|
||||
|
||||
temp = malloc(strlen(pass->pw_dir) + 1 + strlen(txt) + 1);
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
(void) sprintf(temp, "%s/%s", pass->pw_dir, txt);
|
||||
|
||||
return (temp);
|
||||
@ -1200,28 +1285,45 @@ filename_completion_function(const char *text, int state)
|
||||
size_t len;
|
||||
|
||||
if (state == 0 || dir == NULL) {
|
||||
if (dir != NULL) {
|
||||
closedir(dir);
|
||||
dir = NULL;
|
||||
}
|
||||
temp = strrchr(text, '/');
|
||||
if (temp) {
|
||||
char *nptr;
|
||||
temp++;
|
||||
filename = realloc(filename, strlen(temp) + 1);
|
||||
nptr = realloc(filename, strlen(temp) + 1);
|
||||
if (nptr == NULL) {
|
||||
free(filename);
|
||||
return NULL;
|
||||
}
|
||||
filename = nptr;
|
||||
(void) strcpy(filename, temp);
|
||||
len = temp - text; /* including last slash */
|
||||
dirname = realloc(dirname, len + 1);
|
||||
nptr = realloc(dirname, len + 1);
|
||||
if (nptr == NULL) {
|
||||
free(filename);
|
||||
return NULL;
|
||||
}
|
||||
dirname = nptr;
|
||||
(void) strncpy(dirname, text, len);
|
||||
dirname[len] = '\0';
|
||||
} else {
|
||||
filename = strdup(text);
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
dirname = NULL;
|
||||
}
|
||||
|
||||
/* support for ``~user'' syntax */
|
||||
if (dirname && *dirname == '~') {
|
||||
char *nptr;
|
||||
temp = tilde_expand(dirname);
|
||||
dirname = realloc(dirname, strlen(temp) + 1);
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
nptr = realloc(dirname, strlen(temp) + 1);
|
||||
if (nptr == NULL) {
|
||||
free(dirname);
|
||||
return NULL;
|
||||
}
|
||||
dirname = nptr;
|
||||
(void) strcpy(dirname, temp); /* safe */
|
||||
free(temp); /* no longer needed */
|
||||
}
|
||||
@ -1230,6 +1332,10 @@ filename_completion_function(const char *text, int state)
|
||||
if (filename_len == 0)
|
||||
return (NULL); /* no expansion possible */
|
||||
|
||||
if (dir != NULL) {
|
||||
(void)closedir(dir);
|
||||
dir = NULL;
|
||||
}
|
||||
dir = opendir(dirname ? dirname : ".");
|
||||
if (!dir)
|
||||
return (NULL); /* cannot open the directory */
|
||||
@ -1239,7 +1345,7 @@ filename_completion_function(const char *text, int state)
|
||||
/* otherwise, get first entry where first */
|
||||
/* filename_len characters are equal */
|
||||
if (entry->d_name[0] == filename[0]
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#ifndef STRUCT_DIRENT_HAS_D_NAMLEN
|
||||
&& strlen(entry->d_name) >= filename_len
|
||||
#else
|
||||
&& entry->d_namlen >= filename_len
|
||||
@ -1252,21 +1358,26 @@ filename_completion_function(const char *text, int state)
|
||||
if (entry) { /* match found */
|
||||
|
||||
struct stat stbuf;
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#ifndef STRUCT_DIRENT_HAS_D_NAMLEN
|
||||
len = strlen(entry->d_name) +
|
||||
#else
|
||||
len = entry->d_namlen +
|
||||
#endif
|
||||
((dirname) ? strlen(dirname) : 0) + 1 + 1;
|
||||
temp = malloc(len);
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
(void) sprintf(temp, "%s%s",
|
||||
dirname ? dirname : "", entry->d_name); /* safe */
|
||||
|
||||
/* test, if it's directory */
|
||||
if (stat(temp, &stbuf) == 0 && S_ISDIR(stbuf.st_mode))
|
||||
strcat(temp, "/"); /* safe */
|
||||
} else
|
||||
} else {
|
||||
(void)closedir(dir);
|
||||
dir = NULL;
|
||||
temp = NULL;
|
||||
}
|
||||
|
||||
return (temp);
|
||||
}
|
||||
@ -1331,16 +1442,24 @@ completion_matches(const char *text, CPFunction *genfunc)
|
||||
matches = 0;
|
||||
match_list_len = 1;
|
||||
while ((retstr = (*genfunc) (text, matches)) != NULL) {
|
||||
if (matches + 1 >= match_list_len) {
|
||||
/* allow for list terminator here */
|
||||
if (matches + 2 >= match_list_len) {
|
||||
char **nmatch_list;
|
||||
match_list_len <<= 1;
|
||||
match_list = realloc(match_list,
|
||||
nmatch_list = realloc(match_list,
|
||||
match_list_len * sizeof(char *));
|
||||
if (nmatch_list == NULL) {
|
||||
free(match_list);
|
||||
return NULL;
|
||||
}
|
||||
match_list = nmatch_list;
|
||||
|
||||
}
|
||||
match_list[++matches] = retstr;
|
||||
}
|
||||
|
||||
if (!match_list)
|
||||
return (char **) NULL; /* nothing found */
|
||||
return NULL; /* nothing found */
|
||||
|
||||
/* find least denominator and insert it to match_list[0] */
|
||||
which = 2;
|
||||
@ -1354,14 +1473,15 @@ completion_matches(const char *text, CPFunction *genfunc)
|
||||
}
|
||||
|
||||
retstr = malloc(max_equal + 1);
|
||||
if (retstr == NULL) {
|
||||
free(match_list);
|
||||
return NULL;
|
||||
}
|
||||
(void) strncpy(retstr, match_list[1], max_equal);
|
||||
retstr[max_equal] = '\0';
|
||||
match_list[0] = retstr;
|
||||
|
||||
/* add NULL as last pointer to the array */
|
||||
if (matches + 1 >= match_list_len)
|
||||
match_list = realloc(match_list,
|
||||
(match_list_len + 1) * sizeof(char *));
|
||||
match_list[matches + 1] = (char *) NULL;
|
||||
|
||||
return (match_list);
|
||||
@ -1374,10 +1494,8 @@ static int
|
||||
_rl_qsort_string_compare(i1, i2)
|
||||
const void *i1, *i2;
|
||||
{
|
||||
/*LINTED const castaway*/
|
||||
const char *s1 = ((const char **)i1)[0];
|
||||
/*LINTED const castaway*/
|
||||
const char *s2 = ((const char **)i2)[0];
|
||||
const char *s1 = ((const char * const *)i1)[0];
|
||||
const char *s2 = ((const char * const *)i2)[0];
|
||||
|
||||
return strcasecmp(s1, s2);
|
||||
}
|
||||
@ -1459,7 +1577,7 @@ rl_complete_internal(int what_to_do)
|
||||
ctemp--;
|
||||
|
||||
len = li->cursor - ctemp;
|
||||
temp = (char*) alloca(len + 1);
|
||||
temp = alloca(len + 1);
|
||||
(void) strncpy(temp, ctemp, len);
|
||||
temp[len] = '\0';
|
||||
|
||||
|
@ -39,18 +39,6 @@
|
||||
#define _READLINE_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
#ifndef __BEGIN_DECLS
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* list of readline stuff supported by editline library's readline wrapper */
|
||||
|
||||
@ -66,16 +54,18 @@ typedef struct _hist_entry {
|
||||
} HIST_ENTRY;
|
||||
|
||||
/* global variables used by readline enabled applications */
|
||||
__BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern const char *rl_library_version;
|
||||
extern const char *rl_readline_name;
|
||||
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 const char *rl_basic_word_break_characters;
|
||||
extern char *rl_basic_word_break_characters;
|
||||
extern char *rl_completer_word_break_characters;
|
||||
extern char *rl_completer_quote_characters;
|
||||
extern CPFunction *rl_completion_entry_function;
|
||||
@ -121,6 +111,8 @@ void rl_display_match_list(char **, int, int);
|
||||
int rl_insert(int, int);
|
||||
void rl_reset_terminal(const char *);
|
||||
int rl_bind_key(int, int (*)(int, int));
|
||||
__END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _READLINE_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: refresh.c,v 1.17 2001/04/13 00:53:11 lukem Exp $ */
|
||||
/* $NetBSD: refresh.c,v 1.24 2003/03/10 21:18:49 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: refresh.c,v 1.24 2003/03/10 21:18:49 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* refresh.c: Lower level screen refreshing functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
@ -51,28 +57,28 @@
|
||||
|
||||
private void re_addc(EditLine *, int);
|
||||
private void re_update_line(EditLine *, char *, char *, int);
|
||||
private void re_insert (EditLine *, char *, int, int, char *, int);
|
||||
private void re_delete(EditLine *, char *, int, int, int);
|
||||
private void re_insert (EditLine *el, char *, int, int, char *, int);
|
||||
private void re_delete(EditLine *el, char *, int, int, int);
|
||||
private void re_fastputc(EditLine *, int);
|
||||
private void re__strncopy(char *, char *, size_t);
|
||||
private void re__copy_and_pad(char *, const char *, size_t);
|
||||
|
||||
#ifdef DEBUG_REFRESH
|
||||
private void re_printstr(EditLine *, char *, char *, char *);
|
||||
private void re_printstr(EditLine *, const char *, char *, char *);
|
||||
#define __F el->el_errfile
|
||||
#define ELRE_ASSERT(a, b, c) do \
|
||||
if (a) { \
|
||||
if (/*CONSTCOND*/ a) { \
|
||||
(void) fprintf b; \
|
||||
c; \
|
||||
} \
|
||||
while (0)
|
||||
while (/*CONSTCOND*/0)
|
||||
#define ELRE_DEBUG(a, b) ELRE_ASSERT(a,b,;)
|
||||
|
||||
/* re_printstr():
|
||||
* Print a string on the debugging pty
|
||||
*/
|
||||
private void
|
||||
re_printstr(EditLine *el, char *str, char *f, char *t)
|
||||
re_printstr(EditLine *el, const char *str, char *f, char *t)
|
||||
{
|
||||
|
||||
ELRE_DEBUG(1, (__F, "%s:\"", str));
|
||||
@ -203,6 +209,14 @@ re_refresh(EditLine *el)
|
||||
el->el_refresh.r_cursor.h = 0;
|
||||
el->el_refresh.r_cursor.v = 0;
|
||||
|
||||
if (el->el_line.cursor >= el->el_line.lastchar) {
|
||||
if (el->el_map.current == el->el_map.alt
|
||||
&& el->el_line.lastchar != el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.lastchar - 1;
|
||||
else
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
}
|
||||
|
||||
cur.h = -1; /* set flag in case I'm not set */
|
||||
cur.v = 0;
|
||||
|
||||
@ -312,7 +326,6 @@ re_goto_bottom(EditLine *el)
|
||||
{
|
||||
|
||||
term_move_to_line(el, el->el_refresh.r_oldcv);
|
||||
term__putc('\r');
|
||||
term__putc('\n');
|
||||
re_clear_display(el);
|
||||
term__flush();
|
||||
@ -325,7 +338,7 @@ re_goto_bottom(EditLine *el)
|
||||
*/
|
||||
private void
|
||||
/*ARGSUSED*/
|
||||
re_insert(EditLine *el __attribute__((unused)),
|
||||
re_insert(EditLine *el __attribute__((unused)),
|
||||
char *d, int dat, int dlen, char *s, int num)
|
||||
{
|
||||
char *a, *b;
|
||||
@ -369,7 +382,7 @@ re_insert(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
private void
|
||||
/*ARGSUSED*/
|
||||
re_delete(EditLine *el __attribute__((unused)),
|
||||
re_delete(EditLine *el __attribute__((unused)),
|
||||
char *d, int dat, int dlen, int num)
|
||||
{
|
||||
char *a, *b;
|
||||
@ -905,7 +918,7 @@ re_update_line(EditLine *el, char *old, char *new, int i)
|
||||
private void
|
||||
re__copy_and_pad(char *dst, const char *src, size_t width)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
if (*src == '\0')
|
||||
@ -929,6 +942,14 @@ re_refresh_cursor(EditLine *el)
|
||||
char *cp, c;
|
||||
int h, v, th;
|
||||
|
||||
if (el->el_line.cursor >= el->el_line.lastchar) {
|
||||
if (el->el_map.current == el->el_map.alt
|
||||
&& el->el_line.lastchar != el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.lastchar - 1;
|
||||
else
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
}
|
||||
|
||||
/* first we must find where the cursor is... */
|
||||
h = el->el_prompt.p_pos.h;
|
||||
v = el->el_prompt.p_pos.v;
|
||||
@ -1051,8 +1072,8 @@ re_fastaddc(EditLine *el)
|
||||
re_fastputc(el, c);
|
||||
} else {
|
||||
re_fastputc(el, '\\');
|
||||
re_fastputc(el, (int) ((((unsigned int) c >> 6) & 7) + '0'));
|
||||
re_fastputc(el, (int) ((((unsigned int) c >> 3) & 7) + '0'));
|
||||
re_fastputc(el, (int)(((((unsigned int)c) >> 6) & 3) + '0'));
|
||||
re_fastputc(el, (int)(((((unsigned int)c) >> 3) & 7) + '0'));
|
||||
re_fastputc(el, (c & 7) + '0');
|
||||
}
|
||||
term__flush();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: search.c,v 1.11 2001/01/23 15:55:31 jdolecek Exp $ */
|
||||
/* $NetBSD: search.c,v 1.14 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,17 +36,21 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: search.c,v 1.14 2002/11/20 16:50:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* search.c: History and character search functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <stdlib.h>
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if defined(REGEX)
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#elif defined(REGEXP)
|
||||
#include <regexp.h>
|
||||
@ -73,7 +77,8 @@ search_init(EditLine *el)
|
||||
el->el_search.patlen = 0;
|
||||
el->el_search.patdir = -1;
|
||||
el->el_search.chacha = '\0';
|
||||
el->el_search.chadir = -1;
|
||||
el->el_search.chadir = CHAR_FWD;
|
||||
el->el_search.chatflg = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -445,29 +450,23 @@ cv_search(EditLine *el, int dir)
|
||||
char tmpbuf[EL_BUFSIZ];
|
||||
int tmplen;
|
||||
|
||||
tmplen = 0;
|
||||
#ifdef ANCHOR
|
||||
tmpbuf[tmplen++] = '.';
|
||||
tmpbuf[tmplen++] = '*';
|
||||
#endif
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
el->el_search.patdir = dir;
|
||||
|
||||
c_insert(el, 2); /* prompt + '\n' */
|
||||
*el->el_line.cursor++ = '\n';
|
||||
*el->el_line.cursor++ = dir == ED_SEARCH_PREV_HISTORY ? '/' : '?';
|
||||
re_refresh(el);
|
||||
|
||||
#ifdef ANCHOR
|
||||
tmpbuf[0] = '.';
|
||||
tmpbuf[1] = '*';
|
||||
#define LEN 2
|
||||
#else
|
||||
#define LEN 0
|
||||
#endif
|
||||
tmplen = LEN;
|
||||
|
||||
tmplen = c_gets(el, &tmpbuf[LEN]) + LEN;
|
||||
el->el_search.patdir = dir;
|
||||
|
||||
tmplen = c_gets(el, &tmpbuf[LEN],
|
||||
dir == ED_SEARCH_PREV_HISTORY ? "\n/" : "\n?" );
|
||||
if (tmplen == -1)
|
||||
return CC_REFRESH;
|
||||
|
||||
tmplen += LEN;
|
||||
ch = tmpbuf[tmplen];
|
||||
tmpbuf[tmplen] = '\0';
|
||||
|
||||
@ -476,9 +475,6 @@ cv_search(EditLine *el, int dir)
|
||||
* Use the old pattern, but wild-card it.
|
||||
*/
|
||||
if (el->el_search.patlen == 0) {
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
re_refresh(el);
|
||||
return (CC_ERROR);
|
||||
}
|
||||
@ -509,19 +505,15 @@ cv_search(EditLine *el, int dir)
|
||||
el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */
|
||||
el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer;
|
||||
if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) :
|
||||
ed_search_next_history(el, 0)) == CC_ERROR) {
|
||||
ed_search_next_history(el, 0)) == CC_ERROR) {
|
||||
re_refresh(el);
|
||||
return (CC_ERROR);
|
||||
} else {
|
||||
if (ch == 0033) {
|
||||
re_refresh(el);
|
||||
*el->el_line.lastchar++ = '\n';
|
||||
*el->el_line.lastchar = '\0';
|
||||
re_goto_bottom(el);
|
||||
return (CC_NEWLINE);
|
||||
} else
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
if (ch == 0033) {
|
||||
re_refresh(el);
|
||||
return ed_newline(el, 0);
|
||||
}
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
|
||||
@ -578,69 +570,53 @@ cv_repeat_srch(EditLine *el, int c)
|
||||
}
|
||||
|
||||
|
||||
/* cv_csearch_back():
|
||||
* Vi character search reverse
|
||||
/* cv_csearch():
|
||||
* Vi character search
|
||||
*/
|
||||
protected el_action_t
|
||||
cv_csearch_back(EditLine *el, int ch, int count, int tflag)
|
||||
cv_csearch(EditLine *el, int direction, int ch, int count, int tflag)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
if (ch == 0)
|
||||
return CC_ERROR;
|
||||
|
||||
if (ch == -1) {
|
||||
char c;
|
||||
if (el_getc(el, &c) != 1)
|
||||
return ed_end_of_file(el, 0);
|
||||
ch = c;
|
||||
}
|
||||
|
||||
/* Save for ';' and ',' commands */
|
||||
el->el_search.chacha = ch;
|
||||
el->el_search.chadir = direction;
|
||||
el->el_search.chatflg = tflag;
|
||||
|
||||
cp = el->el_line.cursor;
|
||||
while (count--) {
|
||||
if (*cp == ch)
|
||||
cp--;
|
||||
while (cp > el->el_line.buffer && *cp != ch)
|
||||
cp--;
|
||||
cp += direction;
|
||||
for (;;cp += direction) {
|
||||
if (cp >= el->el_line.lastchar)
|
||||
return CC_ERROR;
|
||||
if (cp < el->el_line.buffer)
|
||||
return CC_ERROR;
|
||||
if (*cp == ch)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cp < el->el_line.buffer || (cp == el->el_line.buffer && *cp != ch))
|
||||
return (CC_ERROR);
|
||||
|
||||
if (*cp == ch && tflag)
|
||||
cp++;
|
||||
if (tflag)
|
||||
cp -= direction;
|
||||
|
||||
el->el_line.cursor = cp;
|
||||
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
el->el_line.cursor++;
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
if (direction > 0)
|
||||
el->el_line.cursor++;
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
re_refresh_cursor(el);
|
||||
return (CC_NORM);
|
||||
}
|
||||
|
||||
|
||||
/* cv_csearch_fwd():
|
||||
* Vi character search forward
|
||||
*/
|
||||
protected el_action_t
|
||||
cv_csearch_fwd(EditLine *el, int ch, int count, int tflag)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
cp = el->el_line.cursor;
|
||||
while (count--) {
|
||||
if (*cp == ch)
|
||||
cp++;
|
||||
while (cp < el->el_line.lastchar && *cp != ch)
|
||||
cp++;
|
||||
}
|
||||
|
||||
if (cp >= el->el_line.lastchar)
|
||||
return (CC_ERROR);
|
||||
|
||||
if (*cp == ch && tflag)
|
||||
cp--;
|
||||
|
||||
el->el_line.cursor = cp;
|
||||
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
el->el_line.cursor++;
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
re_refresh_cursor(el);
|
||||
return (CC_NORM);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: search.h,v 1.5 2000/09/04 22:06:32 lukem Exp $ */
|
||||
/* $NetBSD: search.h,v 1.6 2002/11/15 14:32:34 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -52,6 +52,7 @@ typedef struct el_search_t {
|
||||
int patdir; /* Direction of the last search */
|
||||
int chadir; /* Character search direction */
|
||||
char chacha; /* Character we are looking for */
|
||||
char chatflg; /* 0 if f, 1 if t */
|
||||
} el_search_t;
|
||||
|
||||
|
||||
@ -64,7 +65,6 @@ protected el_action_t ce_inc_search(EditLine *, int);
|
||||
protected el_action_t cv_search(EditLine *, int);
|
||||
protected el_action_t ce_search_line(EditLine *, char *, int);
|
||||
protected el_action_t cv_repeat_srch(EditLine *, int);
|
||||
protected el_action_t cv_csearch_back(EditLine *, int, int, int);
|
||||
protected el_action_t cv_csearch_fwd(EditLine *, int, int, int);
|
||||
protected el_action_t cv_csearch(EditLine *, int, int, int, int);
|
||||
|
||||
#endif /* _h_el_search */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sig.c,v 1.8 2001/01/09 17:31:04 jdolecek Exp $ */
|
||||
/* $NetBSD: sig.c,v 1.10 2003/03/10 00:58:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,14 +36,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sig.c,v 1.10 2003/03/10 00:58:05 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* sig.c: Signal handling stuff.
|
||||
* our policy is to trap all signals, set a good state
|
||||
* and pass the ball to our caller.
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -115,9 +121,9 @@ sig_init(EditLine *el)
|
||||
#undef _DO
|
||||
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
|
||||
#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(libedit_sig_t))
|
||||
#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(el_signalhandler_t))
|
||||
|
||||
el->el_signal = (el_signal_t) el_malloc(SIGSIZE);
|
||||
el->el_signal = (el_signalhandler_t *) el_malloc(SIGSIZE);
|
||||
if (el->el_signal == NULL)
|
||||
return (-1);
|
||||
for (i = 0; sighdl[i] != -1; i++)
|
||||
@ -157,7 +163,7 @@ sig_set(EditLine *el)
|
||||
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
|
||||
for (i = 0; sighdl[i] != -1; i++) {
|
||||
libedit_sig_t s;
|
||||
el_signalhandler_t s;
|
||||
/* This could happen if we get interrupted */
|
||||
if ((s = signal(sighdl[i], sig_handler)) != sig_handler)
|
||||
el->el_signal[i] = s;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sig.h,v 1.3 2000/09/04 22:06:32 lukem Exp $ */
|
||||
/* $NetBSD: sig.h,v 1.4 2003/03/10 00:58:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -62,9 +62,8 @@
|
||||
_DO(SIGCONT) \
|
||||
_DO(SIGWINCH)
|
||||
|
||||
typedef RETSIGTYPE (*libedit_sig_t)();
|
||||
typedef libedit_sig_t *el_signal_t;
|
||||
|
||||
typedef void (*el_signalhandler_t)(int);
|
||||
typedef el_signalhandler_t *el_signal_t;
|
||||
|
||||
protected void sig_end(EditLine*);
|
||||
protected int sig_init(EditLine*);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sys.h,v 1.4 2000/09/04 22:06:32 lukem Exp $ */
|
||||
/* $NetBSD: sys.h,v 1.6 2003/03/10 00:57:38 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -44,6 +44,10 @@
|
||||
#ifndef _h_sys
|
||||
#define _h_sys
|
||||
|
||||
#ifdef HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef public
|
||||
# define public /* Externally visible functions/variables */
|
||||
#endif
|
||||
@ -57,10 +61,6 @@
|
||||
/* When we want to hide everything */
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
typedef void *ptr_t;
|
||||
@ -73,22 +73,58 @@ typedef void *ioctl_t;
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#define strlcat libedit_strlcat
|
||||
size_t strlcat(char *dst, const char *src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#define strlcpy libedit_strlcpy
|
||||
size_t strlcpy(char *dst, const char *src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FGETLN
|
||||
#define fgetln libedit_fgetln
|
||||
char *fgetln(FILE *fp, size_t *len);
|
||||
#endif
|
||||
|
||||
#define REGEX /* Use POSIX.2 regular expression functions */
|
||||
#undef REGEXP /* Use UNIX V8 regular expression functions */
|
||||
|
||||
#if defined(__sun__) && defined(__SVR4)
|
||||
#ifdef notdef
|
||||
# undef REGEX
|
||||
# undef REGEXP
|
||||
# include <malloc.h>
|
||||
typedef void (*sig_t)(int);
|
||||
#endif
|
||||
|
||||
#ifndef __P
|
||||
#ifdef __STDC__
|
||||
#define __P(x) x
|
||||
#else
|
||||
#define __P(x) ()
|
||||
#endif
|
||||
# ifdef __GNUC__
|
||||
/*
|
||||
* Broken hdrs.
|
||||
*/
|
||||
extern int tgetent(const char *bp, char *name);
|
||||
extern int tgetflag(const char *id);
|
||||
extern int tgetnum(const char *id);
|
||||
extern char *tgetstr(const char *id, char **area);
|
||||
extern char *tgoto(const char *cap, int col, int row);
|
||||
extern int tputs(const char *str, int affcnt, int (*putc)(int));
|
||||
extern char *getenv(const char *);
|
||||
extern int fprintf(FILE *, const char *, ...);
|
||||
extern int sigsetmask(int);
|
||||
extern int sigblock(int);
|
||||
extern int fputc(int, FILE *);
|
||||
extern int fgetc(FILE *);
|
||||
extern int fflush(FILE *);
|
||||
extern int tolower(int);
|
||||
extern int toupper(int);
|
||||
extern int errno, sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
extern void perror(const char *);
|
||||
# include <string.h>
|
||||
# define strerror(e) sys_errlist[e]
|
||||
# endif
|
||||
# ifdef SABER
|
||||
extern ptr_t memcpy(ptr_t, const ptr_t, size_t);
|
||||
extern ptr_t memset(ptr_t, int, size_t);
|
||||
# endif
|
||||
extern char *fgetline(FILE *, int *);
|
||||
#endif
|
||||
|
||||
#endif /* _h_sys */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: term.c,v 1.32 2001/01/23 15:55:31 jdolecek Exp $ */
|
||||
/* $NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,31 +36,40 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* term.c: Editor/termcap-curses interface
|
||||
* We have to declare a static variable here, since the
|
||||
* termcap putchar routine does not take an argument!
|
||||
*/
|
||||
|
||||
#include "sys.h"
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#if defined(HAVE_TERMCAP_H)
|
||||
#ifdef HAVE_TERMCAP_H
|
||||
#include <termcap.h>
|
||||
#elif defined(HAVE_CURSES_H) && defined(HAVE_TERM_H) /* For HPUX11 */
|
||||
#include <curses.h>
|
||||
#include <term.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_CURSES_H
|
||||
#include <curses.h>
|
||||
#endif
|
||||
#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "el.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/*
|
||||
* IMPORTANT NOTE: these routines are allowed to look at the current screen
|
||||
* and the current possition assuming that it is correct. If this is not
|
||||
@ -340,8 +349,7 @@ term_init(EditLine *el)
|
||||
return (-1);
|
||||
(void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
|
||||
term_outfile = el->el_outfile;
|
||||
if (term_set(el, NULL) == -1)
|
||||
return (-1);
|
||||
(void) term_set(el, NULL);
|
||||
term_init_arrow(el);
|
||||
return (0);
|
||||
}
|
||||
@ -637,7 +645,7 @@ mc_again:
|
||||
* from col 0
|
||||
*/
|
||||
if (EL_CAN_TAB ?
|
||||
((unsigned int)-del > (((unsigned int) where >> 3) +
|
||||
(((unsigned int)-del) > (((unsigned int) where >> 3) +
|
||||
(where & 07)))
|
||||
: (-del > where)) {
|
||||
term__putc('\r'); /* do a CR */
|
||||
@ -897,7 +905,7 @@ term_set(EditLine *el, const char *term)
|
||||
|
||||
memset(el->el_term.t_cap, 0, TC_BUFSIZE);
|
||||
|
||||
i = tgetent(el->el_term.t_cap, (char*) term);
|
||||
i = tgetent(el->el_term.t_cap, term);
|
||||
|
||||
if (i <= 0) {
|
||||
if (i == -1)
|
||||
@ -927,7 +935,7 @@ term_set(EditLine *el, const char *term)
|
||||
Val(T_co) = tgetnum("co");
|
||||
Val(T_li) = tgetnum("li");
|
||||
for (t = tstr; t->name != NULL; t++)
|
||||
term_alloc(el, t, tgetstr((char*) t->name, &area));
|
||||
term_alloc(el, t, tgetstr(t->name, &area));
|
||||
}
|
||||
|
||||
if (Val(T_co) < 2)
|
||||
@ -1067,34 +1075,32 @@ term_reset_arrow(EditLine *el)
|
||||
static const char stOH[] = {033, 'O', 'H', '\0'};
|
||||
static const char stOF[] = {033, 'O', 'F', '\0'};
|
||||
|
||||
term_init_arrow(el); /* Init arrow struct */
|
||||
|
||||
key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
el_key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
el_key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
el_key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
el_key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
el_key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
el_key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
el_key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
el_key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
el_key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
el_key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
el_key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
el_key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
el_key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
el_key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
el_key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
el_key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
el_key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
el_key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
el_key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
|
||||
el_key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
|
||||
el_key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
|
||||
el_key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
||||
el_key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
||||
el_key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1148,7 +1154,7 @@ term_print_arrow(EditLine *el, const char *name)
|
||||
for (i = 0; i < A_K_NKEYS; i++)
|
||||
if (*name == '\0' || strcmp(name, arrow[i].name) == 0)
|
||||
if (arrow[i].type != XK_NOD)
|
||||
key_kprint(el, arrow[i].name, &arrow[i].fun,
|
||||
el_key_kprint(el, arrow[i].name, &arrow[i].fun,
|
||||
arrow[i].type);
|
||||
}
|
||||
|
||||
@ -1189,20 +1195,20 @@ term_bind_arrow(EditLine *el)
|
||||
* unassigned key.
|
||||
*/
|
||||
if (arrow[i].type == XK_NOD)
|
||||
key_clear(el, map, p);
|
||||
el_key_clear(el, map, p);
|
||||
else {
|
||||
if (p[1] && (dmap[j] == map[j] ||
|
||||
map[j] == ED_SEQUENCE_LEAD_IN)) {
|
||||
key_add(el, p, &arrow[i].fun,
|
||||
el_key_add(el, p, &arrow[i].fun,
|
||||
arrow[i].type);
|
||||
map[j] = ED_SEQUENCE_LEAD_IN;
|
||||
} else if (map[j] == ED_UNASSIGNED) {
|
||||
key_clear(el, map, p);
|
||||
el_key_clear(el, map, p);
|
||||
if (arrow[i].type == XK_CMD)
|
||||
map[j] = arrow[i].fun.cmd;
|
||||
else
|
||||
key_add(el, p, &arrow[i].fun,
|
||||
arrow[i].type);
|
||||
el_key_add(el, p, &arrow[i].fun,
|
||||
arrow[i].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1235,10 +1241,11 @@ term__flush(void)
|
||||
/* term_telltc():
|
||||
* Print the current termcap characteristics
|
||||
*/
|
||||
char *el_key__decode_str(const char *, char *, const char *);
|
||||
|
||||
protected int
|
||||
/*ARGSUSED*/
|
||||
term_telltc(EditLine *el, int
|
||||
argc __attribute__((unused)),
|
||||
term_telltc(EditLine *el, int argc __attribute__((unused)),
|
||||
const char **argv __attribute__((unused)))
|
||||
{
|
||||
const struct termcapstr *t;
|
||||
@ -1263,7 +1270,7 @@ term_telltc(EditLine *el, int
|
||||
(void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
|
||||
t->long_name,
|
||||
t->name, *ts && **ts ?
|
||||
key__decode_str(*ts, upbuf, "") : "(empty)");
|
||||
el_key__decode_str(*ts, upbuf, "") : "(empty)");
|
||||
(void) fputc('\n', el->el_outfile);
|
||||
return (0);
|
||||
}
|
||||
@ -1274,7 +1281,8 @@ term_telltc(EditLine *el, int
|
||||
*/
|
||||
protected int
|
||||
/*ARGSUSED*/
|
||||
term_settc(EditLine *el, int argc __attribute__((unused)), const char **argv)
|
||||
term_settc(EditLine *el, int argc __attribute__((unused)),
|
||||
const char **argv __attribute__((unused)))
|
||||
{
|
||||
const struct termcapstr *ts;
|
||||
const struct termcapval *tv;
|
||||
@ -1350,7 +1358,9 @@ term_settc(EditLine *el, int argc __attribute__((unused)), const char **argv)
|
||||
*/
|
||||
protected int
|
||||
/*ARGSUSED*/
|
||||
term_echotc(EditLine *el, int argc __attribute__((unused)), const char **argv)
|
||||
term_echotc(EditLine *el __attribute__((unused)),
|
||||
int argc __attribute__((unused)),
|
||||
const char **argv __attribute__((unused)))
|
||||
{
|
||||
char *cap, *scap, *ep;
|
||||
int arg_need, arg_cols, arg_rows;
|
||||
@ -1429,7 +1439,7 @@ term_echotc(EditLine *el, int argc __attribute__((unused)), const char **argv)
|
||||
break;
|
||||
}
|
||||
if (t->name == NULL)
|
||||
scap = tgetstr((char*) *argv, &area);
|
||||
scap = tgetstr(*argv, &area);
|
||||
if (!scap || scap[0] == '\0') {
|
||||
if (!silent)
|
||||
(void) fprintf(el->el_errfile,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tokenizer.c,v 1.7 2001/01/04 15:56:32 christos Exp $ */
|
||||
/* $NetBSD: tokenizer.c,v 1.11 2002/10/27 20:24:29 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tokenizer.c,v 1.11 2002/10/27 20:24:29 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* tokenize.c: Bourne shell like tokenizer
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "tokenizer.h"
|
||||
@ -66,7 +72,7 @@ typedef enum {
|
||||
struct tokenizer {
|
||||
char *ifs; /* In field separator */
|
||||
int argc, amax; /* Current and maximum number of args */
|
||||
const char **argv; /* Argument list */
|
||||
char **argv; /* Argument list */
|
||||
char *wptr, *wmax; /* Space and limit on the word buffer */
|
||||
char *wstart; /* Beginning of next word */
|
||||
char *wspace; /* Space of word buffer */
|
||||
@ -103,16 +109,29 @@ tok_init(const char *ifs)
|
||||
{
|
||||
Tokenizer *tok = (Tokenizer *) tok_malloc(sizeof(Tokenizer));
|
||||
|
||||
if (tok == NULL)
|
||||
return NULL;
|
||||
tok->ifs = strdup(ifs ? ifs : IFS);
|
||||
if (tok->ifs == NULL) {
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->argc = 0;
|
||||
tok->amax = AINCR;
|
||||
tok->argv = (const char **) tok_malloc(sizeof(char *) * tok->amax);
|
||||
if (tok->argv == NULL)
|
||||
return (NULL);
|
||||
tok->argv = (char **) tok_malloc(sizeof(char *) * tok->amax);
|
||||
if (tok->argv == NULL) {
|
||||
tok_free((ptr_t)tok->ifs);
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->argv[0] = NULL;
|
||||
tok->wspace = (char *) tok_malloc(WINCR);
|
||||
if (tok->wspace == NULL)
|
||||
return (NULL);
|
||||
if (tok->wspace == NULL) {
|
||||
tok_free((ptr_t)tok->argv);
|
||||
tok_free((ptr_t)tok->ifs);
|
||||
tok_free((ptr_t)tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->wmax = tok->wspace + WINCR;
|
||||
tok->wstart = tok->wspace;
|
||||
tok->wptr = tok->wspace;
|
||||
@ -268,7 +287,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
switch (tok->quote) {
|
||||
case Q_none:
|
||||
tok_finish(tok);
|
||||
*argv = tok->argv;
|
||||
*argv = (const char **)tok->argv;
|
||||
*argc = tok->argc;
|
||||
return (0);
|
||||
|
||||
@ -301,7 +320,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
return (3);
|
||||
}
|
||||
tok_finish(tok);
|
||||
*argv = tok->argv;
|
||||
*argv = (const char **)tok->argv;
|
||||
*argc = tok->argc;
|
||||
return (0);
|
||||
|
||||
@ -363,25 +382,25 @@ tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
|
||||
if (tok->wptr >= tok->wmax - 4) {
|
||||
size_t size = tok->wmax - tok->wspace + WINCR;
|
||||
char *s = (char *) tok_realloc(tok->wspace, size);
|
||||
/* SUPPRESS 22 */
|
||||
int offs = s - tok->wspace;
|
||||
if (s == NULL)
|
||||
return (-1);
|
||||
|
||||
if (offs != 0) {
|
||||
if (s != tok->wspace) {
|
||||
int i;
|
||||
for (i = 0; i < tok->argc; i++)
|
||||
tok->argv[i] = tok->argv[i] + offs;
|
||||
tok->wptr = tok->wptr + offs;
|
||||
tok->wstart = tok->wstart + offs;
|
||||
tok->wmax = s + size;
|
||||
for (i = 0; i < tok->argc; i++) {
|
||||
tok->argv[i] =
|
||||
(tok->argv[i] - tok->wspace) + s;
|
||||
}
|
||||
tok->wptr = (tok->wptr - tok->wspace) + s;
|
||||
tok->wstart = (tok->wstart - tok->wspace) + s;
|
||||
tok->wspace = s;
|
||||
}
|
||||
tok->wmax = s + size;
|
||||
}
|
||||
if (tok->argc >= tok->amax - 4) {
|
||||
const char **p;
|
||||
char **p;
|
||||
tok->amax += AINCR;
|
||||
p = (const char **) tok_realloc(tok->argv,
|
||||
p = (char **) tok_realloc(tok->argv,
|
||||
tok->amax * sizeof(char *));
|
||||
if (p == NULL)
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tokenizer.h,v 1.4 2000/09/04 22:06:33 lukem Exp $ */
|
||||
/* $NetBSD: tokenizer.h,v 1.5 2002/03/18 16:01:00 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tty.c,v 1.15 2001/05/17 01:02:17 christos Exp $ */
|
||||
/* $NetBSD: tty.c,v 1.16 2002/03/18 16:01:01 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tty.c,v 1.16 2002/03/18 16:01:01 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* tty.c: tty interface stuff
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "tty.h"
|
||||
#include "el.h"
|
||||
|
||||
@ -54,7 +60,7 @@ typedef struct ttymodes_t {
|
||||
typedef struct ttymap_t {
|
||||
int nch, och; /* Internal and termio rep of chars */
|
||||
el_action_t bind[3]; /* emacs, vi, and vi-cmd */
|
||||
} ttymap_t;
|
||||
} ttymap_t;
|
||||
|
||||
|
||||
private const ttyperm_t ttyperm = {
|
||||
@ -778,15 +784,15 @@ tty_bind_char(EditLine *el, int force)
|
||||
if (new[0] == old[0] && !force)
|
||||
continue;
|
||||
/* Put the old default binding back, and set the new binding */
|
||||
key_clear(el, map, (char *)old);
|
||||
el_key_clear(el, map, (char *)old);
|
||||
map[old[0]] = dmap[old[0]];
|
||||
key_clear(el, map, (char *)new);
|
||||
el_key_clear(el, map, (char *)new);
|
||||
/* MAP_VI == 1, MAP_EMACS == 0... */
|
||||
map[new[0]] = tp->bind[el->el_map.type];
|
||||
if (dalt) {
|
||||
key_clear(el, alt, (char *)old);
|
||||
el_key_clear(el, alt, (char *)old);
|
||||
alt[old[0]] = dalt[old[0]];
|
||||
key_clear(el, alt, (char *)new);
|
||||
el_key_clear(el, alt, (char *)new);
|
||||
alt[new[0]] = tp->bind[el->el_map.type + 1];
|
||||
}
|
||||
}
|
||||
@ -1039,9 +1045,8 @@ tty_stty(EditLine *el, int argc __attribute__((unused)), const char **argv)
|
||||
{
|
||||
const ttymodes_t *m;
|
||||
char x;
|
||||
const char *d;
|
||||
int aflag = 0;
|
||||
const char *s;
|
||||
const char *s, *d;
|
||||
const char *name;
|
||||
int z = EX_IO;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tty.h,v 1.8 2000/09/04 22:06:33 lukem Exp $ */
|
||||
/* $NetBSD: tty.h,v 1.9 2002/03/18 16:01:01 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -453,16 +453,16 @@
|
||||
#define MD_NN 5
|
||||
|
||||
typedef struct {
|
||||
const char *t_name;
|
||||
u_int t_setmask;
|
||||
u_int t_clrmask;
|
||||
const char *t_name;
|
||||
u_int t_setmask;
|
||||
u_int t_clrmask;
|
||||
} ttyperm_t[NN_IO][MD_NN];
|
||||
|
||||
typedef unsigned char ttychar_t[NN_IO][C_NCC];
|
||||
|
||||
protected int tty_init(EditLine *);
|
||||
protected void tty_end(EditLine *);
|
||||
protected int tty_stty(EditLine *, int, const char**);
|
||||
protected int tty_stty(EditLine *, int, const char **);
|
||||
protected int tty_rawmode(EditLine *);
|
||||
protected int tty_cookedmode(EditLine *);
|
||||
protected int tty_quotemode(EditLine *);
|
||||
|
File diff suppressed because it is too large
Load Diff
345
configure.in
345
configure.in
@ -62,9 +62,11 @@ AC_SUBST(MYSQL_NO_DASH_VERSION)
|
||||
AC_SUBST(MYSQL_BASE_VERSION)
|
||||
AC_SUBST(MYSQL_VERSION_ID)
|
||||
AC_SUBST(PROTOCOL_VERSION)
|
||||
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, $PROTOCOL_VERSION)
|
||||
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
|
||||
[mysql client protocol version])
|
||||
AC_SUBST(DOT_FRM_VERSION)
|
||||
AC_DEFINE_UNQUOTED(DOT_FRM_VERSION, $DOT_FRM_VERSION)
|
||||
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
|
||||
[Version of .frm files])
|
||||
AC_SUBST(SHARED_LIB_VERSION)
|
||||
AC_SUBST(AVAILABLE_LANGUAGES)
|
||||
AC_SUBST(AVAILABLE_LANGUAGES_ERRORS)
|
||||
@ -74,19 +76,25 @@ AC_SUBST([NDB_VERSION_MAJOR])
|
||||
AC_SUBST([NDB_VERSION_MINOR])
|
||||
AC_SUBST([NDB_VERSION_BUILD])
|
||||
AC_SUBST([NDB_VERSION_STATUS])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_MAJOR], [$NDB_VERSION_MAJOR])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_MINOR], [$NDB_VERSION_MINOR])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_BUILD], [$NDB_VERSION_BUILD])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_STATUS], ["$NDB_VERSION_STATUS"])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_MAJOR], [$NDB_VERSION_MAJOR],
|
||||
[NDB major version])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_MINOR], [$NDB_VERSION_MINOR],
|
||||
[NDB minor version])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_BUILD], [$NDB_VERSION_BUILD],
|
||||
[NDB build version])
|
||||
AC_DEFINE_UNQUOTED([NDB_VERSION_STATUS], ["$NDB_VERSION_STATUS"],
|
||||
[NDB status version])
|
||||
|
||||
|
||||
# Canonicalize the configuration name.
|
||||
SYSTEM_TYPE="$host_vendor-$host_os"
|
||||
MACHINE_TYPE="$host_cpu"
|
||||
AC_SUBST(SYSTEM_TYPE)
|
||||
AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE")
|
||||
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
|
||||
[Name of system, eg solaris])
|
||||
AC_SUBST(MACHINE_TYPE)
|
||||
AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$MACHINE_TYPE")
|
||||
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
|
||||
[Machine type name, eg sun10])
|
||||
|
||||
# Detect intel x86 like processor
|
||||
BASE_MACHINE_TYPE=$MACHINE_TYPE
|
||||
@ -230,7 +238,7 @@ AC_MSG_CHECKING("return type of sprintf")
|
||||
#check the return type of sprintf
|
||||
case $SYSTEM_TYPE in
|
||||
*netware*)
|
||||
AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int")
|
||||
AC_DEFINE(SPRINTF_RETURNS_INT, [1]) AC_MSG_RESULT("int")
|
||||
;;
|
||||
*)
|
||||
AC_TRY_RUN([
|
||||
@ -244,8 +252,9 @@ AC_TRY_RUN([
|
||||
return -1;
|
||||
}
|
||||
],
|
||||
AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
|
||||
AC_TRY_RUN([
|
||||
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
|
||||
AC_MSG_RESULT("int")],
|
||||
[AC_TRY_RUN([
|
||||
int main()
|
||||
{
|
||||
char* s = "hello";
|
||||
@ -253,9 +262,12 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
|
||||
if((char*)sprintf(buf,s) == buf + strlen(s))
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"),
|
||||
AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage")))
|
||||
} ],
|
||||
[AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
|
||||
AC_MSG_RESULT("ptr")],
|
||||
[AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
|
||||
AC_MSG_RESULT("garbage")])
|
||||
])
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -384,7 +396,7 @@ then
|
||||
# we will gets some problems when linking static programs.
|
||||
# The following code is used to fix this problem.
|
||||
|
||||
if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc"
|
||||
if echo $CXX | grep gcc > /dev/null 2>&1
|
||||
then
|
||||
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
|
||||
then
|
||||
@ -652,15 +664,6 @@ AC_ARG_WITH(named-curses-libs,
|
||||
[ with_named_curses=no ]
|
||||
)
|
||||
|
||||
# Force use of a zlib (compress)
|
||||
AC_ARG_WITH(named-z-libs,
|
||||
[ --with-named-z-libs=ARG
|
||||
Use specified zlib libraries instead of
|
||||
those automatically found by configure.],
|
||||
[ with_named_zlib=$withval ],
|
||||
[ with_named_zlib=z ]
|
||||
)
|
||||
|
||||
# Make thread safe client
|
||||
AC_ARG_ENABLE(thread-safe-client,
|
||||
[ --enable-thread-safe-client
|
||||
@ -701,7 +704,7 @@ AC_ARG_WITH(raid,
|
||||
if test "$USE_RAID" = "yes"
|
||||
then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([USE_RAID])
|
||||
AC_DEFINE([USE_RAID], [1], [Use MySQL RAID])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@ -745,7 +748,8 @@ AC_ARG_ENABLE(local-infile,
|
||||
if test "$ENABLED_LOCAL_INFILE" = "yes"
|
||||
then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([ENABLED_LOCAL_INFILE])
|
||||
AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
|
||||
[If LOAD DATA LOCAL INFILE should be enabled by default])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@ -789,20 +793,11 @@ AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
|
||||
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
|
||||
# For crypt() on Linux
|
||||
AC_CHECK_LIB(crypt, crypt)
|
||||
AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
|
||||
AC_CHECK_FUNC(crypt, AC_DEFINE([HAVE_CRYPT], [1], [crypt]))
|
||||
|
||||
# For sem_xxx functions on Solaris 2.6
|
||||
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
|
||||
|
||||
# For compress in zlib
|
||||
case $SYSTEM_TYPE in
|
||||
*netware* | *modesto*)
|
||||
AC_DEFINE(HAVE_COMPRESS)
|
||||
;;
|
||||
*)
|
||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
||||
;;
|
||||
esac
|
||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for TCP wrapper support
|
||||
@ -832,8 +827,8 @@ int deny_severity = 0;
|
||||
struct request_info *req;
|
||||
],[hosts_access (req)],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(LIBWRAP)
|
||||
AC_DEFINE(HAVE_LIBWRAP)
|
||||
AC_DEFINE([LIBWRAP], [1], [Define if you have -lwrap])
|
||||
AC_DEFINE([HAVE_LIBWRAP], [1], [Define if have -lwrap])
|
||||
if test "$with_libwrap" != "yes"; then
|
||||
WRAPLIBS="-L${with_libwrap}/lib"
|
||||
fi
|
||||
@ -861,7 +856,10 @@ int main()
|
||||
atomic_add(5, &v);
|
||||
return atomic_read(&v) == 28 ? 0 : -1;
|
||||
}
|
||||
], AC_DEFINE(HAVE_ATOMIC_ADD) atom_ops="${atom_ops}atomic_add ",
|
||||
],
|
||||
[AC_DEFINE([HAVE_ATOMIC_ADD], [1],
|
||||
[atomic_add() from <asm/atomic.h> (Linux only)])
|
||||
atom_ops="${atom_ops}atomic_add "],
|
||||
)
|
||||
AC_TRY_RUN([
|
||||
#include <asm/atomic.h>
|
||||
@ -873,7 +871,10 @@ int main()
|
||||
atomic_sub(5, &v);
|
||||
return atomic_read(&v) == 18 ? 0 : -1;
|
||||
}
|
||||
], AC_DEFINE(HAVE_ATOMIC_SUB) atom_ops="${atom_ops}atomic_sub ",
|
||||
],
|
||||
[AC_DEFINE([HAVE_ATOMIC_SUB], [1],
|
||||
[atomic_sub() from <asm/atomic.h> (Linux only)])
|
||||
atom_ops="${atom_ops}atomic_sub "],
|
||||
)
|
||||
|
||||
if test -z "$atom_ops"; then atom_ops="no"; fi
|
||||
@ -903,7 +904,7 @@ dnl I have no idea if this is a good test - can not find docs for libiberty
|
||||
with_mysqld_ldflags="-all-static"
|
||||
AC_SUBST([pstack_dirs])
|
||||
AC_SUBST([pstack_libs])
|
||||
AC_DEFINE([USE_PSTACK])
|
||||
AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
|
||||
dnl This check isn't needed, but might be nice to give some feedback....
|
||||
dnl AC_CHECK_HEADER(libiberty.h,
|
||||
dnl have_libiberty_h=yes,
|
||||
@ -926,7 +927,7 @@ then
|
||||
fi
|
||||
# We make a special variable for client library's to avoid including
|
||||
# thread libs in the client.
|
||||
NON_THREADED_CLIENT_LIBS="$LIBS"
|
||||
NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS"
|
||||
|
||||
AC_MSG_CHECKING([for int8])
|
||||
case $SYSTEM_TYPE in
|
||||
@ -952,7 +953,11 @@ int main()
|
||||
int8 i;
|
||||
return 0;
|
||||
}
|
||||
], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])
|
||||
],
|
||||
[AC_DEFINE([HAVE_INT_8_16_32], [1],
|
||||
[whether int8, int16 and int32 types exist])
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])]
|
||||
)
|
||||
;;
|
||||
esac
|
||||
@ -964,6 +969,16 @@ esac
|
||||
MAX_C_OPTIMIZE="-O3"
|
||||
MAX_CXX_OPTIMIZE="-O3"
|
||||
|
||||
# workaround for Sun Forte/x86 see BUG#4681
|
||||
case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
|
||||
*solaris*-i?86-no)
|
||||
CFLAGS="$CFLAGS -DBIG_TABLES"
|
||||
CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
|
||||
case $SYSTEM_TYPE in
|
||||
*solaris2.7*)
|
||||
# Solaris 2.7 has a broken /usr/include/widec.h
|
||||
@ -1029,7 +1044,8 @@ case $SYSTEM_TYPE in
|
||||
if test "$ac_cv_prog_gcc" = "no"
|
||||
then
|
||||
CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE"
|
||||
CXXFLAGS="$CXXFLAGS +O2"
|
||||
# set working flags first in line, letting override it (i. e. for debug):
|
||||
CXXFLAGS="+O2 $CXXFLAGS"
|
||||
MAX_C_OPTIMIZE=""
|
||||
MAX_CXX_OPTIMIZE=""
|
||||
ndb_cxxflags_fix="$ndb_cxxflags_fix -Aa"
|
||||
@ -1066,10 +1082,11 @@ case $SYSTEM_TYPE in
|
||||
MAX_C_OPTIMIZE="-O"
|
||||
fi
|
||||
;;
|
||||
*darwin7*)
|
||||
*darwin[[7-8]]*)
|
||||
# don't forget to escape [] like above
|
||||
if test "$ac_cv_prog_gcc" = "yes"
|
||||
then
|
||||
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
|
||||
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
|
||||
CFLAGS="$CFLAGS $FLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||
MAX_C_OPTIMIZE="-O"
|
||||
@ -1097,7 +1114,8 @@ case $SYSTEM_TYPE in
|
||||
*bsdi*)
|
||||
echo "Adding fix for BSDI"
|
||||
CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
|
||||
AC_DEFINE_UNQUOTED(SOCKOPT_OPTLEN_TYPE, size_t)
|
||||
AC_DEFINE_UNQUOTED([SOCKOPT_OPTLEN_TYPE], [size_t],
|
||||
[Last argument to get/setsockopt])
|
||||
;;
|
||||
*sgi-irix6*)
|
||||
if test "$with_named_thread" = "no"
|
||||
@ -1247,7 +1265,8 @@ then
|
||||
if test "$res" -gt 0
|
||||
then
|
||||
AC_MSG_RESULT("Found")
|
||||
AC_DEFINE(HAVE_LINUXTHREADS)
|
||||
AC_DEFINE([HAVE_LINUXTHREADS], [1],
|
||||
[Whether we are using Xavier Leroy's LinuxThreads])
|
||||
# Linux 2.0 sanity check
|
||||
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
|
||||
AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
|
||||
@ -1270,7 +1289,8 @@ Reference Manual for more information.])
|
||||
with_named_thread="-lpthread -lmach -lexc"
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
|
||||
AC_DEFINE(HAVE_DEC_THREADS)
|
||||
AC_DEFINE(HAVE_DEC_THREADS, [1],
|
||||
[Whether we are using DEC threads])
|
||||
AC_MSG_RESULT("yes")
|
||||
else
|
||||
AC_MSG_RESULT("no")
|
||||
@ -1278,8 +1298,9 @@ Reference Manual for more information.])
|
||||
if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
|
||||
then
|
||||
with_named_thread="-lpthreads -lmach -lc_r"
|
||||
AC_DEFINE(HAVE_DEC_THREADS)
|
||||
AC_DEFINE(HAVE_DEC_3_2_THREADS)
|
||||
AC_DEFINE(HAVE_DEC_THREADS, [1])
|
||||
AC_DEFINE([HAVE_DEC_3_2_THREADS], [1],
|
||||
[Whether we are using OSF1 DEC threads on 3.2])
|
||||
with_osf32_threads="yes"
|
||||
MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
|
||||
AC_MSG_RESULT("yes")
|
||||
@ -1309,6 +1330,7 @@ then
|
||||
with_named_thread="-lgthreads -lsocket -lgthreads"
|
||||
# sched.h conflicts with fsu-threads
|
||||
touch ./include/sched.h
|
||||
touch ./include/semaphore.h
|
||||
|
||||
# We must have gcc
|
||||
if expr "$CC" : ".*gcc.*"
|
||||
@ -1353,9 +1375,9 @@ then
|
||||
fi
|
||||
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
||||
then
|
||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
|
||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1])
|
||||
else
|
||||
AC_DEFINE(HAVE_UNIXWARE7_POSIX)
|
||||
AC_DEFINE(HAVE_UNIXWARE7_POSIX, [1])
|
||||
fi
|
||||
AC_MSG_RESULT("yes")
|
||||
# We must have cc
|
||||
@ -1399,9 +1421,9 @@ then
|
||||
fi
|
||||
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
||||
then
|
||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
|
||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1])
|
||||
else
|
||||
AC_DEFINE(HAVE_UNIXWARE7_POSIX)
|
||||
AC_DEFINE(HAVE_UNIXWARE7_POSIX, [1])
|
||||
fi
|
||||
# We must have cc
|
||||
AC_MSG_CHECKING("for gcc")
|
||||
@ -1440,9 +1462,11 @@ then
|
||||
fi
|
||||
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
||||
then
|
||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
|
||||
AC_DEFINE([HAVE_UNIXWARE7_THREADS], [1],
|
||||
[UNIXWARE7 threads are not posix])
|
||||
else
|
||||
AC_DEFINE(HAVE_UNIXWARE7_POSIX)
|
||||
AC_DEFINE([HAVE_UNIXWARE7_POSIX], [1],
|
||||
[new UNIXWARE7 threads that are not yet posix])
|
||||
fi
|
||||
# We must have cc
|
||||
AC_MSG_CHECKING("for gcc")
|
||||
@ -1843,6 +1867,7 @@ MYSQL_HAVE_TIOCGWINSZ
|
||||
MYSQL_HAVE_FIONREAD
|
||||
MYSQL_HAVE_TIOCSTAT
|
||||
MYSQL_STRUCT_DIRENT_D_INO
|
||||
MYSQL_STRUCT_DIRENT_D_NAMLEN
|
||||
MYSQL_TYPE_SIGHANDLER
|
||||
if test "$with_named_curses" = "no"
|
||||
then
|
||||
@ -1852,6 +1877,15 @@ else
|
||||
fi
|
||||
AC_SUBST(TERMCAP_LIB)
|
||||
|
||||
LIBEDIT_LOBJECTS=""
|
||||
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
|
||||
AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
|
||||
AC_CHECK_FUNC(strlcpy, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
|
||||
AC_CHECK_FUNC(strlcat, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
|
||||
AC_CHECK_FUNC(fgetln, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
|
||||
AC_SUBST(LIBEDIT_LOBJECTS)
|
||||
enable_readline="yes"
|
||||
|
||||
# End of readline/libedit stuff
|
||||
#########################################################################
|
||||
|
||||
@ -1891,7 +1925,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
|
||||
AC_MSG_CHECKING(for isinf with <math.h>)
|
||||
AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]),
|
||||
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
CFLAGS="$ORG_CFLAGS"
|
||||
@ -1945,7 +1979,8 @@ AC_LANG_RESTORE
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
if test "$mysql_cv_gethost_style" = "solaris"
|
||||
then
|
||||
AC_DEFINE(HAVE_SOLARIS_STYLE_GETHOST)
|
||||
AC_DEFINE([HAVE_SOLARIS_STYLE_GETHOST], [1],
|
||||
[Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines this with 8 arguments])
|
||||
fi
|
||||
|
||||
#---START: Used in for client configure
|
||||
@ -1979,7 +2014,8 @@ AC_LANG_RESTORE
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
if test "$mysql_cv_gethostname_style" = "glibc2"
|
||||
then
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
||||
AC_DEFINE([HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE], [1],
|
||||
[Solaris define gethostbyname_r with 5 arguments. glibc2 defines this with 6 arguments])
|
||||
fi
|
||||
|
||||
# Check 3rd argument of getthostbyname_r
|
||||
@ -2010,7 +2046,8 @@ AC_LANG_RESTORE
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
if test "$mysql_cv_gethostname_arg" = "hostent_data"
|
||||
then
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURN_INT)
|
||||
AC_DEFINE([HAVE_GETHOSTBYNAME_R_RETURN_INT], [1],
|
||||
[In OSF 4.0f the 3'd argument to gethostname_r is hostent_data *])
|
||||
fi
|
||||
|
||||
|
||||
@ -2029,7 +2066,8 @@ pthread_getspecific((pthread_key_t) NULL); ],
|
||||
mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
|
||||
if test "$mysql_cv_getspecific_args" = "other"
|
||||
then
|
||||
AC_DEFINE(HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
|
||||
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
|
||||
[For some non posix threads])
|
||||
fi
|
||||
|
||||
# Check definition of pthread_mutex_init
|
||||
@ -2047,7 +2085,8 @@ mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
|
||||
mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
|
||||
if test "$mysql_cv_mutex_init_args" = "other"
|
||||
then
|
||||
AC_DEFINE(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT)
|
||||
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
|
||||
[For some non posix threads])
|
||||
fi
|
||||
fi
|
||||
#---END:
|
||||
@ -2067,7 +2106,7 @@ readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
|
||||
mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
|
||||
if test "$mysql_cv_readdir_r" = "POSIX"
|
||||
then
|
||||
AC_DEFINE(HAVE_READDIR_R)
|
||||
AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
|
||||
fi
|
||||
|
||||
# Check definition of posix sigwait()
|
||||
@ -2087,7 +2126,7 @@ sigwait(&set,&sig);
|
||||
mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
|
||||
if test "$mysql_cv_sigwait" = "POSIX"
|
||||
then
|
||||
AC_DEFINE(HAVE_SIGWAIT)
|
||||
AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
|
||||
fi
|
||||
|
||||
if test "$mysql_cv_sigwait" != "POSIX"
|
||||
@ -2108,7 +2147,7 @@ sigwait(&set);],
|
||||
mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
|
||||
if test "$mysql_cv_sigwait" = "NONPOSIX"
|
||||
then
|
||||
AC_DEFINE(HAVE_NONPOSIX_SIGWAIT)
|
||||
AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
|
||||
fi
|
||||
fi
|
||||
#---END:
|
||||
@ -2126,7 +2165,7 @@ pthread_attr_setscope(&thr_attr,0);],
|
||||
mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
|
||||
if test "$mysql_cv_pthread_attr_setscope" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCOPE)
|
||||
AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
|
||||
fi
|
||||
|
||||
# Check for bad includes
|
||||
@ -2142,7 +2181,7 @@ AC_TRY_COMPILE(
|
||||
netinet_inc=yes, netinet_inc=no)
|
||||
if test "$netinet_inc" = "no"
|
||||
then
|
||||
AC_DEFINE(HAVE_BROKEN_NETINET_INCLUDES)
|
||||
AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
|
||||
fi
|
||||
AC_MSG_RESULT("$netinet_inc")
|
||||
|
||||
@ -2167,7 +2206,7 @@ AC_ARG_WITH(query_cache,
|
||||
|
||||
if test "$with_query_cache" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_QUERY_CACHE)
|
||||
AC_DEFINE([HAVE_QUERY_CACHE], [1], [If we want to have query cache])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(geometry,
|
||||
@ -2178,8 +2217,8 @@ AC_ARG_WITH(geometry,
|
||||
|
||||
if test "$with_geometry" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_SPATIAL)
|
||||
AC_DEFINE(HAVE_RTREE_KEYS)
|
||||
AC_DEFINE([HAVE_SPATIAL], [1], [Spatial extentions])
|
||||
AC_DEFINE([HAVE_RTREE_KEYS], [1], [RTree keys])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(embedded_privilege_control,
|
||||
@ -2192,7 +2231,8 @@ AC_ARG_WITH(embedded_privilege_control,
|
||||
|
||||
if test "$with_embedded_privilege_control" = "yes"
|
||||
then
|
||||
AC_DEFINE(HAVE_EMBEDDED_PRIVILEGE_CONTROL)
|
||||
AC_DEFINE([HAVE_EMBEDDED_PRIVILEGE_CONTROL], [1],
|
||||
[Access checks in embedded library])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(extra-tools,
|
||||
@ -2275,6 +2315,20 @@ AC_ARG_WITH(libedit,
|
||||
[ with_libedit=undefined ]
|
||||
)
|
||||
|
||||
#
|
||||
# We support next variants of compilation:
|
||||
# --with-readline
|
||||
# | yes | no | undefined
|
||||
# --with-libedit | | |
|
||||
# ---------------+----------------+------+----------------------------------
|
||||
# yes | ERROR! | use libedit from mysql sources
|
||||
# ---------------+----------------+------+----------------------------------
|
||||
# no | use readline | use system readline or external libedit
|
||||
# | from mysql | according to results of m4 tests
|
||||
# ---------------+ sources (if it + +----------------------------------
|
||||
# undefined | is presented) | | use libedit from mysql sources
|
||||
|
||||
|
||||
compile_readline="no"
|
||||
compile_libedit="no"
|
||||
|
||||
@ -2299,10 +2353,11 @@ then
|
||||
readline_topdir="cmd-line-utils"
|
||||
readline_basedir="libedit"
|
||||
readline_dir="$readline_topdir/$readline_basedir"
|
||||
readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a"
|
||||
readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a"
|
||||
readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/libedit/readline readline"
|
||||
compile_libedit=yes
|
||||
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE)
|
||||
AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
|
||||
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
|
||||
elif test "$with_readline" = "yes"
|
||||
then
|
||||
readline_topdir="cmd-line-utils"
|
||||
@ -2311,10 +2366,14 @@ then
|
||||
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
|
||||
readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/readline readline"
|
||||
compile_readline=yes
|
||||
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE)
|
||||
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
|
||||
else
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
MYSQL_CHECK_LIBEDIT_INTERFACE
|
||||
MYSQL_CHECK_NEW_RL_INTERFACE
|
||||
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
|
||||
AC_LANG_RESTORE
|
||||
if [test "$mysql_cv_new_rl_interface" = "yes"] || [test "$mysql_cv_libedit_interface" = "no"]
|
||||
then
|
||||
readline_link="-lreadline"
|
||||
@ -2339,7 +2398,7 @@ dnl you must also create strings/ctype-$charset_name.c
|
||||
AC_DIVERT_PUSH(0)
|
||||
|
||||
define(CHARSETS_AVAILABLE0,binary)
|
||||
define(CHARSETS_AVAILABLE1,ascii armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
|
||||
define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
|
||||
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 dec8 euckr gb2312 gbk geostd8)
|
||||
define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
|
||||
define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
|
||||
@ -2388,8 +2447,10 @@ elif test "$extra_charsets" = none; then
|
||||
CHARSETS="$CHARSETS"
|
||||
elif test "$extra_charsets" = complex; then
|
||||
CHARSETS="$CHARSETS $CHARSETS_COMPLEX"
|
||||
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
|
||||
elif test "$extra_charsets" = all; then
|
||||
CHARSETS="$CHARSETS $CHARSETS_AVAILABLE"
|
||||
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
|
||||
else
|
||||
EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
|
||||
CHARSETS="$CHARSETS $EXTRA_CHARSETS"
|
||||
@ -2399,121 +2460,124 @@ for cs in $CHARSETS
|
||||
do
|
||||
case $cs in
|
||||
armscii8)
|
||||
AC_DEFINE(HAVE_CHARSET_armscii8)
|
||||
AC_DEFINE(HAVE_CHARSET_armscii8, 1,
|
||||
[Define to enable charset armscii8])
|
||||
;;
|
||||
ascii)
|
||||
AC_DEFINE(HAVE_CHARSET_ascii)
|
||||
AC_DEFINE(HAVE_CHARSET_ascii, 1,
|
||||
[Define to enable ascii character set])
|
||||
;;
|
||||
big5)
|
||||
AC_DEFINE(HAVE_CHARSET_big5)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_big5, 1, [Define to enable charset big5])
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, [1], [ ])
|
||||
;;
|
||||
binary)
|
||||
;;
|
||||
cp1250)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1250)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1250, 1, [Define to enable cp1250])
|
||||
;;
|
||||
cp1251)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1251)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1251, 1, [Define to enable charset cp1251])
|
||||
;;
|
||||
cp1256)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1256)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1256, 1, [Define to enable charset cp1256])
|
||||
;;
|
||||
cp1257)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1257)
|
||||
AC_DEFINE(HAVE_CHARSET_cp1257, 1, [Define to enable charset cp1257])
|
||||
;;
|
||||
cp850)
|
||||
AC_DEFINE(HAVE_CHARSET_cp850)
|
||||
AC_DEFINE(HAVE_CHARSET_cp850, 1, [Define to enable charset cp850])
|
||||
;;
|
||||
cp852)
|
||||
AC_DEFINE(HAVE_CHARSET_cp852)
|
||||
AC_DEFINE(HAVE_CHARSET_cp852, 1, [Define to enable charset cp852])
|
||||
;;
|
||||
cp866)
|
||||
AC_DEFINE(HAVE_CHARSET_cp866)
|
||||
AC_DEFINE(HAVE_CHARSET_cp866, 1, [Define to enable charset cp866])
|
||||
;;
|
||||
dec8)
|
||||
AC_DEFINE(HAVE_CHARSET_dec8)
|
||||
AC_DEFINE(HAVE_CHARSET_dec8, 1, [Define to enable charset dec8])
|
||||
;;
|
||||
euckr)
|
||||
AC_DEFINE(HAVE_CHARSET_euckr)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_euckr, 1, [Define to enable charset euckr])
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
gb2312)
|
||||
AC_DEFINE(HAVE_CHARSET_gb2312)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_gb2312, 1, [Define to enable charset gb2312])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
gbk)
|
||||
AC_DEFINE(HAVE_CHARSET_gbk)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_gbk, 1, [Define to enable charset gbk])
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
geostd8)
|
||||
AC_DEFINE(HAVE_CHARSET_geostd8)
|
||||
AC_DEFINE(HAVE_CHARSET_geostd8, 1, [Define to enable charset geostd8])
|
||||
;;
|
||||
greek)
|
||||
AC_DEFINE(HAVE_CHARSET_greek)
|
||||
AC_DEFINE(HAVE_CHARSET_greek, 1, [Define to enable charset greek])
|
||||
;;
|
||||
hebrew)
|
||||
AC_DEFINE(HAVE_CHARSET_hebrew)
|
||||
AC_DEFINE(HAVE_CHARSET_hebrew, 1, [Define to enable charset hebrew])
|
||||
;;
|
||||
hp8)
|
||||
AC_DEFINE(HAVE_CHARSET_hp8)
|
||||
AC_DEFINE(HAVE_CHARSET_hp8, 1, [Define to enable charset hp8])
|
||||
;;
|
||||
keybcs2)
|
||||
AC_DEFINE(HAVE_CHARSET_keybcs2)
|
||||
AC_DEFINE(HAVE_CHARSET_keybcs2, 1, [Define to enable charset keybcs2])
|
||||
;;
|
||||
koi8r)
|
||||
AC_DEFINE(HAVE_CHARSET_koi8r)
|
||||
AC_DEFINE(HAVE_CHARSET_koi8r, 1, [Define to enable charset koi8r])
|
||||
;;
|
||||
koi8u)
|
||||
AC_DEFINE(HAVE_CHARSET_koi8u)
|
||||
AC_DEFINE(HAVE_CHARSET_koi8u, 1, [Define to enable charset koi8u])
|
||||
;;
|
||||
latin1)
|
||||
AC_DEFINE(HAVE_CHARSET_latin1)
|
||||
AC_DEFINE(HAVE_CHARSET_latin1, 1, [Define to enable charset latin1])
|
||||
;;
|
||||
latin2)
|
||||
AC_DEFINE(HAVE_CHARSET_latin2)
|
||||
AC_DEFINE(HAVE_CHARSET_latin2, 1, [Define to enable charset latin2])
|
||||
;;
|
||||
latin5)
|
||||
AC_DEFINE(HAVE_CHARSET_latin5)
|
||||
AC_DEFINE(HAVE_CHARSET_latin5, 1, [Define to enable charset latin5])
|
||||
;;
|
||||
latin7)
|
||||
AC_DEFINE(HAVE_CHARSET_latin7)
|
||||
AC_DEFINE(HAVE_CHARSET_latin7, 1, [Define to enable charset latin7])
|
||||
;;
|
||||
macce)
|
||||
AC_DEFINE(HAVE_CHARSET_macce)
|
||||
AC_DEFINE(HAVE_CHARSET_macce, 1, [Define to enable charset macce])
|
||||
;;
|
||||
macroman)
|
||||
AC_DEFINE(HAVE_CHARSET_macroman)
|
||||
AC_DEFINE(HAVE_CHARSET_macroman, 1,
|
||||
[Define to enable charset macroman])
|
||||
;;
|
||||
sjis)
|
||||
AC_DEFINE(HAVE_CHARSET_sjis)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_sjis, 1, [Define to enable charset sjis])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
swe7)
|
||||
AC_DEFINE(HAVE_CHARSET_swe7)
|
||||
AC_DEFINE(HAVE_CHARSET_swe7, 1, [Define to enable charset swe7])
|
||||
;;
|
||||
tis620)
|
||||
AC_DEFINE(HAVE_CHARSET_tis620)
|
||||
AC_DEFINE(HAVE_CHARSET_tis620, 1, [Define to enable charset tis620])
|
||||
;;
|
||||
ucs2)
|
||||
AC_DEFINE(HAVE_CHARSET_ucs2)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_ucs2, 1, [Define to enable charset ucs2])
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
ujis)
|
||||
AC_DEFINE(HAVE_CHARSET_ujis)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_ujis, 1, [Define to enable charset ujis])
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf8)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8)
|
||||
AC_DEFINE(USE_MB)
|
||||
AC_DEFINE(USE_MB_IDENT)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable ut8])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE).
|
||||
@ -2543,7 +2607,7 @@ case $default_charset in
|
||||
;;
|
||||
cp1250)
|
||||
default_charset_default_collation="cp1250_general_ci"
|
||||
default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin"
|
||||
default_charset_collations="cp1250_general_ci cp1250_czech_cs cp1250_bin"
|
||||
;;
|
||||
cp1251)
|
||||
default_charset_default_collation="cp1251_general_ci"
|
||||
@ -2619,7 +2683,7 @@ case $default_charset in
|
||||
;;
|
||||
latin2)
|
||||
default_charset_default_collation="latin2_general_ci"
|
||||
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci"
|
||||
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_cs latin2_hungarian_ci latin2_croatian_ci"
|
||||
;;
|
||||
latin5)
|
||||
default_charset_default_collation="latin5_turkish_ci"
|
||||
@ -2711,14 +2775,17 @@ else
|
||||
]);
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_CHARSET_NAME,"$default_charset")
|
||||
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_COLLATION_NAME,"$default_collation")
|
||||
AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_CHARSET_NAME], ["$default_charset"],
|
||||
[Define the default charset name])
|
||||
AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_COLLATION_NAME], ["$default_collation"],
|
||||
[Define the default charset name])
|
||||
|
||||
MYSQL_CHECK_ISAM
|
||||
MYSQL_CHECK_BDB
|
||||
MYSQL_CHECK_INNODB
|
||||
MYSQL_CHECK_EXAMPLEDB
|
||||
MYSQL_CHECK_ARCHIVEDB
|
||||
MYSQL_CHECK_CSVDB
|
||||
MYSQL_CHECK_NDBCLUSTER
|
||||
|
||||
# If we have threads generate some library functions and test programs
|
||||
@ -2735,7 +2802,7 @@ if test "$THREAD_SAFE_CLIENT" != "no"
|
||||
then
|
||||
sql_client_dirs="libmysql_r $sql_client_dirs"
|
||||
linked_client_targets="$linked_client_targets linked_libmysql_r_sources"
|
||||
AC_DEFINE(THREAD_SAFE_CLIENT)
|
||||
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
|
||||
fi
|
||||
|
||||
CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS"
|
||||
@ -2761,7 +2828,8 @@ ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'"
|
||||
|
||||
if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
|
||||
then
|
||||
AC_DEFINE(THREAD)
|
||||
AC_DEFINE([THREAD], [1],
|
||||
[Define if you want to have threaded code. This may be undef on client code])
|
||||
# Avoid _PROGRAMS names
|
||||
THREAD_LPROGRAMS="test_thr_alarm\$(EXEEXT) test_thr_lock\$(EXEEXT)"
|
||||
AC_SUBST(THREAD_LPROGRAMS)
|
||||
@ -2788,7 +2856,7 @@ then
|
||||
AC_CONFIG_FILES(bdb/Makefile)
|
||||
|
||||
echo "CONFIGURING FOR BERKELEY DB"
|
||||
bdb_conf_flags=
|
||||
bdb_conf_flags="--disable-shared"
|
||||
if test $with_debug = "yes"
|
||||
then
|
||||
bdb_conf_flags="$bdb_conf_flags --enable-debug --enable-diagnostic"
|
||||
@ -2821,7 +2889,7 @@ dnl echo "bdb = '$bdb'; inc = '$bdb_includes', lib = '$bdb_libs'"
|
||||
echo "END OF BERKELEY DB CONFIGURATION"
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_BERKELEY_DB)
|
||||
AC_DEFINE([HAVE_BERKELEY_DB], [1], [Have berkeley db installed])
|
||||
else
|
||||
if test -d bdb; then :
|
||||
else
|
||||
@ -2878,7 +2946,7 @@ EOF
|
||||
then
|
||||
# MIT user level threads
|
||||
thread_dirs="mit-pthreads"
|
||||
AC_DEFINE(HAVE_mit_thread)
|
||||
AC_DEFINE([HAVE_mit_thread], [1], [Do we use user level threads])
|
||||
MT_INCLUDES="-I\$(top_srcdir)/mit-pthreads/include"
|
||||
AC_SUBST(MT_INCLUDES)
|
||||
if test -n "$OVERRIDE_MT_LD_ADD"
|
||||
@ -2912,7 +2980,7 @@ AC_SUBST(server_scripts)
|
||||
#if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes"
|
||||
#then
|
||||
# MIT pthreads does now support connecting with unix sockets
|
||||
# AC_DEFINE(HAVE_THREADS_WITHOUT_SOCKETS)
|
||||
# AC_DEFINE([HAVE_THREADS_WITHOUT_SOCKETS], [], [MIT pthreads does not support connecting with unix sockets])
|
||||
#fi
|
||||
|
||||
# Some usefull subst
|
||||
@ -2939,10 +3007,10 @@ then
|
||||
if test "$with_debug" = "yes"
|
||||
then
|
||||
# Medium debug.
|
||||
NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
|
||||
NDB_DEFS="-DNDB_DEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
|
||||
elif test "$with_debug" = "full"
|
||||
then
|
||||
NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
|
||||
NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
|
||||
else
|
||||
NDB_DEFS="-DNDEBUG"
|
||||
fi
|
||||
@ -3042,6 +3110,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
|
||||
include/mysql_version.h dnl
|
||||
cmd-line-utils/Makefile dnl
|
||||
cmd-line-utils/libedit/Makefile dnl
|
||||
zlib/Makefile dnl
|
||||
cmd-line-utils/readline/Makefile)
|
||||
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
|
||||
AC_OUTPUT
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <my_global.h>
|
||||
#include <m_string.h>
|
||||
#include <my_sys.h>
|
||||
#include <my_getopt.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
@ -42,7 +42,7 @@ static struct my_option my_long_options[] =
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
{"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
|
||||
(gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
(gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
#ifdef HAVE_SYS_ERRLIST
|
||||
{"all", 'a', "Print all the error messages and the number.",
|
||||
@ -222,7 +222,7 @@ int main(int argc,char *argv[])
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
if (ndb_code)
|
||||
{
|
||||
if (ndb_error_string(code, ndb_string, 1024) < 0)
|
||||
if (ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0)
|
||||
msg= 0;
|
||||
else
|
||||
msg= ndb_string;
|
||||
|
110
heap/hp_hash.c
110
heap/hp_hash.c
@ -245,7 +245,15 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_TEXT)
|
||||
{
|
||||
seg->charset->coll->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,&nr2);
|
||||
CHARSET_INFO *cs= seg->charset;
|
||||
uint char_length= (uint) ((uchar*) key - pos);
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
uint length= char_length;
|
||||
char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
|
||||
set_if_smaller(char_length, length); /* QQ: ok to remove? */
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -280,7 +288,15 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_TEXT)
|
||||
{
|
||||
seg->charset->coll->hash_sort(seg->charset,pos,end-pos,&nr,&nr2);
|
||||
CHARSET_INFO *cs= seg->charset;
|
||||
uint char_length= seg->length;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(cs, pos, pos + char_length,
|
||||
char_length / cs->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
}
|
||||
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,9 +417,26 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_TEXT)
|
||||
{
|
||||
CHARSET_INFO *cs= seg->charset;
|
||||
uint char_length1;
|
||||
uint char_length2;
|
||||
uchar *pos1= (uchar*)rec1 + seg->start;
|
||||
uchar *pos2= (uchar*)rec2 + seg->start;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
uint char_length= seg->length / cs->mbmaxlen;
|
||||
char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length);
|
||||
set_if_smaller(char_length1, seg->length); /* QQ: ok to remove? */
|
||||
char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length);
|
||||
set_if_smaller(char_length2, seg->length); /* QQ: ok to remove? */
|
||||
}
|
||||
else
|
||||
{
|
||||
char_length1= char_length2= seg->length;
|
||||
}
|
||||
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||
(uchar*) rec1+seg->start,seg->length,
|
||||
(uchar*) rec2+seg->start,seg->length))
|
||||
pos1,char_length1,
|
||||
pos2,char_length2))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -435,9 +468,27 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_TEXT)
|
||||
{
|
||||
CHARSET_INFO *cs= seg->charset;
|
||||
uint char_length_key;
|
||||
uint char_length_rec;
|
||||
uchar *pos= (uchar*) rec + seg->start;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
uint char_length= seg->length / cs->mbmaxlen;
|
||||
char_length_key= my_charpos(cs, key, key + seg->length, char_length);
|
||||
set_if_smaller(char_length_key, seg->length);
|
||||
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length);
|
||||
set_if_smaller(char_length_rec, seg->length);
|
||||
}
|
||||
else
|
||||
{
|
||||
char_length_key= seg->length;
|
||||
char_length_rec= seg->length;
|
||||
}
|
||||
|
||||
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||
(uchar*) rec+seg->start, seg->length,
|
||||
(uchar*) key, seg->length))
|
||||
(uchar*) pos, char_length_rec,
|
||||
(uchar*) key, char_length_key))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -458,13 +509,23 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
|
||||
|
||||
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
|
||||
{
|
||||
CHARSET_INFO *cs= seg->charset;
|
||||
uint char_length= seg->length;
|
||||
uchar *pos= (uchar*) rec + seg->start;
|
||||
if (seg->null_bit)
|
||||
*key++= test(rec[seg->null_pos] & seg->null_bit);
|
||||
memcpy(key,rec+seg->start,(size_t) seg->length);
|
||||
key+=seg->length;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(cs, pos, pos + seg->length,
|
||||
char_length / cs->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
}
|
||||
memcpy(key,rec+seg->start,(size_t) char_length);
|
||||
key+= char_length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
|
||||
const byte *rec, byte *recpos)
|
||||
{
|
||||
@ -473,6 +534,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
|
||||
|
||||
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
|
||||
{
|
||||
uint char_length;
|
||||
if (seg->null_bit)
|
||||
{
|
||||
if (!(*key++= 1 - test(rec[seg->null_pos] & seg->null_bit)))
|
||||
@ -515,14 +577,27 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
|
||||
}
|
||||
continue;
|
||||
}
|
||||
memcpy(key, rec + seg->start, (size_t) seg->length);
|
||||
char_length= seg->length;
|
||||
if (seg->charset->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(seg->charset,
|
||||
rec + seg->start, rec + seg->start + char_length,
|
||||
char_length / seg->charset->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
if (char_length < seg->length)
|
||||
seg->charset->cset->fill(seg->charset, key + char_length,
|
||||
seg->length - char_length, ' ');
|
||||
}
|
||||
memcpy(key, rec + seg->start, (size_t) char_length);
|
||||
key+= seg->length;
|
||||
}
|
||||
memcpy(key, &recpos, sizeof(byte*));
|
||||
return key - start_key;
|
||||
}
|
||||
|
||||
uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
|
||||
|
||||
uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
|
||||
uint k_len)
|
||||
{
|
||||
HA_KEYSEG *seg, *endseg;
|
||||
uchar *start_key= key;
|
||||
@ -530,6 +605,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
|
||||
for (seg= keydef->seg, endseg= seg + keydef->keysegs;
|
||||
seg < endseg && (int) k_len > 0; old+= seg->length, seg++)
|
||||
{
|
||||
uint char_length;
|
||||
if (seg->null_bit)
|
||||
{
|
||||
k_len--;
|
||||
@ -551,19 +627,31 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
memcpy((byte*) key, old, seg->length);
|
||||
char_length= seg->length;
|
||||
if (seg->charset->mbmaxlen > 1)
|
||||
{
|
||||
char_length= my_charpos(seg->charset, old, old+char_length,
|
||||
char_length / seg->charset->mbmaxlen);
|
||||
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
|
||||
if (char_length < seg->length)
|
||||
seg->charset->cset->fill(seg->charset, key + char_length,
|
||||
seg->length - char_length, ' ');
|
||||
}
|
||||
memcpy(key, old, (size_t) char_length);
|
||||
key+= seg->length;
|
||||
k_len-= seg->length;
|
||||
}
|
||||
return key - start_key;
|
||||
}
|
||||
|
||||
|
||||
uint hp_rb_key_length(HP_KEYDEF *keydef,
|
||||
const byte *key __attribute__((unused)))
|
||||
{
|
||||
return keydef->length;
|
||||
}
|
||||
|
||||
|
||||
uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
|
||||
{
|
||||
const byte *start_key= key;
|
||||
|
@ -150,6 +150,9 @@ typedef uint rf_SetTimer;
|
||||
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
|
||||
#endif
|
||||
|
||||
/* ERROR is defined in wingdi.h */
|
||||
#undef ERROR
|
||||
|
||||
/* We need to close files to break connections on shutdown */
|
||||
#ifndef SIGNAL_WITH_VIO_CLOSE
|
||||
#define SIGNAL_WITH_VIO_CLOSE
|
||||
|
@ -149,6 +149,7 @@ typedef struct my_charset_handler_st
|
||||
uint (*well_formed_len)(struct charset_info_st *,
|
||||
const char *b,const char *e, uint nchars);
|
||||
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
|
||||
uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
|
||||
|
||||
/* Unicode convertion */
|
||||
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
|
||||
@ -325,6 +326,7 @@ int my_wildcmp_8bit(CHARSET_INFO *,
|
||||
int escape, int w_one, int w_many);
|
||||
|
||||
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
|
||||
@ -342,6 +344,7 @@ int my_wildcmp_mb(CHARSET_INFO *,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many);
|
||||
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_instr_mb(struct charset_info_st *,
|
||||
@ -391,8 +394,10 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
|
||||
#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
|
||||
#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
|
||||
((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
|
||||
#define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
|
||||
#define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m)))
|
||||
#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
|
||||
#define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
|
||||
|
||||
|
||||
#define use_mb(s) ((s)->cset->ismbchar != NULL)
|
||||
#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
|
||||
|
@ -238,6 +238,9 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
|
||||
#ifndef HAVE_STRTOULL
|
||||
#define HAVE_STRTOULL
|
||||
#endif
|
||||
#ifndef HAVE_STRTOLL
|
||||
#define HAVE_STRTOLL
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_LONG_LONG
|
||||
extern char *longlong2str(longlong val,char *dst,int radix);
|
||||
|
@ -14,6 +14,9 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_getopt_h
|
||||
#define _my_getopt_h
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#define GET_NO_ARG 1
|
||||
@ -51,14 +54,15 @@ struct my_option
|
||||
int app_type; /* To be used by an application */
|
||||
};
|
||||
|
||||
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
|
||||
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
|
||||
|
||||
extern char *disabled_my_option;
|
||||
extern my_bool my_getopt_print_errors;
|
||||
extern my_error_reporter my_getopt_error_reporter;
|
||||
|
||||
extern int handle_options (int *argc, char ***argv,
|
||||
const struct my_option *longopts,
|
||||
my_bool (*get_one_option)(int,
|
||||
const struct my_option *,
|
||||
char *));
|
||||
const struct my_option *longopts, my_get_one_option);
|
||||
extern void my_print_help(const struct my_option *options);
|
||||
extern void my_print_variables(const struct my_option *options);
|
||||
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
||||
@ -66,4 +70,8 @@ extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
||||
|
||||
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
|
||||
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* _my_getopt_h */
|
||||
|
||||
|
@ -644,23 +644,17 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#endif
|
||||
#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
#define INT_MIN32 (long) 0x80000000L
|
||||
#define INT_MAX32 (long) 0x7FFFFFFFL
|
||||
#define INT_MIN24 ((long) 0xff800000L)
|
||||
#define INT_MAX24 0x007fffffL
|
||||
#define INT_MIN16 ((short int) 0x8000)
|
||||
#define INT_MAX16 0x7FFF
|
||||
#define INT_MIN8 ((char) 0x80)
|
||||
#define INT_MAX8 ((char) 0x7F)
|
||||
#else /* Probably Alpha */
|
||||
#define INT_MIN32 ((long) (int) 0x80000000)
|
||||
#define INT_MAX32 ((long) (int) 0x7FFFFFFF)
|
||||
#define INT_MIN24 ((long) (int) 0xff800000)
|
||||
#define INT_MAX24 ((long) (int) 0x007fffff)
|
||||
#define INT_MIN16 ((short int) 0xffff8000)
|
||||
#define INT_MAX16 ((short int) 0x00007FFF)
|
||||
#endif
|
||||
#define INT_MIN32 (~0x7FFFFFFFL)
|
||||
#define INT_MAX32 0x7FFFFFFFL
|
||||
#define UINT_MAX32 0xFFFFFFFFL
|
||||
#define INT_MIN24 (~0x007FFFFF)
|
||||
#define INT_MAX24 0x007FFFFF
|
||||
#define UINT_MAX24 0x00FFFFFF
|
||||
#define INT_MIN16 (~0x7FFF)
|
||||
#define INT_MAX16 0x7FFF
|
||||
#define UINT_MAX16 0xFFFF
|
||||
#define INT_MIN8 (~0x7F)
|
||||
#define INT_MAX8 0x7F
|
||||
|
||||
/* From limits.h instead */
|
||||
#ifndef DBL_MIN
|
||||
|
@ -251,6 +251,12 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */
|
||||
my_string *wild; /* Pointer to wildcards */
|
||||
} WF_PACK;
|
||||
|
||||
enum loglevel {
|
||||
ERROR_LEVEL,
|
||||
WARNING_LEVEL,
|
||||
INFORMATION_LEVEL
|
||||
};
|
||||
|
||||
enum cache_type
|
||||
{
|
||||
READ_CACHE,WRITE_CACHE,
|
||||
|
@ -27,6 +27,16 @@
|
||||
C_MODE_START
|
||||
|
||||
extern ulonglong log_10_int[20];
|
||||
extern uchar days_in_month[];
|
||||
|
||||
/*
|
||||
Portable time_t replacement.
|
||||
Should be signed and hold seconds for 1902-2038 range.
|
||||
*/
|
||||
typedef long my_time_t;
|
||||
|
||||
#define MY_TIME_T_MAX LONG_MAX
|
||||
#define MY_TIME_T_MIN LONG_MIN
|
||||
|
||||
#define YY_PART_YEAR 70
|
||||
|
||||
@ -41,6 +51,15 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
int *was_cut);
|
||||
|
||||
long calc_daynr(uint year,uint month,uint day);
|
||||
|
||||
void init_time(void);
|
||||
|
||||
my_time_t
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
|
||||
|
||||
void set_zero_time(MYSQL_TIME *tm);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* _my_time_h_ */
|
||||
|
@ -22,215 +22,218 @@
|
||||
*/
|
||||
|
||||
/* these two are for uniformity */
|
||||
#define mi_sint1korr(A) (int8)(*A)
|
||||
#define mi_uint1korr(A) (uint8)(*A)
|
||||
#define mi_sint1korr(A) ((int8)(*A))
|
||||
#define mi_uint1korr(A) ((uint8)(*A))
|
||||
|
||||
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
|
||||
((int16) ((int16) (A)[0]) << 8))
|
||||
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
|
||||
(((uint32) 255L << 24) | \
|
||||
(((uint32) (uchar) (A)[0]) << 16) |\
|
||||
(((uint32) (uchar) (A)[1]) << 8) | \
|
||||
((uint32) (uchar) (A)[2])) : \
|
||||
(((uint32) (uchar) (A)[0]) << 16) |\
|
||||
(((uint32) (uchar) (A)[1]) << 8) | \
|
||||
((uint32) (uchar) (A)[2])))
|
||||
#define mi_sint4korr(A) (int32) (((int32) ((uchar) (A)[3])) +\
|
||||
(((int32) ((uchar) (A)[2]) << 8)) +\
|
||||
(((int32) ((uchar) (A)[1]) << 16)) +\
|
||||
(((int32) ((int16) (A)[0]) << 24)))
|
||||
#define mi_sint8korr(A) (longlong) mi_uint8korr(A)
|
||||
#define mi_uint2korr(A) (uint16) (((uint16) ((uchar) (A)[1])) +\
|
||||
((uint16) ((uchar) (A)[0]) << 8))
|
||||
#define mi_uint3korr(A) (uint32) (((uint32) ((uchar) (A)[2])) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[0])) << 16))
|
||||
#define mi_uint4korr(A) (uint32) (((uint32) ((uchar) (A)[3])) +\
|
||||
(((uint32) ((uchar) (A)[2])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[0])) << 24))
|
||||
#define mi_uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[4])) +\
|
||||
(((uint32) ((uchar) (A)[3])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[2])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 24)) +\
|
||||
(((ulonglong) ((uchar) (A)[0])) << 32))
|
||||
#define mi_uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[5])) +\
|
||||
(((uint32) ((uchar) (A)[4])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[3])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[2])) << 24)) +\
|
||||
(((ulonglong) (((uint32) ((uchar) (A)[1])) +\
|
||||
(((uint32) ((uchar) (A)[0]) << 8)))) <<\
|
||||
32))
|
||||
#define mi_uint7korr(A) ((ulonglong)(((uint32) ((uchar) (A)[6])) +\
|
||||
(((uint32) ((uchar) (A)[5])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[4])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[3])) << 24)) +\
|
||||
(((ulonglong) (((uint32) ((uchar) (A)[2])) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[0])) << 16))) <<\
|
||||
32))
|
||||
#define mi_uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[7])) +\
|
||||
(((uint32) ((uchar) (A)[6])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[5])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[4])) << 24)) +\
|
||||
(((ulonglong) (((uint32) ((uchar) (A)[3])) +\
|
||||
(((uint32) ((uchar) (A)[2])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 16) +\
|
||||
(((uint32) ((uchar) (A)[0])) << 24))) <<\
|
||||
32))
|
||||
#define mi_sint2korr(A) ((int16) (((int16) (((uchar*) (A))[1])) +\
|
||||
((int16) ((int16) ((char*) (A))[0]) << 8)))
|
||||
#define mi_sint3korr(A) ((int32) (((((uchar*) (A))[0]) & 128) ? \
|
||||
(((uint32) 255L << 24) | \
|
||||
(((uint32) ((uchar*) (A))[0]) << 16) |\
|
||||
(((uint32) ((uchar*) (A))[1]) << 8) | \
|
||||
((uint32) ((uchar*) (A))[2])) : \
|
||||
(((uint32) ((uchar*) (A))[0]) << 16) |\
|
||||
(((uint32) ((uchar*) (A))[1]) << 8) | \
|
||||
((uint32) ((uchar*) (A))[2])))
|
||||
#define mi_sint4korr(A) ((int32) (((int32) (((uchar*) (A))[3])) +\
|
||||
((int32) (((uchar*) (A))[2]) << 8) +\
|
||||
((int32) (((uchar*) (A))[1]) << 16) +\
|
||||
((int32) ((int16) ((char*) (A))[0]) << 24)))
|
||||
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
|
||||
#define mi_uint2korr(A) ((uint16) (((uint16) (((uchar*) (A))[1])) +\
|
||||
((uint16) (((uchar*) (A))[0]) << 8)))
|
||||
#define mi_uint3korr(A) ((uint32) (((uint32) (((uchar*) (A))[2])) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 16)))
|
||||
#define mi_uint4korr(A) ((uint32) (((uint32) (((uchar*) (A))[3])) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 24)))
|
||||
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[4])) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 24)) +\
|
||||
(((ulonglong) (((uchar*) (A))[0])) << 32))
|
||||
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[1])) +\
|
||||
(((uint32) (((uchar*) (A))[0]) << 8)))) <<\
|
||||
32))
|
||||
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\
|
||||
(((uint32) (((uchar*) (A))[5])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[2])) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 16))) <<\
|
||||
32))
|
||||
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
|
||||
(((uint32) (((uchar*) (A))[6])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[5])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[3])) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 24))) <<\
|
||||
32))
|
||||
|
||||
/* This one is for uniformity */
|
||||
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
|
||||
|
||||
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
|
||||
*((uchar*) ((T)+1))= (uchar)(def_temp); \
|
||||
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }
|
||||
#define mi_int3store(T,A) { /*lint -save -e734 */\
|
||||
ulong def_temp= (ulong) (A);\
|
||||
*(((T)+2))=(char) (def_temp);\
|
||||
*((T)+1)= (char) (def_temp >> 8);\
|
||||
*((T)+0)= (char) (def_temp >> 16);\
|
||||
/*lint -restore */}
|
||||
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
|
||||
*((T)+3)=(char) (def_temp);\
|
||||
*((T)+2)=(char) (def_temp >> 8);\
|
||||
*((T)+1)=(char) (def_temp >> 16);\
|
||||
*((T)+0)=(char) (def_temp >> 24); }
|
||||
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
*((T)+4)=(char) (def_temp);\
|
||||
*((T)+3)=(char) (def_temp >> 8);\
|
||||
*((T)+2)=(char) (def_temp >> 16);\
|
||||
*((T)+1)=(char) (def_temp >> 24);\
|
||||
*((T)+0)=(char) (def_temp2); }
|
||||
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
*((T)+5)=(char) (def_temp);\
|
||||
*((T)+4)=(char) (def_temp >> 8);\
|
||||
*((T)+3)=(char) (def_temp >> 16);\
|
||||
*((T)+2)=(char) (def_temp >> 24);\
|
||||
*((T)+1)=(char) (def_temp2);\
|
||||
*((T)+0)=(char) (def_temp2 >> 8); }
|
||||
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
*((T)+6)=(char) (def_temp);\
|
||||
*((T)+5)=(char) (def_temp >> 8);\
|
||||
*((T)+4)=(char) (def_temp >> 16);\
|
||||
*((T)+3)=(char) (def_temp >> 24);\
|
||||
*((T)+2)=(char) (def_temp2);\
|
||||
*((T)+1)=(char) (def_temp2 >> 8);\
|
||||
*((T)+0)=(char) (def_temp2 >> 16); }
|
||||
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A), \
|
||||
def_temp4= (ulong) ((A) >> 32); \
|
||||
mi_int4store((T),def_temp4); \
|
||||
mi_int4store((T+4),def_temp3); \
|
||||
}
|
||||
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 8); }
|
||||
#define mi_int3store(T,A) { /*lint -save -e734 */\
|
||||
ulong def_temp= (ulong) (A);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 16);\
|
||||
/*lint -restore */}
|
||||
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 24); }
|
||||
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2); }
|
||||
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[5]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp2);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); }
|
||||
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[6]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[5]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp2);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); }
|
||||
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\
|
||||
def_temp4= (ulong) ((A) >> 32);\
|
||||
mi_int4store((uchar*) (T) + 0, def_temp4);\
|
||||
mi_int4store((uchar*) (T) + 4, def_temp3); }
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
|
||||
#define mi_float4store(T,A) { *(T)= ((byte *) &A)[0];\
|
||||
*((T)+1)=(char) ((byte *) &A)[1];\
|
||||
*((T)+2)=(char) ((byte *) &A)[2];\
|
||||
*((T)+3)=(char) ((byte *) &A)[3]; }
|
||||
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\
|
||||
((uchar*) (T))[1]= ((uchar*) &A)[1];\
|
||||
((uchar*) (T))[2]= ((uchar*) &A)[2];\
|
||||
((uchar*) (T))[3]= ((uchar*) &A)[3]; }
|
||||
|
||||
#define mi_float4get(V,M) { float def_temp;\
|
||||
((byte*) &def_temp)[0]=(M)[0];\
|
||||
((byte*) &def_temp)[1]=(M)[1];\
|
||||
((byte*) &def_temp)[2]=(M)[2];\
|
||||
((byte*) &def_temp)[3]=(M)[3];\
|
||||
(V)=def_temp; }
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[0];\
|
||||
*((T)+1)=(char) ((byte *) &V)[1];\
|
||||
*((T)+2)=(char) ((byte *) &V)[2];\
|
||||
*((T)+3)=(char) ((byte *) &V)[3];\
|
||||
*((T)+4)=(char) ((byte *) &V)[4];\
|
||||
*((T)+5)=(char) ((byte *) &V)[5];\
|
||||
*((T)+6)=(char) ((byte *) &V)[6];\
|
||||
*((T)+7)=(char) ((byte *) &V)[7]; }
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[0];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[4];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[7]; }
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((byte*) &def_temp)[0]=(M)[0];\
|
||||
((byte*) &def_temp)[1]=(M)[1];\
|
||||
((byte*) &def_temp)[2]=(M)[2];\
|
||||
((byte*) &def_temp)[3]=(M)[3];\
|
||||
((byte*) &def_temp)[4]=(M)[4];\
|
||||
((byte*) &def_temp)[5]=(M)[5];\
|
||||
((byte*) &def_temp)[6]=(M)[6];\
|
||||
((byte*) &def_temp)[7]=(M)[7]; \
|
||||
(V)=def_temp; }
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[4];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[7]; \
|
||||
(V)= def_temp; }
|
||||
#else
|
||||
|
||||
#define mi_float4store(T,A) { *(T)= ((byte *) &A)[3];\
|
||||
*((T)+1)=(char) ((byte *) &A)[2];\
|
||||
*((T)+2)=(char) ((byte *) &A)[1];\
|
||||
*((T)+3)=(char) ((byte *) &A)[0]; }
|
||||
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[3];\
|
||||
((uchar*) (T))[1]= ((uchar*) &A)[2];\
|
||||
((uchar*) (T))[2]= ((uchar*) &A)[1];\
|
||||
((uchar*) (T))[3]= ((uchar*) &A)[0]; }
|
||||
|
||||
#define mi_float4get(V,M) { float def_temp;\
|
||||
((byte*) &def_temp)[0]=(M)[3];\
|
||||
((byte*) &def_temp)[1]=(M)[2];\
|
||||
((byte*) &def_temp)[2]=(M)[1];\
|
||||
((byte*) &def_temp)[3]=(M)[0];\
|
||||
(V)=def_temp; }
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[3];\
|
||||
*((T)+1)=(char) ((byte *) &V)[2];\
|
||||
*((T)+2)=(char) ((byte *) &V)[1];\
|
||||
*((T)+3)=(char) ((byte *) &V)[0];\
|
||||
*((T)+4)=(char) ((byte *) &V)[7];\
|
||||
*((T)+5)=(char) ((byte *) &V)[6];\
|
||||
*((T)+6)=(char) ((byte *) &V)[5];\
|
||||
*((T)+7)=(char) ((byte *) &V)[4];}
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[0];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[7];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[4];}
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((byte*) &def_temp)[0]=(M)[3];\
|
||||
((byte*) &def_temp)[1]=(M)[2];\
|
||||
((byte*) &def_temp)[2]=(M)[1];\
|
||||
((byte*) &def_temp)[3]=(M)[0];\
|
||||
((byte*) &def_temp)[4]=(M)[7];\
|
||||
((byte*) &def_temp)[5]=(M)[6];\
|
||||
((byte*) &def_temp)[6]=(M)[5];\
|
||||
((byte*) &def_temp)[7]=(M)[4];\
|
||||
(V)=def_temp; }
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[7];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[4];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#else
|
||||
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[7];\
|
||||
*((T)+1)=(char) ((byte *) &V)[6];\
|
||||
*((T)+2)=(char) ((byte *) &V)[5];\
|
||||
*((T)+3)=(char) ((byte *) &V)[4];\
|
||||
*((T)+4)=(char) ((byte *) &V)[3];\
|
||||
*((T)+5)=(char) ((byte *) &V)[2];\
|
||||
*((T)+6)=(char) ((byte *) &V)[1];\
|
||||
*((T)+7)=(char) ((byte *) &V)[0];}
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[7];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[4];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[0];}
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((byte*) &def_temp)[0]=(M)[7];\
|
||||
((byte*) &def_temp)[1]=(M)[6];\
|
||||
((byte*) &def_temp)[2]=(M)[5];\
|
||||
((byte*) &def_temp)[3]=(M)[4];\
|
||||
((byte*) &def_temp)[4]=(M)[3];\
|
||||
((byte*) &def_temp)[5]=(M)[2];\
|
||||
((byte*) &def_temp)[6]=(M)[1];\
|
||||
((byte*) &def_temp)[7]=(M)[0];\
|
||||
(V)=def_temp; }
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[7];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[4];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[0];\
|
||||
(V)= def_temp; }
|
||||
#endif /* __FLOAT_WORD_ORDER */
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
|
||||
|
||||
#ifdef BIG_TABLES
|
||||
#define mi_rowstore(T,A) mi_int8store(T,A)
|
||||
#define mi_rowkorr(T) mi_uint8korr(T)
|
||||
#define mi_rowstore(T,A) mi_int8store(T, A)
|
||||
#define mi_rowkorr(T) mi_uint8korr(T)
|
||||
#else
|
||||
#define mi_rowstore(T,A) { mi_int4store(T,0); mi_int4store(((T)+4),A); }
|
||||
#define mi_rowkorr(T) mi_uint4korr((T)+4)
|
||||
#define mi_rowstore(T,A) { mi_int4store(T, 0);\
|
||||
mi_int4store(((uchar*) (T) + 4), A); }
|
||||
#define mi_rowkorr(T) mi_uint4korr((uchar*) (T) + 4)
|
||||
#endif
|
||||
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#define mi_sizestore(T,A) mi_int8store(T,A)
|
||||
#define mi_sizekorr(T) mi_uint8korr(T)
|
||||
#define mi_sizestore(T,A) mi_int8store(T, A)
|
||||
#define mi_sizekorr(T) mi_uint8korr(T)
|
||||
#else
|
||||
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR) bfill((char*) (T),8,255); else { mi_int4store((T),0); mi_int4store(((T)+4),A); }}
|
||||
#define mi_sizekorr(T) mi_uint4korr((T)+4)
|
||||
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\
|
||||
bfill((char*) (T), 8, 255);\
|
||||
else { mi_int4store((T), 0);\
|
||||
mi_int4store(((T) + 4), A); }}
|
||||
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
|
||||
#endif
|
||||
|
@ -99,7 +99,7 @@ typedef struct st_mysql_field {
|
||||
unsigned int flags; /* Div flags */
|
||||
unsigned int decimals; /* Number of decimals in field */
|
||||
unsigned int charsetnr; /* Character set */
|
||||
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
|
||||
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
|
||||
} MYSQL_FIELD;
|
||||
|
||||
typedef char **MYSQL_ROW; /* return data as array of strings */
|
||||
@ -175,7 +175,7 @@ struct st_mysql_options {
|
||||
*/
|
||||
my_bool rpl_parse;
|
||||
/*
|
||||
If set, never read from a master,only from slave, when doing
|
||||
If set, never read from a master, only from slave, when doing
|
||||
a read that is replication-aware
|
||||
*/
|
||||
my_bool no_master_reads;
|
||||
@ -454,7 +454,7 @@ int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
|
||||
const char* passwd);
|
||||
|
||||
int STDCALL mysql_shutdown(MYSQL *mysql,
|
||||
enum enum_shutdown_level
|
||||
enum mysql_enum_shutdown_level
|
||||
shutdown_level);
|
||||
int STDCALL mysql_dump_debug_info(MYSQL *mysql);
|
||||
int STDCALL mysql_refresh(MYSQL *mysql,
|
||||
@ -538,7 +538,7 @@ enum enum_mysql_stmt_state
|
||||
typedef struct st_mysql_bind
|
||||
{
|
||||
unsigned long *length; /* output length pointer */
|
||||
my_bool *is_null; /* Pointer to null indicators */
|
||||
my_bool *is_null; /* Pointer to null indicator */
|
||||
void *buffer; /* buffer to get/put data */
|
||||
enum enum_field_types buffer_type; /* buffer type */
|
||||
unsigned long buffer_length; /* buffer length, must be set for str/binary */
|
||||
@ -587,7 +587,7 @@ typedef struct st_mysql_stmt
|
||||
*/
|
||||
unsigned int server_status;
|
||||
unsigned int last_errno; /* error code */
|
||||
unsigned int param_count; /* inpute parameters count */
|
||||
unsigned int param_count; /* input parameter count */
|
||||
unsigned int field_count; /* number of columns in result set */
|
||||
enum enum_mysql_stmt_state state; /* statement state */
|
||||
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
|
||||
@ -638,6 +638,7 @@ typedef struct st_mysql_methods
|
||||
MYSQL_RES * (*use_result)(MYSQL *mysql);
|
||||
void (*fetch_lengths)(unsigned long *to,
|
||||
MYSQL_ROW column, unsigned int field_count);
|
||||
void (*flush_use_result)(MYSQL *mysql);
|
||||
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
|
||||
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
|
||||
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
|
||||
|
@ -242,25 +242,32 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
|
||||
#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM
|
||||
#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
|
||||
|
||||
enum enum_shutdown_level {
|
||||
|
||||
/* Shutdown/kill enums and constants */
|
||||
|
||||
/* Bits for THD::killable. */
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
|
||||
#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3)
|
||||
|
||||
enum mysql_enum_shutdown_level {
|
||||
/*
|
||||
We want levels to be in growing order of hardness. So we leave room
|
||||
for future intermediate levels. For now, escalating one level is += 10;
|
||||
later if we insert new levels in between we will need a function
|
||||
next_shutdown_level(level). Note that DEFAULT does not respect the
|
||||
growing property.
|
||||
We want levels to be in growing order of hardness (because we use number
|
||||
comparisons). Note that DEFAULT does not respect the growing property, but
|
||||
it's ok.
|
||||
*/
|
||||
SHUTDOWN_DEFAULT= 0, /* mapped to WAIT_ALL_BUFFERS for now */
|
||||
/*
|
||||
Here is the list in growing order (the next does the previous plus
|
||||
something). WAIT_ALL_BUFFERS is what we have now. Others are "this MySQL
|
||||
server does not support this shutdown level yet".
|
||||
*/
|
||||
SHUTDOWN_WAIT_CONNECTIONS= 10, /* wait for existing connections to finish */
|
||||
SHUTDOWN_WAIT_TRANSACTIONS= 20, /* wait for existing trans to finish */
|
||||
SHUTDOWN_WAIT_STATEMENTS= 30, /* wait for existing updating stmts to finish */
|
||||
SHUTDOWN_WAIT_ALL_BUFFERS= 40, /* flush InnoDB buffers */
|
||||
SHUTDOWN_WAIT_CRITICAL_BUFFERS= 50, /* flush MyISAM buffs (no corruption) */
|
||||
SHUTDOWN_DEFAULT = 0,
|
||||
/* wait for existing connections to finish */
|
||||
SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT,
|
||||
/* wait for existing trans to finish */
|
||||
SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS,
|
||||
/* wait for existing updates to finish (=> no partial MyISAM update) */
|
||||
SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE,
|
||||
/* flush InnoDB buffers and other storage engines' buffers*/
|
||||
SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
|
||||
/* don't flush InnoDB buffers, flush other storage engines' buffers*/
|
||||
SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
|
||||
/* Now the 2 levels of the KILL command */
|
||||
#if MYSQL_VERSION_ID >= 50000
|
||||
KILL_QUERY= 254,
|
||||
|
@ -17,7 +17,14 @@
|
||||
#ifndef _mysql_time_h_
|
||||
#define _mysql_time_h_
|
||||
|
||||
/* Time declarations shared between server and client library */
|
||||
/*
|
||||
Time declarations shared between the server and client API:
|
||||
you should not add anything to this header unless it's used
|
||||
(and hence should be visible) in mysql.h.
|
||||
If you're looking for a place to add new time-related declaration,
|
||||
it's most likely my_time.h. See also "C API Handling of Date
|
||||
and Time Values" chapter in documentation.
|
||||
*/
|
||||
|
||||
enum enum_mysql_timestamp_type
|
||||
{
|
||||
|
@ -318,60 +318,61 @@
|
||||
#define ER_WARN_INVALID_TIMESTAMP 1299
|
||||
#define ER_INVALID_CHARACTER_STRING 1300
|
||||
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
|
||||
#define ER_SP_NO_RECURSIVE_CREATE 1302
|
||||
#define ER_SP_ALREADY_EXISTS 1303
|
||||
#define ER_SP_DOES_NOT_EXIST 1304
|
||||
#define ER_SP_DROP_FAILED 1305
|
||||
#define ER_SP_STORE_FAILED 1306
|
||||
#define ER_SP_LILABEL_MISMATCH 1307
|
||||
#define ER_SP_LABEL_REDEFINE 1308
|
||||
#define ER_SP_LABEL_MISMATCH 1309
|
||||
#define ER_SP_UNINIT_VAR 1310
|
||||
#define ER_SP_BADSELECT 1311
|
||||
#define ER_SP_BADRETURN 1312
|
||||
#define ER_SP_BADSTATEMENT 1313
|
||||
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1314
|
||||
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1315
|
||||
#define ER_QUERY_INTERRUPTED 1316
|
||||
#define ER_SP_WRONG_NO_OF_ARGS 1317
|
||||
#define ER_SP_COND_MISMATCH 1318
|
||||
#define ER_SP_NORETURN 1319
|
||||
#define ER_SP_NORETURNEND 1320
|
||||
#define ER_SP_BAD_CURSOR_QUERY 1321
|
||||
#define ER_SP_BAD_CURSOR_SELECT 1322
|
||||
#define ER_SP_CURSOR_MISMATCH 1323
|
||||
#define ER_SP_CURSOR_ALREADY_OPEN 1324
|
||||
#define ER_SP_CURSOR_NOT_OPEN 1325
|
||||
#define ER_SP_UNDECLARED_VAR 1326
|
||||
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1327
|
||||
#define ER_SP_FETCH_NO_DATA 1328
|
||||
#define ER_SP_DUP_PARAM 1329
|
||||
#define ER_SP_DUP_VAR 1330
|
||||
#define ER_SP_DUP_COND 1331
|
||||
#define ER_SP_DUP_CURS 1332
|
||||
#define ER_SP_CANT_ALTER 1333
|
||||
#define ER_SP_SUBSELECT_NYI 1334
|
||||
#define ER_SP_NO_USE 1335
|
||||
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1336
|
||||
#define ER_SP_CURSOR_AFTER_HANDLER 1337
|
||||
#define ER_SP_CASE_NOT_FOUND 1338
|
||||
#define ER_FPARSER_TOO_BIG_FILE 1339
|
||||
#define ER_FPARSER_BAD_HEADER 1340
|
||||
#define ER_FPARSER_EOF_IN_COMMENT 1341
|
||||
#define ER_FPARSER_ERROR_IN_PARAMETER 1342
|
||||
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1343
|
||||
#define ER_VIEW_NO_EXPLAIN 1344
|
||||
#define ER_FRM_UNKNOWN_TYPE 1345
|
||||
#define ER_WRONG_OBJECT 1346
|
||||
#define ER_NONUPDATEABLE_COLUMN 1347
|
||||
#define ER_VIEW_SELECT_DERIVED 1348
|
||||
#define ER_VIEW_SELECT_PROCEDURE 1349
|
||||
#define ER_VIEW_SELECT_VARIABLE 1350
|
||||
#define ER_VIEW_SELECT_TMPTABLE 1351
|
||||
#define ER_VIEW_WRONG_LIST 1352
|
||||
#define ER_WARN_VIEW_MERGE 1353
|
||||
#define ER_WARN_VIEW_WITHOUT_KEY 1354
|
||||
#define ER_VIEW_INVALID 1355
|
||||
#define ER_SP_NO_DROP_SP 1356
|
||||
#define ER_SP_GOTO_IN_HNDLR 1357
|
||||
#define ER_ERROR_MESSAGES 357
|
||||
#define ER_CONFLICTING_DECLARATIONS 1302
|
||||
#define ER_SP_NO_RECURSIVE_CREATE 1303
|
||||
#define ER_SP_ALREADY_EXISTS 1304
|
||||
#define ER_SP_DOES_NOT_EXIST 1305
|
||||
#define ER_SP_DROP_FAILED 1306
|
||||
#define ER_SP_STORE_FAILED 1307
|
||||
#define ER_SP_LILABEL_MISMATCH 1308
|
||||
#define ER_SP_LABEL_REDEFINE 1309
|
||||
#define ER_SP_LABEL_MISMATCH 1310
|
||||
#define ER_SP_UNINIT_VAR 1311
|
||||
#define ER_SP_BADSELECT 1312
|
||||
#define ER_SP_BADRETURN 1313
|
||||
#define ER_SP_BADSTATEMENT 1314
|
||||
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315
|
||||
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316
|
||||
#define ER_QUERY_INTERRUPTED 1317
|
||||
#define ER_SP_WRONG_NO_OF_ARGS 1318
|
||||
#define ER_SP_COND_MISMATCH 1319
|
||||
#define ER_SP_NORETURN 1320
|
||||
#define ER_SP_NORETURNEND 1321
|
||||
#define ER_SP_BAD_CURSOR_QUERY 1322
|
||||
#define ER_SP_BAD_CURSOR_SELECT 1323
|
||||
#define ER_SP_CURSOR_MISMATCH 1324
|
||||
#define ER_SP_CURSOR_ALREADY_OPEN 1325
|
||||
#define ER_SP_CURSOR_NOT_OPEN 1326
|
||||
#define ER_SP_UNDECLARED_VAR 1327
|
||||
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328
|
||||
#define ER_SP_FETCH_NO_DATA 1329
|
||||
#define ER_SP_DUP_PARAM 1330
|
||||
#define ER_SP_DUP_VAR 1331
|
||||
#define ER_SP_DUP_COND 1332
|
||||
#define ER_SP_DUP_CURS 1333
|
||||
#define ER_SP_CANT_ALTER 1334
|
||||
#define ER_SP_SUBSELECT_NYI 1335
|
||||
#define ER_SP_NO_USE 1336
|
||||
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337
|
||||
#define ER_SP_CURSOR_AFTER_HANDLER 1338
|
||||
#define ER_SP_CASE_NOT_FOUND 1339
|
||||
#define ER_FPARSER_TOO_BIG_FILE 1340
|
||||
#define ER_FPARSER_BAD_HEADER 1341
|
||||
#define ER_FPARSER_EOF_IN_COMMENT 1342
|
||||
#define ER_FPARSER_ERROR_IN_PARAMETER 1343
|
||||
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344
|
||||
#define ER_VIEW_NO_EXPLAIN 1345
|
||||
#define ER_FRM_UNKNOWN_TYPE 1346
|
||||
#define ER_WRONG_OBJECT 1347
|
||||
#define ER_NONUPDATEABLE_COLUMN 1348
|
||||
#define ER_VIEW_SELECT_DERIVED 1349
|
||||
#define ER_VIEW_SELECT_PROCEDURE 1350
|
||||
#define ER_VIEW_SELECT_VARIABLE 1351
|
||||
#define ER_VIEW_SELECT_TMPTABLE 1352
|
||||
#define ER_VIEW_WRONG_LIST 1353
|
||||
#define ER_WARN_VIEW_MERGE 1354
|
||||
#define ER_WARN_VIEW_WITHOUT_KEY 1355
|
||||
#define ER_VIEW_INVALID 1356
|
||||
#define ER_SP_NO_DROP_SP 1357
|
||||
#define ER_SP_GOTO_IN_HNDLR 1358
|
||||
#define ER_ERROR_MESSAGES 359
|
||||
|
@ -25,7 +25,6 @@ extern "C" {
|
||||
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||
my_bool default_value, uint server_capabilities);
|
||||
void free_rows(MYSQL_DATA *cur);
|
||||
void flush_use_result(MYSQL *mysql);
|
||||
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
|
||||
void free_old_query(MYSQL *mysql);
|
||||
void end_server(MYSQL *mysql);
|
||||
|
@ -217,7 +217,9 @@ buf_flush_buffered_writes(void)
|
||||
/*===========================*/
|
||||
{
|
||||
buf_block_t* block;
|
||||
byte* write_buf;
|
||||
ulint len;
|
||||
ulint len2;
|
||||
ulint i;
|
||||
|
||||
if (trx_doublewrite == NULL) {
|
||||
@ -244,6 +246,16 @@ buf_flush_buffered_writes(void)
|
||||
block = trx_doublewrite->buf_block_arr[i];
|
||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
|
||||
"InnoDB: before posting to the doublewrite buffer.\n");
|
||||
}
|
||||
|
||||
if (block->check_index_page_at_flush
|
||||
&& !page_simple_validate(block->frame)) {
|
||||
|
||||
@ -272,6 +284,19 @@ buf_flush_buffered_writes(void)
|
||||
trx_doublewrite->block1, 0, len,
|
||||
(void*)trx_doublewrite->write_buf, NULL);
|
||||
|
||||
write_buf = trx_doublewrite->write_buf;
|
||||
|
||||
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
|
||||
if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
len = (trx_doublewrite->first_free
|
||||
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
|
||||
@ -282,6 +307,22 @@ buf_flush_buffered_writes(void)
|
||||
(void*)(trx_doublewrite->write_buf
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
|
||||
NULL);
|
||||
|
||||
write_buf = trx_doublewrite->write_buf
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
|
||||
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
|
||||
len2 += UNIV_PAGE_SIZE) {
|
||||
if (mach_read_from_4(write_buf + len2
|
||||
+ FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(write_buf + len2
|
||||
+ UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now flush the doublewrite buffer data to disk */
|
||||
@ -295,6 +336,18 @@ buf_flush_buffered_writes(void)
|
||||
for (i = 0; i < trx_doublewrite->first_free; i++) {
|
||||
block = trx_doublewrite->buf_block_arr[i];
|
||||
|
||||
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
|
||||
"InnoDB: after posting and flushing the doublewrite buffer.\n"
|
||||
"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
|
||||
(ulong)block->buf_fix_count, (ulong)block->io_fix,
|
||||
(ulong)block->state);
|
||||
}
|
||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
@ -412,6 +465,9 @@ buf_flush_write_block_low(
|
||||
/*======================*/
|
||||
buf_block_t* block) /* in: buffer block to write */
|
||||
{
|
||||
#ifdef UNIV_LOG_DEBUG
|
||||
static ibool univ_log_debug_warned;
|
||||
#endif /* UNIV_LOG_DEBUG */
|
||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
@ -420,8 +476,13 @@ buf_flush_write_block_low(
|
||||
ut_ad(!ut_dulint_is_zero(block->newest_modification));
|
||||
|
||||
#ifdef UNIV_LOG_DEBUG
|
||||
fputs("Warning: cannot force log to disk in the log debug version!\n",
|
||||
stderr);
|
||||
if (!univ_log_debug_warned) {
|
||||
univ_log_debug_warned = TRUE;
|
||||
fputs(
|
||||
"Warning: cannot force log to disk if UNIV_LOG_DEBUG is defined!\n"
|
||||
"Crash recovery will not work!\n",
|
||||
stderr);
|
||||
}
|
||||
#else
|
||||
/* Force the log to the disk before writing the modified block */
|
||||
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
|
||||
|
@ -629,6 +629,8 @@ buf_read_ibuf_merge_pages(
|
||||
}
|
||||
}
|
||||
|
||||
os_aio_simulated_wake_handler_threads();
|
||||
|
||||
/* Flush pages from the end of the LRU list if necessary */
|
||||
buf_flush_free_margin();
|
||||
|
||||
|
@ -32,6 +32,7 @@ static
|
||||
dtuple_t*
|
||||
dict_create_sys_tables_tuple(
|
||||
/*=========================*/
|
||||
/* out: the tuple which should be inserted */
|
||||
dict_table_t* table, /* in: table */
|
||||
mem_heap_t* heap) /* in: memory heap from which the memory for
|
||||
the built tuple is allocated */
|
||||
|
@ -682,6 +682,7 @@ dict_init(void)
|
||||
rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);
|
||||
|
||||
dict_foreign_err_file = os_file_create_tmpfile();
|
||||
ut_a(dict_foreign_err_file);
|
||||
mutex_create(&dict_foreign_err_mutex);
|
||||
mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
|
||||
}
|
||||
|
@ -1513,6 +1513,8 @@ fil_decr_pending_ibuf_merges(
|
||||
mutex_exit(&(system->mutex));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
Creates the database directory for a table if it does not exist yet. */
|
||||
static
|
||||
void
|
||||
fil_create_directory_for_tablename(
|
||||
|
@ -47,7 +47,8 @@ dyn_array_open(
|
||||
/*===========*/
|
||||
/* out: pointer to the buffer */
|
||||
dyn_array_t* arr, /* in: dynamic array */
|
||||
ulint size); /* in: size in bytes of the buffer */
|
||||
ulint size); /* in: size in bytes of the buffer; MUST be
|
||||
smaller than DYN_ARRAY_DATA_SIZE! */
|
||||
/*************************************************************************
|
||||
Closes the buffer returned by dyn_array_open. */
|
||||
UNIV_INLINE
|
||||
|
@ -111,7 +111,8 @@ mlog_open(
|
||||
/*======*/
|
||||
/* out: buffer, NULL if log mode MTR_LOG_NONE */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
ulint size); /* in: buffer size in bytes */
|
||||
ulint size); /* in: buffer size in bytes; MUST be
|
||||
smaller than DYN_ARRAY_DATA_SIZE! */
|
||||
/************************************************************
|
||||
Closes a buffer opened to mlog. */
|
||||
UNIV_INLINE
|
||||
|
@ -18,7 +18,8 @@ mlog_open(
|
||||
/*======*/
|
||||
/* out: buffer, NULL if log mode MTR_LOG_NONE */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
ulint size) /* in: buffer size in bytes */
|
||||
ulint size) /* in: buffer size in bytes; MUST be
|
||||
smaller than DYN_ARRAY_DATA_SIZE! */
|
||||
{
|
||||
dyn_array_t* mlog;
|
||||
|
||||
|
@ -169,12 +169,12 @@ void
|
||||
os_io_init_simple(void);
|
||||
/*===================*/
|
||||
/***************************************************************************
|
||||
Creates a temporary file. In case of error, causes abnormal termination. */
|
||||
Creates a temporary file. */
|
||||
|
||||
FILE*
|
||||
os_file_create_tmpfile(void);
|
||||
/*========================*/
|
||||
/* out: temporary file handle (never NULL) */
|
||||
/* out: temporary file handle (never NULL) */
|
||||
/***************************************************************************
|
||||
The os_file_opendir() function opens a directory stream corresponding to the
|
||||
directory named by the dirname argument. The directory stream is positioned
|
||||
|
@ -479,7 +479,20 @@ page_rec_get_next(
|
||||
|
||||
offs = rec_get_next_offs(rec);
|
||||
|
||||
ut_a(offs < UNIV_PAGE_SIZE);
|
||||
if (offs >= UNIV_PAGE_SIZE) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n",
|
||||
(ulong)offs, (ulong)(rec - page));
|
||||
fprintf(stderr,
|
||||
"\nInnoDB: rec address %lx, first buffer frame %lx\n"
|
||||
"InnoDB: buffer pool high end %lx, buf fix count %lu\n",
|
||||
(ulong)rec, (ulong)buf_pool->frame_zero,
|
||||
(ulong)buf_pool->high_end,
|
||||
(ulong)buf_block_align(rec)->buf_fix_count);
|
||||
buf_page_print(page);
|
||||
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
if (offs == 0) {
|
||||
|
||||
|
@ -42,6 +42,7 @@ extern char* srv_arch_dir;
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
|
||||
extern ibool srv_file_per_table;
|
||||
extern ibool srv_locks_unsafe_for_binlog;
|
||||
|
||||
extern ulint srv_n_data_files;
|
||||
extern char** srv_data_file_names;
|
||||
@ -98,6 +99,8 @@ extern lint srv_conc_n_threads;
|
||||
|
||||
extern ibool srv_fast_shutdown;
|
||||
|
||||
extern ibool srv_innodb_status;
|
||||
|
||||
extern ibool srv_use_doublewrite_buf;
|
||||
|
||||
extern ibool srv_set_thread_priorities;
|
||||
|
@ -64,15 +64,17 @@ innobase_start_or_create_for_mysql(void);
|
||||
/* out: DB_SUCCESS or error code */
|
||||
/********************************************************************
|
||||
Shuts down the Innobase database. */
|
||||
|
||||
int
|
||||
innobase_shutdown_for_mysql(void);
|
||||
/*=============================*/
|
||||
/* out: DB_SUCCESS or error code */
|
||||
|
||||
extern dulint srv_shutdown_lsn;
|
||||
extern dulint srv_start_lsn;
|
||||
|
||||
#ifdef __NETWARE__
|
||||
void set_panic_flag_for_netware(void);
|
||||
#endif
|
||||
|
||||
extern ulint srv_sizeof_trx_t_in_ha_innodb_cc;
|
||||
|
||||
extern ibool srv_is_being_started;
|
||||
|
@ -22,7 +22,38 @@ extern ulint* ut_dbg_null_ptr;
|
||||
extern const char* ut_dbg_msg_assert_fail;
|
||||
extern const char* ut_dbg_msg_trap;
|
||||
extern const char* ut_dbg_msg_stop;
|
||||
|
||||
/* Have a graceful exit on NetWare rather than a segfault to avoid abends */
|
||||
#ifdef __NETWARE__
|
||||
extern ibool panic_shutdown;
|
||||
#define ut_a(EXPR) do {\
|
||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
||||
ut_print_timestamp(stderr);\
|
||||
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||
os_thread_pf(os_thread_get_curr_id()), __FILE__,\
|
||||
(ulint)__LINE__);\
|
||||
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
|
||||
fputs(ut_dbg_msg_trap, stderr);\
|
||||
ut_dbg_stop_threads = TRUE;\
|
||||
if (ut_dbg_stop_threads) {\
|
||||
fprintf(stderr, ut_dbg_msg_stop,\
|
||||
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
|
||||
}\
|
||||
if(!panic_shutdown){\
|
||||
panic_shutdown = TRUE;\
|
||||
innobase_shutdown_for_mysql();}\
|
||||
exit(1);\
|
||||
}\
|
||||
} while (0)
|
||||
#define ut_error do {\
|
||||
ut_print_timestamp(stderr);\
|
||||
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
|
||||
fprintf(stderr, ut_dbg_msg_trap);\
|
||||
ut_dbg_stop_threads = TRUE;\
|
||||
if(!panic_shutdown){panic_shutdown = TRUE;\
|
||||
innobase_shutdown_for_mysql();}\
|
||||
} while (0)
|
||||
#else
|
||||
#define ut_a(EXPR) do {\
|
||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
||||
ut_print_timestamp(stderr);\
|
||||
@ -49,6 +80,7 @@ extern const char* ut_dbg_msg_stop;
|
||||
ut_dbg_stop_threads = TRUE;\
|
||||
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
#define ut_ad(EXPR) ut_a(EXPR)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user